浏览代码

lots of good stuff

Chris 5 年之前
父节点
当前提交
5977c59876
共有 10 个文件被更改,包括 60 次插入47 次删除
  1. 10 20
      general/functions.vim
  2. 2 5
      general/settings.vim
  3. 4 13
      init.vim
  4. 1 1
      keys/mappings.vim
  5. 5 3
      keys/which-key.vim
  6. 4 0
      plug-config/closetags.vim
  7. 8 0
      plug-config/floaterm.vim
  8. 9 2
      plug-config/fzf.vim
  9. 9 0
      plug-config/vista.vim
  10. 8 3
      vim-plug/plugins.vim

+ 10 - 20
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 <silent> n n:call HLCurrent()<cr>
-nnoremap <silent> N N:call HLCurrent()<cr>

+ 2 - 5
general/settings.vim

@@ -1,7 +1,5 @@
-" set leader key
-"map <Space> <Leader>
-"nmap <space> <leader>
 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
 
 

+ 4 - 13
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    = '<F7>'
-let g:floaterm_keymap_prev   = '<F8>'
-let g:floaterm_keymap_next   = '<F9>'
-let g:floaterm_keymap_toggle = '<F12>'
-
-let g:pear_tree_smart_openers = 1
-let g:pear_tree_smart_closers = 1
-let g:pear_tree_smart_backspace = 1
-

+ 1 - 1
keys/mappings.vim

@@ -1,6 +1,6 @@
 " Leader key
 let mapleader=" "
-let localleader=" "
+" let localleader=" "
 nnoremap <Space> <Nop>
 
 " Better indenting

+ 5 - 3
keys/which-key.vim

@@ -85,6 +85,7 @@ let g:which_key_map.l = {
       \ 't' : ['<Plug>(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'],
       \ }
 
 

+ 4 - 0
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'
+

+ 8 - 0
plug-config/floaterm.vim

@@ -0,0 +1,8 @@
+
+" let g:floaterm_wintype='normal'
+" let g:floaterm_height=6
+
+let g:floaterm_keymap_toggle = '<F1>'
+let g:floaterm_keymap_next   = '<F2>'
+let g:floaterm_keymap_prev   = '<F3>'
+let g:floaterm_keymap_new    = '<F4>'

+ 9 - 2
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(<q-args>), 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(<q-args>), 1,
-  \   fzf#vim#with_preview(), <bang>0)
+  \   'rg --column --line-number --hidden --smart-case --no-heading --color=always '.shellescape(<q-args>), 1,
+  \   <bang>0 ? fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}, 'up:60%')
+  \           : fzf#vim#with_preview({'options': '--delimiter : --nth 4.. -e'}, 'right:50%', '?'),
+  \   <bang>0) \   fzf#vim#with_preview(), <bang>0)
 
 " Ripgrep advanced
 function! RipgrepFzf(query, fullscreen)

+ 9 - 0
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",
+\  }

+ 8 - 3
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