Move vim plug prefs to dedicated files

This commit is contained in:
Christian Nieves
2022-09-28 16:40:17 +00:00
parent 0139026e84
commit 5f0f3bba37
10 changed files with 188 additions and 307 deletions

View File

@ -0,0 +1,76 @@
" AirLine visual settings
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_theme='onedark'
" let g:airline_stl_path_style = 'short'
let g:airline#extensions#coc#enabled = 1
let g:airline_left_sep=''
let g:airline_left_alt_sep = ''
let g:airline_right_sep=''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.dirty = ''
let g:airline_symbols.linenr = '␤'
"let g:airline_symbols.whitespace = 'Ξ'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline#extensions#tabline#show_buffers = 0
let g:airline#extensions#tabline#show_splits = 1
let g:airline#extensions#tabline#show_tabs = 1
let g:airline#extensions#tabline#show_tab_nr = 0
let g:airline#extensions#tabline#show_tab_type = 0
let g:airline#extensions#tabline#exclude_preview = 1
let g:airline#extensions#tabline#show_close_button = 0
let g:airline#extensions#tabline#fnamemod = ':t'
lua << EOF
function getCitc()
local fname = vim.api.nvim_buf_get_name(0)
if string.find(fname, '/google/src/cloud/', 1, true) then
local parts = split(fname, '/')
return parts[5]
end
end
EOF
" let g:airline_section_c = execute("lua getCitc()")
let g:airline_mode_map = {
\ '__' : '------',
\ 'n' : 'NORMAL',
\ 'c' : 'COMMAND',
\ 'i' : 'INSERT',
\ 'R' : 'REPLACE',
\ 's' : 'SELECT',
\ 'S' : 'S-LINE',
\ '' : 'S-BLOCK',
\ 'v' : 'VISUAL',
\ 'V' : 'V-LINE',
\ '' : 'V-BLOCK',
\ }
let g:PaperColor_Theme_Options = {
\ 'language': {
\ 'python': {
\ 'highlight_builtins' : 1
\ },
\ 'cpp': {
\ 'highlight_standard_library': 1
\ },
\ 'c': {
\ 'highlight_builtins' : 1
\ }
\ },
\ 'theme': {
\ 'default.dark': {
\ 'transparent_background': 1
\ }
\ }
\ }

42
vim/.vim/prefs/ctrlp.vim Normal file
View File

@ -0,0 +1,42 @@
" -------- CTRL-P --------
let g:ctrlp_map = '<c-o>'
let g:ctrlp_show_hidden = 1
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*.so,*.swo,*.swp,*.zip,*.o,*.d " MacOSX/Linux
"let g:ctrlp_custom_ignore = '\v[\/](vendor|node_modules|target|dist|build)|(\.(swp|ico|git|svn))$'
let g:ctrlp_custom_ignore = {
\ 'dir': 'vendor\|node_modules\|target\|dist\|build\|mntdeps',
\'file': '\v\.(swp|ico|git|svn|exe)'
\ }
"let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
let g:ctrlp_extensions = ['smarttabs']
let g:ctrlp_switch_buffer = 'ETVH'
let g:ctrlp_open_new_file = 't'
" Let CtrlP not go all the way up to the root of the client. Instead, consider a
" METADATA file to delimit a project.
let g:ctrlp_root_markers = ['METADATA']
" CtrlP auto cache clearing.
function! SetupCtrlP()
if exists("g:loaded_ctrlp") && g:loaded_ctrlp
augroup CtrlPExtension
autocmd!
autocmd FocusGained * CtrlPClearCache
autocmd BufWritePost * CtrlPClearCache
augroup END
endif
endfunction
if has("autocmd")
autocmd VimEnter * :call SetupCtrlP()
endif
" Ripgrep (rg) is a super fast search utility
" Use rg for ctrl-p plugin
if executable('rg')
set grepprg=rg\ --hidden\ --color=never
let g:ctrlp_use_caching = 0
let g:ctrlp_user_command = 'rg --files --hidden --color=never * %s'
endif

View File

@ -0,0 +1,22 @@
let s:brown = "964B00"
let s:aqua = "3AFFDB"
let s:blue = "689FB6"
let s:darkBlue = "44788E"
let s:purple = "834F79"
let s:lightPurple = "834F79"
let s:red = "AE403F"
let s:beige = "F5C06F"
let s:yellow = "F09F17"
let s:orange = "D4843E"
let s:darkOrange = "F16529"
let s:pink = "CB6F6F"
let s:salmon = "EE6E73"
let s:green = "8FAA54"
let s:lightGreen = "31B53E"
let s:white = "FFFFFF"
let s:rspec_red = 'FE405F'
let s:git_orange = 'F54D27'
" If you have vim-devicons you can customize your icons for each file type.
let g:NERDTreeExtensionHighlightColor = {} "this line is needed to avoid error
let g:NERDTreeExtensionHighlightColor['java'] = s:lightGreen "assigning it to an empty string will skip highlight

