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

commit 3d0b1d3f5bdd02193a3bf759d86b89eb1930fe44
parent f2efd56d3fdc577b0aacf4ffeaaff96be6c7655b
Author: mcol <mcol@posteo.net>
Date:   Sun,  2 Dec 2018 00:19:50 +0000

fixed a bunch of things

Diffstat:
Mplugin/autohighlight.vim | 5++++-
Mplugin/bclose.vim | 18+++++-------------
Mplugin/keybindings.vim | 1-
Mvimrc | 22+++++++++-------------
4 files changed, 18 insertions(+), 28 deletions(-)

diff --git a/plugin/autohighlight.vim b/plugin/autohighlight.vim @@ -1,5 +1,6 @@ +"------------------------------------------------------------------" " Highlight all instances of word under cursor, when idle. -nnoremap <bar> :if AutoHighlightToggle()<Bar>set hls<Bar>endif<CR> +"------------------------------------------------------------------" function! AutoHighlightToggle() let @/ = '' if exists('#auto_highlight') @@ -18,3 +19,5 @@ function! AutoHighlightToggle() return 1 endif endfunction + +nnoremap <bar> :if AutoHighlightToggle()<Bar>set hls<Bar>endif<CR> diff --git a/plugin/bclose.vim b/plugin/bclose.vim @@ -75,21 +75,13 @@ endfunction command! -bang -complete=buffer -nargs=? Bclose call s:Bclose('<bang>', '<args>') -""""" These are left in case the above is not ideal -"function! CloseIfLastBuffer() -" if len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1 -" let g:fromFile=expand('%:p') -" execute "q" -" execute "bd" -"endfunction -"nnoremap <BS> :call CloseIfLastBuffer()<CR> -"autocmd BufDelete * if len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1 | quit | endif -"autocmd BufDelete * if len(filter(range(1, bufnr('$')), '! empty(bufname(v:val)) && buflisted(v:val)')) == 1 | quit | endif - -if v:this_session == expand("$HOME") . ".cache/vim/sessions/matlab-session.vim" - nnoremap <buffer> <silent> <BS> :Bclose<CR> +if v:servername == "VIMLAB" + nnoremap <buffer> <silent> <BS> <Plug>Kwbd +else + autocmd BufDelete * if len(filter(range(1, bufnr('$')), 'empty(bufname(v:val)) && buflisted(v:val)')) == 1 && v:servername != "VIMLAB" | quit | endif endif +nnoremap <silent> <BS> :Bclose<CR> diff --git a/plugin/keybindings.vim b/plugin/keybindings.vim @@ -13,7 +13,6 @@ nnoremap <leader>b :ls<CR>:b<space> nnoremap <Leader>v :ls<CR>:vert sb<space> nnoremap <Leader>j :bnext<CR> nnoremap <Leader>k :bprevious<CR> -nnoremap <silent> <BS> :bdelete<CR> nnoremap <Leader><BS> :w<CR>:bdelete<CR> " move between tabs diff --git a/vimrc b/vimrc @@ -41,8 +41,7 @@ filetype plugin indent on " required "------------------------------------------------------------------" set hidden " allow opening new buffers without saving first -set lazyredraw " dont update screen during macros/scripts -"set showmatch " Highlight matching brace +"set lazyredraw " dont update screen during macros/scripts set hlsearch " Highlight all search results - toggled by <Leader>h set smartcase " searches ignore case only if all lower case set incsearch " Searches for strings while typing search term @@ -58,20 +57,21 @@ set backspace=indent,eol,start " Backspace behaviour set formatoptions+=j " Delete comment characters when joining lines. autocmd FileType * setlocal formatoptions-=cro " disable autocommenting -set undolevels=100 " Number of undo levels -set dir^=~/.cache/vim/swap// " where to store swapfiles -set backupdir=~/.cache/vim " where to store backups +set undolevels=50 " Number of undo levels +set dir^=~/.vim/swap// " where to store swapfiles +set backupdir=~/.vim/backups/ " where to store backups set splitbelow " default new sp window goes below set splitright " default new vsp window goes right -set scrolloff=15 " keep x lines at top and bottom visible when scrolling +set scrolloff=12 " keep x lines at top and bottom visible when scrolling autocmd VimResized * wincmd = " keep splits equal size when resizing window syntax on " enable syntax highlighting set mouse=a " enable mouse set t_Co=16 " use the 16 terminal colours -set sessionoptions-=options " do not store global and local values in a session +set sessionoptions=buffers,folds,tabpages +set viewoptions=folds,cursor set wildmenu " enable wildmenu for tab completion of commands set wildmode=longest:list,full " format wildmenu to expand and scroll with tab @@ -115,15 +115,11 @@ endif " mlint code checking if hostname() == "zenbook" - let g:mlint_path_to_mlint = "/home/mlv/applications/MATLAB/R2018b/bin/glnxa64/mlint" + let g:mlint_path_to_mlint = expand("$HOME") . "/applications/MATLAB/R2018b/bin/glnxa64/mlint" else let g:mlint_path_to_mlint = "to be filled in later" endif let g:mlint_hover = 0 " session saving -let g:vimlab_session = "~/.cache/vim/sessions/matlab-session.vim" - -" I am using this for debugging -cmap test echo synIDattr(synIDtrans(synID(line("."), col("."), 0)), "name")<CR> - +let g:vimlab_session = "~/.vim/sessions/matlab-session.vim"