summaryrefslogtreecommitdiff
path: root/vimrc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--vimrc74
1 files changed, 43 insertions, 31 deletions
diff --git a/vimrc b/vimrc
index 0431ea6..a4a83fc 100644
--- a/vimrc
+++ b/vimrc
@@ -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
+