1
0
mirror of https://github.com/amix/vimrc synced 2025-02-28 14:12:51 +08:00

recent updates

This commit is contained in:
plrectco 2020-06-13 14:46:00 -07:00
parent f244e0837b
commit 313efdd16a
4 changed files with 57 additions and 13 deletions

View File

@ -47,7 +47,7 @@ noremap <unique> <script> <Plug>PeepOpen <SID>Launch
noremap <SID>Launch :call <SID>LaunchPeepOpenViaVim()<CR> noremap <SID>Launch :call <SID>LaunchPeepOpenViaVim()<CR>
if !hasmapto('<Plug>PeepOpen') if !hasmapto('<Plug>PeepOpen')
map! <unique> <silent> <Leader>p <Plug>PeepOpen map <unique> <silent> <Leader>p <Plug>PeepOpen
endif endif
let &cpo = s:save_cpo let &cpo = s:save_cpo

View File

@ -1 +0,0 @@
Undo dir for VIM

View File

@ -210,7 +210,8 @@ vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
" => Moving around, tabs, windows and buffers " => Moving around, tabs, windows and buffers
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search) " Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
map <space> / " I don't need this mapping
" map <space> /
map <c-space> ? map <c-space> ?
" Disable highlight when <leader><cr> is pressed " Disable highlight when <leader><cr> is pressed

View File

@ -1,3 +1,6 @@
" File : google.vim
" Date : 28.02.2020
" Last Modified Date: 28.02.2020
source /usr/share/vim/google/google.vim source /usr/share/vim/google/google.vim
@ -10,8 +13,7 @@ Glug piper plugin[mappings]
" :help g4 " :help g4
Glug g4 Glug g4
Glug youcompleteme-google
let g:ycm_always_populate_location_list = 1
" BlazeDeps " BlazeDeps
" Use :BlazeDepsUpdate to update the BUILD file dependency " Use :BlazeDepsUpdate to update the BUILD file dependency
@ -19,7 +21,7 @@ Glug blazedeps
" code format for build file " code format for build file
Glug codefmt Glug codefmt
Glug codefmt-google auto_filetypes+=python,cc,proto, Glug codefmt-google auto_filetypes+=python,cc,proto,ts,html
autocmd FileType bzl AutoFormatBuffer buildifier autocmd FileType bzl AutoFormatBuffer buildifier
Glug relatedfiles plugin[mappings]=',2' Glug relatedfiles plugin[mappings]=',2'
@ -30,6 +32,14 @@ Glug relatedfiles plugin[mappings]=',2'
Glug corpweb plugin[mappings] Glug corpweb plugin[mappings]
" Kythe LSP
au User lsp_setup call lsp#register_server({
\ 'name': 'Kythe Language Server',
\ 'cmd': {server_info->['/google/bin/releases/grok/tools/kythe_languageserver', '--google3']},
\ 'whitelist': ['python', 'go', 'java', 'cpp', 'proto'],
\})
" CiderLSP
au User lsp_setup call lsp#register_server({ au User lsp_setup call lsp#register_server({
\ 'name': 'CiderLSP', \ 'name': 'CiderLSP',
\ 'cmd': {server_info->[ \ 'cmd': {server_info->[
@ -40,6 +50,23 @@ au User lsp_setup call lsp#register_server({
\ 'whitelist': ['c', 'cpp', 'proto', 'textproto', 'go'], \ 'whitelist': ['c', 'cpp', 'proto', 'textproto', 'go'],
\}) \})
let g:asyncomplete_auto_popup = 0 let g:asyncomplete_auto_popup = 0
let g:lsp_signs_error = {'text': '✗'}
let g:lsp_highlight_references_enabled = 1
let g:lsp_async_completion = 1
" Enable UI for diagnostics
let g:lsp_signs_enabled = 1 " enable diagnostics signs in the gutter
let g:lsp_diagnostics_echo_cursor = 1 " enable echo under cursor when in normal mode
" Enabling fuzzy completion
let g:asyncomplete_smart_completion = 1
let g:asyncomplete_auto_popup = 1
" asyncomplete
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"
" Clang include fixer " Clang include fixer
@ -104,7 +131,7 @@ endfunction
" An edit function that can recognize google3 path. " An edit function that can recognize google3 path.
" The filepath is relative the google3/ " The filepath is relative the google3/
" eg. you can go to //ads/video.txt wherever you are inside " eg. you can go to //ads/video.txt wherever you are inside
" citc by :e //ads/video/.txt. " citc by :e //ads/video.txt.
function GoogleE(...) function GoogleE(...)
" if the number of argument is not 0 " if the number of argument is not 0
if a:0 if a:0
@ -131,8 +158,6 @@ command! -nargs=+ CommandCabbr call CommandCabbr(<f-args>)
execute 'CommandCabbr ccab CommandCabbr' execute 'CommandCabbr ccab CommandCabbr'
execute 'CommandCabbr e GoogleE' execute 'CommandCabbr e GoogleE'
" Play the macro in register q.
nnoremap <Leader>. @q
" Class Access Operator toggle " Class Access Operator toggle
@ -144,10 +169,13 @@ function ClassAccessOperatorToggle()
" To do replace . with -> or replace -> with . " To do replace . with -> or replace -> with .
let line = line(".") let line = line(".")
if cur_char == '.' if cur_char == '.'
execute line . "," . line . "s/\\./->/" normal dwi->
endif endif
if cur_char == '-' || cur_char == '>' if cur_char == '-'
execute line . "," . line . "s/->/./" normal dwi.
endif
if cur_char == '>'
normal hdwi.
endif endif
endfunction endfunction
@ -166,14 +194,30 @@ function! GetCurrentFileBuildCmd()
" Need to escapte the dot. " Need to escapte the dot.
let file_subs = split(file, '\.') let file_subs = split(file, '\.')
if len(subs) > 1 && len(file_subs) > 0 if len(subs) > 1 && len(file_subs) > 0
let output = 'blaze build ' . subs[1] . ':' . file_subs[0] let output = 'blaze build /' . subs[1] . ':' . file_subs[0]
" Copy to secondary clipboard, ctrl+c/v " Copy to secondary clipboard, ctrl+c/v
echom l:output echom l:output
let @+ = l:output let @+ = l:output
endif endif
endfunction endfunction
command GetCurrentFileBuildCmd call GetCurrentFileBuildCmd()
nmap <script> <silent> <unique> ,bb :GetCurrentFileBuildCmd<CR>
function CopyFilePathGoogle()
let path = expand('%:p')
let l:dst_matches = matchlist(path, '\v(.*)/google3/(.*)$')
if len(l:dst_matches) > 0
let @* = l:dst_matches[2]
endif
endfunction
command CopyFilePathGoogle call CopyFilePathGoogle()
Glug youcompleteme-google
nnoremap <silent> <C-]> :YcmCompleter GoTo<CR>
let g:ycm_always_populate_location_list = 1
" Disable template
let g:templates_no_autocmd = 1