diff options
Diffstat (limited to '')
-rw-r--r-- | vim/pack/downloads/opt/snippets/snippets.vim | 16 | ||||
-rw-r--r-- | vimrc | 74 |
2 files changed, 56 insertions, 34 deletions
diff --git a/vim/pack/downloads/opt/snippets/snippets.vim b/vim/pack/downloads/opt/snippets/snippets.vim index d4c6e4e..92f0af7 100644 --- a/vim/pack/downloads/opt/snippets/snippets.vim +++ b/vim/pack/downloads/opt/snippets/snippets.vim @@ -1,14 +1,24 @@ autocmd FileType go - \ :iabbrev <buffer> err@ if err != nil {}<Left><Enter><Left> + \ :iabbrev <buffer> err@ if err != nil {<CR><CR>}<Left><Up><Tab> autocmd FileType go - \ :iabbrev <buffer> hand@ <Backspace><Esc>^ifunc <Esc>A(c *gin.Context) { + \ :iabbrev <buffer> h@ <Backspace><Esc>^ifunc <Esc>A(c *gin.Context) {<CR><CR>}<Left><Up><Tab> + +autocmd FileType go + \ :iabbrev <buffer> t@ <Backspace><Esc>^ifunc <Esc>A(t *testing.T) {<CR><CR>}<Left><Up><Tab> + +autocmd FileType go + \ :iabbrev <buffer> f@ <Backspace><Esc>^ifunc <Esc>A() {<CR><CR>}<Esc><Up><Up>f(li autocmd FileType go \ :iabbrev <buffer> fat@ log.Fatal(" %v", err)<Esc>F%i<Left> -:autocmd FileType php,html.twig,html,javascript,typescript,vue,go +:autocmd FileType go + \ :iabbrev <buffer> if@ if {<CR><CR>}<Esc>%<Left>i + + +:autocmd FileType php,html.twig,html,javascript,typescript,vue \ :iabbrev <buffer> if@ if() {<CR>}<Esc>%<Left><Left>i @@ -2,6 +2,8 @@ packadd snippets " General set ignorecase +set backspace=indent,eol,start + " Indentation set tabstop=8 @@ -9,27 +11,25 @@ set shiftround set nobackup set autoindent set smartindent -set cindent -set backspace=2 +set nu + +" Search +set incsearch +set matchpairs+=<:> " Theme syntax on set background=light -set rnu set termguicolors colorscheme quiet -set incsearch -set matchpairs+=<:> -set t_Co=256 -hi Normal guifg=black guibg=#FEFFFA -"hi Keyword ctermfg=black cterm=bold -set tgc -hi SpellBad term=reverse cterm=underline ctermfg=124 ctermbg=white -hi SpellCap term=reverse cterm=underline ctermfg=25 ctermbg=white -hi SpellRare term=reverse cterm=underline ctermfg=30 ctermbg=white -hi SpellLocal term=reverse cterm=underline ctermfg=90 ctermbg=white - -" Cursor - switch between line and full +hi Normal guifg=black guibg=#FFFFEA +""hi Keyword ctermfg=black cterm=bold +hi SpellBad term=reverse term=underline guibg=#FFFFEA +hi SpellCap term=reverse term=underline guibg=#FFFFEA +hi SpellRare term=reverse term=underline guibg=#FFFFEA +hi SpellLocal term=reverse term=underline guibg=#FFFFEA + +"" Cursor - switch between line and full when going to insert mode let &t_SI = "\<Esc>[6 q" let &t_SR = "\<Esc>[4 q" let &t_EI = "\<Esc>[2 q" @@ -52,7 +52,7 @@ packadd lsp if exists('g:loaded_lsp') call LspOptionsSet(#{ \ aleSupport: v:false, - \ autoComplete: v:false, + \ autoComplete: v:true, \ autoHighlight: v:false, \ autoHighlightDiags: v:true, \ autoPopulateDiags: v:true, @@ -97,13 +97,6 @@ if exists('g:loaded_lsp') \ }) end -" Yaml -autocmd Filetype yaml setlocal tabstop=2 -autocmd Filetype yaml setlocal shiftwidth=2 -autocmd Filetype yaml setlocal expandtab -autocmd Filetype yaml setlocal smarttab - - " Ocaml if exists('g:loaded_lsp') call LspAddServer([#{ @@ -114,11 +107,9 @@ if exists('g:loaded_lsp') \ syncInit: v:true \ }]) end -autocmd Filetype ocaml autocmd BufWritePre <buffer> :LspFormat +"autocmd Filetype ocaml autocmd BufWritePre <buffer> :LspFormat autocmd Filetype ocaml setlocal tabstop=2 autocmd Filetype ocaml setlocal shiftwidth=2 -autocmd Filetype ocaml setlocal expandtab -autocmd Filetype ocaml setlocal smarttab " Go if exists('g:loaded_lsp') @@ -131,12 +122,15 @@ if exists('g:loaded_lsp') \ }]) end +filetype plugin on autocmd Filetype go set makeprg=go\ build "autocmd Filetype go autocmd BufWritePre <buffer> :LspFormat +" Auto test directory with <leader>t +autocmd Filetype go nnoremap <buffer> <leader>t :!go test %:h/*.go<Enter> au BufRead,BufNewFile *.tmpl set filetype=gohtml autocmd Filetype gohtml setlocal tabstop=2 -" autocmd Filetype gohtml setlocal formatprg=djlint\ --profile=golang\ --reformat\ - + " Nix if exists('g:loaded_lsp') @@ -148,7 +142,7 @@ if exists('g:loaded_lsp') \ syncInit: v:true \ }]) end -"autocmd Filetype nix autocmd BufWritePre <buffer> :LspFormat +autocmd Filetype nix autocmd BufWritePre <buffer> :LspFormat " Markdown if exists('g:loaded_lsp') @@ -168,10 +162,12 @@ autocmd Filetype markdown setlocal spell " Keybindings let mapleader=" " noremap , : -noremap <leader>e :e **/ +noremap <leader>e :e! **/* noremap <silent> gd mB:LspGotoDefinition<Enter> noremap <silent> ]d :LspDiagNext<Enter> noremap <silent> [d :LspDiagPrev<Enter> +noremap <silent> ]c :cnext<Enter> +noremap <silent> [c :cprev<Enter> noremap <silent> gs mB:LspDocumentSymbol<Enter> noremap <silent> gr mB:LspGotoImpl<Enter> noremap <leader>ca :LspCodeAction<Enter> @@ -181,16 +177,32 @@ noremap <silent> <leader>k :LspDiagCurrent<Enter> noremap <silent> K :LspHover<Enter> nnoremap <leader>l :ls<CR>:b<space> nnoremap <silent> <leader>= :LspFormat<Enter> +"" Tab completion +inoremap <expr> <TAB> pumvisible() ? "\<C-n>" : "\<TAB>" +inoremap <expr> <S-TAB> pumvisible() ? "\<C-p>" : "\<TAB>" + " Spell au BufEnter *.org set spell " Wildmenu set wildmenu -set wildmode=longest:full,lastused set wildignore=_build/**,release/**,node_modules/** -set wildoptions+=fuzzy +set wildoptions=fuzzy " Grep set grepprg=git\ grep\ -nH + +" Auto add marks +augroup VIMRC + autocmd! + autocmd BufLeave *.css,*.scss normal! mC + autocmd BufLeave *.html normal! mH + autocmd BufLeave *.js,*.ts normal! mJ + autocmd BufLeave *.md normal! mM + autocmd BufLeave *.yml,*.yaml normal! mY + autocmd BufLeave *_test.go normal! mT + autocmd BufLeave *{_test}\@<!.go normal! mA +augroup END + |