From 5977c59876bd41de06461b81b6758dafe097faed Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 10 May 2020 16:20:02 -0400 Subject: [PATCH] lots of good stuff --- general/functions.vim | 30 ++++++++++-------------------- general/settings.vim | 7 ++----- init.vim | 17 ++++------------- keys/mappings.vim | 2 +- keys/which-key.vim | 8 +++++--- plug-config/closetags.vim | 4 ++++ plug-config/floaterm.vim | 8 ++++++++ plug-config/fzf.vim | 11 +++++++++-- plug-config/vista.vim | 9 +++++++++ vim-plug/plugins.vim | 11 ++++++++--- 10 files changed, 60 insertions(+), 47 deletions(-) create mode 100644 plug-config/closetags.vim create mode 100644 plug-config/floaterm.vim create mode 100644 plug-config/vista.vim diff --git a/general/functions.vim b/general/functions.vim index bec4580b..31297c36 100644 --- a/general/functions.vim +++ b/general/functions.vim @@ -1,21 +1,11 @@ -" distinct highlight current, first and last match when searching -function! HLCurrent() abort - if exists("currmatch") - call matchdelete(currmatch) - endif - " only on cursor - let patt = '\c\%#'.@/ - " check prev and next match - let prevmatch = search(@/, 'bWn') - let nextmatch = search(@/, 'Wn') - " if on first or last match - if prevmatch == 0 || nextmatch == 0 - let currmatch = matchadd('EdgeSearch', patt, 101) - else - let currmatch = matchadd('IncSearch', patt, 101) - endif - redraw -endfunction +" Turn spellcheck on for markdown files +augroup auto_spellcheck + autocmd BufNewFile,BufRead *.md setlocal spell +augroup END + +" Remove trailing whitespaces automatically before save +augroup strip_ws + autocmd BufWritePre * call utils#stripTrailingWhitespaces() +augroup END + -nnoremap n n:call HLCurrent() -nnoremap N N:call HLCurrent() diff --git a/general/settings.vim b/general/settings.vim index be7e9acf..06b13ede 100644 --- a/general/settings.vim +++ b/general/settings.vim @@ -1,7 +1,5 @@ -" set leader key -"map -"nmap set iskeyword+=- " treat dash separated words as a word text object" +set formatoptions-=cro " Stop newline continution of comments if !exists('g:vscode') syntax enable " Enables syntax highlighing @@ -35,7 +33,6 @@ if !exists('g:vscode') set signcolumn=yes " Always show the signcolumn, otherwise it would shift the text each time set updatetime=300 " Faster completion set timeoutlen=100 " By default timeoutlen is 1000 ms - set formatoptions-=cro " Stop newline continution of comments set clipboard=unnamedplus " Copy paste between vim and everything else set incsearch set guifont=Hack\ Nerd\ Font @@ -44,7 +41,7 @@ if !exists('g:vscode') " set autochdir " Your working directory will always be the same as your working directory " set foldcolumn=2 " Folding abilities - au! BufWritePost $MYVIMRC source % " auto source when writing to init.vm alternatively you can run :source $MYVIMRC + " au! BufWritePost $MYVIMRC source % " auto source when writing to init.vm alternatively you can run :source $MYVIMRC autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o diff --git a/init.vim b/init.vim index bb394e2c..f819ecd4 100644 --- a/init.vim +++ b/init.vim @@ -31,20 +31,11 @@ else source $HOME/.config/nvim/plug-config/sneak.vim source $HOME/.config/nvim/plug-config/goyo.vim source $HOME/.config/nvim/plug-config/vim-rooter.vim - "source $HOME/.config/nvim/plug-config/easymotion.vim source $HOME/.config/nvim/plug-config/start-screen.vim source $HOME/.config/nvim/plug-config/signify.vim + source $HOME/.config/nvim/plug-config/closetags.vim + source $HOME/.config/nvim/plug-config/floaterm.vim + source $HOME/.config/nvim/plug-config/vista.vim luafile $HOME/.config/nvim/lua/plug-colorizer.lua + "source $HOME/.config/nvim/plug-config/easymotion.vim endif - -let g:floaterm_wintype='normal' -let g:floaterm_height=6 -let g:floaterm_keymap_new = '' -let g:floaterm_keymap_prev = '' -let g:floaterm_keymap_next = '' -let g:floaterm_keymap_toggle = '' - -let g:pear_tree_smart_openers = 1 -let g:pear_tree_smart_closers = 1 -let g:pear_tree_smart_backspace = 1 - diff --git a/keys/mappings.vim b/keys/mappings.vim index 79311e5f..c24dbdea 100644 --- a/keys/mappings.vim +++ b/keys/mappings.vim @@ -1,6 +1,6 @@ " Leader key let mapleader=" " -let localleader=" " +" let localleader=" " nnoremap " Better indenting diff --git a/keys/which-key.vim b/keys/which-key.vim index d37592e4..7b472b4b 100644 --- a/keys/which-key.vim +++ b/keys/which-key.vim @@ -85,6 +85,7 @@ let g:which_key_map.l = { \ 't' : ['(coc-type-definition)' , 'type definition'], \ 'u' : [':CocListResume' , 'resume list'], \ 'U' : [':CocUpdate' , 'update CoC'], + \ 'v' : [':Vista!!' , 'tag viewer'], \ 'z' : [':CocDisable' , 'disable CoC'], \ 'Z' : [':CocEnable' , 'enable CoC'], \ } @@ -93,12 +94,13 @@ let g:which_key_map.l = { " t is for toggle let g:which_key_map.t = { \ 'name' : '+toggle' , + \ 'c' : [':ColorizerToggle' , 'colorizer'], \ 'e' : [':CocCommand explorer' , 'explorer'], \ 'n' : [':set nonumber!' , 'line-numbers'], - \ 'r' : [':set norelativenumber!' , 'rel-line-numbers'], - \ 's' : [':let @/ = ""' , 'remove-search-highlight'], - \ 'c' : [':ColorizerToggle' , 'colorizer'], + \ 'r' : [':set norelativenumber!' , 'relative line nums'], + \ 's' : [':let @/ = ""' , 'remove search highlight'], \ 't' : [':FloatermToggle' , 'terminal'], + \ 'v' : [':Vista!!' , 'tag viewer'], \ } diff --git a/plug-config/closetags.vim b/plug-config/closetags.vim new file mode 100644 index 00000000..e3e964bc --- /dev/null +++ b/plug-config/closetags.vim @@ -0,0 +1,4 @@ +let g:closetag_filenames = '*.html,*.xhtml,*.phtml' +let g:closetag_xhtml_filenames = '*.xhtml,*.jsx,*.js' +let g:closetag_filetypes = 'html,xhtml,phtml,javascript' + diff --git a/plug-config/floaterm.vim b/plug-config/floaterm.vim new file mode 100644 index 00000000..b0ee674c --- /dev/null +++ b/plug-config/floaterm.vim @@ -0,0 +1,8 @@ + +" let g:floaterm_wintype='normal' +" let g:floaterm_height=6 + +let g:floaterm_keymap_toggle = '' +let g:floaterm_keymap_next = '' +let g:floaterm_keymap_prev = '' +let g:floaterm_keymap_new = '' diff --git a/plug-config/fzf.vim b/plug-config/fzf.vim index c7ad00a2..c715dab5 100644 --- a/plug-config/fzf.vim +++ b/plug-config/fzf.vim @@ -47,10 +47,17 @@ command! -bang -nargs=? -complete=dir Files " Get text in files with Rg +" command! -bang -nargs=* Rg +" \ call fzf#vim#grep( +" \ "rg --column --line-number --no-heading --color=always --smart-case --glob '!.git/**' ".shellescape(), 1, + + " Make Ripgrep ONLY search file contents and not filenames command! -bang -nargs=* Rg \ call fzf#vim#grep( - \ "rg --column --line-number --no-heading --color=always --smart-case --glob '!.git/**' ".shellescape(), 1, - \ fzf#vim#with_preview(), 0) + \ 'rg --column --line-number --hidden --smart-case --no-heading --color=always '.shellescape(), 1, + \ 0 ? fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}, 'up:60%') + \ : fzf#vim#with_preview({'options': '--delimiter : --nth 4.. -e'}, 'right:50%', '?'), + \ 0) \ fzf#vim#with_preview(), 0) " Ripgrep advanced function! RipgrepFzf(query, fullscreen) diff --git a/plug-config/vista.vim b/plug-config/vista.vim new file mode 100644 index 00000000..eefc8366 --- /dev/null +++ b/plug-config/vista.vim @@ -0,0 +1,9 @@ +let g:vista_default_executive = 'coc' +let g:vista_fzf_preview = ['right:50%'] + +let g:vista#renderer#enable_icon = 1 + +let g:vista#renderer#icons = { +\ "function": "\uf794", +\ "variable": "\uf71b", +\ } diff --git a/vim-plug/plugins.vim b/vim-plug/plugins.vim index 583800ee..0094e9a2 100644 --- a/vim-plug/plugins.vim +++ b/vim-plug/plugins.vim @@ -22,6 +22,8 @@ call plug#begin('~/.config/nvim/autoload/plugged') Plug 'tpope/vim-commentary' " Have the file system follow you around Plug 'airblade/vim-rooter' + " auto set indent settings + Plug 'tpope/vim-sleuth' if exists('g:vscode') " Easy motion for VSCode @@ -40,8 +42,9 @@ call plug#begin('~/.config/nvim/autoload/plugged') " Cool Icons Plug 'ryanoasis/vim-devicons' " Auto pairs for '(' '[' '{' - " Plug 'jiangmiao/auto-pairs' - Plug 'tmsvg/pear-tree' + Plug 'jiangmiao/auto-pairs' + " Closetags + Plug 'alvan/vim-closetag' " Themes Plug 'christianchiarulli/onedark.vim' " Plug 'kaicataldo/material.vim' @@ -68,7 +71,7 @@ call plug#begin('~/.config/nvim/autoload/plugged') Plug 'mhinz/vim-startify' " Vista Plug 'liuchengxu/vista.vim' - " Help + " See what keys do like in emacs Plug 'liuchengxu/vim-which-key' " Zen mode Plug 'junegunn/goyo.vim' @@ -78,6 +81,8 @@ call plug#begin('~/.config/nvim/autoload/plugged') " Plug 'SirVer/ultisnips' " Better Comments Plug 'jbgutierrez/vim-better-comments' + " Echo doc + " Plug 'Shougo/echodoc.vim' endif