From 4a7032aff44ad618b1481c5deb0a59f99fd824b0 Mon Sep 17 00:00:00 2001 From: Barak Michener Date: Tue, 3 Nov 2020 20:47:16 +0000 Subject: [PATCH 1/4] add some bin tools --- bin/bazel-in-bear | 4 ++++ bin/move_bazel_rule.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100755 bin/bazel-in-bear create mode 100755 bin/move_bazel_rule.sh diff --git a/bin/bazel-in-bear b/bin/bazel-in-bear new file mode 100755 index 0000000..1fd0873 --- /dev/null +++ b/bin/bazel-in-bear @@ -0,0 +1,4 @@ +#!/bin/sh +LIB=lib/x86_64-linux-gnu +export LD_PRELOAD=$(eval "echo ${LD_PRELOAD}") +bazel --batch "$@" --action_env=LD_PRELOAD=${LD_PRELOAD} --action_env=BEAR_OUTPUT=${BEAR_OUTPUT} --spawn_strategy=local diff --git a/bin/move_bazel_rule.sh b/bin/move_bazel_rule.sh new file mode 100755 index 0000000..f852922 --- /dev/null +++ b/bin/move_bazel_rule.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e +if [ -z "$1" ]; then + cat << EOF +Usages: + $0 NEW_BAZEL_FILE + Search for BUILD targets with these names in the git repo + $0 NEW_BAZEL_FILE FIXUP_BAZEL_FILE + Find instances of the BUILD targets in the to-be-fixed-file + $0 NEW_BAZEL_FILE FIXUP_BAZEL_FILE PREFIX + Find instances of that BUILD target with an old prefix (eg: '//:') + $0 NEW_BAZEL_FILE FIXUP_BAZEL_FILE PREFIX NEW_PREFIX + Apply the NEW_PREFIX (eg, a package move) in place of the PREFIX in the FIXUP file. +EOF + exit +fi +INCOMING_SET=$(grep "name" $1 | cut -d '"' -f 2) +TO_CHANGE=$2 +PREVIOUS_PATH=$3 +NEW_PATH=$4 + +for TARGET in $INCOMING_SET; do + if [ -n "$TO_CHANGE" ]; then + grep ${PREVIOUS_PATH}${TARGET} $TO_CHANGE + if [ -n "$NEW_PATH" ]; then + sed -i "s^${PREVIOUS_PATH}${TARGET}^${NEW_PATH}${TARGET}^g" $TO_CHANGE + fi + else + git grep ${TARGET} + fi + +done From 28a0928b83f1936612681856ad5a904622f2d34c Mon Sep 17 00:00:00 2001 From: Barak Michener Date: Tue, 3 Nov 2020 20:52:28 +0000 Subject: [PATCH 2/4] update coc --- .config/coc/extensions/package.json | 2 +- .vim/coc-settings.json | 12 +++++----- .vimrc | 47 +++++++++++++++++++++++-------------- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/.config/coc/extensions/package.json b/.config/coc/extensions/package.json index ba295d1..a744de5 100644 --- a/.config/coc/extensions/package.json +++ b/.config/coc/extensions/package.json @@ -5,4 +5,4 @@ "coc-snippets": ">=2.2.3", "coc-ultisnips": ">=1.2.3" } -} \ No newline at end of file +} diff --git a/.vim/coc-settings.json b/.vim/coc-settings.json index 911aafa..0d8de01 100644 --- a/.vim/coc-settings.json +++ b/.vim/coc-settings.json @@ -21,13 +21,13 @@ "directory": ".ccls-cache" } } + }, + "golang": { + "command": "gopls", + "rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"], + "filetypes": ["go"] + } }, - "golang": { - "command": "gopls", - "rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"], - "filetypes": ["go"] - } -}, "python.autoComplete.extraPaths": [ "${env:SPARK_HOME}/python", "${env:SPARK_HOME}/python/pyspark" diff --git a/.vimrc b/.vimrc index 5aa11b9..29921b8 100644 --- a/.vimrc +++ b/.vimrc @@ -49,7 +49,8 @@ set splitbelow " For autocomplete, show a menu, show it when there's only one option, " and only complete the longest common bit instead of the whole thing (like " bash). -set completeopt=menu,menuone,longest +"set completeopt=menu,menuone,longest +set completeopt=noinsert,menuone,noselect,longest set diffopt+=vertical " Some stuff for 256-Color consoles that I've forgotten. @@ -100,18 +101,19 @@ Plug 'let-def/vimbufsync' Plug 'lambdalisue/suda.vim' " Plugins that I almost never use -Plug 'vim-scripts/DrawIt' -Plug 'tpope/vim-speeddating' -Plug 'vim-scripts/EasyGrep' +"Plug 'vim-scripts/DrawIt' +"Plug 'tpope/vim-speeddating' +"Plug 'vim-scripts/EasyGrep' Plug 'chrisbra/NrrwRgn' -Plug 'mattn/calendar-vim' -Plug 'rstacruz/sparkup' -Plug 'tristen/vim-sparkup' -Plug 'tpope/vim-fireplace', {'for': 'clojure'} -"Plug 'terryma/vim-multiple-cursors' -Plug 'ambv/black' +"Plug 'mattn/calendar-vim' +"Plug 'rstacruz/sparkup' +"Plug 'tristen/vim-sparkup' +"Plug 'tpope/vim-fireplace', {'for': 'clojure'} +""Plug 'terryma/vim-multiple-cursors' +"Plug 'ambv/black' Plug 'kana/vim-textobj-user' + " Plugins I wish I used more "Plug 'hsitz/VimOrganizer' Plug 'jceb/vim-orgmode' @@ -143,6 +145,8 @@ Plug 'sheerun/vim-polyglot' Plug 'Shougo/denite.nvim' Plug 'plytophogy/vim-virtualenv' Plug 'ervandew/supertab' +"Plug 'ncm2/ncm2' +"Plug 'roxma/nvim-yarp' " Plugins I NEEDED @@ -199,12 +203,15 @@ Plug 'lervag/vimtex' " Unclear -Plug 'ncm2/float-preview.nvim' +"Plug 'ncm2/float-preview.nvim' Plug 'lambdalisue/gina.vim' Plug 'barakmich/vim-code-dark' call plug#end() +" enable ncm2 for all buffers +"autocmd BufEnter * call ncm2#enable_for_buffer() + nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) @@ -283,12 +290,13 @@ let g:SuperTabDefaultCompletionType = "" " Change the source rank "call deoplete#custom#option('sources', { - "\ 'python': ['LanguageClient', 'jedi'], + "\ 'python': ['LanguageClient'], + "\ 'cpp': ['LanguageClient'], "\}) "call deoplete#custom#source('buffer', 'rank', 1) "let g:deoplete#sources#clang#libclang_path = '/usr/lib/llvm-6.0/lib/libclang.so' "let g:deoplete#sources#clang#clang_header = '/usr/lib/llvm-6.0/lib/clang' -"let g:deoplete#enable_at_startup = 1 +let g:deoplete#enable_at_startup = 1 "let g:deoplete#sources = {} "let g:deoplete#sources.scala = ['buffer', 'tags', 'omni'] "let g:deoplete#omni#input_patterns = {} @@ -322,15 +330,20 @@ let g:airline#extensions#ale#enabled = 1 let g:ale_set_highlights = 0 " * LanguageServer -"let g:LanguageClient_serverCommands = { - "\ 'python': ['pyls'], - "\ } +let g:LanguageClient_serverCommands = { + \ 'python': ['pyls'], + \ 'cpp': ['ccls'], + \ 'go': ['gopls'], + \ } let g:LanguageClient_diagnosticsDisplay = { \1: {'name': 'Error', 'texthl': 'ALEError', 'signText': 'E>', 'signTexthl': 'ALEErrorSign',}, \2: {"name": "Warning", "texthl": "ALEWarning", "signText": "W>", "signTexthl": "ALEWarningSign",}, \3: {"name": "Information", "texthl": "ALEInfo", "signText": "i-", "signTexthl": "ALEInfoSign",}, \4: {"name": "Hint", "texthl": "ALEInfo", "signText": "--", "signTexthl": "ALEInfoSign",}, \} +"nmap gd (lcn-definition) +"nmap K (lcn-hover) +"nmap m (lcn-menu) " * Configure browser for haskell_doc.vim let g:haddock_browser = "open" @@ -725,7 +738,7 @@ xnoremap gj xnoremap gk inoremap gj inoremap gk -nnoremap +"nnoremap " Years of using bash and zsh have caused my fingers to expect these Emacs-like " mappings to exist. Make them exist in vim as well. But eye them with " suspicion, as they come from Emacs. From c59e88722c9652e5017112b4a316bb6b80bc1b98 Mon Sep 17 00:00:00 2001 From: Barak Michener Date: Wed, 4 Nov 2020 21:35:21 +0000 Subject: [PATCH 3/4] better default C-k in vim --- .vimrc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.vimrc b/.vimrc index 29921b8..6f41f50 100644 --- a/.vimrc +++ b/.vimrc @@ -132,7 +132,7 @@ Plug 'sjbach/lusty' Plug 'mhinz/vim-signify' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' -Plug 'junegunn/fzf' +Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' Plug 'bling/vim-bufferline' Plug 'majutsushi/tagbar' @@ -813,14 +813,13 @@ call denite#custom#var('grep', { nnoremap g :Denite -buffer-name=search-buffer grep nnoremap aa :RipGrep! "nnoremap :Files! `git rev-parse --show-toplevel` -nnoremap :GFiles -nnoremap :Buffers +nnoremap :GFiles " For C++ -- A is a great plugin which allows you to jump from the c file to the " header and vice-versa. Mneumonic here is headerheader. nnoremap hh :A " CommandT is useful, but if I'm juggling lots of buffers, limit it to another " one I have open (instead of standard t). -nnoremap o :CtrlPBuffer +nnoremap o :Buffers "nnoremap j "nnoremap p :PTW nnoremap p :LustyJugglePrevious From 69c6eedd3fc7cd2273bb18d9845630fa2f82ecaa Mon Sep 17 00:00:00 2001 From: Barak Michener Date: Mon, 9 Nov 2020 18:50:01 +0000 Subject: [PATCH 4/4] checkcurrentline --- .vim/coc-settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vim/coc-settings.json b/.vim/coc-settings.json index 0d8de01..5f0c157 100644 --- a/.vim/coc-settings.json +++ b/.vim/coc-settings.json @@ -3,6 +3,7 @@ "suggest.enablePreview": true, "suggest.maxPreviewWidth": 70, "diagnostic.displayByAle": false, + "diagnostic.checkCurrentLine": true, "python.linting.pylintEnabled": false, "python.linting.flake8Enabled": true, "python.linting.mypyEnabled": true,