diff --git a/vimrc b/vimrc index 696936a..8f4c90a 100644 --- a/vimrc +++ b/vimrc @@ -1,4 +1,4 @@ -let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' +let data_dir = '~/.vim' if empty(glob(data_dir . '/autoload/plug.vim')) silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' endif @@ -10,11 +10,19 @@ autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) call plug#begin('~/.vim/plugged') Plug 'tpope/vim-surround' Plug 'jiangmiao/auto-pairs' - Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } - Plug 'junegunn/fzf.vim' + Plug 'junegunn/fzf', { 'do': './install --all' } + if v:version < 800 + Plug 'junegunn/fzf.vim', { 'commit': '5ab282c2f4a597fa655f39f36e7ee8e97bf51650' } + else + Plug 'junegunn/fzf.vim' + endif Plug 'mtdl9/vim-log-highlighting' - Plug 'machakann/vim-highlightedyank' Plug 'osyo-manga/vim-anzu' + if v:version < 800 && has('timers') + Plug 'machakann/vim-highlightedyank', { 'commit': '03fe057c5836a3f3897a943dc96bdfe3f087890e' } + elseif v:version >= 800 + Plug 'machakann/vim-highlightedyank' + endif call plug#end() let mapleader = "\" @@ -35,6 +43,11 @@ highlight LineNr ctermbg=NONE guibg=NONE highlight Visual ctermbg=Gray guibg=Gray ctermfg=Black guifg=Black let g:highlightedyank_highlight_duration = 140 +if v:version < 800 && has('timers') + nmap y (highlightedyank) + xmap y (highlightedyank) + omap y (highlightedyank) +endif let $FZF_DEFAULT_OPTS = '--bind=tab:up,shift-tab:down' let g:fzf_layout = { 'window': 'enew' } @@ -75,7 +88,9 @@ set shiftwidth=2 set softtabstop=2 set expandtab set smartindent -set fillchars=eob:\ +if v:version >= 800 + set fillchars=eob:\ +endif set statusline=%{exists('*anzu#search_status')?anzu#search_status():''} @@ -117,7 +132,7 @@ function! SafeBdelete() return endif - let l:buflisted = getbufinfo({'buflisted': 1}) + let l:buflisted = filter(range(1, bufnr('$')), 'buflisted(v:val)') if len(l:buflisted) <= 1 echohl WarningMsg | echom 'Cannot delete last buffer' | echohl None return @@ -150,13 +165,13 @@ vnoremap > >gv nnoremap zz nnoremap zz -" --- Window navigation (matches nvim , skips netrw) --- +" --- Window navigation (skips netrw) --- nnoremap :call SafeWincmd('h') nnoremap :call SafeWincmd('j') nnoremap :call SafeWincmd('k') nnoremap :call SafeWincmd('l') -" --- Window resize (matches nvim ) --- +" --- Window resize --- nnoremap :vertical resize +10 nnoremap :vertical resize -10 nnoremap :resize +10 @@ -184,7 +199,9 @@ nnoremap H :bprevious nnoremap L :bnext " --- Terminal --- -nnoremap t :below terminal ++rows=10 +if exists(':terminal') == 2 + nnoremap t :below terminal ++rows=10 +endif " --- Misc --- nnoremap ts :execute "normal! a" . strftime('[%b %d %H:%M:%S - BR]')