Update vim prefs

This commit is contained in:
Christian Nieves
2022-06-03 17:52:18 +00:00
parent 0101a69b56
commit 89aff8fc53
11 changed files with 127 additions and 78 deletions

View File

@ -53,4 +53,4 @@ vim.api.nvim_set_keymap("n", "<Leader>xx", "<Cmd>Trouble<CR>", { silent = true,
vim.api.nvim_set_keymap("n", "<Leader>xw", "<Cmd>Trouble workspace_diagnostics<CR>", { silent = true, noremap = true })
vim.api.nvim_set_keymap("n", "<Leader>xd", "<Cmd>Trouble document_diagnostics<CR>", { silent = true, noremap = true })
vim.api.nvim_set_keymap("n", "<Leader>xl", "<Cmd>Trouble loclist<CR>", { silent = true, noremap = true })
vim.api.nvim_set_keymap("n", "<Leader>xq", "<Cmd>Trouble quick`ix<CR>", { silent = true, noremap = true })
vim.api.nvim_set_keymap("n", "<Leader>xq", "<Cmd>Trouble quickfix<CR>", { silent = true, noremap = true })

View File

@ -154,8 +154,10 @@ local on_attach = function(client, bufnr)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts) -- diagnostics controls references
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "i", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "[g", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "]g", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts)

View File

@ -2,6 +2,24 @@
export FZF_SOURCE="${HOME}/fzf-relevant-files.zsh"
# General fzf settings.
export FZF_DEFAULT_OPTS=" \
--inline-info \
--reverse \
--exact \
--color=fg+:#F8F8F8,bg+:#515559,pointer:#F8F8F8,marker:226 \
--bind=ctrl-e:select-all+accept \
--bind=ctrl-d:half-page-down \
--bind=ctrl-e:half-page-up
--bind=ctrl-t:toggle+down
--bind=ctrl-b:toggle+up
--bind=ctrl-g:select-all+accept \
"
# Preview code with pygmentize.
# export FZF_CS_PREVIEW_COMMAND="python /google/src/files/head/depot/google3/third_party/py/pygments/google/google_pygmentize.py -f terminal16m -O style=native"
# Preview highlight: foreground: RG(248, 248, 248) = #F8F8F8, background: RGB(81, 85, 89) = #515559.
export FZF_CS_PREVIEW_HIGHLIGHT="\x1b[38;2;248;248;248m\x1b[48;2;81;85;89m"
function create_fzf_command() {
rg --files $(${FZF_SOURCE})
}

View File

