diff --git a/.vim/deoplete.vimrc.vim b/.vim/deoplete.vimrc.vim index 0c3263a..6321895 100644 --- a/.vim/deoplete.vimrc.vim +++ b/.vim/deoplete.vimrc.vim @@ -1,3 +1,4 @@ +let g:deoplete#enable_at_startup = 0 let g:deoplete#disable_auto_complete = 1 inoremap deoplete#manual_complete() let g:deoplete#enable_ignore_case = 1 diff --git a/.vim/python.vimrc.vim b/.vim/python.vimrc.vim new file mode 100644 index 0000000..f818d2f --- /dev/null +++ b/.vim/python.vimrc.vim @@ -0,0 +1,28 @@ +" vim-python +augroup vimrc-python + autocmd! + autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8 colorcolumn=79 + \ formatoptions+=croq softtabstop=4 + \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with +augroup END + +" jedi-vim +let g:jedi#popup_on_dot = 0 +let g:jedi#goto_assignments_command = 'g' +let g:jedi#goto_definitions_command = 'd' +let g:jedi#documentation_command = 'K' +let g:jedi#usages_command = 'n' +let g:jedi#rename_command = 'r' +let g:jedi#show_call_signatures = '0' +let g:jedi#completions_command = '' +let g:jedi#smart_auto_mappings = 0 + +" ale +:call extend(g:ale_linters, { + \'python': ['flake8'], }) + +" vim-airline +let g:airline#extensions#virtualenv#enabled = 1 + +" Syntax highlight +let python_highlight_all = 1 diff --git a/.vim/vimrc b/.vim/vimrc index 0b5b917..9226529 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -3,9 +3,11 @@ " not necessary, as vim will turn this on by default, when .vimrc is found " set nocompatible +set encoding=utf-8 " important for powerline besides others scriptencoding=utf8 filetype off "required +" hi clear augroup install_vim_plug @@ -46,6 +48,7 @@ Plug 'axvr/photon.vim' Plug 'Lokaltog/vim-monotone' Plug 'https://git.sr.ht/~romainl/vim-bruin' Plug 'fxn/vim-monochrome' +Plug 'folke/tokyonight.nvim' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' @@ -64,6 +67,7 @@ Plug 'LunarWatcher/auto-pairs' Plug 'SirVer/ultisnips', { 'on': [] } Plug 'honza/vim-snippets', { 'on': [] } +" Plug 'farmergreg/vim-lastplace' Plug 'tpope/vim-surround' " fugitive.vim: A Git wrapper so awesome, it should be illegal Plug 'tpope/vim-fugitive' @@ -76,6 +80,10 @@ Plug 'tpope/vim-jdaddy', { 'for': 'json' } Plug 'tpope/vim-ragtag', { 'for': ['html', 'xhtml', 'wml', 'xml', 'xslt', 'xsd', 'jsp', 'php', 'aspperl', 'aspvbs', 'cf', 'mason', 'htmldjango', 'eruby'] } Plug 'bazelbuild/vim-ft-bzl', { 'for': ['starlark', 'bzl'] } Plug 'z0mbix/vim-shfmt', { 'for': ['sh', 'bash'] } +" post install (yarn install | npm install) then load plugin only for editing supported files +Plug 'prettier/vim-prettier', { + \ 'do': 'npm install --frozen-lockfile', + \ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'vue', 'svelte', 'yaml', 'html', 'gohtmltmpl'] } " Plug 'gorodinskiy/vim-coloresque'| " coloured background for colour names/codes " Plug 'lpinilla/vim-codepainter'| " text highlighting @@ -94,15 +102,22 @@ Plug 'prabirshrestha/vim-lsp' Plug 'rhysd/vim-lsp-ale' Plug 'rhysd/vim-clang-format', { 'for': ['cpp', 'c', 'cmake', 'java', 'proto'] } +Plug 'vim-test/vim-test' Plug 'dense-analysis/ale' " Plug 'cdelledonne/vim-cmake', { 'for': ['c', 'cpp', 'cmake'] } " Plug 'ilyachur/cmake4vim', { 'for': ['c', 'cpp', 'cmake'] } Plug 'OmniSharp/omnisharp-vim', { 'for': ['cs'] } +" Plug 'chrisbra/NrrwRgn' Plug 'majutsushi/tagbar' Plug 'NoahTheDuke/vim-just', { 'for': ['just'] } Plug 'fladson/vim-kitty', { 'for': ['kitty'] } Plug 'relastle/vim-nayvy', { 'for': ['python'] } +" Plug 'python-mode/python-mode', { 'for': ['python'] } Plug 'lvht/tagbar-markdown', { 'for': 'markdown' } +" Plug 'preservim/vim-markdown', { 'for': 'markdown' } + +" switch to related files +" Plug 'arp242/switchy.vim', { 'for': ['go', 'c', 'cpp'] } Plug 'lervag/vimtex', { 'for': 'tex' } Plug 'cespare/vim-toml', { 'for': 'toml' } @@ -118,6 +133,7 @@ Plug 'https://git.sr.ht/~sircmpwn/hare.vim', { 'for': 'hare' } Plug 'ziglang/zig.vim', { 'for': 'zig' } Plug 'ollykel/v-vim', { 'for': 'v' } Plug 'bfrg/vim-cpp-modern', { 'for': ['cpp', 'cmake'] } +Plug 'vmchale/dhall-vim', { 'for': 'dhall' } Plug 'isobit/vim-caddyfile', { 'for': 'caddyfile' } Plug 'chikamichi/mediawiki.vim', { 'for': 'wiki' } Plug 's3rvac/vim-syntax-redminewiki', { 'for': 'redminewiki' } @@ -131,12 +147,18 @@ let g:airline_experimental = 1 let g:airline_powerline_fonts = 1 let g:airline_highlighting_cache = 1 " violet, wombat, deus +" let g:airline_theme = 'violet' +" let g:airline_theme = 'base16_spacemacs' let g:airline_theme = 'minimalist' +" let g:airline_theme = 'iceberg' let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#formatter = 'unique_tail_improved' " show tab number instead of number of splits let g:airline#extensions#tabline#tab_nr_type = 1 +" Show just the filename +" let g:airline#extensions#tabline#fnamemod = ':t' + let g:airline_mode_map = { \ '__' : '-', \ 'c' : 'C', @@ -158,6 +180,8 @@ let g:airline_mode_map = { \ '' : 'V-B', \ } +" let g:airline_section_b = airline#section#create(['ffenc','hunks', '%f']) +" let g:airline_section_b = airline#section#create_left(['ffenc','hunks', '%f']) " skip displaying fileformat output if the output matches a configured string. let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]' @@ -190,7 +214,7 @@ let g:airline#extensions#ale#enabled = 1 " nrrwrgn integration let g:airline#extensions#nrrwrgn#enabled = 1 " vcs integration -let g:airline#extensions#branch#enabled = 1 +let g:airline#extensions#branch#enabled = 0 " show summary of changed hunks (gitgutter and/or vim-signify) let g:airline#extensions#hunks#enabled = 1 " tabline integration @@ -238,6 +262,7 @@ let g:ale_hover_to_floating_preview = 1 set omnifunc=ale#completion#OmniFunc let g:ale_completion_autoimport = 1 let g:ale_hover_to_preview = 1 +" let g:ale_lsp_suggestions = 0 let g:ale_lsp_suggestions = 1 let g:ale_terraform_langserver_executable = 'terraform-ls' let g:ale_set_balloons = 1 @@ -274,8 +299,8 @@ let g:ale_echo_cursor = 1 let g:ale_echo_msg_error_str = 'E' let g:ale_echo_msg_warning_str = 'W' let g:ale_echo_msg_info_str = 'I' -let g:ale_sign_error = '❌' -let g:ale_sign_warning = '' +let g:ale_sign_error = '✗' +let g:ale_sign_warning = '' let g:ale_sign_info = '' " let g:ale_echo_msg_format = '%s' let g:ale_echo_msg_format = '(%severity%): [%linter%] %s' @@ -289,29 +314,38 @@ let g:ale_list_window_size = 7 let g:ale_lint_on_enter = 1 " Do not run ale upon changes to the file. " let g:ale_lint_on_text_changed = 'never' +" lint in normal and insert mode. let g:ale_lint_on_text_changed = 'always' +" only lint in normal mode. +" let g:ale_lint_on_text_changed = 'normal' " Run ale after leaving insert mode. let g:ale_lint_on_insert_leave = 1 +let g:ale_lint_on_filetype_changed = 1 +let g:ale_lint_on_save = 1 +" let g:ale_lint_delay = 700 +" let g:ale_lint_delay = 500 let g:ale_lint_delay = 300| " the default being 200 let g:ale_linters = { \ 'go': ['gofumpt', 'govet', 'gofmt', 'golangci-lint', 'gopls'], + \ 'gohtmltmpl': ['gofumpt', 'govet', 'gofmt', 'golangci-lint', 'gopls'], \ 'dockerfile': ['hadolint'], \ 'c': ['clang-format', 'clangd', 'clangtidy', 'cppcheck', 'cquery', 'flawfinder'], \ 'cpp': ['clang-format', 'g++', 'clang', 'clangd', 'clangtidy', 'cppcheck', 'flawfinder'], \ 'cs': ['OmniSharp'], - \ 'hare': ['hare', 'vimls', 'vim-lsp'], - \ 'lua': ['vimls'], - \ 'nix': ['rnix_lsp', 'statix', 'nixpkgs-fmt', 'vimls'], + \ 'css': ['vim-lsp'], + \ 'hare': ['hare', 'vim-lsp'], + \ 'lua': ['vim-lsp'], + \ 'nix': ['rnix_lsp', 'statix', 'nixpkgs-fmt', 'vim-lsp'], \ 'python': ['vim-lsp', 'pylint', 'yapf', 'isort'], - \ 'rust': ['analyzer', 'cargo', 'rls', 'vimls'], - \ 'sh': ['shellcheck', 'shfmt', 'shell', 'vimls'], - \ 'bash': ['shellcheck', 'shfmt', 'shell', 'vimls'], - \ 'systemd': ['systemd_analyze', 'systemdlint'], - \ 'vim': ['vint', 'vimls', 'vim-lsp'], - \ 'tex': ['chktex', 'vimls'], + \ 'rust': ['analyzer', 'cargo', 'rls', 'vim-lsp'], + \ 'sh': ['shellcheck', 'shfmt', 'shell', 'vim-lsp'], + \ 'bash': ['shellcheck', 'shfmt', 'shell', 'vim-lsp'], + \ 'systemd': ['systemd_analyze', 'systemdlint', 'vim-lsp'], + \ 'vim': ['vint', 'vim-lsp'], + \ 'tex': ['chktex'], \ 'tf': ['vimls', 'vim-lsp', 'tflint', 'terraform', 'tfsec', 'checkov'], - \ 'terraform': ['vimls', 'vim-lsp', 'tflint', 'terraform', 'tfsec', 'checkov'], + \ 'terraform': ['vim-lsp', 'tflint', 'terraform', 'terraform_ls', 'terraform_lsp', 'tfsec', 'checkov'], \ 'yaml': ['yaml-language-server', 'spectral', 'swaglint','yamllint'], \ 'zsh': ['shellcheck', 'shell', 'vimls'], \ } @@ -342,6 +376,14 @@ else endif +" Hardcore mode, disable arrow keys. +"noremap +"noremap +"noremap +"noremap + + +" gitgutter let g:gitgutter_terminal_reports_focus=0 let g:gitgutter_async = 1 let g:gitgutter_sign_column_always = 1 @@ -366,8 +408,8 @@ let g:clang_format#auto_format=0 let g:clang_format#detect_style_file=1 augroup clang_format autocmd! - autocmd FileType c,cpp,proto nnoremap cf :ClangFormat - autocmd FileType c,cpp,proto vnoremap cf :ClangFormat + autocmd FileType c,cpp,proto nnoremap cf :ClangFormat + autocmd FileType c,cpp,proto vnoremap cf :ClangFormat function! Formatonsave() " alternative function to clang-format#auto_format param @@ -403,7 +445,7 @@ let g:vimtex_quickfix_enabled = 0 " nerdcommenter " _ stands for forward slash (/) -noremap :call nerdcommenter#Comment(0,"toggle") +noremap :call nerdcommenter#Comment(0,"toggle") " Add spaces after comment delimiters by default let g:NERDSpaceDelims = 1 " Allow commenting and inverting empty lines (useful when commenting a region) @@ -415,7 +457,9 @@ let g:NERDTrimTrailingWhitespace = 1 " Add your own custom formats or override the defaults let g:NERDCustomDelimiters = { \ 'vim': { 'left': '"','right': '' }, + \ 'bib': { 'left': '\%','right': '' }, \ 'c': {'left': '/**','right': '*/' }, + \ 'dhall': {'left': '-- | ', 'right': '' }, \ 'zsh': { 'left': '#','right': ''}, \ 'sysctl': {'left': '#', 'right': ''}, \ 'systemd': {'left': ';', 'right': ''}, @@ -531,11 +575,16 @@ let g:terraform_fmt_on_save=1 " autopairs +let g:AutoPairsMapBS = 1 +let g:AutoPairsMapBSIn = 1 +let g:AutoPairsMapBSAfter = 1 +" ignore next char - default binding is " sometimes issues with expanding {} let g:AutoPairsMultilineClose = 0 -let g:AutoPairsFlyMode = 0 +let g:AutoPairsFlyMode = 0 "jump back with +" disable jumpy cursor - centers screen when in lower 1/3. let g:AutoPairsMapCR = 0 -" inoremap :call autopairs#AutoPairsReturn()i +" inoremap :call autopairs#AutoPairsReturn()i " let g:AutoPairsFlyModeBlacklist = " let g:AutoPairsShortcutToggle = '' let b:AutoPairsShortcutToggle = '' @@ -554,7 +603,7 @@ let g:cpp_member_highlight = 1 " ctrlp " Setup some default ignores let g:ctrlp_custom_ignore = { - \ 'dir':'\v[\/](\.(git\/(branches|hooks|info|logs|modules|objects|rebase-merge|refs)|hg|svn)|\_site)$', + \ 'dir':'\v[\/](\.(git\/(branches|hooks|info|logs|modules|objects|rebase-merge|refs)|hg|svn)|\_site|node_modules)$', \ 'file':'\v\.(exe|so|dll|class|png|jpg|jpeg)|(\.(git\/(description|index|packed-refs|COMMIT_EDITMSG|HEAD|FETCH_HEAD|ORIG_HEAD|REBASE_HEAD)))$', \} @@ -563,13 +612,27 @@ let g:ctrlp_custom_ignore = { " control. It also supports works with .svn, .hg, .bzr. " let g:ctrlp_working_path_mode = 'r' let g:ctrlp_working_path_mode = 'raw' +let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp' -nnoremap '' : +" The Silver Searcher +if executable('ag') + " use ag instead of grep. + set grepprg=ag\ --nogroup\ --nocolor -let g:ctrlp_map = '' + " use ag in CtrlP + let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""' + " ag is fast enough that CtrlP doesn't need to cache + let g:ctrlp_use_caching = 0 +endif + +nnoremap '' :CtrlP +nnoremap s (ctrlp) + +" let g:ctrlp_map = 's' let g:ctrlp_show_hidden = 1 " Use a leader instead of the actual named binding -nmap p :CtrlP +nmap p (ctrlp) +noremap :CtrlP :pwd " ctrlp buffers " Easy bindings for its various modes @@ -608,24 +671,26 @@ command! WW execute 'silent w !sudo tee % >/dev/null' | edit! command! -nargs=* Make write | make! | cwindow command Note execute 'e ~/Sync/notes/' . strftime('%y-%m-%d-%H:%M:%S') . '.md' command NoteLocal execute 'e ./' . strftime('%y-%m-%d-%H:%M:%S') . '.md' +" easy session saving. +command! Xs :mks! | :xa "save the session, save modified files, and exit " always show full path on nnoremap 1 " open a terminal in $PWD -nnoremap tt :terminal +nnoremap tt :terminal " terminal normal mode tnoremap N " toggle showing whitespace -noremap :set list! +noremap :set list! " make shortcut nnoremap :term ++hidden ++open make nnoremap :term ++open make -nnoremap :TagbarToggle +nnoremap :TagbarToggle -vmap gb :!git blame % -L=line("'<") ,=line("'>") -nnoremap gb :!git blame % +vmap gb :!git blame % -L=line("'<") ,=line("'>") +nnoremap gb :!git blame % " ll provided by vimtex -" nnoremap kk :w! !pdflatex -shell-escape -interaction=nonstopmode ./*.tex +" nnoremap kk :w! !pdflatex -shell-escape -interaction=nonstopmode ./*.tex function! Pdfpls() echom 'compiling ur tex goodness!' " w! @@ -664,13 +729,13 @@ endfunction nnoremap lb :call PdfBibLuapls() -nnoremap l :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=1" +nnoremap l :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=1" " ALE bindings -nmap :ALEPreviousWrap -nmap :ALENextWrap -nnoremap a :ALEDetail +nmap (ale_previous_wrap) +nmap (ale_next_wrap) +nnoremap a :ALEDetail nnoremap :ALEGoToDefinition @@ -685,6 +750,7 @@ nnoremap gT nnoremap gt " resize windows +" imap map - - map + + @@ -693,8 +759,8 @@ vmap < >gv " moving visual blocks -vnoremap J :m '>+1gv=gv -vnoremap K :m '<-2gv=gv +" vnoremap J :m '>+1gv=gv +" vnoremap K :m '<-2gv=gv "------------------------------------ @@ -731,9 +797,11 @@ let g:go_gopls_options = ['-remote=unix;/tmp/.gopls-daemon.sock'] " let lsp handle connecting to gopls let g:go_gopls_enabled = 1 " let g:go_doc_popup_window = 0 +let g:go_doc_popup_window = 1 let g:go_fillstruct_mode = 'gopls' let g:go_term_reuse = 1 let g:go_term_enabled = 1 +let g:go_doc_balloon = 1 augroup vimgo @@ -742,16 +810,16 @@ augroup vimgo au FileType go nmap b (go-build) au FileType go nmap gr (go-run) au FileType go nmap gt (go-test) - au FileType go nmap gs (go-implements) - au FileType go nmap gi (go-info) - au FileType go nmap ge (go-rename) - au FileType go nmap gd (go-doc) + au FileType go nmap gs (go-implements) + au FileType go nmap gi (go-info) + au FileType go nmap ge (go-rename) + au FileType go nmap gd (go-doc) " Navigation commands - au FileType go nmap ds (go-def-split) - au FileType go nmap dv (go-def-vertical) + au FileType go nmap ds (go-def-split) + au FileType go nmap dv (go-def-vertical) " Alternate commands - au FileType go nmap ae (go-alternate-edit) - au FileType go nmap av (go-alternate-vertical) + au FileType go nmap hae (go-alternate-edit) + au FileType go nmap vae (go-alternate-vertical) " Use new vim 8.2 popup windows for Go Doc augroup END @@ -760,42 +828,33 @@ augroup END exec 'source ' . escape(expand('~/.vim'),' ') . '/' . 'gotags.vimrc.vim' +""" dhall +let g:dhall_format=1 + + """ python -" vim-python -augroup vimrc-python - autocmd! - autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8 colorcolumn=79 - \ formatoptions+=croq softtabstop=4 - \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with -augroup END - -" jedi-vim -let g:jedi#popup_on_dot = 0 -let g:jedi#goto_assignments_command = 'g' -let g:jedi#goto_definitions_command = 'd' -let g:jedi#documentation_command = 'K' -let g:jedi#usages_command = 'n' -let g:jedi#rename_command = 'r' -let g:jedi#show_call_signatures = '0' -let g:jedi#completions_command = '' -let g:jedi#smart_auto_mappings = 0 - -" ale -:call extend(g:ale_linters, { - \'python': ['flake8'], }) - -" vim-airline -let g:airline#extensions#virtualenv#enabled = 1 - -" Syntax highlight -let python_highlight_all = 1 +exec 'source ' . escape(expand('~/.vim'),' ') . '/' . 'python.vimrc.vim' +""" vim-test +" see kitty -o allow_remote_control=yes --listen-on unix:/tmp/mykitty +" let test#strategy = 'kitty' +let test#strategy = 'vimterminal' +nmap t :TestNearest +nmap tf :TestFile +" nmap a :TestSuite +nmap tl :TestLast +nmap g :TestVisit + + +" partially superseded by jasonccox/vim-wayland-clipboard (for "+) +" still keeping the "* mappings " ------ wayland copy and pasting let s:env = toupper(substitute(system('uname'), '\n', '', '')) if s:env =~# 'LINUX' && executable('wl-copy') xnoremap "+y y:call system("wl-copy", @") xnoremap "*y y:call system("wl-copy", @") + " xnoremap y y:call system("wl-copy --trim-newline", @*):call system("wl-copy -p --trim-newline", @*) endif if s:env =~# 'LINUX' && executable('wl-paste') nnoremap "+p :let @"=substitute(system("wl-paste --no-newline"), '', '', 'g')p @@ -805,7 +864,7 @@ endif inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" -inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" " ------ autocmd ------ @@ -823,10 +882,21 @@ augroup load_changed_file autocmd FileChangedShellPost * echo "Changes loaded from source file" augroup END +" http://vim.wikia.com/wiki/Restore_cursor_to_file_position_in_previous_editing_session +" function! ResCur() + " if line("'\"") <= line("$") + " normal! g`" + " return 1 + " endif +" endfunction + " when quitting a file, save the cursor position augroup save_cursor_position if &filetype !~# 'commit\|rebase' autocmd! + " au BufReadPost * call setpos(".", getpos("'\""))|normal! zv + " autocmd BufWinEnter * call ResCur() + " autocmd BufEnter,BufWinEnter " also automatically open any folds the cursor might land on. autocmd BufReadPost * silent! normal! g`" zv endif @@ -837,6 +907,7 @@ augroup END if $DISPLAY !=? '' && &t_Co == 256 augroup cursorline autocmd! + " autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline autocmd WinEnter,BufWinEnter * setlocal cursorline autocmd WinLeave * setlocal nocursorline augroup END @@ -878,9 +949,9 @@ augroup filetypes au FileType xml setlocal shiftwidth=4 tabstop=4 au FileType html setlocal shiftwidth=4 tabstop=4 - au BufNewFile,BufRead *.js - \ setlocal shiftwidth=4 tabstop=4 softtabstop=4 expandtab autoindent - \ fileformat=unix filetype=js + au BufNewFile,BufRead,BufEnter *.js + \ setlocal shiftwidth=2 tabstop=2 softtabstop=2 backspace=2 expandtab autoindent + \ fileformat=unix filetype=javascript au BufNewFile,BufRead,BufEnter *.md \ setlocal textwidth=79 foldmethod=manual filetype=markdown @@ -910,6 +981,14 @@ augroup filetypes \ set tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab autoindent \ textwidth=79 fileformat=unix omnifunc=lsp#complete " \ textwidth=79 fileformat=unix + au FileType terraform + \ set fileformat=unix omnifunc=lsp#complete + au FileType css + \ set fileformat=unix omnifunc=lsp#complete + au FileType gohtmltmpl setlocal + \ fileformat=unix tabstop=2 shiftwidth=2 softtabstop=2 noexpandtab + au FileType just setlocal + \ fileformat=unix tabstop=2 shiftwidth=2 softtabstop=2 noexpandtab au FileType tex setlocal tabstop=2 @@ -922,6 +1001,10 @@ augroup filetypes \ setlocal ft=bib tabstop=2 shiftwidth=2 softtabstop=2 noexpandtab autoindent \ fileformat=unix conceallevel=0 + au FileType bib + \ setlocal tabstop=2 shiftwidth=2 softtabstop=2 noexpandtab autoindent + \ fileformat=unix conceallevel=0 + autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab indentkeys-=0# \ indentkeys-=<:> foldmethod=indent nofoldenable @@ -959,6 +1042,7 @@ augroup END if executable('clangd') augroup lsp_clangd autocmd! + " \ 'cmd': {server_info->['clangd', '-enable-snippets']}, autocmd User lsp_setup call lsp#register_server({ \ 'name': 'clangd', \ 'cmd': {server_info->['clangd']}, @@ -1008,17 +1092,42 @@ if executable('terraform-ls') \ 'cmd': {server_info->[&shell, &shellcmdflag, 'terraform-ls']}, \ 'allowlist': ['terraform'], \ }) + " \ 'cmd': {server_info->[&shell, &shellcmdflag, 'terraform-ls', 'serve']}, + augroup END +endif +"" tailwind ls +"if executable('tailwindcss-language-server') +" augroup lsp_twls +" autocmd! +" au User lsp_setup call lsp#register_server({ +" \ 'name': 'tailwindcss-language-server', +" \ 'cmd': {server_info->[&shell, &shellcmdflag, 'tailwindcss-language-server']}, +" \ 'allowlist': ['css', 'html', 'gohtmltmpl'], +" \ }) +" augroup END +"endif +" this has some untold deps (on archlinux): haskell-some haskell-lsp1.4 haskell-lsp-types1.4 +if executable('dhall-lsp-server') + augroup lsp_dhall + autocmd! + au User lsp_setup call lsp#register_server({ + \ 'name': 'dhall-lsp-server', + \ 'cmd': {server_info->[&shell, &shellcmdflag, 'dhall-lsp-server']}, + \ 'allowlist': ['dhall'], + \ }) augroup END endif if executable('pyls') " pip install python-language-server + " or python-lsp-black from the AUR augroup lsp_py autocmd! autocmd User lsp_setup call lsp#register_server({ \ 'name': 'pyls', - \ 'cmd': {server_info->['pyls']}, + \ 'cmd': {server_info->[&shell, &shellcmdflag, 'pyls']}, \ 'allowlist': ['python'], \ }) + " \ 'cmd': {server_info->['pyls']}, augroup END endif if executable('omnisharp') @@ -1082,14 +1191,14 @@ augroup omnisharp_commands " The following commands are contextual, based on the cursor position. autocmd FileType cs nmap gd (omnisharp_go_to_definition) - autocmd FileType cs nmap osfu (omnisharp_find_usages) - autocmd FileType cs nmap osfi (omnisharp_find_implementations) - autocmd FileType cs nmap ospd (omnisharp_preview_definition) - autocmd FileType cs nmap ospi (omnisharp_preview_implementations) - autocmd FileType cs nmap ost (omnisharp_type_lookup) - autocmd FileType cs nmap osd (omnisharp_documentation) - autocmd FileType cs nmap osfs (omnisharp_find_symbol) - autocmd FileType cs nmap osfx (omnisharp_fix_usings) + autocmd FileType cs nmap osfu (omnisharp_find_usages) + autocmd FileType cs nmap osfi (omnisharp_find_implementations) + autocmd FileType cs nmap ospd (omnisharp_preview_definition) + autocmd FileType cs nmap ospi (omnisharp_preview_implementations) + autocmd FileType cs nmap ost (omnisharp_type_lookup) + autocmd FileType cs nmap osd (omnisharp_documentation) + autocmd FileType cs nmap osfs (omnisharp_find_symbol) + autocmd FileType cs nmap osfx (omnisharp_fix_usings) autocmd FileType cs nmap (omnisharp_signature_help) autocmd FileType cs imap (omnisharp_signature_help) @@ -1097,29 +1206,29 @@ augroup omnisharp_commands autocmd FileType cs nmap [[ (omnisharp_navigate_up) autocmd FileType cs nmap ]] (omnisharp_navigate_down) " Find all code errors/warnings for the current solution and populate the quickfix window - autocmd FileType cs nmap osgcc (omnisharp_global_code_check) + autocmd FileType cs nmap osgcc (omnisharp_global_code_check) " Contextual code actions (uses fzf, vim-clap, CtrlP or unite.vim selector when available) - autocmd FileType cs nmap osca (omnisharp_code_actions) - autocmd FileType cs xmap osca (omnisharp_code_actions) - " Repeat the last code action performed (does not use a selector) - autocmd FileType cs nmap os. (omnisharp_code_action_repeat) - autocmd FileType cs xmap os. (omnisharp_code_action_repeat) + autocmd FileType cs nmap osca (omnisharp_code_actions) + autocmd FileType cs xmap osca (omnisharp_code_actions) + " Repeat the last code action performed (doeS not use a selector) + autocmd FileType cs nmap os. (omnisharp_code_action_repeat) + autocmd FileType cs xmap os. (omnisharp_code_action_repeat) - autocmd FileType cs nmap os= (omnisharp_code_format) + autocmd FileType cs nmap os= (omnisharp_code_format) - autocmd FileType cs nmap osnm (omnisharp_rename) + autocmd FileType cs nmap osnm (omnisharp_rename) - autocmd FileType cs nmap osre (omnisharp_restart_server) - autocmd FileType cs nmap osst (omnisharp_start_server) - autocmd FileType cs nmap ossp (omnisharp_stop_server) + autocmd FileType cs nmap osre (omnisharp_restart_server) + autocmd FileType cs nmap osst (omnisharp_start_server) + autocmd FileType cs nmap ossp (omnisharp_stop_server) augroup END endif " ------ adv maps ------ -" strip trailing whitespace, ss (strip space) -nnoremap ss +" strip trailing whitespace, xs (strip space) +nnoremap xs \ :let b:_p = getpos(".") \ let b:_s = (@/ != '') ? @/ : '' \ %s/\s\+$//e @@ -1127,7 +1236,7 @@ nnoremap ss \ nohlsearch \ unlet b:_s \ call setpos('.', b:_p) - \ unlet b:_p + \ unlet b:_p match Todo /\s\+$/ @@ -1140,6 +1249,7 @@ nnoremap . :execute "norm! " . repeat(".", v:count1) set softtabstop=4 set tabstop=4 set shiftwidth=4 +set shiftround " Rounds the indentation to the nearest multiple of shiftwidth. set expandtab set smarttab filetype plugin indent on @@ -1160,6 +1270,8 @@ set smartcase " ... unless they contain at least one capital let set autoindent set backspace=2 +set equalalways " When on, all the windows are automatically + " made the same size after splitting or closing a window. set splitbelow splitright " splits open at bottom and right set lazyredraw " don't redraw while executing macros (good performance config) set ttyfast @@ -1187,6 +1299,7 @@ set wildmode=longest:longest,full " ignore case and whitespace changes set diffopt=filler,vertical +" set scrolloff=3 " scroll offset, min lines above/below cursor set scrolloff=5 " scroll offset, min lines above/below cursor "set scrolljump=5 " jump 5 lines when running out of the screen - NO set sidescroll=10 " minimum columns to scroll horizontally @@ -1209,17 +1322,20 @@ set noerrorbells " bells in vim " % : saves and restores the buffer list set viminfo='100,"100,:20,% " '=marks for x files, "=registers for x files +" set nofoldenable set foldmethod=manual " manual folding -set encoding=utf-8 " important for powerline besides others set fileencoding=utf-8 " set encoding for newly saved files set noscrollbind set cmdheight=2 " lines under {status,air}line set updatetime=250 - +" set updatetime=200 +" set updatetime=100 if (has('termguicolors')) set termguicolors +else + set t_Co=256 endif " let there be light " set background=light @@ -1259,6 +1375,26 @@ hi GitGutterDelete guifg=#c471a3 ctermfg=59 " erase most of the background colour in this specific case. if g:colors_name =~# 'spacemacs-theme' && &background =~# 'dark' +" if $TERM =~ 'xterm-256color' +" if &background =~ 'dark' +" if vim.g.colors_name == 'space_vim_theme' +" if exists('space_vim_theme' || 'spacemacs-theme') + + " hi Cursor ctermfg=black cterm=reverse + " hi Cursor gui=reverse cterm=reverse ctermbg=5 + " hi CursorLine gui=reverse + " hi Cursor guifg=NONE guibg=Purple ctermbg=8 cterm=reverse + " hi Cursor guifg=NONE guibg=Purple ctermbg=8 + " hi Cursor guifg=NONE guibg=NONE + " hi Cursor ctermfg=15 ctermbg=11 guifg=#373040 guibg=#68727c cterm=reverse + " hi! Cursor ctermfg=4 ctermbg=2 guifg=Black guibg=Purple + " hi! iCursor ctermfg=4 ctermbg=2 guifg=Black guibg=Purple + " hi! TermCursorNC ctermfg=4 ctermbg=2 guifg=Black guibg=Purple + + " hi Comment guifg=#5c6370 ctermfg=59 + " hi Function cterm=bold + " hi NonText cterm=NONE ctermbg=17 gui=NONE guibg=NONE guifg=#5c6370 + hi Normal ctermbg=NONE guibg=NONE hi LineNr ctermbg=NONE guibg=NONE " hi CursorLineNR cterm=bold @@ -1293,10 +1429,15 @@ hi SpellBad guisp=red gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=N hi SpellCap guisp=yellow gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=undercurl ctermul=yellow " compensate for lack of theme italics +" for s in ["Comment", "Constant", "Include", "Define", "Macro", "Delimiter", "Debug", "Identifier", "Boolean", "markdownItalic"] +" for s in ["Comment", "markdownItalic"] for s in ['Comment', 'markdownItalic', 'Boolean'] execute 'hi ' s ' cterm=italic' endfor +" python +hi pythonSelf ctermfg=68 guifg=#5f87d7 cterm=bold gui=bold + " vimtex highlight groups hi! link texMathEnvArgName texEnvArgName hi! link texMathZone LocalIdent @@ -1345,7 +1486,8 @@ set timeoutlen=200 " display normal mode immediately in the terminal) " ttimeout only applies to keycodes (so changes to default vim keys that can't " be unmapped is not an issue, e.g. using r in multikey/prefix bindings) -set notimeout ttimeout ttimeoutlen=10 +" set notimeout ttimeout ttimeoutlen=10 +set notimeout ttimeout ttimeoutlen=30 " persistent undo history (even if close buffer) " Save undos after file closes @@ -1371,13 +1513,16 @@ endif set laststatus=2 " show status bar set report=1 " Always report number of lines changed by ex commands -set t_Co=256 set guifont=Fira\ Code\ weight=450\ 12 set ballooneval " vim8+ popups let g:netrw_beval = 1 set t_vb= +" commented +" highlight ColorColumn guibg=Black ctermbg=0 +" highlight ColorColumn ctermbg=0 + " cursorline optimizations set cursorlineopt=number " 0 automatic selection @@ -1405,6 +1550,9 @@ set clipboard=unnamed,unnamedplus set exrc set secure +" nicer scrolling when long lines are wrapped. +set smoothscroll + " Append modeline before first line in buffer. " Use substitute() instead of printf() to handle '%%s' modeline in LaTeX @@ -1415,7 +1563,7 @@ function! AppendModeline() let l:modeline = substitute(&commentstring, '%s', l:modeline, '') call append (line('^'), l:modeline) endfunction -nnoremap ml :call AppendModeline() +nnoremap ml :call AppendModeline() function! AskQuit (msg, proposed_action) @@ -1485,6 +1633,15 @@ silent function! LINUX() return has('unix') && !has('macunix') && !has('win32unix') endfunction +" " fix meta-keys which generate a .. z +" let c='a' +" while c <= 'z' +" exec "set =\e".c +" exec "imap \e".c." " +" let c = nr2char(1+char2nr(c)) +" endw +" set =a +" imap a " note: this might be outdated at this point, I am not sure. " https://github.com/bling/vim-airline/issues/539 @@ -1503,12 +1660,13 @@ augroup autoReloadVimRC autocmd! " automatically reload vimrc when it's saved autocmd BufWritePost ~/.vimrc so ~/.vimrc | call RefreshUI() + autocmd BufWritePost ~/utils/dotfiles/vim/.vimrc so ~/utils/dotfiles/vim/.vimrc | call RefreshUI() augroup END " reload config -nnoremap ve :e $MYVIMRC +nnoremap ve :e $MYVIMRC " reload config and call refresh fn -nnoremap vr :source $MYVIMRCcall RefreshUI() +nnoremap vr :source $MYVIMRCcall RefreshUI() let base16colorspace=256 diff --git a/home-surtur.nix b/home-surtur.nix index ac66978..10e6f0d 100644 --- a/home-surtur.nix +++ b/home-surtur.nix @@ -47,12 +47,18 @@ in { source = .config/kitty/kitty.conf; }; + ".vimrc" = { + source = ./.vim/vimrc; + }; ".vim/deoplete.vimrc.vim" = { source = ./.vim/deoplete.vimrc.vim; }; ".vim/gotags.vimrc.vim" = { source = ./.vim/gotags.vimrc.vim; }; + ".vim/python.vimrc.vim" = { + source = ./.vim/python.vimrc.vim; + }; ".config/fusuma/config-wl.yml" = { source = ./.config/fusuma/config-wl.yml;