Mercurial > dotfiles
comparison .chezmoitemplates/init.lua @ 726:2a341028a2c5
fix: use full vim.opt to avoid diagnostic warnings
see: https://github.com/folke/neodev.nvim/issues/77
author | zegervdv <zegervdv@me.com> |
---|---|
date | Sun, 11 Dec 2022 16:11:30 +0100 |
parents | 624d8036f5ae |
children | 772aea09bb0a |
comparison
equal
deleted
inserted
replaced
725:624d8036f5ae | 726:2a341028a2c5 |
---|---|
708 else | 708 else |
709 vim.cmd.colorscheme 'espresso-tutti-colori' | 709 vim.cmd.colorscheme 'espresso-tutti-colori' |
710 end | 710 end |
711 | 711 |
712 -- Configuration | 712 -- Configuration |
713 local opt = vim.opt | 713 vim.opt.backspace = { 'indent', 'eol', 'start' } -- Backspace everything |
714 | 714 |
715 opt.backspace = { 'indent', 'eol', 'start' } -- Backspace everything | 715 vim.opt.autoread = true -- Read changed files |
716 | 716 vim.opt.hidden = true -- Allow to move away from modified files |
717 opt.autoread = true -- Read changed files | 717 vim.opt.autowriteall = true -- Write changes when losing focus |
718 opt.hidden = true -- Allow to move away from modified files | |
719 opt.autowriteall = true -- Write changes when losing focus | |
720 | 718 |
721 -- Visuals | 719 -- Visuals |
722 opt.number = true | 720 vim.opt.number = true |
723 opt.relativenumber = true | 721 vim.opt.relativenumber = true |
724 opt.scrolloff = 4 | 722 vim.opt.scrolloff = 4 |
725 opt.showcmd = true -- Show incomplete commands while typing | 723 vim.opt.showcmd = true -- Show incomplete commands while typing |
726 | 724 |
727 opt.termguicolors = true | 725 vim.opt.termguicolors = true |
728 opt.background = 'dark' | 726 vim.opt.background = 'dark' |
729 | 727 |
730 opt.showmatch = true -- Highligh matching braces | 728 vim.opt.showmatch = true -- Highligh matching braces |
731 | 729 |
732 opt.wrap = true -- Wrap lines | 730 vim.opt.wrap = true -- Wrap lines |
733 opt.wrapmargin = 2 -- Stay 2 chars from side | 731 vim.opt.wrapmargin = 2 -- Stay 2 chars from side |
734 opt.textwidth = 79 | 732 vim.opt.textwidth = 79 |
735 opt.colorcolumn = '81' -- Show indication of 81 chars | 733 vim.opt.colorcolumn = '81' -- Show indication of 81 chars |
736 opt.linebreak = true -- Smarter wrapping | 734 vim.opt.linebreak = true -- Smarter wrapping |
737 opt.breakindent = true -- Indent wrapped lines to same level | 735 vim.opt.breakindent = true -- Indent wrapped lines to same level |
738 | 736 |
739 opt.fixendofline = true -- Add EOL when missing | 737 vim.opt.fixendofline = true -- Add EOL when missing |
740 | 738 |
741 opt.expandtab = true -- Add spaces when pressing tab | 739 vim.opt.expandtab = true -- Add spaces when pressing tab |
742 opt.tabstop = 2 -- Tab is 2 spaces | 740 vim.opt.tabstop = 2 -- Tab is 2 spaces |
743 opt.shiftwidth = 2 -- Shift per 2 spaces | 741 vim.opt.shiftwidth = 2 -- Shift per 2 spaces |
744 opt.shiftround = true -- Round shifts to allign (1 space + tab = 2 spaces) | 742 vim.opt.shiftround = true -- Round shifts to allign (1 space + tab = 2 spaces) |
745 | 743 |
746 -- Searching and substitute | 744 -- Searching and substitute |
747 opt.magic = true -- Enable regexes | 745 vim.opt.magic = true -- Enable regexes |
748 opt.hlsearch = true -- Highlight all matches | 746 vim.opt.hlsearch = true -- Highlight all matches |
749 opt.incsearch = true -- Show matches while typing | 747 vim.opt.incsearch = true -- Show matches while typing |
750 opt.ignorecase = true | 748 vim.opt.ignorecase = true |
751 opt.smartcase = true -- When search pattern contains cases, be case sensitive | 749 vim.opt.smartcase = true -- When search pattern contains cases, be case sensitive |
752 opt.gdefault = true -- Use global flag for substitute: replace all matches on line | 750 vim.opt.gdefault = true -- Use global flag for substitute: replace all matches on line |
753 opt.inccommand = 'nosplit' -- Show live replacements directly in text | 751 vim.opt.inccommand = 'nosplit' -- Show live replacements directly in text |
754 | 752 |
755 opt.autoindent = true | 753 vim.opt.autoindent = true |
756 opt.cindent = true -- C-syntax based indenting | 754 vim.opt.cindent = true -- C-syntax based indenting |
757 | 755 |
758 opt.updatetime = 300 -- Faster triggering of CursorHold events | 756 vim.opt.updatetime = 300 -- Faster triggering of CursorHold events |
759 | 757 |
760 opt.errorbells = false -- Don't you beep to me | 758 vim.opt.errorbells = false -- Don't you beep to me |
761 opt.title = false -- Don't set the shell title | 759 vim.opt.title = false -- Don't set the shell title |
762 | 760 |
763 opt.history = 1000 -- Remember last commands | 761 vim.opt.history = 1000 -- Remember last commands |
764 | 762 |
765 opt.wildmenu = true -- Command completion | 763 vim.opt.wildmenu = true -- Command completion |
766 opt.wildmode = 'longest:full,full' | 764 vim.opt.wildmode = 'longest:full,full' |
767 opt.shortmess:append 'c' -- Hide ins-completion messages | 765 vim.opt.shortmess:append 'c' -- Hide ins-completion messages |
768 | 766 |
769 opt.ttyfast = true -- fast terminal | 767 vim.opt.ttyfast = true -- fast terminal |
770 opt.lazyredraw = true | 768 vim.opt.lazyredraw = true |
771 opt.ttimeoutlen = -1 -- Minimum timeout | 769 vim.opt.ttimeoutlen = -1 -- Minimum timeout |
772 | 770 |
773 opt.diffopt:append 'iwhite' -- Ignore whitespace in diffs | 771 vim.opt.diffopt:append 'iwhite' -- Ignore whitespace in diffs |
774 opt.diffopt:append 'internal' -- Internal diff engine | 772 vim.opt.diffopt:append 'internal' -- Internal diff engine |
775 opt.diffopt:append 'algorithm:patience' -- Use patience algorithm | 773 vim.opt.diffopt:append 'algorithm:patience' -- Use patience algorithm |
776 | 774 |
777 opt.tags = { '.git/tags', 'tags' } | 775 vim.opt.tags = { '.git/tags', 'tags' } |
778 | 776 |
779 opt.path:append '**' -- Recursively search current directory | 777 vim.opt.path:append '**' -- Recursively search current directory |
780 | 778 |
781 opt.formatoptions = { | 779 vim.opt.formatoptions = { |
782 c = true, -- Wrap comments | 780 c = true, -- Wrap comments |
783 r = true, -- Continue comments | 781 r = true, -- Continue comments |
784 o = true, -- Insert comment with o/O | 782 o = true, -- Insert comment with o/O |
785 q = true, -- Format comments with gq | 783 q = true, -- Format comments with gq |
786 n = true, -- Indent numbered lists | 784 n = true, -- Indent numbered lists |
787 [2] = true, -- Indent from 2nd line of paragraph | 785 [2] = true, -- Indent from 2nd line of paragraph |
788 [1] = true, -- Don't break before one letter words | 786 [1] = true, -- Don't break before one letter words |
789 } | 787 } |
790 | 788 |
791 opt.signcolumn = 'yes' -- Always show signcolumn | 789 vim.opt.signcolumn = 'yes' -- Always show signcolumn |
792 | 790 |
793 opt.cursorline = true | 791 vim.opt.cursorline = true |
794 | 792 |
795 opt.startofline = false -- When moving try to keep cursor in column | 793 vim.opt.startofline = false -- When moving try to keep cursor in column |
796 | 794 |
797 -- Show certain characters | 795 -- Show certain characters |
798 opt.list = true | 796 vim.opt.list = true |
799 opt.listchars = { trail = '·', extends = '>', precedes = '<', nbsp = '+', tab = '▸ ' } | 797 vim.opt.listchars = { trail = '·', extends = '>', precedes = '<', nbsp = '+', tab = '▸ ' } |
800 | 798 |
801 opt.sessionoptions:remove 'options' -- Remove options from saved sessions (reload from config) | 799 vim.opt.sessionoptions:remove 'options' -- Remove options from saved sessions (reload from config) |
802 | 800 |
803 opt.completeopt = { 'menu', 'menuone', 'noselect' } | 801 vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } |
804 | 802 |
805 opt.splitright = true -- Open new splits to right | 803 vim.opt.splitright = true -- Open new splits to right |
806 opt.virtualedit = 'block' -- Enable block editting | 804 vim.opt.virtualedit = 'block' -- Enable block editting |
807 | 805 |
808 opt.conceallevel = 0 -- Disable conceal | 806 vim.opt.conceallevel = 0 -- Disable conceal |
809 | 807 |
810 opt.pastetoggle = '<F2>' -- Enable paste mode | 808 vim.opt.pastetoggle = '<F2>' -- Enable paste mode |
811 | 809 |
812 local optdir = function(path) | 810 local optdir = function(path) |
813 local Path = require 'plenary.path' | 811 local Path = require 'plenary.path' |
814 local full_path = Path:new(vim.fn.stdpath 'cache' .. '/' .. path) | 812 local full_path = Path:new(vim.fn.stdpath 'cache' .. '/' .. path) |
815 if not full_path:exists() then full_path:mkdir { parents = true } end | 813 if not full_path:exists() then full_path:mkdir { parents = true } end |
816 return full_path .. '//' | 814 return full_path .. '//' |
817 end | 815 end |
818 | 816 |
819 opt.undofile = true -- Persistently remember undos | 817 vim.opt.undofile = true -- Persistently remember undos |
820 opt.undolevels = 1000 | 818 vim.opt.undolevels = 1000 |
821 opt.undodir = optdir 'undo' | 819 vim.opt.undodir = optdir 'undo' |
822 opt.swapfile = false -- Disable swap files | 820 vim.opt.swapfile = false -- Disable swap files |
823 opt.backup = true -- Keep backups | 821 vim.opt.backup = true -- Keep backups |
824 opt.backupdir = optdir 'backup' | 822 vim.opt.backupdir = optdir 'backup' |
825 | 823 |
826 -- Files to ignore from completion | 824 -- Files to ignore from completion |
827 opt.wildignore:append { | 825 vim.opt.wildignore:append { |
828 '*/tmp/*', | 826 '*/tmp/*', |
829 '*.so', | 827 '*.so', |
830 '*.swp', | 828 '*.swp', |
831 '*.zip', | 829 '*.zip', |
832 '*.o', | 830 '*.o', |
839 '.hg/**', | 837 '.hg/**', |
840 '*.orig', | 838 '*.orig', |
841 '*.*~', | 839 '*.*~', |
842 } | 840 } |
843 | 841 |
844 opt.mouse = { | 842 vim.opt.mouse = { |
845 n = true, -- Normal mode | 843 n = true, -- Normal mode |
846 i = true, -- Insert mode | 844 i = true, -- Insert mode |
847 c = true, -- Commandline mode | 845 c = true, -- Commandline mode |
848 } | 846 } |
849 | 847 |
850 opt.fillchars:append { | 848 vim.opt.fillchars:append { |
851 diff = '╱', | 849 diff = '╱', |
852 } | 850 } |
853 | 851 |
854 opt.jumpoptions:append { 'view' } | 852 vim.opt.jumpoptions:append { 'view' } |
855 | 853 |
856 opt.foldmethod = 'expr' | 854 vim.opt.foldmethod = 'expr' |
857 opt.foldexpr = 'nvim_treesitter#foldexpr()' | 855 vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' |
858 opt.foldnestmax = 3 | 856 vim.opt.foldnestmax = 3 |
859 opt.foldminlines = 1 | 857 vim.opt.foldminlines = 1 |
860 opt.foldtext = | 858 vim.opt.foldtext = |
861 [[substitute(getline(v:foldstart),'\\t',repeat('\ ',&tabstop),'g').'...'.trim(getline(v:foldend)) . ' (' . (v:foldend - v:foldstart + 1) . ' lines)']] | 859 [[substitute(getline(v:foldstart),'\\t',repeat('\ ',&tabstop),'g').'...'.trim(getline(v:foldend)) . ' (' . (v:foldend - v:foldstart + 1) . ' lines)']] |
862 opt.foldenable = false | 860 vim.opt.foldenable = false |
863 | 861 |
864 function _G.qftf(info) | 862 function _G.qftf(info) |
865 local items | 863 local items |
866 local ret = {} | 864 local ret = {} |
867 if info.quickfix == 1 then | 865 if info.quickfix == 1 then |