Update vim with ack, git, keybindings, nerdtree

This commit is contained in:
Daniel Lynn 2021-06-16 16:30:55 -05:00
parent 51d1be03bd
commit 143ec2f33f
7 changed files with 72 additions and 23 deletions

3
nvim/ack Normal file
View File

@ -0,0 +1,3 @@
let g:ackprg = 'ag --vimgrep --smart-case' " Use the_silver_searcher for Ack
noremap <Leader>\ :Ag <C-r><C-w><CR>

View File

@ -1,3 +1,7 @@
" True color support
let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
let &t_8b = "\<Esc>[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

6
nvim/git Normal file
View File

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

25
nvim/keybindings Normal file
View File

@ -0,0 +1,25 @@
let mapleader = " "
" Auto-toggle paste mode
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
" Clear search highlighting
noremap <Leader><Esc> :let @/ = ""<CR>
" Spellcheck
nnoremap <Leader>S :setlocal spell! spelllang=en_us<CR>
noremap H ^
noremap L $
noremap <Leader>c :set cursorline!<CR>
noremap <Leader>n :set relativenumber!<CR>
noremap <Leader>; $a;<Esc>

7
nvim/nerdtree Normal file
View File

@ -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 <Leader>d :NERDTreeToggle<CR>

View File

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

38
vimrc
View File

@ -43,29 +43,11 @@ set vb t_vb=
syntax enable
syntax sync minlines=128 maxlines=512
let mapleader = " "
" Cursor shapes
let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q"
let &t_EI = "\<Esc>[0 q"
" True color support
let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
" Auto-toggle paste mode
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
set pastetoggle=<Esc>[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