summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-03-28 23:55:31 +0100
committerJulian T <julian@jtle.dk>2020-03-28 23:55:31 +0100
commit8117073221f6c568d6f242bb2db82b9447686c2e (patch)
tree0b24d5a856dbc791fc2a158382d0ac3dfae86f7c
parent5fc79dd7adec88e33ff97368fd7fcd13ce2f96b3 (diff)
Vim autocompletion and minor stuff. Zsh keep commands
-rw-r--r--vim/.vimrc55
-rw-r--r--zsh/.zshrc5
2 files changed, 45 insertions, 15 deletions
diff --git a/vim/.vimrc b/vim/.vimrc
index 13234bb..f1818a9 100644
--- a/vim/.vimrc
+++ b/vim/.vimrc
@@ -14,14 +14,15 @@ set shellslash
Plugin 'VundleVim/Vundle.vim'
" Completion
- "Plugin 'prabirshrestha/async.vim'
- "Plugin 'prabirshrestha/vim-lsp'
- Plugin 'fatih/vim-go'
+ Plugin 'prabirshrestha/async.vim'
+ Plugin 'prabirshrestha/vim-lsp'
+ " Plugin 'fatih/vim-go'
Plugin 'ajh17/VimCompletesMe'
- Plugin 'ludovicchabant/vim-gutentags'
+ " Plugin 'ludovicchabant/vim-gutentags'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-repeat'
+ Plugin 'tpope/vim-unimpaired'
" Editor config
Plugin 'editorconfig/editorconfig-vim'
@@ -40,7 +41,7 @@ set shellslash
" Git
" Plugin 'jreybert/vimagit'
- " Plugin 'tpope/vim-fugitive'
+ Plugin 'tpope/vim-fugitive'
" File support
" Plugin 'cespare/vim-toml'
@@ -58,16 +59,42 @@ set shellslash
filetype plugin indent on " required
" Completion
- let g:go_def_mode='gopls'
- let g:go_info_mode='gopls'
+ set completeopt=menuone
+ " let g:go_def_mode='gopls'
+ " let g:go_info_mode='gopls'
" let g:rustfmt_autosave = 1
- " autocmd FileType c let b:vcm_tab_complete = 'omni'
autocmd FileType c let b:vcm_tab_complete = 'omni'
autocmd FileType go let b:vcm_tab_complete = 'omni'
autocmd FileType vim let b:vcm_tab_complete = 'vim'
- set completeopt=menuone
+ " Setup lsp servers
+ if executable('clangd')
+ au User lsp_setup call lsp#register_server({
+ \ 'name': 'clangd',
+ \ 'cmd': {server_info->['clangd']},
+ \ 'whitelist': ['c', 'cpp'],
+ \ })
+ endif
+
+ " Enable csp if available, stolen from lsp github
+ function! s:on_lsp_buffer_enabled() abort
+ echo "Enabling lsp"
+ set omnifunc=lsp#complete
+ set signcolumn=yes
+ nmap <buffer> gd <plug>(lsp-definition)
+ nmap <buffer> <f2> <plug>(lsp-rename)
+ " refer to doc to add more commands
+ endfunction
+
+ augroup lsp_install
+ au!
+ " call s:on_lsp_buffer_enabled only for languages that has the server registered.
+ autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
+ augroup END
+
+ let g:lsp_log_verbose = 1
+ let g:lsp_log_file = expand('/tmp/vim-lsp.log')
" General vim settings
syntax enable
@@ -80,7 +107,7 @@ set shellslash
set noexpandtab
" Remove statusline
- set laststatus=0
+ set laststatus=1
" Check if file has changed
au FocusGained,BufEnter * :checktime
@@ -91,6 +118,13 @@ set shellslash
set hidden
+ " Case insensitive search if all letters are small
+ set smartcase
+ set ignorecase
+
+ " Persistent undo
+ set undofile
+
" Latex stuff
let g:tex_flavor='latex'
@@ -129,6 +163,7 @@ set shellslash
map <leader>mm :make V=1<CR>
map <leader>mf :make flash V=1<CR>
+ map <leader>t :terminal<CR>i
" Enforcing filetypes
autocmd BufRead,BufNewFile *.ino set filetype=c
diff --git a/zsh/.zshrc b/zsh/.zshrc
index 69dfa3a..a8a9a99 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -69,11 +69,6 @@ alias vim="nvim"
#alias cmacs="emacsclient -nw -c"
alias sc="systemctl"
-#Setup git lol
-git config --global alias.lol "log --graph --decorate --abbrev-commit --all"
-
-
-
alias hej="echo 'Hej, hvordan går det?'"
export EDITOR=nvim