30
vim/.vim/prefs/fzf.vim Normal file
View File

@ -0,0 +1,30 @@
"nnoremap <silent> <C-p> :FZF -m<cr>
"let $FZF_DEFAULT_COMMAND = 'ag -g ""'
" nmap <C-P> :FZF<CR>
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
let g:fzf_history_dir = '~/.local/share/fzf-history'
let g:fzf_command_prefix = 'Fzf'
" use the same keybindings for fzf as in shell
" nnoremap <silent> <c-s-t> :FzfHgFiles<CR>
" nnoremap <silent> <c-s-f> :FzfHgRg<space>
let s:hg_command = 'hg files 2>/dev/null'
command! -bang FzfHgFiles
\ call fzf#run(fzf#wrap({
\ 'source': s:hg_command,
\ 'options': $FZF_DEFAULT_OPTS . " " . $FZF_CTRL_T_OPTS,
\ }),
\ <bang>0
\ )
command! -bang -nargs=* FzfHgRg
\ call fzf#vim#grep(
\ s:rg_command . " " . <q-args> . " " . "$(" . s:hg_command . ")", 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%'),
\ <bang>0)

View File

@ -4,9 +4,13 @@ set runtimepath+=/google/src/files/head/depot/google3/experimental/users/tstone/
set runtimepath+=/google/src/files/head/depot/google3/experimental/users/tstone/vim/imp-csearch set runtimepath+=/google/src/files/head/depot/google3/experimental/users/tstone/vim/imp-csearch
Glug! glaive Glug! glaive
Glaive imp plugin[mappings] Suggest[default]=buffer,csearch,prompt,primp Report[default]=popupnotify " Glaive imp Suggest[default]=buffer,primp,csearch,prompt Report[default]=popupnotify
" Glaive imp Suggest[default]=buffer,csearch,prompt,primp Report[default]=popupnotify
" Glaive imp Pick[default]=inputlist Suggest[default]=buffer,primp,csearch,prompt Report[default]=echo
Glaive imp Pick[default]=fzf Suggest[default]=buffer,primp,csearch,prompt Report[default]=echo
" "
" nnoremap <leader>csi :CsImporter<cr> " nnoremap <leader>csi :CsImporter<cr>
nnoremap <leader>csi :ImpSuggest nnoremap <leader>csi :ImpSuggest <C-r><C-w><cr>
" nnoremap <leader>ii :ImpSuggest nnoremap <leader>ii :ImpSuggest <C-r><C-w><cr>
" nnoremap <leader>if :ImpFirst nnoremap <leader>if :ImpFirst <C-r><C-w><cr>

View File

@ -1,18 +1,6 @@
" mnemonic: (i)nsert (l)ambda
imap <leader>il <C-K>l*
" HEX<->ASCII
" mnemonic: (h)ex (t)o (a)scii
vnoremap <leader>hta :<c-u>s/\%V\x\x/\=nr2char(printf("%d", "0x".submatch(0)))/g<cr><c-l>`<
" mnemonic: (a)scii (t)o (h)ex
vnoremap <leader>ath :<c-u>s/\%V./\=printf("%x",char2nr(submatch(0)))/g<cr><c-l>`<
let g:windowswap_map_keys = 0 "prevent default bindings let g:windowswap_map_keys = 0 "prevent default bindings
nnoremap <silent> <leader>yw :call WindowSwap#MarkWindowSwap()<CR> nnoremap <silent> <leader>yw :call WindowSwap#MarkWindowSwap()<CR>
" --------- SURROUND MAPPINGS --------- " --------- SURROUND MAPPINGS ---------
" <leader>" Surround a word with "quotes" " <leader>" Surround a word with "quotes"
map <leader>" ysiw" map <leader>" ysiw"
@ -86,20 +74,6 @@ endfunction
nmap <leader>toi :CocCommand tsserver.organizeImports<cr> nmap <leader>toi :CocCommand tsserver.organizeImports<cr>
" --------- FUGITIVE MAPPINGS ---------
nmap <leader>dg :diffget<cr>
nmap <leader>dp :diffput<cr>
nmap <leader>du :diffupdate<cr>
vmap <leader>dg :diffget<cr>
vmap <leader>dp :diffput<cr>
vmap <leader>du :diffupdate<cr>
nmap <leader>giw :Gwrite<cr>
nmap <leader>gic :Gcommit -v<cr>
nmap <leader>gid :Gdiff<cr>
nmap <leader>gis :Gstatus<cr>
"" --------- NERD Commenter "" --------- NERD Commenter
" Create default mappings " Create default mappings
let g:NERDCreateDefaultMappings = 0 let g:NERDCreateDefaultMappings = 0

