vimrc: update and bring to HM

This commit is contained in:
surtur 2023-07-10 00:38:37 +02:00
parent 0c21234215
commit b337d259c4
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI
4 changed files with 297 additions and 104 deletions

View File

@ -1,3 +1,4 @@
let g:deoplete#enable_at_startup = 0
let g:deoplete#disable_auto_complete = 1
inoremap <expr> <C-n> deoplete#manual_complete()
let g:deoplete#enable_ignore_case = 1

28
.vim/python.vimrc.vim Normal file
View File

@ -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 = '<leader>g'
let g:jedi#goto_definitions_command = '<leader>d'
let g:jedi#documentation_command = 'K'
let g:jedi#usages_command = '<leader>n'
let g:jedi#rename_command = '<leader>r'
let g:jedi#show_call_signatures = '0'
let g:jedi#completions_command = '<C-Space>'
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

View File

@ -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 <Up> <NOP>
"noremap <Down> <NOP>
"noremap <Left> <NOP>
"noremap <Right> <NOP>
" 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 <buffer><Leader>cf :<C-u>ClangFormat<cr>
autocmd FileType c,cpp,proto vnoremap <buffer><Leader>cf :ClangFormat<cr>
autocmd FileType c,cpp,proto nnoremap <buffer><leader>cf :<C-u>ClangFormat<cr>
autocmd FileType c,cpp,proto vnoremap <buffer><leader>cf :ClangFormat<cr>
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 <silent><c-_> :call nerdcommenter#Comment(0,"toggle")<CR>
noremap <silent><c-_> :call nerdcommenter#Comment(0,"toggle")<cr>
" 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 <c-p><c-e>
" sometimes issues with expanding {}
let g:AutoPairsMultilineClose = 0
let g:AutoPairsFlyMode = 0
let g:AutoPairsFlyMode = 0 "jump back with <c-p><c-b>
" disable jumpy cursor - centers screen when in lower 1/3.
let g:AutoPairsMapCR = 0
" inoremap <CR> <esc>:call autopairs#AutoPairsReturn()<cr>i
" inoremap <cr> <esc>:call autopairs#AutoPairsReturn()<cr>i
" let g:AutoPairsFlyModeBlacklist =
" let g:AutoPairsShortcutToggle = '<c-h>'
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 '<c-p>' :<CtrlP><cr>
" The Silver Searcher
if executable('ag')
" use ag instead of grep.
set grepprg=ag\ --nogroup\ --nocolor
let g:ctrlp_map = '<c-p>'
" 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 '<c-p>' :CtrlP<cr><cr>
nnoremap <leader>s <Plug>(ctrlp)
" let g:ctrlp_map = '<leader>s'
let g:ctrlp_show_hidden = 1
" Use a leader instead of the actual named binding
nmap <leader>p :CtrlP<cr>
nmap <leader>p <Plug>(ctrlp)
noremap <M-p> :CtrlP :pwd<cr>
" 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! <args> | 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 <c-g>
nnoremap <c-g> 1<c-g>
" open a terminal in $PWD
nnoremap <silent> <Leader>tt :terminal<CR>
nnoremap <silent> <leader>tt :terminal<cr>
" terminal normal mode
tnoremap <F1> <C-W>N
" toggle showing whitespace
noremap <F5> :set list!<CR>
noremap <F5> :set list!<cr>
" make shortcut
nnoremap <F4> :term ++hidden ++open make<cr>
nnoremap <leader><F4> :term ++open make<cr>
nnoremap <F8> :TagbarToggle<CR>
nnoremap <F8> :TagbarToggle<cr>
vmap gb :<C-U>!git blame % -L<C-R>=line("'<") <CR>,<C-R>=line("'>") <CR><CR>
nnoremap gb :!git blame %<CR>
vmap gb :<C-U>!git blame % -L<C-R>=line("'<") <cr>,<C-R>=line("'>") <cr><cr>
nnoremap gb :!git blame %<cr>
" ll provided by vimtex
" nnoremap <silent> <Leader>kk :w! !pdflatex -shell-escape -interaction=nonstopmode ./*.tex<CR><CR>
" nnoremap <silent> <leader>kk :w! !pdflatex -shell-escape -interaction=nonstopmode ./*.tex<cr><cr>
function! Pdfpls()
echom 'compiling ur tex goodness!'
" w!
@ -664,13 +729,13 @@ endfunction
nnoremap <silent><leader>lb :call PdfBibLuapls()<cr><esc>
nnoremap <Leader>l :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=1"<CR><CR>
nnoremap <leader>l :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=1"<cr><cr>
" ALE bindings
nmap <silent> <C-k> :ALEPreviousWrap<cr>
nmap <silent> <C-j> :ALENextWrap<cr>
nnoremap <Leader>a :ALEDetail<cr>
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
nnoremap <leader>a :ALEDetail<cr>
nnoremap <c-LeftMouse> :ALEGoToDefinition<cr>
@ -685,6 +750,7 @@ nnoremap <silent><f6> gT
nnoremap <silent><f7> gt
" resize windows
" imap <C-w> <C-o><C-w>
map - <C-W>-
map + <C-W>+
@ -693,8 +759,8 @@ vmap < <gv
vmap > >gv
" moving visual blocks
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
" vnoremap J :m '>+1<cr>gv=gv
" vnoremap K :m '<-2<cr>gv=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 <leader>b <Plug>(go-build)
au FileType go nmap <leader>gr <Plug>(go-run)
au FileType go nmap <leader>gt <Plug>(go-test)
au FileType go nmap <Leader>gs <Plug>(go-implements)
au FileType go nmap <Leader>gi <Plug>(go-info)
au FileType go nmap <Leader>ge <Plug>(go-rename)
au FileType go nmap <Leader>gd <Plug>(go-doc)
au FileType go nmap <leader>gs <Plug>(go-implements)
au FileType go nmap <leader>gi <Plug>(go-info)
au FileType go nmap <leader>ge <Plug>(go-rename)
au FileType go nmap <leader>gd <Plug>(go-doc)
" Navigation commands
au FileType go nmap <Leader>ds <Plug>(go-def-split)
au FileType go nmap <Leader>dv <Plug>(go-def-vertical)
au FileType go nmap <leader>ds <Plug>(go-def-split)
au FileType go nmap <leader>dv <Plug>(go-def-vertical)
" Alternate commands
au FileType go nmap <Leader>ae <Plug>(go-alternate-edit)
au FileType go nmap <Leader>av <Plug>(go-alternate-vertical)
au FileType go nmap <leader>hae <Plug>(go-alternate-edit)
au FileType go nmap <leader>vae <Plug>(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 = '<leader>g'
let g:jedi#goto_definitions_command = '<leader>d'
let g:jedi#documentation_command = 'K'
let g:jedi#usages_command = '<leader>n'
let g:jedi#rename_command = '<leader>r'
let g:jedi#show_call_signatures = '0'
let g:jedi#completions_command = '<C-Space>'
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 <silent> <leader>t :TestNearest<CR>
nmap <silent> <leader>tf :TestFile<CR>
" nmap <silent> <leader>a :TestSuite<CR>
nmap <silent> <leader>tl :TestLast<CR>
nmap <silent> <leader>g :TestVisit<CR>
" 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 <silent>"+y y:call system("wl-copy", @")<cr>
xnoremap <silent>"*y y:call system("wl-copy", @")<cr>
" xnoremap <silent><leader>y y:call system("wl-copy --trim-newline", @*)<cr>:call system("wl-copy -p --trim-newline", @*)<cr>
endif
if s:env =~# 'LINUX' && executable('wl-paste')
nnoremap <silent>"+p :let @"=substitute(system("wl-paste --no-newline"), '<C-v><C-m>', '', 'g')<cr>p
@ -805,7 +864,7 @@ endif
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<left>"
inoremap <expr> <CR> pumvisible() ? "\<C-Y>" : "\<CR>"
inoremap <expr> <cr> pumvisible() ? "\<C-Y>" : "\<cr>"
" ------ 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 <silent> <buffer> gd <Plug>(omnisharp_go_to_definition)
autocmd FileType cs nmap <silent> <buffer> <Leader>osfu <Plug>(omnisharp_find_usages)
autocmd FileType cs nmap <silent> <buffer> <Leader>osfi <Plug>(omnisharp_find_implementations)
autocmd FileType cs nmap <silent> <buffer> <Leader>ospd <Plug>(omnisharp_preview_definition)
autocmd FileType cs nmap <silent> <buffer> <Leader>ospi <Plug>(omnisharp_preview_implementations)
autocmd FileType cs nmap <silent> <buffer> <Leader>ost <Plug>(omnisharp_type_lookup)
autocmd FileType cs nmap <silent> <buffer> <Leader>osd <Plug>(omnisharp_documentation)
autocmd FileType cs nmap <silent> <buffer> <Leader>osfs <Plug>(omnisharp_find_symbol)
autocmd FileType cs nmap <silent> <buffer> <Leader>osfx <Plug>(omnisharp_fix_usings)
autocmd FileType cs nmap <silent> <buffer> <leader>osfu <Plug>(omnisharp_find_usages)
autocmd FileType cs nmap <silent> <buffer> <leader>osfi <Plug>(omnisharp_find_implementations)
autocmd FileType cs nmap <silent> <buffer> <leader>ospd <Plug>(omnisharp_preview_definition)
autocmd FileType cs nmap <silent> <buffer> <leader>ospi <Plug>(omnisharp_preview_implementations)
autocmd FileType cs nmap <silent> <buffer> <leader>ost <Plug>(omnisharp_type_lookup)
autocmd FileType cs nmap <silent> <buffer> <leader>osd <Plug>(omnisharp_documentation)
autocmd FileType cs nmap <silent> <buffer> <leader>osfs <Plug>(omnisharp_find_symbol)
autocmd FileType cs nmap <silent> <buffer> <leader>osfx <Plug>(omnisharp_fix_usings)
autocmd FileType cs nmap <silent> <buffer> <C-\> <Plug>(omnisharp_signature_help)
autocmd FileType cs imap <silent> <buffer> <C-\> <Plug>(omnisharp_signature_help)
@ -1097,29 +1206,29 @@ augroup omnisharp_commands
autocmd FileType cs nmap <silent> <buffer> [[ <Plug>(omnisharp_navigate_up)
autocmd FileType cs nmap <silent> <buffer> ]] <Plug>(omnisharp_navigate_down)
" Find all code errors/warnings for the current solution and populate the quickfix window
autocmd FileType cs nmap <silent> <buffer> <Leader>osgcc <Plug>(omnisharp_global_code_check)
autocmd FileType cs nmap <silent> <buffer> <leader>osgcc <Plug>(omnisharp_global_code_check)
" Contextual code actions (uses fzf, vim-clap, CtrlP or unite.vim selector when available)
autocmd FileType cs nmap <silent> <buffer> <Leader>osca <Plug>(omnisharp_code_actions)
autocmd FileType cs xmap <silent> <buffer> <Leader>osca <Plug>(omnisharp_code_actions)
" Repeat the last code action performed (does not use a selector)
autocmd FileType cs nmap <silent> <buffer> <Leader>os. <Plug>(omnisharp_code_action_repeat)
autocmd FileType cs xmap <silent> <buffer> <Leader>os. <Plug>(omnisharp_code_action_repeat)
autocmd FileType cs nmap <silent> <buffer> <leader>osca <Plug>(omnisharp_code_actions)
autocmd FileType cs xmap <silent> <buffer> <leader>osca <Plug>(omnisharp_code_actions)
" Repeat the last code action performed (doeS not use a selector)
autocmd FileType cs nmap <silent> <buffer> <leader>os. <Plug>(omnisharp_code_action_repeat)
autocmd FileType cs xmap <silent> <buffer> <leader>os. <Plug>(omnisharp_code_action_repeat)
autocmd FileType cs nmap <silent> <buffer> <Leader>os= <Plug>(omnisharp_code_format)
autocmd FileType cs nmap <silent> <buffer> <leader>os= <Plug>(omnisharp_code_format)
autocmd FileType cs nmap <silent> <buffer> <Leader>osnm <Plug>(omnisharp_rename)
autocmd FileType cs nmap <silent> <buffer> <leader>osnm <Plug>(omnisharp_rename)
autocmd FileType cs nmap <silent> <buffer> <Leader>osre <Plug>(omnisharp_restart_server)
autocmd FileType cs nmap <silent> <buffer> <Leader>osst <Plug>(omnisharp_start_server)
autocmd FileType cs nmap <silent> <buffer> <Leader>ossp <Plug>(omnisharp_stop_server)
autocmd FileType cs nmap <silent> <buffer> <leader>osre <Plug>(omnisharp_restart_server)
autocmd FileType cs nmap <silent> <buffer> <leader>osst <Plug>(omnisharp_start_server)
autocmd FileType cs nmap <silent> <buffer> <leader>ossp <Plug>(omnisharp_stop_server)
augroup END
endif
" ------ adv maps ------
" strip trailing whitespace, ss (strip space)
nnoremap <silent> <Leader>ss
" strip trailing whitespace, xs (strip space)
nnoremap <silent> <leader>xs
\ :let b:_p = getpos(".") <Bar>
\ let b:_s = (@/ != '') ? @/ : '' <Bar>
\ %s/\s\+$//e <Bar>
@ -1127,7 +1236,7 @@ nnoremap <silent> <Leader>ss
\ nohlsearch <Bar>
\ unlet b:_s <Bar>
\ call setpos('.', b:_p) <Bar>
\ unlet b:_p <CR>
\ unlet b:_p <cr>
match Todo /\s\+$/
@ -1140,6 +1249,7 @@ nnoremap . :<c-u>execute "norm! " . repeat(".", v:count1)<cr>
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 <silent> <Leader>ml :call AppendModeline()<CR>
nnoremap <silent> <leader>ml :call AppendModeline()<cr>
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 <Esc>a .. <Esc>z
" let c='a'
" while c <= 'z'
" exec "set <M-".toupper(c).">=\e".c
" exec "imap \e".c." <M-".toupper(c).">"
" let c = nr2char(1+char2nr(c))
" endw
" set <M-A>=a
" imap a <M-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 <Leader>ve :e $MYVIMRC<CR>
nnoremap <leader>ve :e $MYVIMRC<cr>
" reload config and call refresh fn
nnoremap <Leader>vr :source $MYVIMRC<CR>call RefreshUI()<CR>
nnoremap <leader>vr :source $MYVIMRC<cr>call RefreshUI()<cr>
let base16colorspace=256

View File

@ -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;