My vim configuration
git clone https://mcol.xyz/code/vim-misc
Log | Files | Refs | README

commit 87688ede66c439d90edac96e57fac81693b6dd71
parent 01dc9dccb876b488cfdfc1593a02b5b6ad5f7a6b
Author: mcol <mcol@posteo.net>
Date:   Mon,  5 Jul 2021 00:57:44 +0100

updates

Diffstat:
Aafter/plugin/gitgutter.vim | 16++++++++++++++++
Dplugin/goyo.vim.shelved | 15---------------
Mplugin/indent.vim | 18+++++++++---------
Mplugin/keybindings.vim | 38+++++++++++++++++++-------------------
Mplugin/theme.vim | 22+++++++++++-----------
Mvimrc | 19+++++--------------
6 files changed, 60 insertions(+), 68 deletions(-)

diff --git a/after/plugin/gitgutter.vim b/after/plugin/gitgutter.vim @@ -0,0 +1,16 @@ +"turn off realtime updates for gitgutter but update upon write +let g:gitgutter_enabled = 0 +autocmd! gitgutter CursorHold,CursorHoldI +autocmd BufWritePost * GitGutter + +" gitgutter +nmap <localleader>g :GitGutterToggle<CR> +nmap gp <Plug>(GitGutterPreviewHunk) +nmap gs <Plug>(GitGutterStageHunk) +nmap gu <Plug>(GitGutterUndoHunk) +nmap [g <Plug>(GitGutterPrevHunk) +nmap ]g <Plug>(GitGutterNextHunk) +omap ig <Plug>(GitGutterTextObjectInnerPending) +omap ag <Plug>(GitGutterTextObjectOuterPending) +xmap ig <Plug>(GitGutterTextObjectInnerVisual) +xmap ag <Plug>(GitGutterTextObjectOuterVisual) diff --git a/plugin/goyo.vim.shelved b/plugin/goyo.vim.shelved @@ -1,15 +0,0 @@ -"------------------------------------------------------------------" -" Goyo configuration -"------------------------------------------------------------------" - -function! s:goyo_enter() - set noshowmode - set noshowcmd -endfunction - -function! s:goyo_leave() - source ~/.vim/bundle/vim-misc/plugin/theme.vim -endfunction - -autocmd! User GoyoEnter nested call <SID>goyo_enter() -autocmd! User GoyoLeave nested call <SID>goyo_leave() diff --git a/plugin/indent.vim b/plugin/indent.vim @@ -2,12 +2,12 @@ " Indentation of entire file "------------------------------------------------------------------ -function! IndentFile() - mkview - let l:win_view = winsaveview() - :normal! gg=G - silent loadview - call winrestview(l:win_view) -endfunction - -nnoremap <C-i> :call IndentFile()<CR> +"function! IndentFile() +" mkview +" let l:win_view = winsaveview() +" :normal! gg=G +" silent loadview +" call winrestview(l:win_view) +"endfunction +" +"nnoremap <C-i> :call IndentFile()<CR> diff --git a/plugin/keybindings.vim b/plugin/keybindings.vim @@ -38,10 +38,13 @@ nnoremap :W :w nnoremap K k " copy and paste system clipboard -nnoremap <C-y> "+y -nnoremap <C-y><C-y> ms0v$"+y`s -vnoremap <C-y> "+y -inoremap <C-y> <Esc>"+y +nmap <C-y> "+y +nmap <C-y><C-y> ms0v$"+y`s +vmap <C-y> "+y +imap <C-y> <Esc>"+y +if exists("$WAYLAND_DISPLAY") + xmap "+y y:call system("wl-copy", @")\|echo '' <cr> +endif " save read-only file with sudo trick cnoremap w!! w !sudo tee > /dev/null % @@ -108,18 +111,15 @@ nnoremap <localleader>cp :cp<CR> nmap <C-n> :Explore<CR> let g:netrw_sort_sequence='[\/]$' -" disable middle click paste (restoring xterm middle click open url) -map <MiddleMouse> <Nop> -imap <MiddleMouse> <Nop> - -" gitgutter -nmap <localleader>g :GitGutterToggle<CR> -nmap gp <Plug>(GitGutterPreviewHunk) -nmap gs <Plug>(GitGutterStageHunk) -nmap gu <Plug>(GitGutterUndoHunk) -nmap [g <Plug>(GitGutterPrevHunk) -nmap ]g <Plug>(GitGutterNextHunk) -omap ig <Plug>(GitGutterTextObjectInnerPending) -omap ag <Plug>(GitGutterTextObjectOuterPending) -xmap ig <Plug>(GitGutterTextObjectInnerVisual) -xmap ag <Plug>(GitGutterTextObjectOuterVisual) +" bind number keys to scroll so i can use foot terminal's alt scrolling +map <Down> j +map <Up> k + + +" bind scroll to move cursor up and down +nnoremap <ScrollWheelDown> <Down> +nnoremap <ScrollWheelUp> <Up> +inoremap <ScrollWheelDown> <Down> +inoremap <ScrollWheelUp> <Up> +vnoremap <ScrollWheelDown> <Down> +vnoremap <ScrollWheelUp> <Up> diff --git a/plugin/theme.vim b/plugin/theme.vim @@ -35,11 +35,11 @@ hi TabLine ctermfg=0 ctermbg=13 hi TabLineSel ctermfg=0 ctermbg=12 hi Title ctermfg=0 ctermbg=12 -" vimdiff -hi DiffAdd cterm=none ctermfg=0 ctermbg=2 -hi DiffChange cterm=none ctermfg=0 ctermbg=4 -hi DiffText cterm=none ctermfg=0 ctermbg=6 -hi DiffDelete cterm=bold ctermfg=0 ctermbg=1 +" vimdiff " commented out as it was disrupting git gutter +"hi DiffAdd cterm=none ctermfg=0 ctermbg=2 +"hi DiffChange cterm=none ctermfg=0 ctermbg=4 +"hi DiffText cterm=none ctermfg=0 ctermbg=6 +"hi DiffDelete cterm=bold ctermfg=0 ctermbg=1 " folds hi Folded ctermbg=8 ctermfg=4 cterm=none @@ -66,12 +66,12 @@ augroup CursorLine augroup END " change cursor shape in insert mode -"let &t_SI = "\e[4 q" "underscore -"let &t_EI = "\e[2 q" "block -"augroup myCmds -" au! -" autocmd VimEnter * silent !echo -ne "\e[2 q" -"augroup END +let &t_SI = "\e[4 q" "underscore +let &t_EI = "\e[2 q" "block +augroup myCmds + au! + autocmd VimEnter * silent !echo -ne "\e[2 q" +augroup END " character for split barrier set fillchars=vert:\ diff --git a/vimrc b/vimrc @@ -25,12 +25,12 @@ if stridx(hostname(), "book") != -1 Plugin 'gu-fan/riv.vim' Plugin 'https://mcol.xyz/code/vimlab' " vimlab Plugin 'lervag/vimtex' " vimtex + Plugin 'elixir-editors/vim-elixir' " elixir support endif Plugin 'https://mcol.xyz/code/vim-misc' " my vimrc and misc functions Plugin 'https://mcol.xyz/code/tide' " tmux ide Plugin 'airblade/vim-gitgutter' " gitgutter -Plugin 'terryma/vim-multiple-cursors' " multicursor call vundle#end() " required filetype plugin indent on " required @@ -75,7 +75,7 @@ set noswapfile set splitbelow " default new sp window goes below set splitright " default new vsp window goes right -set scrolloff=10 " keep x lines at top and bottom visible when scrollingkeep x lines at top and bottom visible when scrolling +set scrolloff=4 " keep x lines at top and bottom visible when scrollingkeep x lines at top and bottom visible when scrolling autocmd VimResized * wincmd = " keep splits equal size when resizing window syntax on " enable syntax highlighting @@ -118,9 +118,6 @@ if stridx(hostname(), "book") != -1 set mmp=2000 endif -let g:gitgutter_enabled = 0 - - " Intelligently navigate tmux panes and Vim splits using the same keys. " See https://sunaku.github.io/tmux-select-pane.html for documentation. let progname = substitute($VIM, '.*[/\\]', '', '') @@ -132,12 +129,6 @@ endif if &term =~ '^screen' && !has('nvim') | exe "set t_ts=\e]2; t_fs=\7" | endif -" vim-multiple-cursors -let g:multi_cursor_use_default_mapping = 0 -let g:multi_cursor_start_word_key = '<C-c>' -let g:multi_cursor_next_key = '<C-n>' -let g:multi_cursor_prev_key = '<C-p>' -let g:multi_cursor_skip_key = '<C-x>' -let g:multi_cursor_quit_key = '<Esc>' - -set ff=unix +if exists("$WAYLAND_DISPLAY") + set ttym=sgr +endif