From 143ec2f33f145579d56c7d6c7964486a823f1930 Mon Sep 17 00:00:00 2001 From: Daniel Lynn Date: Wed, 16 Jun 2021 16:30:55 -0500 Subject: [PATCH] Update vim with ack, git, keybindings, nerdtree --- nvim/ack | 3 +++ nvim/colors | 5 +++++ nvim/git | 6 ++++++ nvim/keybindings | 25 +++++++++++++++++++++++++ nvim/nerdtree | 7 +++++++ nvim/plugins | 11 ++++++----- vimrc | 38 ++++++++++++++++++++------------------ 7 files changed, 72 insertions(+), 23 deletions(-) create mode 100644 nvim/ack create mode 100644 nvim/git create mode 100644 nvim/keybindings create mode 100644 nvim/nerdtree diff --git a/nvim/ack b/nvim/ack new file mode 100644 index 0000000..e4232f4 --- /dev/null +++ b/nvim/ack @@ -0,0 +1,3 @@ +let g:ackprg = 'ag --vimgrep --smart-case' " Use the_silver_searcher for Ack + +noremap \ :Ag diff --git a/nvim/colors b/nvim/colors index ea9fefa..1653165 100644 --- a/nvim/colors +++ b/nvim/colors @@ -1,3 +1,7 @@ +" True color support +let &t_8f = "\[38:2:%lu:%lu:%lum" +let &t_8b = "\[48:2:%lu:%lu:%lum" + function! s:sonokai_custom() abort " Link a highlight group to a predefined highlight group. " See `colors/sonokai.vim` for all predefined highlight groups. @@ -23,6 +27,7 @@ function! s:sonokai_custom() abort call sonokai#highlight('CocGitRemovedSign', l:palette.red, l:palette.bg1) call sonokai#highlight('CocGitTopRemovedSign', l:palette.red, l:palette.bg1) call sonokai#highlight('CocGitChangeRemovedSign', l:palette.purple, l:palette.bg1) + call sonokai#highlight('GitCommitTemplateTag', l:palette.orange, l:palette.none) endfunction augroup CustomColors diff --git a/nvim/git b/nvim/git new file mode 100644 index 0000000..58ae266 --- /dev/null +++ b/nvim/git @@ -0,0 +1,6 @@ +augroup GitCommitTemplates + autocmd! + autocmd BufNewFile,BufRead PULL_REQUEST_TEMPLATE,*.pr set filetype=pullrequest + autocmd Filetype pullrequest :match GitCommitTemplateTag /<[^>]*>/ + autocmd Filetype pullrequest :let @/ ='<[^>]*>' +augroup END diff --git a/nvim/keybindings b/nvim/keybindings new file mode 100644 index 0000000..5c29fbe --- /dev/null +++ b/nvim/keybindings @@ -0,0 +1,25 @@ +let mapleader = " " + +" Auto-toggle paste mode +let &t_SI .= "\[?2004h" +let &t_EI .= "\[?2004l" + +function! XTermPasteBegin() + set pastetoggle=[201~ + set paste + return "" +endfunction + +inoremap [200~ XTermPasteBegin() + +" Clear search highlighting +noremap :let @/ = "" + +" Spellcheck +nnoremap S :setlocal spell! spelllang=en_us + +noremap H ^ +noremap L $ +noremap c :set cursorline! +noremap n :set relativenumber! +noremap ; $a; diff --git a/nvim/nerdtree b/nvim/nerdtree new file mode 100644 index 0000000..de9d499 --- /dev/null +++ b/nvim/nerdtree @@ -0,0 +1,7 @@ +augroup CustomNERDTree + autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif + autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif + autocmd Filetype nerdtree,tagbar setlocal signcolumn=no nocursorline norelativenumber +augroup END + +noremap d :NERDTreeToggle diff --git a/nvim/plugins b/nvim/plugins index cda7d19..defed80 100644 --- a/nvim/plugins +++ b/nvim/plugins @@ -1,7 +1,8 @@ " Assorted plugins -Plug 'tpope/vim-surround' -Plug 'tpope/vim-fugitive' Plug 'cespare/vim-toml' +Plug 'mileszs/ack.vim' +Plug 'tpope/vim-fugitive' +Plug 'tpope/vim-surround' " CoC Plug 'neoclide/coc.nvim', {'branch': 'release'} | @@ -9,9 +10,9 @@ Plug 'neoclide/coc.nvim', {'branch': 'release'} | " Lightline Plug 'itchyny/lightline.vim' | + \ Plug 'albertomontesg/lightline-asyncrun' | \ Plug 'itchyny/vim-gitbranch' | \ Plug 'macthecadillac/lightline-gitdiff' | - \ Plug 'albertomontesg/lightline-asyncrun' | \ Plug 'anstadnik/tmuxline.vim' " Using the above fork for lightline truecolor support " \ Plug 'edkolev/tmuxline.vim' @@ -24,5 +25,5 @@ Plug 'preservim/nerdtree' | " sonokai colorscheme + supporting plugins Plug 'sainnhe/sonokai' | - \ Plug 'sainnhe/artify.vim' | - \ Plug 'rmolin88/pomodoro.vim' + \ Plug 'rmolin88/pomodoro.vim' | + \ Plug 'sainnhe/artify.vim' diff --git a/vimrc b/vimrc index f5f9ecc..d70525d 100644 --- a/vimrc +++ b/vimrc @@ -43,29 +43,11 @@ set vb t_vb= syntax enable syntax sync minlines=128 maxlines=512 -let mapleader = " " - " Cursor shapes let &t_SI = "\[6 q" let &t_SR = "\[4 q" let &t_EI = "\[0 q" -" True color support -let &t_8f = "\[38:2:%lu:%lu:%lum" -let &t_8b = "\[48:2:%lu:%lu:%lum" - -" Auto-toggle paste mode -let &t_SI .= "\[?2004h" -let &t_EI .= "\[?2004l" - -inoremap [200~ XTermPasteBegin() - -function! XTermPasteBegin() - set pastetoggle=[201~ - set paste - return "" -endfunction - " Plugins call plug#begin('~/.vim/plugged') if filereadable(expand("~/.config/nvim/plugins")) @@ -73,6 +55,11 @@ if filereadable(expand("~/.config/nvim/plugins")) endif call plug#end() +" Keybindings +if filereadable(expand("~/.config/nvim/keybindings")) + source ~/.config/nvim/keybindings +endif + " Lightline setup if filereadable(expand("~/.config/nvim/lightline")) source ~/.config/nvim/lightline @@ -83,6 +70,21 @@ if filereadable(expand("~/.config/nvim/tmuxline")) source ~/.config/nvim/tmuxline endif +" Git setup +if filereadable(expand("~/.config/nvim/git")) + source ~/.config/nvim/git +endif + +" NERDTree setup +if filereadable(expand("~/.config/nvim/nerdtree")) + source ~/.config/nvim/nerdtree +endif + +" Ack setup +if filereadable(expand("~/.config/nvim/ack")) + source ~/.config/nvim/ack +endif + " Color setup if filereadable(expand("~/.config/nvim/colors")) source ~/.config/nvim/colors