@ -38,8 +38,8 @@ Glug relatedfiles plugin[mappings]
Glug g4
Glug corpweb
Glug google-csimporter
Glug blazedeps
" Update the current file's build deps
Plug 'junegunn/fzf', { 'do': { -> fzf#install() }, 'commit': '3f75a83' }
Plug 'junegunn/fzf.vim'
Glug outline-window
@ -47,12 +47,16 @@ Glug fzf-query
function s:blazeExec(cmd, targets)
if len(a:targets) == 0
exe VimuxRunCommand("build_target.py " . expand('%:p') . " " . a:cmd)<CR>
exe VimuxRunCommand("build_target.py " . expand('%:p') . " " . a:cmd)
else
exe VimuxRunCommand(a:cmd . " " . join(a:targets, ' '))
endif
endfunction
function BlazeRun() abort
call <SID>blazeExec("blaze run", blaze#GetTargets())
endfunction
function BlazeBuild() abort
call <SID>blazeExec("blaze build", blaze#GetTargets())
endfunction
@ -65,9 +69,15 @@ function BlazeTestDebug() abort
call <SID>blazeExec("blaze test --java_debug", blaze#GetTargets())
endfunction
function BuildCleaner() abort
exe VimuxRunCommand("build_cleaner " . expand('%'))
endfunction
nnoremap <Leader>br :call BlazeRun()<cr>
nnoremap <Leader>bb :call BlazeBuild()<cr>
nnoremap <Leader>bt :call BlazeTest()<cr>
nnoremap <Leader>btd :call BlazeTestDebug()<cr>
nnoremap <Leader>bc :call BuildCleaner()<cr>
let g:asyncrun_open = 1
@ -154,6 +164,10 @@ endfunction
com! -nargs=? -complete=file Blame :call G4Blame(<f-args>)
nnoremap <leader>cs :FzfCs<space>
" The buffer n can be replaced by any other unused buffer.
" <c-u> removes the visual range because csearch doesn't support ranges.
" Removes newlines to allow the entire line search using V-LINE mode.
vnoremap <leader>cs "ny:<c-u>FzfCs "<c-r>=substitute(@n, '\n', '', '')<cr>"<cr>
nnoremap <leader>csi :CsImporter<cr>
nnoremap <leader>CS :FzfCs<Space> <C-r><C-w> <cr>
nnoremap <leader>cc :CritiqueUnresolvedComments<space><cr>

View File

@ -3,7 +3,8 @@ lua << EOF
require('google.comments').setup {
-- The command for fetching comments, refer to `get_comments.par --help` to
-- see all the options.
command = {'/google/bin/releases/editor-devtools/get_comments.par', '--full', '--noresolved', '--json', "-x=''"},
-- command = {'/google/bin/releases/editor-devtools/get_comments.par', '--full', '--noresolved', '--json', "-x=''"},
command = {'/google/bin/releases/editor-devtools/get_comments.par', '--nofull', '-u', '--json', "-x=''"},
-- Define your own icon by `vim.fn.sign_define('ICON_NAME', {text = ' '})`.
-- See :help sign_define
-- The sign property passed to setup should be the 'ICON_NAME' in the define
@ -29,8 +30,11 @@ vim.api.nvim_set_keymap('n', '<Leader>lc',
[[<Cmd>lua require('google.comments').toggle_line_comments()<CR>]],
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<Leader>ac',
[[<Cmd>lua require('google.comments').show_all_comments()<CR>]],
[[<Cmd>lua require('google.comments').toggle_all_comments()<CR>]],
{ noremap = true, silent = true })
vim.fn.sign_define('COMMENT_ICON', {text = ''})
EOF
autocmd InsertLeave * :lua require('google.comments').update_signs()
autocmd FileType * :lua require('google.comments').fetch_comments()

View File

@ -1,64 +0,0 @@
set directory=/tmp
set undodir=/tmp
set nobackup
set nowritebackup
au BufWritePre * let &bex = '@' . strftime("%F.%H:%M")
autocmd BufWritePre * StripWhitespace
set termguicolors
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
let &t_AB="\e[48;5;%dm"
let &t_AF="\e[38;5;%dm"
syntax on
set laststatus=2
set cmdheight=1
set ttyfast
set relativenumber
set copyindent
set preserveindent
set lazyredraw " Enable if running slow...
set autoindent
set wrap
set linebreak
set textwidth=79
set showbreak=
" use intelligent indentation for C
" configure tabwidth and insert spaces instead of tabs
set tabstop=4 " tab width is 4 spaces
set shiftwidth=4 " indent also with 4 spaces
set expandtab " expand tabs to spaces
set number
set showcmd
set cursorline
set showmatch
set visualbell " don't beep
set history=6000 " remember more commands and search history
set undolevels=6000 " use many levels of undo
" ------------------------------------------------
" -------------------SEARCHING--------------------
" ------------------------------------------------
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase, case-sensitive otherwise
set incsearch " search as characters are entered
set hlsearch " highlight matches
set splitright " Puts new vsplit windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current
set scrolljump=5 " Line to scroll when cursor leaves screen
set scrolloff=3 " Minumum lines to keep above and below cursor
" makes sure that when opening, files are normal, i.e. not folded.
set nofoldenable
" set clipboard=unnamed
set shortmess=A
set updatetime=100

View File

@ -23,7 +23,6 @@ tnoremap <C-L> <C-\><C-n><C-w>l
inoremap <Nul> <C-n>
" Fox for Ack
cnoreabbrev Ack Ack!
cnoremap %% <C-R>=fnameescape(expand("%:p:h")."/")<CR>
" move vertically by visual line

View File

@ -20,9 +20,11 @@ Plug 'junegunn/fzf.vim'
Plug 'vim-airline/vim-airline' " ...
Plug 'nathanaelkane/vim-indent-guides'
Plug 'Konfekt/vim-scratchpad'
Plug 'kyazdani42/nvim-web-devicons'
" Plug 'kyazdani42/nvim-web-devicons'
" Plug 'ryanoasis/vim-devicons'
" INTEGRATION
Plug 'AndrewRadev/linediff.vim'
Plug 'tpope/vim-fugitive' " git
Plug 'junegunn/gv.vim' " git commit browser
Plug 'tpope/vim-git'
@ -49,10 +51,10 @@ Plug 'christoomey/vim-titlecase'
Plug 'chiedo/vim-case-convert'
" FILE INTERACTIONS
Plug 'mileszs/ack.vim' " Ack bindings
" Plug 'mileszs/ack.vim' " Ack bindings
Plug 'jremmen/vim-ripgrep'
Plug 'preservim/nerdtree' " File Tree
Plug 'ryanoasis/vim-devicons'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
" LANGUAGE PLUGINS

View File

@ -0,0 +1,13 @@
Plug 'kyoh86/vim-ripgrep'
" command! -nargs=+ -complete=file Rg :call ripgrep#search(<q-args>)
command! -nargs=+ -complete=file Rg :call s:ripgrep(<q-args>)
function s:ripgrep(searchterm)
let l:dir = fnameescape(expand("%:p:h")."/")
let l:rel = ripgrep#path#rel(l:dir)
" echomsg 'DIR: ' . l:dir . '\tREL: ' . l:rel
call ripgrep#call('rg --smart-case --json ' . a:searchterm, l:dir, l:rel)
endfunction
nnoremap <leader>rg :Rg<Space>
let g:rg_root_marks = ['BUILD', 'METADATA', '.git']

View File

@ -4,21 +4,82 @@ let mapleader="," " BEST LEADER OF ALL TIME (BLOT)
filetype off " required
set rtp+=~/.vim/after
" -----------------------------------------------------------
" ------------------------PLUGINS----------------------------
" -----------------------------------------------------------
set directory=/tmp
set undodir=/tmp
set nobackup
set nowritebackup
au BufWritePre * let &bex = '@' . strftime("%F.%H:%M")
autocmd BufWritePre * StripWhitespace
set termguicolors
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
let &t_AB="\e[48;5;%dm"
let &t_AF="\e[38;5;%dm"
syntax on
set laststatus=2
set cmdheight=1
set ttyfast
set relativenumber
set copyindent
set preserveindent
set lazyredraw " Enable if running slow...
set autoindent
set wrap
set linebreak
set textwidth=79
set showbreak=
" use intelligent indentation for C
" configure tabwidth and insert spaces instead of tabs
set tabstop=4 " tab width is 4 spaces
set shiftwidth=4 " indent also with 4 spaces
set expandtab " expand tabs to spaces
set number
set showcmd
set cursorline
set showmatch
set visualbell " don't beep
set history=6000 " remember more commands and search history
set undolevels=6000 " use many levels of undo
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase, case-sensitive otherwise
set incsearch " search as characters are entered
set hlsearch " highlight matches
set splitright " Puts new vsplit windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current
set scrolljump=5 " Line to scroll when cursor leaves screen
set scrolloff=3 " Minumum lines to keep above and below cursor
" makes sure that when opening, files are normal, i.e. not folded.
set nofoldenable
" set clipboard=unnamed
set shortmess=A
set updatetime=100
call plug#begin('~/.vim/plugged')
source ~/.vim/prefs/plugins.vim
source ~/.vim/prefs/init.vim
if filereadable(expand("~/.vimrc.local"))
source ~/.vim/prefs/google.vim
endif
source ~/.vim/prefs/mappings.vim
source ~/.vim/prefs/leader.vim
source ~/.vim/prefs/plug_prefs.vim
source ~/.vim/prefs/ui.vim
source ~/.vim/prefs/golang.vim
source ~/.vim/prefs/ultisnips.vim
source ~/.vim/prefs/ripgrep.vim
" source ~/.vim/prefs/coc.vim
" source ~/.vim/prefs/asynclsp.vim
" source ~/.vim/prefs/ycm.vim

View File

@ -89,7 +89,7 @@ get_current_activity() {
}
cl_search() {
hg whatsout | xargs -i sh -c "echo {} && rg $1 {}"
hg whatsout | xargs -i sh -c "echo {} && grep $1 {}"
}
cl_replace() {