View File

@ -12,7 +12,6 @@ map <Esc>[D <Left>
" remove mapping to be used in nerdtree " remove mapping to be used in nerdtree
inoremap <Nul> <C-n> inoremap <Nul> <C-n>
" Fox for Ack
cnoremap %% <C-R>=fnameescape(expand("%:p:h")."/")<CR> cnoremap %% <C-R>=fnameescape(expand("%:p:h")."/")<CR>
" move vertically by visual line " move vertically by visual line
@ -40,7 +39,7 @@ nnoremap <S-D> <C-D>
nnoremap [e :<c-u>execute 'move -1-'. v:count1<cr> nnoremap [e :<c-u>execute 'move -1-'. v:count1<cr>
nnoremap ]e :<c-u>execute 'move +'. v:count1<cr> nnoremap ]e :<c-u>execute 'move +'. v:count1<cr>
" Create window splits easier. The default " Create window splits easier
nnoremap <silent> vv <C-w>v nnoremap <silent> vv <C-w>v
nnoremap <silent> ss <C-w>s nnoremap <silent> ss <C-w>s
@ -49,7 +48,4 @@ nnoremap <C-t> <Cmd>CocCommand explorer<CR>
" always use very magic mode when searching " always use very magic mode when searching
"nnoremap / /\v "nnoremap / /\v
"vnoremap / /\v "vnoremap / /\v
" nnoremap <silent> <leader>ww :call WindowSwap#EasyWindowSwap()<CR>
vnoremap // y/\V<C-r>=escape(@",'/\')<CR><CR>
nmap <F1> :CocCommand java.debug.vimspector.start<CR>

View File

@ -1,186 +1,7 @@
let pyxversion = 3 " ONE LINERS ONLY
" -------- FZF --------
" nmap <C-P> :FZF<CR>
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
let g:fzf_command_prefix = 'Fzf'
let s:hg_command = 'hg whatsout --template= -- '
" command! -bang -nargs=* HgFiles
" \ call fzf#vim#grep(
" \ 'git grep --line-number -- '.shellescape(<q-args>), 0,
" \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)
command! -bang FzfHgFiles
\ call fzf#run(fzf#wrap({
\ 'source': s:hg_command,
\ }),
\ <bang>0
\ )
command! -bang -nargs=* FzfHgRg
\ call fzf#vim#grep(
\ s:rg_command . " " . <q-args> . " " . "$(" . s:hg_command . ")", 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%'),
\ <bang>0)
"
"
" -------- CTRL-P --------
" let g:ctrlp_map = '<c-o>'
" let g:ctrlp_show_hidden = 1
" let g:ctrlp_working_path_mode = 'ra'
" set wildignore+=*/tmp/*,*.so,*.swo,*.swp,*.zip,*.o,*.d " MacOSX/Linux
" "let g:ctrlp_custom_ignore = '\v[\/](vendor|node_modules|target|dist|build)|(\.(swp|ico|git|svn))$'
" let g:ctrlp_custom_ignore = {
" \ 'dir': 'vendor\|node_modules\|target\|dist\|build\|mntdeps',
" \'file': '\v\.(swp|ico|git|svn|exe)'
" \ }
" "let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" let g:ctrlp_extensions = ['smarttabs']
" let g:ctrlp_switch_buffer = 'ETVH'
" let g:ctrlp_open_new_file = 't'
"
" " Let CtrlP not go all the way up to the root of the client. Instead, consider a
" " METADATA file to delimit a project.
" let g:ctrlp_root_markers = ['METADATA']
"
" " CtrlP auto cache clearing.
" function! SetupCtrlP()
" if exists("g:loaded_ctrlp") && g:loaded_ctrlp
" augroup CtrlPExtension
" autocmd!
" autocmd FocusGained * CtrlPClearCache
" autocmd BufWritePost * CtrlPClearCache
" augroup END
" endif
" endfunction
" if has("autocmd")
" autocmd VimEnter * :call SetupCtrlP()
" endif
"
" " Ripgrep (rg) is a super fast search utility
" " Use rg for ctrl-p plugin
" if executable('rg')
" set grepprg=rg\ --hidden\ --color=never
" let g:ctrlp_use_caching = 0
" let g:ctrlp_user_command = 'rg --files --hidden --color=never * %s'
" endif
" -------- VIM-MARKDOWN --------
let g:vim_markdown_folding_disabled = 1
" -------- LATEX --------
let g:windowswap_map_keys = 0 "prevent default bindings
nnoremap <silent> <leader>ww :call WindowSwap#EasyWindowSwap()<CR>
"Don't ask to save when changing buffers (i.e. when jumping to a type definition)
set hidden
let g:UltiSnipsExpandTrigger = "<nop>"
inoremap <expr> <CR> pumvisible() ? "<C-R>=UltiSnips#ExpandSnippetOrJump()<CR>" : "\<CR>"
let g:vim_php_refactoring_use_default_mapping = 0
nnoremap <Leader>da :call PhpDocAll()<CR>
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
let g:php_html_in_heredoc = 0
let g:php_html_in_nowdoc = 0
let g:php_sql_query = 0
let g:php_sql_heredoc = 0
let g:php_sql_nowdoc = 0
let jshint2_read = 1
" set statusline+=%#warningmsg# " set statusline+=%#warningmsg#
" set statusline+=%{SyntasticStatuslineFlag()} " set statusline+=%{SyntasticStatuslineFlag()}
" set statusline+=%* " set statusline+=%*
set statusline=%{pathshorten(expand('%:f'))} set statusline=%{pathshorten(expand('%:f'))}
let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle
" FZF
"nnoremap <silent> <C-p> :FZF -m<cr>
"let $FZF_DEFAULT_COMMAND = 'ag -g ""'
let g:fzf_history_dir = '~/.local/share/fzf-history'
" vim-easy-align
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
let g:scratchpad_ftype = 'md'
" NERDTree
" Help w/ lag
let g:NERDTreeLimitedSyntax = 1
let s:brown = "964B00"
let s:aqua = "3AFFDB"
let s:blue = "689FB6"
let s:darkBlue = "44788E"
let s:purple = "834F79"
let s:lightPurple = "834F79"
let s:red = "AE403F"
let s:beige = "F5C06F"
let s:yellow = "F09F17"
let s:orange = "D4843E"
let s:darkOrange = "F16529"
let s:pink = "CB6F6F"
let s:salmon = "EE6E73"
let s:green = "8FAA54"
let s:lightGreen = "31B53E"
let s:white = "FFFFFF"
let s:rspec_red = 'FE405F'
let s:git_orange = 'F54D27'
" If you have vim-devicons you can customize your icons for each file type.
let g:NERDTreeExtensionHighlightColor = {} "this line is needed to avoid error
let g:NERDTreeExtensionHighlightColor['java'] = s:lightGreen "assigning it to an empty string will skip highlight
let g:jdbPort="5005"
" Set a nicer foldtext function
set foldtext=MyFoldText()
function! MyFoldText()
let line = getline(v:foldstart)
if match( line, '^[ \t]*\(\/\*\|\/\/\)[*/\\]*[ \t]*$' ) == 0
let initial = substitute( line, '^\([ \t]\)*\(\/\*\|\/\/\)\(.*\)', '\1\2', '' )
let linenum = v:foldstart + 1
while linenum < v:foldend
let line = getline( linenum )
let comment_content = substitute( line, '^\([ \t\/\*]*\)\(.*\)$', '\2', 'g' )
if comment_content != ''
break
endif
let linenum = linenum + 1
endwhile
let sub = initial . ' ' . comment_content
else
let sub = line
let startbrace = substitute( line, '^.*{[ \t]*$', '{', 'g')
if startbrace == '{'
let line = getline(v:foldend)
let endbrace = substitute( line, '^[ \t]*}\(.*\)$', '}', 'g')
if endbrace == '}'
let sub = sub.substitute( line, '^[ \t]*}\(.*\)$', '...}\1', 'g')
endif
endif
endif
let n = v:foldend - v:foldstart + 1
let info = " " . n . " lines"
let sub = sub . " "
let num_w = getwinvar( 0, '&number' ) * getwinvar( 0, '&numberwidth' )
let fold_w = getwinvar( 0, '&foldcolumn' )
let sub = strpart( sub, 0, winwidth(0) - strlen( info ) - num_w - fold_w - 1 )
return sub . info
endfunction

