From ea9a96ab61471cdcb58e20779e361d7e8ee2ef57 Mon Sep 17 00:00:00 2001 From: Alexander Karle Date: Tue, 29 May 2018 00:10:27 -0400 Subject: [PATCH] Vim tweaks 1. Using more system tools (fzf + rg for searching) 2. Key mappings for terminal feature (if there) 3. Markdown preferences --- vim/ftplugin/markdown.vim | 8 ++++++++ vim/vimrc | 27 +++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 vim/ftplugin/markdown.vim diff --git a/vim/ftplugin/markdown.vim b/vim/ftplugin/markdown.vim new file mode 100644 index 0000000..c231262 --- /dev/null +++ b/vim/ftplugin/markdown.vim @@ -0,0 +1,8 @@ +" wrap at word breaks +setlocal linebreak + +" have broken lines indent! +setlocal breakindent + +" spell check +set spell diff --git a/vim/vimrc b/vim/vimrc index bdfe093..ef3b41a 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -68,6 +68,12 @@ endif " Backup files to ~/.vim/swp if present, else . set directory=~/.vim/swp,. + +" Faster grepping! +if executable('rg') + set grepprg=rg\ --vimgrep\ --no-heading + set grepformat=%f:%l:%c:%m,%f:%l:%m +endif " }}} " PLUGIN RELATED SETTINGS {{{ @@ -110,8 +116,8 @@ if filereadable(expand("~/.vim/autoload/plug.vim")) " Simple latex tools Plug 'lervag/vimtex', { 'for': 'tex' } - " fzf -- fuzzy finder - "Plug 'junegunn/fzf.vim' + " fzf -- fuzzy finder (installed system wide) + Plug 'junegunn/fzf', { 'dir': '~/.fzf' } " surround for parens and such Plug 'tpope/vim-surround' @@ -119,6 +125,9 @@ if filereadable(expand("~/.vim/autoload/plug.vim")) " markdown rendering Plug 'suan/vim-instant-markdown' + " code-completion (leave commented usually -- slows down start) + " Plug 'Valloric/YouCompleteMe' + " List ends here. Plugins become visible to Vim after this call. call plug#end() " }}} @@ -234,6 +243,14 @@ nnoremap k nnoremap h nnoremap l +if(has('terminal')) + tnoremap j + tnoremap k + tnoremap h + tnoremap l + tnoremap t :tabnext +endif + "Map ctrl-p to toggle paste mode nnoremap :set paste! @@ -254,4 +271,10 @@ nnoremap D :set background=dark " toggle color column (to ensure short lines) nnoremap C :call ToggleColorColumn() + +" easier tab switching (good for use w terminal wher gt doesn't work) +nnoremap t :tabnext + +" call fzf! +nnoremap f :FZF " }}} -- libgit2 0.28.4