diff options
author | gxlin <[email protected]> | 2021-03-16 19:47:31 +0800 |
---|---|---|
committer | gxlin <[email protected]> | 2021-03-18 23:57:40 +0800 |
commit | bd166c76b65006f2945d5072fe07e4777c085eff (patch) | |
tree | 1338f3b55e33d4f42bdc12f36d5a50557c01e70f | |
parent | 06929ba11c0ef83da2462f60ee8c6dc07a2aa9a4 (diff) | |
download | dotfiles-bd166c76b65006f2945d5072fe07e4777c085eff.tar.gz dotfiles-bd166c76b65006f2945d5072fe07e4777c085eff.tar.bz2 dotfiles-bd166c76b65006f2945d5072fe07e4777c085eff.zip |
More vim config
-rw-r--r-- | .gitconfig | 2 | ||||
-rw-r--r-- | .tmux.conf | 16 | ||||
-rw-r--r-- | .vim/init.vim | 93 | ||||
-rw-r--r-- | .vim/plugins/ack.vim | 7 | ||||
-rw-r--r-- | .vim/plugins/ime.vim | 4 | ||||
-rw-r--r-- | .vim/plugins/leaderf.vim | 8 | ||||
-rw-r--r-- | .vim/plugins/ledger.vim | 14 | ||||
-rw-r--r-- | .vim/plugins/markdown.vim | 4 | ||||
-rw-r--r-- | .vim/plugins/misc.vim | 6 | ||||
-rw-r--r-- | .vim/plugins/slime.vim | 15 | ||||
-rw-r--r-- | .vim/plugins/vimspector.vim | 68 | ||||
-rw-r--r-- | .vim/plugins/vimwiki.vim | 2 | ||||
-rw-r--r-- | .vim/plugins/youcompleteme.vim | 8 | ||||
-rw-r--r-- | .vimrc | 83 | ||||
-rw-r--r-- | install.sh | 2 |
15 files changed, 221 insertions, 111 deletions
@@ -1,7 +1,5 @@ [user] email = [email protected] name = gxlin -[http] - proxy = http://127.0.0.1:7890 [init] defaultBranch = main @@ -1,19 +1,19 @@ # modify the prefix -unbind ^b -set -g prefix 'M-`' +# unbind ^b +# set -g prefix 'M-`' # vim mode setw -g mode-keys vi # copy and paste like vim -bind -T copy-mode-vi 'v' send -X begin-selection -bind -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" +# bind -T copy-mode-vi 'v' send -X begin-selection +# bind -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" # swtich between pane -bind h select-pane -L -bind j select-pane -D -bind k select-pane -U -bind l select-pane -R +# bind h select-pane -L +# bind j select-pane -D +# bind k select-pane -U +# bind l select-pane -R # resize the pane # bind h resize-pane -L 10 diff --git a/.vim/init.vim b/.vim/init.vim index 2a5d6df..bd00085 100644 --- a/.vim/init.vim +++ b/.vim/init.vim @@ -1 +1,94 @@ +" General Config + +set nocompatible +set number +set backspace=indent,eol,start +syntax on +set encoding=utf-8 +set t_Co=256 +set showcmd +set autoread +set mouse=a +filetype indent on +set modeline +set textwidth=72 +set formatoptions+=mB +set formatoptions-=t +set secure + +set hidden + +set completeopt=menu,menuone + +if $COLORTERM is 'truecolor' + set termguicolors +endif + +" MacVim + +if has("gui_running") + if has("gui_macvim") + set guifont=Monaco:h15 + set noimdisable + set transparency=10 + endif +endif + +if has("macunix") +endif + +" Identation + +set autoindent +set tabstop=4 +set shiftwidth=4 +set expandtab +set softtabstop=4 + +autocmd FileType html setlocal shiftwidth=2 softtabstop=2 expandtab +autocmd FileType css setlocal shiftwidth=2 softtabstop=2 expandtab +autocmd FileType javascript setlocal shiftwidth=2 softtabstop=2 expandtab + +set wrap +"set nowrap +"set wrapmargin=4 +set scrolloff=5 +"set sidescrolloff=5 +set laststatus=2 +set ruler + +set hlsearch +set incsearch +set ignorecase +set smartcase + +" Completion + +set wildmenu +set wildmode=longest:list,full +set wildignore=*.o,*.obj,*~ +set wildignore+=*DS_Store* +set wildignore+=*.gem +set wildignore+=*.png,*.jpg,*.gif + +" change default directory +let s:vim_swapfiles_dir = expand('~/.vim/.swp/') +if !isdirectory(s:vim_swapfiles_dir) + silent! call mkdir(s:vim_swapfiles_dir, 'p') +endif +set directory=~/.vim/.swp// + +" tags +set tags=./.tags;,.tags + +" mapping +let mapleader=',' " change the key <leader> +nnoremap <leader>n :bn<CR> +nnoremap <leader>p :bp<CR> + source ~/.dotfiles/.vim/plugins/init.vim + +silent colorscheme onehalfdark + +highlight Pmenu ctermbg=grey +set exrc diff --git a/.vim/plugins/ack.vim b/.vim/plugins/ack.vim deleted file mode 100644 index dd96e47..0000000 --- a/.vim/plugins/ack.vim +++ /dev/null @@ -1,7 +0,0 @@ -Plug 'mileszs/ack.vim' - -if executable('ag') - let g:ackprg = 'ag --vimgrep' -endif -cnoreabbrev Ack Ack! -nnoremap <Leader>a :Ack!<Space> diff --git a/.vim/plugins/ime.vim b/.vim/plugins/ime.vim new file mode 100644 index 0000000..de7dcf2 --- /dev/null +++ b/.vim/plugins/ime.vim @@ -0,0 +1,4 @@ +Plug 'pi314/ime.vim' +Plug 'pi314/ime-phonetic.vim' + +let g:ime_plugins = ['pinyin'] diff --git a/.vim/plugins/leaderf.vim b/.vim/plugins/leaderf.vim index 4d6d0ac..584322a 100644 --- a/.vim/plugins/leaderf.vim +++ b/.vim/plugins/leaderf.vim @@ -1,10 +1,8 @@ -Plug 'Yggdroot/LeaderF', {'do': './install.sh'} +Plug 'Yggdroot/LeaderF', {'do': ':LeaderfInstallCExtension'} " " Show icons, icons are shown by default let g:Lf_ShowDevIcons = 1 -" For GUI vim, the icon font can be specify like this, for example -let g:Lf_DevIconsFont = "DejaVuSansMono Nerd Font Mono" let g:Lf_WindowPosition = 'popup' let g:Lf_ShortcutF = "<leader>ff" @@ -12,11 +10,13 @@ noremap <leader>fb :<C-U><C-R>=printf("Leaderf buffer %s", "")<CR><CR> noremap <leader>fm :<C-U><C-R>=printf("Leaderf mru %s", "")<CR><CR> noremap <leader>ft :<C-U><C-R>=printf("Leaderf bufTag %s", "")<CR><CR> noremap <leader>fl :<C-U><C-R>=printf("Leaderf line %s", "")<CR><CR> +noremap <leader>fr :<C-U><C-R>=printf("Leaderf rg %s", "")<CR><CR> noremap <C-B> :<C-U><C-R>=printf("Leaderf! rg --current-buffer -e %s ", expand("<cword>"))<CR> noremap <C-F> :<C-U><C-R>=printf("Leaderf! rg -e %s ", expand("<cword>"))<CR> " search visually selected text literally xnoremap gf :<C-U><C-R>=printf("Leaderf! rg -F -e %s ", leaderf#Rg#visual())<CR> noremap go :<C-U>Leaderf! rg --recall<CR> -let g:Lf_RootMarkers = ['.project', '.root', '.svn', '.git'] + let g:Lf_WorkingDirectoryMode = 'AF' +let g:Lf_RootMarkers = ['.project', '.root', '.svn', '.git', '.hg'] diff --git a/.vim/plugins/ledger.vim b/.vim/plugins/ledger.vim new file mode 100644 index 0000000..b3a1e25 --- /dev/null +++ b/.vim/plugins/ledger.vim @@ -0,0 +1,14 @@ +Plug 'ledger/vim-ledger', {'for': 'ledger'} + +let g:ledger_bin = 'ledger' +let g:ledger_align_at = 50 +let g:ledger_commodity_before = 0 + +au FileType ledger call s:ledger_keymap() + +function! s:ledger_keymap() abort + noremap { ?^\d<CR> + noremap } /^\d<CR> + inoremap <silent> <Tab> <C-r>=ledger#autocomplete_and_align()<CR> + vnoremap <silent> <Tab> :LedgerAlign<CR> +endfunction diff --git a/.vim/plugins/markdown.vim b/.vim/plugins/markdown.vim new file mode 100644 index 0000000..1e12dad --- /dev/null +++ b/.vim/plugins/markdown.vim @@ -0,0 +1,4 @@ +Plug 'iamcco/markdown-preview.nvim', { + \ 'do': {-> mkdp#util#install()}, + \ 'for': ['markdown', 'vim-plug'] + \ } diff --git a/.vim/plugins/misc.vim b/.vim/plugins/misc.vim index a07c23c..5067f5a 100644 --- a/.vim/plugins/misc.vim +++ b/.vim/plugins/misc.vim @@ -9,11 +9,7 @@ let g:asyncrun_bell = 1 " the bell rings when the task is done " use f10 to open/close asyncrun quickfix window nnoremap <F10> :call asyncrun#quickfix_toggle(6)<cr> -Plug 'puremourning/vimspector' - -let g:vimspector_enable_mappings = 'HUMAN' - Plug 'mhinz/vim-signify' Plug 'tpope/vim-unimpaired' Plug 'godlygeek/tabular' -Plug 'ledger/vim-ledger', {'for': 'ledger'} +Plug 'sonph/onehalf', { 'rtp': 'vim' } diff --git a/.vim/plugins/slime.vim b/.vim/plugins/slime.vim new file mode 100644 index 0000000..0989a66 --- /dev/null +++ b/.vim/plugins/slime.vim @@ -0,0 +1,15 @@ +Plug 'jpalardy/vim-slime', { + \'on': [ + \'<Plug>SlimeRegionSend', + \'<Plug>SlimeParagraphSend', + \'<Plug>SlimeConfig' + \] + \} + +let g:slime_no_mappings = 1 + +xmap <c-c><c-c> <Plug>SlimeRegionSend +nmap <c-c><c-c> <Plug>SlimeParagraphSend +nmap <c-c>v <Plug>SlimeConfig + +let g:slime_target = 'tmux' diff --git a/.vim/plugins/vimspector.vim b/.vim/plugins/vimspector.vim new file mode 100644 index 0000000..a39d4bd --- /dev/null +++ b/.vim/plugins/vimspector.vim @@ -0,0 +1,68 @@ +Plug 'puremourning/vimspector', { 'on': '<Plug>VimspectorContinue' } + +let g:vimspector_install_gadgets = ['debugpy'] + +nmap <silent> <Leader>dc <Plug>VimspectorContinue +nmap <silent> <Leader>dq <Plug>VimspectorStop +nmap <silent> <Leader>db <Plug>VimspectorToggleBreakpoint +nmap <silent> <Leader>dn <Plug>VimspectorStepOver +nmap <silent> <Leader>ds <Plug>VimspectorStepInto +nmap <silent> <Leader>df <Plug>VimspectorStepOut +nmap <silent> <Leader>di <Plug>VimspectorBalloonEval +xmap <silent> <Leader>di <Plug>VimspectorBalloonEval + +let s:mapped = {} + +function! s:set_debug_keymaps() abort + if has_key(s:mapped, string(bufnr())) + return + endif + + " nmap <silent> <buffer> c <Plug>VimspectorContinue + " nmap <silent> <buffer> q <Plug>VimspectorStop + " nmap <silent> <buffer> b <Plug>VimspectorToggleBreakpoint + nmap <silent> <buffer> m <Plug>VimspectorStepOver + " nmap <silent> <buffer> s <Plug>VimspectorStepInto + " nmap <silent> <buffer> f <Plug>VimspectorStepOut + " nmap <silent> <buffer> i <Plug>VimspectorBalloonEval + " xmap <silent> <buffer> i <Plug>VimspectorBalloonEval + + let s:mapped[string(bufnr())] = {'modifiable': &modifiable} + + setlocal nomodifiable +endfunction + +function! s:unset_debug_keymaps() abort + let original_buf = bufnr() + let hidden = &hidden + + try + set hidden + for bufnr in keys(s:mapped) + try + execute 'noautocmd buffer' bufnr + " silent! nunmap <buffer> c + " silent! nunmap <buffer> q + " silent! nunmap <buffer> b + silent! nunmap <buffer> m + " silent! nunmap <buffer> s + " silent! nunmap <buffer> f + " silent! nunmap <buffer> i + " silent! xunmap <buffer> i + + let &l:modifiable = s:mapped[bufnr]['modifiable'] + endtry + endfor + finally + execute 'noautocmd buffer' original_buf + let &hidden = hidden + endtry + + let s:mapped = {} +endfunction + +augroup CustomMappings + au! + autocmd User VimspectorJumpedToFrame call s:set_debug_keymaps() + autocmd User VimspectorDebugEnded call s:unset_debug_keymaps() +augroup end diff --git a/.vim/plugins/vimwiki.vim b/.vim/plugins/vimwiki.vim index 226e135..f2930e4 100644 --- a/.vim/plugins/vimwiki.vim +++ b/.vim/plugins/vimwiki.vim @@ -2,3 +2,5 @@ Plug 'vimwiki/vimwiki' let g:vimwiki_list = [{'path': '~/Documents/notes', \ 'syntax': 'markdown', 'ext': '.md'}] + +au FileType vimwiki setlocal textwidth=72 diff --git a/.vim/plugins/youcompleteme.vim b/.vim/plugins/youcompleteme.vim index 449e8ff..e289214 100644 --- a/.vim/plugins/youcompleteme.vim +++ b/.vim/plugins/youcompleteme.vim @@ -1,4 +1,7 @@ -Plug 'Valloric/YouCompleteMe', {'do': 'python3 ./install.py --clangd-completer'} +Plug 'Valloric/YouCompleteMe', { + \ 'do': 'python3 ./install.py --clangd-completer', + \ 'for': ['python', 'cpp'] + \ } let g:ycm_server_log_level = 'info' let g:ycm_add_preview_to_completeopt = 0 @@ -10,3 +13,6 @@ let g:ycm_filetype_whilelist = { \ "c": 1, "cpp": 1, "sh": 1, "zsh": 1, \ "python": 1, \ } +let g:ycm_filetype_blacklist = { + \ 'ledger': 1 + \ } @@ -1,83 +0,0 @@ -" General Config - -set nocompatible -set number -set backspace=indent,eol,start -syntax on -set encoding=utf-8 -set t_Co=256 -set showcmd -set autoread -set mouse=a -filetype indent on - -set hidden - -set completeopt=menu,menuone - -" MacVim - -if has("gui_running") - if has("gui_macvim") - set guifont=Monaco:h16 - set transparency=10 - endif -endif - -if has("macunix") -endif - -" Identation - -set autoindent -set tabstop=4 -set shiftwidth=4 -set expandtab -set softtabstop=4 - -autocmd FileType html setlocal shiftwidth=2 softtabstop=2 expandtab -autocmd FileType css setlocal shiftwidth=2 softtabstop=2 expandtab -autocmd FileType javascript setlocal shiftwidth=2 softtabstop=2 expandtab - -set wrap -"set nowrap -"set wrapmargin=4 -set scrolloff=5 -"set sidescrolloff=5 -set laststatus=2 -set ruler - -set hlsearch -set incsearch -set ignorecase -set smartcase - -" Completion - -set wildmenu -set wildmode=longest:list,full -set wildignore=*.o,*.obj,*~ -set wildignore+=*DS_Store* -set wildignore+=*.gem -set wildignore+=*.png,*.jpg,*.gif - -" change default directory -let s:vim_swapfiles_dir = expand('~/.vim/.swp/') -if !isdirectory(s:vim_swapfiles_dir) - silent! call mkdir(s:vim_swapfiles_dir, 'p') -endif -set directory=~/.vim/.swp// - -" tags -set tags=./.tags;,.tags - -" mapping -let mapleader=',' " change the key <leader> -nnoremap <leader>n :bn<CR> -nnoremap <leader>p :bp<CR> -nnoremap <leader>d :bd<CR> - -if filereadable(expand('~/.dotfiles/.vim/init.vim')) - exec "source " . '~/.dotfiles/.vim/init.vim' -endif - @@ -24,13 +24,13 @@ get_dotfiles() { cd "$HOME" rm -rf .vimrc .tmux.conf .bashrc .zshrc .i3/config .emacs.d/init.el .gitconfig - ln -s ~/.dotfiles/.vimrc .vimrc ln -s ~/.dotfiles/.tmux.conf .tmux.conf ln -s ~/.dotfiles/.bashrc .bashrc ln -s ~/.dotfiles/.zshrc .zshrc ln -s ~/.dotfiles/.emacs.d/init.el .emacs.d/init.el ln -s ~/.dotfiles/.i3/config .i3/config ln -s ~/.dotfiles/.gitconfig .gitconfig + echo "source ~/.dotfiles/.vim/init.vim" > ~/.vimrc ) } |