View File

@ -8,100 +8,9 @@ highlight ExtraWhitespace ctermbg=red
let g:cpp_class_scope_highlight = 1 let g:cpp_class_scope_highlight = 1
let g:cpp_experimental_template_highlight = 1 let g:cpp_experimental_template_highlight = 1
" AirLine visual settings
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_theme='onedark'
" let g:airline_stl_path_style = 'short'
let g:airline#extensions#coc#enabled = 1
let g:airline_left_sep=''
let g:airline_left_alt_sep = ''
let g:airline_right_sep=''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.dirty = ''
let g:airline_symbols.linenr = '␤'
"let g:airline_symbols.whitespace = 'Ξ'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline#extensions#tabline#show_buffers = 0
let g:airline#extensions#tabline#show_splits = 1
let g:airline#extensions#tabline#show_tabs = 1
let g:airline#extensions#tabline#show_tab_nr = 0
let g:airline#extensions#tabline#show_tab_type = 0
let g:airline#extensions#tabline#exclude_preview = 1
let g:airline#extensions#tabline#show_close_button = 0
let g:airline#extensions#tabline#fnamemod = ':t'
lua << EOF
function getCitc()
local fname = vim.api.nvim_buf_get_name(0)
if string.find(fname, '/google/src/cloud/', 1, true) then
local parts = split(fname, '/')
return parts[5]
end
end
EOF
" let g:airline_section_c = execute("lua getCitc()")
let g:airline_mode_map = {
\ '__' : '------',
\ 'n' : 'NORMAL',
\ 'c' : 'COMMAND',
\ 'i' : 'INSERT',
\ 'R' : 'REPLACE',
\ 's' : 'SELECT',
\ 'S' : 'S-LINE',
\ '' : 'S-BLOCK',
\ 'v' : 'VISUAL',
\ 'V' : 'V-LINE',
\ '' : 'V-BLOCK',
\ }
let g:PaperColor_Theme_Options = {
\ 'language': {
\ 'python': {
\ 'highlight_builtins' : 1
\ },
\ 'cpp': {
\ 'highlight_standard_library': 1
\ },
\ 'c': {
\ 'highlight_builtins' : 1
\ }
\ },
\ 'theme': {
\ 'default.dark': {
\ 'transparent_background': 1
\ }
\ }
\ }
" Function to let me know what syntax hilighting group is under the cursor. " Function to let me know what syntax hilighting group is under the cursor.
" Not used often " Not used often
function! SynGroup() function! SynGroup()
let l:s = synID(line('.'), col('.'), 1) let l:s = synID(line('.'), col('.'), 1)
echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name') echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name')
endfun endfun
function! PhpSyntaxOverride()
" Put snippet overrides in this function.
hi! link phpDocTags phpDefine
hi! link phpDocParam phpType
endfunction
augroup phpSyntaxOverride
autocmd!
autocmd FileType php call PhpSyntaxOverride()
augroup END
" Highlight the symbol and its references when holding the cursor.

