summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coc-settings.json9
-rw-r--r--keys/which-key.vim50
-rw-r--r--plug-config/coc.vim58
-rw-r--r--snips/markdown.snippets9
-rw-r--r--vim-plug/plugins.vim2
5 files changed, 81 insertions, 47 deletions
diff --git a/coc-settings.json b/coc-settings.json
index 623bb95e..7409a4d4 100644
--- a/coc-settings.json
+++ b/coc-settings.json
@@ -40,7 +40,14 @@
"python.linting.pylintEnabled": true,
// snippets
- "snippets.ultisnips.directories": ["UltiSnips", "~/.config/nvim/utils/snips"],
+ // "snippets.ultisnips.directories": ["UltiSnips"],
+ "snippets.userSnippetsDirectory": "~/.config/nvim/snips",
+
+ // emmet
+ "emmet.includeLanguages": {
+ "vue-html": "html",
+ "javascript": "javascriptreact"
+ },
// explorer
"explorer.width": 30,
diff --git a/keys/which-key.vim b/keys/which-key.vim
index a7ff908a..19dfbbc7 100644
--- a/keys/which-key.vim
+++ b/keys/which-key.vim
@@ -73,31 +73,32 @@ let g:which_key_map.b = {
" s is for search
let g:which_key_map.s = {
\ 'name' : '+search' ,
- \ '/' : [':History/' , 'history'],
- \ ';' : [':Commands' , 'commands'],
- \ 'a' : [':Ag' , 'text Ag'],
- \ 'b' : [':BLines' , 'current buffer'],
- \ 'B' : [':Buffers' , 'open buffers'],
- \ 'c' : [':Commits' , 'commits'],
- \ 'C' : [':BCommits' , 'buffer commits'],
- \ 'f' : [':Files' , 'files'],
- \ 'g' : [':GFiles' , 'git files'],
- \ 'G' : [':GFiles?' , 'modified git files'],
- \ 'h' : [':History' , 'file history'],
- \ 'H' : [':History:' , 'command history'],
- \ 'l' : [':Lines' , 'lines'] ,
- \ 'm' : [':Marks' , 'marks'] ,
- \ 'M' : [':Maps' , 'normal maps'] ,
- \ 'p' : [':Helptags' , 'help tags'] ,
- \ 'P' : [':Tags' , 'project tags'],
- \ 's' : [':Snippets' , 'snippets'],
- \ 'S' : [':Colors' , 'color schemes'],
- \ 't' : [':Rg' , 'text Rg'],
- \ 'T' : [':BTags' , 'buffer tags'],
- \ 'w' : [':Windows' , 'search windows'],
- \ 'y' : [':Filetypes' , 'file types'],
- \ 'z' : [':FZF' , 'FZF'],
+ \ '/' : [':History/' , 'history'],
+ \ ';' : [':Commands' , 'commands'],
+ \ 'a' : [':Ag' , 'text Ag'],
+ \ 'b' : [':BLines' , 'current buffer'],
+ \ 'B' : [':Buffers' , 'open buffers'],
+ \ 'c' : [':Commits' , 'commits'],
+ \ 'C' : [':BCommits' , 'buffer commits'],
+ \ 'f' : [':Files' , 'files'],
+ \ 'g' : [':GFiles' , 'git files'],
+ \ 'G' : [':GFiles?' , 'modified git files'],
+ \ 'h' : [':History' , 'file history'],
+ \ 'H' : [':History:' , 'command history'],
+ \ 'l' : [':Lines' , 'lines'] ,
+ \ 'm' : [':Marks' , 'marks'] ,
+ \ 'M' : [':Maps' , 'normal maps'] ,
+ \ 'p' : [':Helptags' , 'help tags'] ,
+ \ 'P' : [':Tags' , 'project tags'],
+ \ 's' : [':CocList snippets' , 'snippets'],
+ \ 'S' : [':Colors' , 'color schemes'],
+ \ 't' : [':Rg' , 'text Rg'],
+ \ 'T' : [':BTags' , 'buffer tags'],
+ \ 'w' : [':Windows' , 'search windows'],
+ \ 'y' : [':Filetypes' , 'file types'],
+ \ 'z' : [':FZF' , 'FZF'],
\ }
+ " \ 's' : [':Snippets' , 'snippets'],
" g is for git
let g:which_key_map.g = {
@@ -156,6 +157,7 @@ let g:which_key_map.l = {
\ 'r' : ['<Plug>(coc-rename)' , 'rename'],
\ 'R' : ['<Plug>(coc-references)' , 'references'],
\ 's' : [':CocList -I symbols' , 'references'],
+ \ 'S' : [':CocList snippets' , 'snippets'],
\ 't' : ['<Plug>(coc-type-definition)' , 'type definition'],
\ 'u' : [':CocListResume' , 'resume list'],
\ 'U' : [':CocUpdate' , 'update CoC'],
diff --git a/plug-config/coc.vim b/plug-config/coc.vim
index 709f971d..561cc0e9 100644
--- a/plug-config/coc.vim
+++ b/plug-config/coc.vim
@@ -1,25 +1,24 @@
- " let g:coc_global_extensions = [
- " \ 'coc-snippets',
- " \ 'coc-actions',
- " \ 'coc-emmet',
- " \ 'coc-pairs',
- " \ 'coc-tsserver',
- " \ 'coc-floaterm',
- " \ 'coc-html',
- " \ 'coc-css',
- " \ 'coc-cssmodules',
- " \ 'coc-yaml',
- " \ 'coc-python',
- " \ 'coc-explorer',
- " \ 'coc-svg',
- " \ 'coc-prettier',
- " \ 'coc-vimlsp',
- " \ 'coc-flutter',
- " \ 'coc-xml',
- " \ 'coc-yank',
- " \ 'coc-json',
- " \ 'coc-vimtex',
- " \ ]
+ let g:coc_global_extensions = [
+ \ 'coc-snippets',
+ \ 'coc-actions',
+ \ 'coc-emmet',
+ \ 'coc-pairs',
+ \ 'coc-tsserver',
+ \ 'coc-floaterm',
+ \ 'coc-html',
+ \ 'coc-css',
+ \ 'coc-cssmodules',
+ \ 'coc-yaml',
+ \ 'coc-python',
+ \ 'coc-explorer',
+ \ 'coc-svg',
+ \ 'coc-prettier',
+ \ 'coc-vimlsp',
+ \ 'coc-xml',
+ \ 'coc-yank',
+ \ 'coc-json',
+ \ 'coc-vimtex',
+ \ ]
" Use tab for trigger completion with characters ahead and navigate.
inoremap <silent><expr> <TAB>
@@ -155,3 +154,18 @@ let g:coc_explorer_global_presets = {
" nmap <space>f :CocCommand explorer --preset floatingRightside<CR>
autocmd BufEnter * if (winnr("$") == 1 && &filetype == 'coc-explorer') | q | endif
+" Snippets
+" Use <C-l> for trigger snippet expand.
+imap <C-l> <Plug>(coc-snippets-expand)
+
+" Use <C-j> for select text for visual placeholder of snippet.
+vmap <C-j> <Plug>(coc-snippets-select)
+
+" Use <C-j> for jump to next placeholder, it's default of coc.nvim
+let g:coc_snippet_next = '<c-j>'
+
+" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
+let g:coc_snippet_prev = '<c-k>'
+
+" Use <C-j> for both expand and jump (make expand higher priority.)
+imap <C-j> <Plug>(coc-snippets-expand-jump)
diff --git a/snips/markdown.snippets b/snips/markdown.snippets
new file mode 100644
index 00000000..cdfbe5cc
--- /dev/null
+++ b/snips/markdown.snippets
@@ -0,0 +1,9 @@
+snippet meta(data)? "Markdown metadata front matter" br
+---
+title: $1
+date: "`!v strftime("%Y-%m-%d")`"
+image: "$2"
+author: "$3"
+tags: [$4]
+---
+endsnippet
diff --git a/vim-plug/plugins.vim b/vim-plug/plugins.vim
index ec3e7a15..64cf2416 100644
--- a/vim-plug/plugins.vim
+++ b/vim-plug/plugins.vim
@@ -81,6 +81,7 @@ call plug#begin('~/.config/nvim/autoload/plugged')
" Making stuff
Plug 'neomake/neomake'
" Snippets TODO fix TAB hijack
+ Plug 'honza/vim-snippets'
" Plug 'SirVer/ultisnips'
" Better Comments
" Plug 'jbgutierrez/vim-better-comments'
@@ -88,6 +89,7 @@ call plug#begin('~/.config/nvim/autoload/plugged')
" Plug 'Shougo/echodoc.vim'
" Interactive code
Plug 'metakirby5/codi.vim'
+ Plug 'mattn/emmet-vim'
endif