diff --git a/any/bash/.bashrc b/any/bash/.bashrc index de2a76a..1e5c3ed 100644 --- a/any/bash/.bashrc +++ b/any/bash/.bashrc @@ -111,6 +111,10 @@ if [ -d "$HOME/.local/bin" ] then export PATH="$HOME/.local/bin:$PATH" fi +if [ -d "$HOME/bin" ] +then + export PATH="$HOME/bin:$PATH" +fi if [ -d "$HOME/devel/go" ] then diff --git a/any/vim/.vim/bak.vimrc b/any/vim/.vim/bak.vimrc new file mode 100644 index 0000000..fb075a0 --- /dev/null +++ b/any/vim/.vim/bak.vimrc @@ -0,0 +1,470 @@ +call plug#begin('~/.vim/plugged') +if empty($VIM_LITE) + Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } " Amazing combination of features. +endif +Plug 'jmcantrell/vim-virtualenv' +" Plug 'mg979/vim-visual-multi' +Plug 'airblade/vim-rooter' +if empty($VIM_LITE) + Plug 'vim-airline/vim-airline' + Plug 'vim-airline/vim-airline-themes' + Plug 'majutsushi/tagbar' " install exuberant-ctags +endif +Plug 'tpope/vim-commentary' +Plug 'tpope/vim-fugitive' +Plug 'airblade/vim-gitgutter' +" Plug 'SirVer/ultisnips' +" Plug 'neomake/neomake' +" Plug 'godlygeek/tabular' +" Plug 'lepture/vim-jinja' +" Plug 'b4b4r07/vim-hcl' +" Plug 'hashivim/vim-packer' +" Plug 'hashivim/vim-terraform' +" Plug 'scrooloose/nerdtree' +Plug 'preservim/nerdtree' +Plug 'ryanoasis/vim-devicons' +if empty($VIM_LITE) + Plug 'towolf/vim-helm' + Plug 'ARM9/arm-syntax-vim' +endif +" Plug 'PotatoesMaster/i3-vim-syntax' +"Plug 'tpope/vim-surround' +"Plugin 'jiangmiao/auto-pairs' +" Plug 'tsandall/vim-rego' +" Plug 'honza/vim-snippets' +if empty($VIM_LITE) + Plug 'psliwka/vim-smoothie' +endif +Plug 'Yggdroot/indentLine' +if !has('nvim') + " Plugins for when you're not using neovim +endif +if has('nvim') + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.8' } + " Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} + Plug 'neoclide/coc.nvim', {'branch': 'release'} + "Plug 'jodosha/vim-godebug' " Debugger integration via delve + Plug 'github/copilot.vim' + " Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + Plug 'folke/todo-comments.nvim' + Plug 'akinsho/toggleterm.nvim', {'tag' : 'v2.11.0'} + Plug 'neovim/nvim-lspconfig' + " Plug 'mfussenegger/nvim-dap-python' + " Plug 'linux-cultist/venv-selector.nvim', {'branch': 'regexp'} +endif +" All of your Plugs must be added before the following line +call plug#end() + +""""""""""""""""" +" Plugin Config " +""""""""""""""""" +let mapleader = " " + +""" coc +if has('nvim') + " --------------------------------------------------------------------------- + " coc.nvim default settings + " --------------------------------------------------------------------------- + let g:coc_global_extensions = [ + \'coc-json', + \'coc-go', + \'@yaegassy/coc-pylsp', + \'coc-pydocstring', + \'coc-yaml', + \'coc-snippets', + \'coc-lua', + \'coc-solargraph', + \'coc-toml', + \'coc-docker', + \'coc-clangd', + \'coc-tsserver', + \'coc-html' + \] + + " Some servers have issues with backup files, see #649 + " set nobackup + " set nowritebackup + + " Having longer updatetime (default is 4000 ms = 4s) leads to noticeable + " delays and poor user experience + set updatetime=300 + + " Always show the signcolumn, otherwise it would shift the text each time + " diagnostics appear/become resolved + " set signcolumn=yes + + " Make to accept selected completion item or notify coc.nvim to format + " u breaks current undo, please make your own choice + inoremap coc#pum#visible() ? coc#pum#confirm() + \: "\u\\=coc#on_enter()\" + + " function! CheckBackspace() abort + " let col = col('.') - 1 + " return !col || getline('.')[col - 1] =~# '\s' + " endfunction + + " Use `[g` and `]g` to navigate diagnostics + " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list + nmap [g (coc-diagnostic-prev) + nmap ]g (coc-diagnostic-next) + + " GoTo code navigation + nmap gd (coc-definition) + nmap gy (coc-type-definition) + nmap gi (coc-implementation) + nmap gr (coc-references) + + " Use K to show documentation in preview window + nnoremap K :call ShowDocumentation() + + function! ShowDocumentation() + if CocAction('hasProvider', 'hover') + call CocActionAsync('doHover') + else + call feedkeys('K', 'in') + endif + endfunction + + " Highlight the symbol and its references when holding the cursor + autocmd CursorHold * silent call CocActionAsync('highlight') + + " Symbol renaming + nmap rn (coc-rename) + + " Formatting selected code + xmap f (coc-format-selected) + nmap f (coc-format-selected) + + augroup mygroup + autocmd! + " Setup formatexpr specified filetype(s) + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " Update signature help on jump placeholder + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') + augroup end + + " Applying code actions to the selected code block + " Example: `aap` for current paragraph + xmap a (coc-codeaction-selected) + nmap a (coc-codeaction-selected) + + " Remap keys for applying code actions at the cursor position + nmap ac (coc-codeaction-cursor) + " Remap keys for apply code actions affect whole buffer + nmap as (coc-codeaction-source) + " Apply the most preferred quickfix action to fix diagnostic on the current line + nmap qf (coc-fix-current) + + " Remap keys for applying refactor code actions + nmap re (coc-codeaction-refactor) + xmap r (coc-codeaction-refactor-selected) + nmap r (coc-codeaction-refactor-selected) + + " Run the Code Lens action on the current line + nmap cl (coc-codelens-action) + + " Map function and class text objects + " NOTE: Requires 'textDocument.documentSymbol' support from the language server + xmap if (coc-funcobj-i) + omap if (coc-funcobj-i) + xmap af (coc-funcobj-a) + omap af (coc-funcobj-a) + xmap ic (coc-classobj-i) + omap ic (coc-classobj-i) + xmap ac (coc-classobj-a) + omap ac (coc-classobj-a) + + " Remap and to scroll float windows/popups + " if has('nvim-0.4.0') || has('patch-8.2.0750') + " nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + " nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + " inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" + " inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" + " vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + " vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + " endif + + " Code Gen + nmap ga (coc-codeaction-line) + xmap ga (coc-codeaction-selected) + nmap gA (coc-codeaction) + + " Use CTRL-S for selections ranges + " Requires 'textDocument/selectionRange' support of language server + nmap (coc-range-select) + xmap (coc-range-select) + + " Add `:Format` command to format current buffer + command! -nargs=0 Format :call CocActionAsync('format') + + " Add `:Fold` command to fold current buffer + command! -nargs=? Fold :call CocAction('fold', ) + + " Add `:OR` command for organize imports of the current buffer + command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') + + " Add (Neo)Vim's native statusline support + " NOTE: Please see `:h coc-status` for integrations with external plugins that + " provide custom statusline: lightline.vim, vim-airline + + " Mappings for CoCList + " Show all diagnostics + nnoremap a :CocList diagnostics + " Manage extensions + nnoremap e :CocList extensions + " Show commands + nnoremap c :CocList commands + " Find symbol of current document + nnoremap o :CocList outline + " Search workspace symbols + nnoremap s :CocList -I symbols + " Do default action for next item + nnoremap j :CocNext + " Do default action for previous item + nnoremap k :CocPrev + " Resume latest coc list + nnoremap p :CocListResume + + """" Snippets + + " Use for trigger snippet expand. + imap (coc-snippets-expand) + + " Use for select text for visual placeholder of snippet. + vmap (coc-snippets-select) + + " Use for jump to next placeholder, it's default of coc.nvim + let g:coc_snippet_next = '' + + " Use for jump to previous placeholder, it's default of coc.nvim + let g:coc_snippet_prev = '' + + " Use for both expand and jump (make expand higher priority.) + imap (coc-snippets-expand-jump) + + " Use x for convert visual selected code to snippet + xmap x (coc-convert-snippet) + + " inoremap + " \ pumvisible() ? coc#_select_confirm() : + " \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : + " \ check_back_space() ? "\" : + " \ coc#refresh() + + " function! s:check_back_space() abort + " let col = col('.') - 1 + " return !col || getline('.')[col - 1] =~# '\s' + " endfunction + + " let g:coc_snippet_next = '' +endif + + +""" tagbar +if empty($VIM_LITE) + nmap b :TagbarToggle + " let g:tagbar_type_go = { + " \ 'ctagstype' : 'go', + " \ 'kinds' : [ + " \ 'p:package', + " \ 'i:imports:1', + " \ 'c:constants', + " \ 'v:variables', + " \ 't:types', + " \ 'n:interfaces', + " \ 'w:fields', + " \ 'e:embedded', + " \ 'm:methods', + " \ 'r:constructor', + " \ 'f:functions' + " \ ], + " \ 'sro' : '.', + " \ 'kind2scope' : { + " \ 't' : 'ctype', + " \ 'n' : 'ntype' + " \ }, + " \ 'scope2kind' : { + " \ 'ctype' : 't', + " \ 'ntype' : 'n' + " \ }, + " \ 'ctagsbin' : 'gotags', + " \ 'ctagsargs' : '-sort -silent' + " \ } +endif + + +""" vim-rooter +" let g:rooter_use_lcd = 1 +let g:rooter_cd_cmd="lcd" +let g:rooter_silent_chdir = 1 +let g:rooter_resolve_links = 1 + + +""" vim-terraform +" let g:terraform_fmt_on_save=1 +"autocmd filetype tf set syntax=terraform +" autocmd FileType terraform setlocal commentstring=#%s + + +""" vim-jinja +" autocmd BufNewFile,BufRead *.j2 set filetype=jinja + + +""" vim-go +" " disable all linters as that is taken care of by coc.nvim +" let g:go_diagnostics_enabled = 0 +" let g:go_metalinter_enabled = [] + +" " don't jump to errors after metalinter is invoked +" let g:go_jump_to_error = 0 + +" " run go imports on file save +" let g:go_fmt_command = "gofmt" + +" " automatically highlight variable your cursor is on +" let g:go_auto_sameids = 0 + +" let g:go_highlight_types = 1 +" let g:go_highlight_types = 1 +" let g:go_highlight_fields = 1 +" let g:go_highlight_functions = 1 +" let g:go_highlight_function_calls = 1 +" let g:go_highlight_operators = 1 +" let g:go_highlight_extra_types = 1 +" let g:go_highlight_build_constraints = 1 +" let g:go_highlight_generate_tags = 1 + +" " let g:go_def_mode='gopls' +" " let g:go_info_mode='gopls' +" let g:go_term_enabled = 1 + +" " disable vim-go :GoDef short cut (gd) +" " this is handled by LanguageClient [LC] +" let g:go_def_mapping_enabled = 0 + + +""" neomake +" Full config: when writing or reading a buffer, and on changes in insert and +" normal mode (after 1s; no delay when writing). +" call neomake#configure#automake('nrwi', 500) + + +""" NERDtree +nnoremap n :NERDTreeFocus +nnoremap e :NERDTreeToggle +nnoremap o :NERDTreeFind + +" Open NERDTree on the right side of the window. +let g:NERDTreeWinPos = "right" + +" Start NERDTree when Vim starts with a directory argument. +autocmd StdinReadPre * let s:std_in=1 +autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') | + \ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif +" Start NERDTree when Vim is started without file arguments. +autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | endif +" Exit Vim if NERDTree is the only window remaining in the only tab. +autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif +" Close the tab if NERDTree is the only window remaining in it. +autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif +" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree. +autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | + \ let buf=bufnr() | buffer# | execute "normal! \w" | execute 'buffer'.buf | endif + + + +""" airline +let g:airline_theme='powerlineish' " is a valid theme name +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#virtualenv#enabled = 1 +let g:airline#extensions#virtualenv#ft = ['python', 'markdown', 'dosini', 'text', 'make'] + +" customize the statusline. +" let g:airline_section_w=%{virtualenv#statusline()} +" let g:airline_section_w = %{coc#status()}%{get(b:,'coc_current_function','')} + +""" Telescope +" Find files using Telescope command-line sugar. +if has('nvim') + nnoremap ff Telescope find_files + nnoremap fg Telescope live_grep + nnoremap fb Telescope buffers + nnoremap fh Telescope help_tags +endif + +""" TreeSitter +" if has('nvim') +" luafile ~/.vim/vimrc.d/treesitter.lua +" endif + +""" todo-comments +if has('nvim') + luafile ~/.vim/vimrc.d/todo-comments.lua +endif + +""" toggleterm +if has('nvim') + lua require("toggleterm").setup() + nnoremap t :ToggleTerm direction=float + +endif + +""" venv-selector +" luafile ~/.vim/vimrc.d/venv-selector.lua +" nnoremap vs :VenvSelect + + +""" vim-smoothie + +""""""""""""""""""""" +" Personal Settings " +""""""""""""""""""""" +set number + +colorscheme Czar +hi Normal guibg=NONE ctermbg=NONE + +command! W w !sudo tee >/dev/null % + +set backupdir=~/.vim/tmp/backup// +set directory=~/.vim/tmp/swap// +set undodir=~/.vim/tmp/undo// + +set completeopt-=preview + +"set list lcs=tab:\┆\ ,trail:▓,space:. +"set list lcs=tab:\⇥\ ,trail:▓,space:. +set list lcs=tab:\⇥\ ,trail:▓ + +set colorcolumn=80 +autocmd Filetype java setlocal colorcolumn=100 +autocmd Filetype html setlocal colorcolumn=100 +autocmd Filetype go setlocal colorcolumn=100 +autocmd Filetype netrw setlocal colorcolumn= +autocmd Filetype netrw setlocal signcolumn=0 + +set tabstop=2 +set shiftwidth=2 +set noexpandtab +autocmd FileType python setlocal expandtab +autocmd FileType python setlocal tabstop=4 +autocmd FileType python setlocal shiftwidth=4 +" autocmd filetype json setlocal expandtab +autocmd filetype tf setlocal expandtab +autocmd filetype terraform setlocal expandtab +autocmd FileType terraform setlocal tabstop=4 +autocmd FileType terraform setlocal shiftwidth=4 +autocmd FileType helm setlocal expandtab + +let g:indentLine_concealcursor = 'nc' + +""" Help Navigation +" autocmd FileType help nnoremap +" autocmd FileType help nnoremap +" autocmd FileType help nnoremap o /'\l\{2,\}' +" autocmd FileType help nnoremap O ?'\l\{2,\}' +" autocmd FileType help nnoremap s /\|\zs\S\+\ze\| +" autocmd FileType help nnoremap S ?\|\zs\S\+\ze\| diff --git a/any/vim/.vim/vimrc b/any/vim/.vim/vimrc index fb075a0..ea03d03 100644 --- a/any/vim/.vim/vimrc +++ b/any/vim/.vim/vimrc @@ -1,298 +1,77 @@ -call plug#begin('~/.vim/plugged') -if empty($VIM_LITE) - Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } " Amazing combination of features. +" vim-bootstrap 2024-09-23 08:37:05 + +"***************************************************************************** +"" Vim-Plug core +"***************************************************************************** +let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim') +if has('win32')&&!has('win64') + let curl_exists=expand('C:\Windows\Sysnative\curl.exe') +else + let curl_exists=expand('curl') endif -Plug 'jmcantrell/vim-virtualenv' -" Plug 'mg979/vim-visual-multi' -Plug 'airblade/vim-rooter' -if empty($VIM_LITE) - Plug 'vim-airline/vim-airline' - Plug 'vim-airline/vim-airline-themes' - Plug 'majutsushi/tagbar' " install exuberant-ctags + +let g:vim_bootstrap_langs = "c,go,lua,python,ruby,rust" +let g:vim_bootstrap_editor = "nvim" " nvim or vim +let g:vim_bootstrap_theme = "gruvbox" +let g:vim_bootstrap_frams = "" + +if !filereadable(vimplug_exists) + if !executable(curl_exists) + echoerr "You have to install curl or first install vim-plug yourself!" + execute "q!" + endif + echo "Installing Vim-Plug..." + echo "" + silent exec "!"curl_exists" -fLo " . shellescape(vimplug_exists) . " --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" + let g:not_finish_vimplug = "yes" + + autocmd VimEnter * PlugInstall endif + +" Required: +call plug#begin(expand('~/.config/nvim/plugged')) + +"***************************************************************************** +"" Plug install packages +"***************************************************************************** +Plug 'scrooloose/nerdtree' +Plug 'jistr/vim-nerdtree-tabs' Plug 'tpope/vim-commentary' Plug 'tpope/vim-fugitive' Plug 'airblade/vim-gitgutter' -" Plug 'SirVer/ultisnips' -" Plug 'neomake/neomake' -" Plug 'godlygeek/tabular' -" Plug 'lepture/vim-jinja' -" Plug 'b4b4r07/vim-hcl' -" Plug 'hashivim/vim-packer' -" Plug 'hashivim/vim-terraform' -" Plug 'scrooloose/nerdtree' -Plug 'preservim/nerdtree' -Plug 'ryanoasis/vim-devicons' -if empty($VIM_LITE) - Plug 'towolf/vim-helm' - Plug 'ARM9/arm-syntax-vim' -endif -" Plug 'PotatoesMaster/i3-vim-syntax' -"Plug 'tpope/vim-surround' -"Plugin 'jiangmiao/auto-pairs' -" Plug 'tsandall/vim-rego' -" Plug 'honza/vim-snippets' -if empty($VIM_LITE) +Plug 'vim-scripts/grep.vim' +Plug 'vim-scripts/CSApprox' +Plug 'Raimondi/delimitMate' +Plug 'majutsushi/tagbar' +Plug 'dense-analysis/ale' +Plug 'Yggdroot/indentLine' +Plug 'editor-bootstrap/vim-bootstrap-updater' +Plug 'tpope/vim-rhubarb' " required by fugitive to :GBrowse +Plug 'airblade/vim-rooter' +Plug 'morhetz/gruvbox' +if empty($VI) + Plug 'vim-airline/vim-airline' + Plug 'vim-airline/vim-airline-themes' Plug 'psliwka/vim-smoothie' endif -Plug 'Yggdroot/indentLine' -if !has('nvim') - " Plugins for when you're not using neovim -endif if has('nvim') - Plug 'nvim-lua/plenary.nvim' - Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.8' } - " Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} - Plug 'neoclide/coc.nvim', {'branch': 'release'} - "Plug 'jodosha/vim-godebug' " Debugger integration via delve Plug 'github/copilot.vim' - " Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} - Plug 'folke/todo-comments.nvim' Plug 'akinsho/toggleterm.nvim', {'tag' : 'v2.11.0'} Plug 'neovim/nvim-lspconfig' - " Plug 'mfussenegger/nvim-dap-python' - " Plug 'linux-cultist/venv-selector.nvim', {'branch': 'regexp'} -endif -" All of your Plugs must be added before the following line -call plug#end() - -""""""""""""""""" -" Plugin Config " -""""""""""""""""" -let mapleader = " " - -""" coc -if has('nvim') - " --------------------------------------------------------------------------- - " coc.nvim default settings - " --------------------------------------------------------------------------- - let g:coc_global_extensions = [ - \'coc-json', - \'coc-go', - \'@yaegassy/coc-pylsp', - \'coc-pydocstring', - \'coc-yaml', - \'coc-snippets', - \'coc-lua', - \'coc-solargraph', - \'coc-toml', - \'coc-docker', - \'coc-clangd', - \'coc-tsserver', - \'coc-html' - \] - - " Some servers have issues with backup files, see #649 - " set nobackup - " set nowritebackup - - " Having longer updatetime (default is 4000 ms = 4s) leads to noticeable - " delays and poor user experience - set updatetime=300 - - " Always show the signcolumn, otherwise it would shift the text each time - " diagnostics appear/become resolved - " set signcolumn=yes - - " Make to accept selected completion item or notify coc.nvim to format - " u breaks current undo, please make your own choice - inoremap coc#pum#visible() ? coc#pum#confirm() - \: "\u\\=coc#on_enter()\" - - " function! CheckBackspace() abort - " let col = col('.') - 1 - " return !col || getline('.')[col - 1] =~# '\s' - " endfunction - - " Use `[g` and `]g` to navigate diagnostics - " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list - nmap [g (coc-diagnostic-prev) - nmap ]g (coc-diagnostic-next) - - " GoTo code navigation - nmap gd (coc-definition) - nmap gy (coc-type-definition) - nmap gi (coc-implementation) - nmap gr (coc-references) - - " Use K to show documentation in preview window - nnoremap K :call ShowDocumentation() - - function! ShowDocumentation() - if CocAction('hasProvider', 'hover') - call CocActionAsync('doHover') - else - call feedkeys('K', 'in') - endif - endfunction - - " Highlight the symbol and its references when holding the cursor - autocmd CursorHold * silent call CocActionAsync('highlight') - - " Symbol renaming - nmap rn (coc-rename) - - " Formatting selected code - xmap f (coc-format-selected) - nmap f (coc-format-selected) - - augroup mygroup - autocmd! - " Setup formatexpr specified filetype(s) - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " Update signature help on jump placeholder - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') - augroup end - - " Applying code actions to the selected code block - " Example: `aap` for current paragraph - xmap a (coc-codeaction-selected) - nmap a (coc-codeaction-selected) - - " Remap keys for applying code actions at the cursor position - nmap ac (coc-codeaction-cursor) - " Remap keys for apply code actions affect whole buffer - nmap as (coc-codeaction-source) - " Apply the most preferred quickfix action to fix diagnostic on the current line - nmap qf (coc-fix-current) - - " Remap keys for applying refactor code actions - nmap re (coc-codeaction-refactor) - xmap r (coc-codeaction-refactor-selected) - nmap r (coc-codeaction-refactor-selected) - - " Run the Code Lens action on the current line - nmap cl (coc-codelens-action) - - " Map function and class text objects - " NOTE: Requires 'textDocument.documentSymbol' support from the language server - xmap if (coc-funcobj-i) - omap if (coc-funcobj-i) - xmap af (coc-funcobj-a) - omap af (coc-funcobj-a) - xmap ic (coc-classobj-i) - omap ic (coc-classobj-i) - xmap ac (coc-classobj-a) - omap ac (coc-classobj-a) - - " Remap and to scroll float windows/popups - " if has('nvim-0.4.0') || has('patch-8.2.0750') - " nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - " nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - " inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" - " inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" - " vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - " vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - " endif - - " Code Gen - nmap ga (coc-codeaction-line) - xmap ga (coc-codeaction-selected) - nmap gA (coc-codeaction) - - " Use CTRL-S for selections ranges - " Requires 'textDocument/selectionRange' support of language server - nmap (coc-range-select) - xmap (coc-range-select) - - " Add `:Format` command to format current buffer - command! -nargs=0 Format :call CocActionAsync('format') - - " Add `:Fold` command to fold current buffer - command! -nargs=? Fold :call CocAction('fold', ) - - " Add `:OR` command for organize imports of the current buffer - command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') - - " Add (Neo)Vim's native statusline support - " NOTE: Please see `:h coc-status` for integrations with external plugins that - " provide custom statusline: lightline.vim, vim-airline - - " Mappings for CoCList - " Show all diagnostics - nnoremap a :CocList diagnostics - " Manage extensions - nnoremap e :CocList extensions - " Show commands - nnoremap c :CocList commands - " Find symbol of current document - nnoremap o :CocList outline - " Search workspace symbols - nnoremap s :CocList -I symbols - " Do default action for next item - nnoremap j :CocNext - " Do default action for previous item - nnoremap k :CocPrev - " Resume latest coc list - nnoremap p :CocListResume - - """" Snippets - - " Use for trigger snippet expand. - imap (coc-snippets-expand) - - " Use for select text for visual placeholder of snippet. - vmap (coc-snippets-select) - - " Use for jump to next placeholder, it's default of coc.nvim - let g:coc_snippet_next = '' - - " Use for jump to previous placeholder, it's default of coc.nvim - let g:coc_snippet_prev = '' - - " Use for both expand and jump (make expand higher priority.) - imap (coc-snippets-expand-jump) - - " Use x for convert visual selected code to snippet - xmap x (coc-convert-snippet) - - " inoremap - " \ pumvisible() ? coc#_select_confirm() : - " \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : - " \ check_back_space() ? "\" : - " \ coc#refresh() - - " function! s:check_back_space() abort - " let col = col('.') - 1 - " return !col || getline('.')[col - 1] =~# '\s' - " endfunction - - " let g:coc_snippet_next = '' + Plug 'folke/todo-comments.nvim' endif - -""" tagbar -if empty($VIM_LITE) - nmap b :TagbarToggle - " let g:tagbar_type_go = { - " \ 'ctagstype' : 'go', - " \ 'kinds' : [ - " \ 'p:package', - " \ 'i:imports:1', - " \ 'c:constants', - " \ 'v:variables', - " \ 't:types', - " \ 'n:interfaces', - " \ 'w:fields', - " \ 'e:embedded', - " \ 'm:methods', - " \ 'r:constructor', - " \ 'f:functions' - " \ ], - " \ 'sro' : '.', - " \ 'kind2scope' : { - " \ 't' : 'ctype', - " \ 'n' : 'ntype' - " \ }, - " \ 'scope2kind' : { - " \ 'ctype' : 't', - " \ 'ntype' : 'n' - " \ }, - " \ 'ctagsbin' : 'gotags', - " \ 'ctagsargs' : '-sort -silent' - " \ } +if isdirectory('/usr/local/opt/fzf') + Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim' +else + Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' } + Plug 'junegunn/fzf.vim' endif - +let g:make = 'gmake' +if exists('make') + let g:make = 'make' +endif +Plug 'Shougo/vimproc.vim', {'do': g:make} """ vim-rooter " let g:rooter_use_lcd = 1 @@ -300,60 +79,239 @@ let g:rooter_cd_cmd="lcd" let g:rooter_silent_chdir = 1 let g:rooter_resolve_links = 1 +"" Vim-Session +Plug 'xolox/vim-misc' +Plug 'xolox/vim-session' -""" vim-terraform -" let g:terraform_fmt_on_save=1 -"autocmd filetype tf set syntax=terraform -" autocmd FileType terraform setlocal commentstring=#%s +"" Snippets +Plug 'SirVer/ultisnips' +Plug 'honza/vim-snippets' + +"***************************************************************************** +"" Custom bundles +"***************************************************************************** + +" c +Plug 'vim-scripts/c.vim', {'for': ['c', 'cpp']} +Plug 'ludwig/split-manpage.vim' -""" vim-jinja -" autocmd BufNewFile,BufRead *.j2 set filetype=jinja +" go +"" Go Lang Bundle +Plug 'fatih/vim-go', {'do': ':GoInstallBinaries'} -""" vim-go -" " disable all linters as that is taken care of by coc.nvim -" let g:go_diagnostics_enabled = 0 -" let g:go_metalinter_enabled = [] - -" " don't jump to errors after metalinter is invoked -" let g:go_jump_to_error = 0 - -" " run go imports on file save -" let g:go_fmt_command = "gofmt" - -" " automatically highlight variable your cursor is on -" let g:go_auto_sameids = 0 - -" let g:go_highlight_types = 1 -" let g:go_highlight_types = 1 -" let g:go_highlight_fields = 1 -" let g:go_highlight_functions = 1 -" let g:go_highlight_function_calls = 1 -" let g:go_highlight_operators = 1 -" let g:go_highlight_extra_types = 1 -" let g:go_highlight_build_constraints = 1 -" let g:go_highlight_generate_tags = 1 - -" " let g:go_def_mode='gopls' -" " let g:go_info_mode='gopls' -" let g:go_term_enabled = 1 - -" " disable vim-go :GoDef short cut (gd) -" " this is handled by LanguageClient [LC] -" let g:go_def_mapping_enabled = 0 +" lua +"" Lua Bundle +Plug 'xolox/vim-lua-ftplugin' +Plug 'xolox/vim-lua-inspect' -""" neomake -" Full config: when writing or reading a buffer, and on changes in insert and -" normal mode (after 1s; no delay when writing). -" call neomake#configure#automake('nrwi', 500) +" python +"" Python Bundle +Plug 'davidhalter/jedi-vim' +Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'} -""" NERDtree -nnoremap n :NERDTreeFocus -nnoremap e :NERDTreeToggle -nnoremap o :NERDTreeFind +" ruby +Plug 'tpope/vim-rails' +Plug 'tpope/vim-rake' +Plug 'tpope/vim-projectionist' +Plug 'thoughtbot/vim-rspec' +Plug 'ecomba/vim-ruby-refactoring', {'tag': 'main'} + + +" rust +" Vim racer +Plug 'racer-rust/vim-racer' + +" Rust.vim +Plug 'rust-lang/rust.vim' + +" Async.vim +Plug 'prabirshrestha/async.vim' + +" Vim lsp +Plug 'prabirshrestha/vim-lsp' + +" Asyncomplete.vim +Plug 'prabirshrestha/asyncomplete.vim' + +" Asyncomplete lsp.vim +Plug 'prabirshrestha/asyncomplete-lsp.vim' + + +" Zig +"" Zig Bundle +Plug 'neovim/nvim-lspconfig' " https://github.com/neovim/nvim-lspconfig +Plug 'ziglang/zig.vim' " https://github.com/ziglang/zig.vim + + +"***************************************************************************** +"***************************************************************************** + +"" Include user's extra bundle +if filereadable(expand("~/.config/nvim/local_bundles.vim")) + source ~/.config/nvim/local_bundles.vim +endif + +call plug#end() + +" Required: +filetype plugin indent on + + +"***************************************************************************** +"" Basic Setup +"*****************************************************************************" +"" Encoding +set encoding=utf-8 +set fileencoding=utf-8 +set fileencodings=utf-8 + + +"" Fix backspace indent +set backspace=indent,eol,start + +"" Tabs. May be overridden by autocmd rules +set tabstop=4 +set softtabstop=0 +set shiftwidth=4 +""""""set expandtab + +"" Map leader to , +let mapleader=' ' + +"" Enable hidden buffers +set hidden + +"" Searching +set hlsearch +set incsearch +set ignorecase +set smartcase + +set fileformats=unix,dos,mac + +if exists('$SHELL') + set shell=$SHELL +else + set shell=/bin/sh +endif + +" session management +let g:session_directory = "~/.config/nvim/session" +let g:session_autoload = "no" +let g:session_autosave = "no" +let g:session_command_aliases = 1 + +"***************************************************************************** +"" Visual Settings +"***************************************************************************** +syntax on +set ruler +set number + +let no_buffers_menu=1 +colorscheme gruvbox + +" Better command line completion +set wildmenu + +" mouse support +set mouse=a + +set mousemodel=popup +set t_Co=256 +set guioptions=egmrti + +set gfn=Monospace\ 10 + +if has("gui_running") + if has("gui_mac") || has("gui_macvim") + set guifont=Menlo:h12 + set transparency=7 + endif +else + let g:CSApprox_loaded = 1 + + " IndentLine + let g:indentLine_enabled = 1 + let g:indentLine_concealcursor = '' + let g:indentLine_char = '┆' + let g:indentLine_faster = 1 + let g:indentLine_concealcursor = 'nc' +endif + + + +"" Disable the blinking cursor. +set gcr=a:blinkon0 + +au TermEnter * setlocal scrolloff=0 +au TermLeave * setlocal scrolloff=3 + + +"" Status bar +set laststatus=2 + +"" Use modeline overrides +set modeline +set modelines=10 + +set title +set titleold="Terminal" +set titlestring=%F + +set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\ + +" Search mappings: These will make it so that going to the next one in a +" search will center on the line it's found in. +nnoremap n nzzzv +nnoremap N Nzzzv + +if exists("*fugitive#statusline") + set statusline+=%{fugitive#statusline()} +endif + +" vim-airline +let g:airline_theme = 'powerlineish' +let g:airline_powerline_fonts = 1 +let g:airline#extensions#branch#enabled = 1 +let g:airline#extensions#ale#enabled = 1 +let g:airline#extensions#tabline#enabled = 1 +let g:airline#extensions#tagbar#enabled = 1 +let g:airline_skip_empty_sections = 1 + +"***************************************************************************** +"" Abbreviations +"***************************************************************************** +"" no one is really happy until you have this shortcuts +"""""" cnoreabbrev W! w! +"""""" cnoreabbrev Q! q! +"""""" cnoreabbrev Qall! qall! +"""""" cnoreabbrev Wq wq +"""""" cnoreabbrev Wa wa +"""""" cnoreabbrev wQ wq +"""""" cnoreabbrev WQ wq +"""""" cnoreabbrev W w +"""""" cnoreabbrev Q q +"""""" cnoreabbrev Qall qall + +"" NERDTree configuration +let g:NERDTreeChDirMode=2 +let g:NERDTreeIgnore=['node_modules','\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__'] +let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$'] +let g:NERDTreeShowBookmarks=1 +let g:nerdtree_tabs_focus_on_files=1 +let g:NERDTreeMapOpenInTabSilent = '' +let g:NERDTreeWinSize = 50 +set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite,*node_modules/ +nnoremap :NERDTreeFind +""""""nnoremap e :NERDTreeToggle +nnoremap n :NERDTreeFocus +nnoremap e :NERDTreeToggle +nnoremap o :NERDTreeFind " Open NERDTree on the right side of the window. let g:NERDTreeWinPos = "right" @@ -361,70 +319,425 @@ let g:NERDTreeWinPos = "right" " Start NERDTree when Vim starts with a directory argument. autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') | - \ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif -" Start NERDTree when Vim is started without file arguments. -autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | endif -" Exit Vim if NERDTree is the only window remaining in the only tab. -autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif -" Close the tab if NERDTree is the only window remaining in it. -autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif -" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree. -autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | - \ let buf=bufnr() | buffer# | execute "normal! \w" | execute 'buffer'.buf | endif + \ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif + +" grep.vim +nnoremap f :Rgrep +let Grep_Default_Options = '-IR' +let Grep_Skip_Files = '*.log *.db' +let Grep_Skip_Dirs = '.git node_modules' + +" terminal emulation +nnoremap sh :terminal +"***************************************************************************** +"" Commands +"***************************************************************************** +" remove trailing whitespaces +command! FixWhitespace :%s/\s\+$//e -""" airline -let g:airline_theme='powerlineish' " is a valid theme name -let g:airline_powerline_fonts = 1 -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#tabline#formatter = 'unique_tail_improved' +"***************************************************************************** +"" Functions +"***************************************************************************** +if !exists('*s:setupWrapping') + function s:setupWrapping() + set wrap + set wm=2 + set textwidth=79 + endfunction +endif + +"***************************************************************************** +"" Autocmd Rules +"***************************************************************************** +"" The PC is fast enough, do syntax highlight syncing from start unless 200 lines +augroup vimrc-sync-fromstart + autocmd! + autocmd BufEnter * :syntax sync maxlines=200 +augroup END + +"" Remember cursor position +augroup vimrc-remember-cursor-position + autocmd! + autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif +augroup END + +"" txt +augroup vimrc-wrapping + autocmd! + autocmd BufRead,BufNewFile *.txt call s:setupWrapping() +augroup END + +"" make/cmake +augroup vimrc-make-cmake + autocmd! + autocmd FileType make setlocal noexpandtab + autocmd BufNewFile,BufRead CMakeLists.txt setlocal filetype=cmake +augroup END + +set autoread + +"***************************************************************************** +"" Mappings +"***************************************************************************** + +"" Split +noremap h :split +noremap v :vsplit + +"" Git +noremap ga :Gwrite +noremap gc :Git commit --verbose +noremap gsh :Git push +noremap gll :Git pull +noremap gs :Git +noremap gb :Git blame +noremap gd :Gvdiffsplit +noremap gr :GRemove + +" session management +nnoremap so :OpenSession +nnoremap ss :SaveSession +nnoremap sd :DeleteSession +nnoremap sc :CloseSession + +"" Tabs +nnoremap gt +nnoremap gT +nnoremap :tabnew + +"" Set working directory +nnoremap . :lcd %:p:h + +"" Opens an edit command with the path of the currently edited file filled in +""""""noremap e :e =expand("%:p:h") . "/" + +"" Opens a tab edit command with the path of the currently edited file filled +noremap te :tabe =expand("%:p:h") . "/" + +"" fzf.vim +set wildmode=list:longest,list:full +set wildignore+=*.o,*.obj,.git,*.rbc,*.pyc,__pycache__ +let $FZF_DEFAULT_COMMAND = "find * -path '*/\.*' -prune -o -path 'node_modules/**' -prune -o -path 'target/**' -prune -o -path 'dist/**' -prune -o -type f -print -o -type l -print 2> /dev/null" + +" The Silver Searcher +if executable('ag') + let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""' + set grepprg=ag\ --nogroup\ --nocolor +endif + +" ripgrep +if executable('rg') + let $FZF_DEFAULT_COMMAND = 'rg --files --hidden --follow --glob "!.git/*"' + set grepprg=rg\ --vimgrep + command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --glob "!.git/*" --color "always" '.shellescape().'| tr -d "\017"', 1, 0) +endif + +cnoremap =expand("%:p:h") . "/" +nnoremap b :Buffers +""""""nnoremap e :FZF -m +"Recovery commands from history through FZF +nmap y :History: + +" snippets +let g:UltiSnipsExpandTrigger="" +let g:UltiSnipsJumpForwardTrigger="" +let g:UltiSnipsJumpBackwardTrigger="" +let g:UltiSnipsEditSplit="vertical" + +" ale +let g:ale_linters = {} + +" Tagbar +nmap :TagbarToggle +let g:tagbar_autofocus = 1 + +" Disable visualbell +set noerrorbells visualbell t_vb= +if has('autocmd') + autocmd GUIEnter * set visualbell t_vb= +endif + +"" Copy/Paste/Cut +if has('unnamedplus') + set clipboard=unnamed,unnamedplus +endif + +noremap YY "+y +noremap p "+gP +noremap XX "+x + +if has('macunix') + " pbcopy for OSX copy/paste + vmap :!pbcopy + vmap :w !pbcopy +endif + +"" Buffer nav +noremap z :bp +noremap q :bp +noremap x :bn +noremap w :bn + +"" Close buffer +noremap c :bd + +"" Clean search (highlight) +nnoremap :noh + +"" Switching windows +noremap j +noremap k +noremap l +noremap h + +"" Vmap for maintain Visual Mode after shifting > and < +vmap < >gv + +"" Move visual block +vnoremap J :m '>+1gv=gv +vnoremap K :m '<-2gv=gv + +"" Open current line on GitHub +""""""nnoremap o :.GBrowse + +"***************************************************************************** +"" Custom configs +"***************************************************************************** + +" c +autocmd FileType c setlocal tabstop=4 shiftwidth=4 expandtab +autocmd FileType cpp setlocal tabstop=4 shiftwidth=4 expandtab + + +" go +" vim-go +" run :GoBuild or :GoTestCompile based on the go file +function! s:build_go_files() + let l:file = expand('%') + if l:file =~# '^\f\+_test\.go$' + call go#test#Test(0, 1) + elseif l:file =~# '^\f\+\.go$' + call go#cmd#Build(0) + endif +endfunction + +let g:go_list_type = "quickfix" +let g:go_fmt_command = "goimports" +let g:go_fmt_fail_silently = 1 + +let g:go_highlight_types = 1 +let g:go_highlight_fields = 1 +let g:go_highlight_functions = 1 +let g:go_highlight_methods = 1 +let g:go_highlight_operators = 1 +let g:go_highlight_build_constraints = 1 +let g:go_highlight_structs = 1 +let g:go_highlight_generate_tags = 1 +let g:go_highlight_space_tab_error = 0 +let g:go_highlight_array_whitespace_error = 0 +let g:go_highlight_trailing_whitespace_error = 0 +let g:go_highlight_extra_types = 1 + +autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 + +augroup completion_preview_close + autocmd! + if v:version > 703 || v:version == 703 && has('patch598') + autocmd CompleteDone * if !&previewwindow && &completeopt =~ 'preview' | silent! pclose | endif + endif +augroup END + +augroup go + + au! + au Filetype go command! -bang A call go#alternate#Switch(0, 'edit') + au Filetype go command! -bang AV call go#alternate#Switch(0, 'vsplit') + au Filetype go command! -bang AS call go#alternate#Switch(0, 'split') + au Filetype go command! -bang AT call go#alternate#Switch(0, 'tabe') + + au FileType go nmap dd (go-def-vertical) + au FileType go nmap dv (go-doc-vertical) + au FileType go nmap db (go-doc-browser) + + au FileType go nmap r (go-run) + au FileType go nmap t (go-test) + au FileType go nmap gt (go-coverage-toggle) + au FileType go nmap i (go-info) + au FileType go nmap l (go-metalinter) + au FileType go nmap :GoDecls + au FileType go nmap dr :GoDeclsDir + au FileType go imap :GoDecls + au FileType go imap dr :GoDeclsDir + au FileType go nmap rb :call build_go_files() + +augroup END + +" ale +:call extend(g:ale_linters, { + \"go": ['golint', 'go vet'], }) + + +" lua + + +" python +" vim-python +augroup vimrc-python + autocmd! + autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8 colorcolumn=79 + \ formatoptions+=croq softtabstop=4 + \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with +augroup END + +" jedi-vim +let g:jedi#popup_on_dot = 0 +let g:jedi#goto_assignments_command = "g" +let g:jedi#goto_definitions_command = "d" +let g:jedi#documentation_command = "K" +let g:jedi#usages_command = "n" +let g:jedi#rename_command = "r" +let g:jedi#show_call_signatures = "0" +let g:jedi#completions_command = "" +let g:jedi#smart_auto_mappings = 0 + +" ale +:call extend(g:ale_linters, { + \'python': ['flake8'], }) + +" vim-airline let g:airline#extensions#virtualenv#enabled = 1 -let g:airline#extensions#virtualenv#ft = ['python', 'markdown', 'dosini', 'text', 'make'] -" customize the statusline. -" let g:airline_section_w=%{virtualenv#statusline()} -" let g:airline_section_w = %{coc#status()}%{get(b:,'coc_current_function','')} +" Syntax highlight +let python_highlight_all = 1 -""" Telescope -" Find files using Telescope command-line sugar. + +" ruby +let g:rubycomplete_buffer_loading = 1 +let g:rubycomplete_classes_in_global = 1 +let g:rubycomplete_rails = 1 + +augroup vimrc-ruby + autocmd! + autocmd BufNewFile,BufRead *.rb,*.rbw,*.gemspec setlocal filetype=ruby + autocmd FileType ruby set tabstop=2|set shiftwidth=2|set expandtab softtabstop=2 +augroup END + +let g:tagbar_type_ruby = { + \ 'kinds' : [ + \ 'm:modules', + \ 'c:classes', + \ 'd:describes', + \ 'C:contexts', + \ 'f:methods', + \ 'F:singleton methods' + \ ] +\ } + +" RSpec.vim mappings +map t :call RunCurrentSpecFile() +map s :call RunNearestSpec() +map l :call RunLastSpec() +map a :call RunAllSpecs() + +" For ruby refactory if has('nvim') - nnoremap ff Telescope find_files - nnoremap fg Telescope live_grep - nnoremap fb Telescope buffers - nnoremap fh Telescope help_tags + runtime! macros/matchit.vim +else + packadd! matchit endif -""" TreeSitter -" if has('nvim') -" luafile ~/.vim/vimrc.d/treesitter.lua -" endif +" Ruby refactory +nnoremap rap :RAddParameter +nnoremap rcpc :RConvertPostConditional +nnoremap rel :RExtractLet +vnoremap rec :RExtractConstant +vnoremap relv :RExtractLocalVariable +nnoremap rit :RInlineTemp +vnoremap rrlv :RRenameLocalVariable +vnoremap rriv :RRenameInstanceVariable +vnoremap rem :RExtractMethod + + +" rust +" Vim racer +au FileType rust nmap gd (rust-def) +au FileType rust nmap gs (rust-def-split) +au FileType rust nmap gx (rust-def-vertical) +au FileType rust nmap gd (rust-doc) + + +" Zig +"disable format-on-save from `ziglang/zig.vim` +let g:zig_fmt_autosave = 0 +"don't show parse errors in a separate window + +let g:zig_fmt_parse_errors = 0 + +" ZLS uses `zig fmt` as the formatter. +" The Zig FAQ answers some questions about `zig fmt`: +" https://github.com/ziglang/zig/wiki/FAQ + +autocmd BufWritePre *.zig lua vim.lsp.buf.format() -""" todo-comments if has('nvim') - luafile ~/.vim/vimrc.d/todo-comments.lua + luafile ~/.vim/vimrc.d/zls.lua endif -""" toggleterm -if has('nvim') - lua require("toggleterm").setup() - nnoremap t :ToggleTerm direction=float - + +"***************************************************************************** +"***************************************************************************** + +"" Include user's local vim config +if filereadable(expand("~/.config/nvim/local_init.vim")) + source ~/.config/nvim/local_init.vim endif -""" venv-selector -" luafile ~/.vim/vimrc.d/venv-selector.lua -" nnoremap vs :VenvSelect +"***************************************************************************** +"" Convenience variables +"***************************************************************************** +" vim-airline +if !exists('g:airline_symbols') + let g:airline_symbols = {} +endif -""" vim-smoothie +if !exists('g:airline_powerline_fonts') + let g:airline#extensions#tabline#left_sep = ' ' + let g:airline#extensions#tabline#left_alt_sep = '|' + 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#extensions#branch#prefix = '⤴' "➔, ➥, ⎇ + let g:airline#extensions#readonly#symbol = '⊘' + let g:airline#extensions#linecolumn#prefix = '¶' + let g:airline#extensions#paste#symbol = 'ρ' + let g:airline_symbols.linenr = '␊' + let g:airline_symbols.branch = '⎇' + let g:airline_symbols.paste = 'ρ' + let g:airline_symbols.paste = 'Þ' + let g:airline_symbols.paste = '∥' + let g:airline_symbols.whitespace = 'Ξ' +else + let g:airline#extensions#tabline#left_sep = '' + let g:airline#extensions#tabline#left_alt_sep = '' -""""""""""""""""""""" -" Personal Settings " -""""""""""""""""""""" -set number + " powerline symbols + 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.linenr = '' +endif -colorscheme Czar +"***************************************************************************** +"" Personal +"***************************************************************************** hi Normal guibg=NONE ctermbg=NONE command! W w !sudo tee >/dev/null % @@ -433,10 +746,6 @@ set backupdir=~/.vim/tmp/backup// set directory=~/.vim/tmp/swap// set undodir=~/.vim/tmp/undo// -set completeopt-=preview - -"set list lcs=tab:\┆\ ,trail:▓,space:. -"set list lcs=tab:\⇥\ ,trail:▓,space:. set list lcs=tab:\⇥\ ,trail:▓ set colorcolumn=80 @@ -459,12 +768,3 @@ autocmd FileType terraform setlocal tabstop=4 autocmd FileType terraform setlocal shiftwidth=4 autocmd FileType helm setlocal expandtab -let g:indentLine_concealcursor = 'nc' - -""" Help Navigation -" autocmd FileType help nnoremap -" autocmd FileType help nnoremap -" autocmd FileType help nnoremap o /'\l\{2,\}' -" autocmd FileType help nnoremap O ?'\l\{2,\}' -" autocmd FileType help nnoremap s /\|\zs\S\+\ze\| -" autocmd FileType help nnoremap S ?\|\zs\S\+\ze\| diff --git a/any/vim/.vim/vimrc.d/zls.lua b/any/vim/.vim/vimrc.d/zls.lua new file mode 100644 index 0000000..a105d48 --- /dev/null +++ b/any/vim/.vim/vimrc.d/zls.lua @@ -0,0 +1,21 @@ +-- enable format-on-save from nvim-lspconfig + ZLS +-- +local lspconfig = require('lspconfig') +lspconfig.zls.setup { + -- Server-specific settings. See `:help lspconfig-setup` + + -- omit the following line if `zls` is in your PATH + -- cmd = { '/path/to/zls_executable' }, + -- There are two ways to set config options: + -- - edit your `zls.json` that applies to any editor that uses ZLS + -- - set in-editor config options with the `settings` field below. + -- + -- Further information on how to configure ZLS: + -- https://github.com/zigtools/zls/wiki/Configuration + -- settings = { + -- zls = { + -- -- omit the following line if `zig` is in your PATH + -- zig_exe_path = '/path/to/zig_executable', + -- } + -- } +} diff --git a/any/wezterm/.wezterm.lua b/any/wezterm/.wezterm.lua index 1c59565..a619ad0 100644 --- a/any/wezterm/.wezterm.lua +++ b/any/wezterm/.wezterm.lua @@ -95,6 +95,7 @@ config.inactive_pane_hsb = { brightness = 0.4, } config.window_background_opacity = 0.90 +config.window_decorations = "INTEGRATED_BUTTONS|RESIZE" config.use_fancy_tab_bar = false config.tab_bar_at_bottom = true config.hide_tab_bar_if_only_one_tab = true diff --git a/stowall.sh b/stowall.sh index f33c1e6..38b1b8e 100755 --- a/stowall.sh +++ b/stowall.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash mkdir -p $HOME/.ssh > /dev/null 2>&1 +mkdir -p $HOME/.gnupg > /dev/null 2>&1 +chmod 700 $HOME/.gnupg shopt -s extglob for x in {any,"${OSTYPE%%+([[:digit:].])}"}/*