View File

@ -82,6 +82,7 @@ call plug#begin('~/.vim/plugged')
if filereadable(expand("~/.vimrc.local")) if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local source ~/.vimrc.local
endif endif
if filereadable(expand("~/use_google")) if filereadable(expand("~/use_google"))
source ~/.vim/prefs/google.vim source ~/.vim/prefs/google.vim
endif endif
@ -93,6 +94,9 @@ call plug#begin('~/.vim/plugged')
source ~/.vim/prefs/golang.vim source ~/.vim/prefs/golang.vim
source ~/.vim/prefs/ultisnips.vim source ~/.vim/prefs/ultisnips.vim
source ~/.vim/prefs/ripgrep.vim source ~/.vim/prefs/ripgrep.vim
source ~/.vim/prefs/fzf.vim
source ~/.vim/prefs/devicons.vim
source ~/.vim/prefs/airline.vim
call plug#end() " required call plug#end() " required
" Require CiderLSP and Diagnostics modules " Require CiderLSP and Diagnostics modules
@ -155,3 +159,6 @@ set omnifunc= completeopt=menuone,noinsert,noselect
let g:lsp_log_verbose = 1 let g:lsp_log_verbose = 1
let g:lsp_log_file = expand('~/vim-lsp.log') let g:lsp_log_file = expand('~/vim-lsp.log')
"Don't ask to save when changing buffers (i.e. when jumping to a type definition)
set hidden