diff options
author | Filemon Moenne-loccoz <fmoenne-@z4r3p5.42lyon.fr> | 2021-03-03 13:51:31 +0100 |
---|---|---|
committer | Filemon Moenne-loccoz <fmoenne-@z4r3p5.42lyon.fr> | 2021-03-03 13:51:31 +0100 |
commit | f6fa63d6bce9ed3a9e9c4c345657f8cc15d4e94c (patch) | |
tree | 036dfb79790e08add5015dfdced6ad3981ba5fdc | |
parent | add awesome config (diff) | |
download | dotfiles-f6fa63d6bce9ed3a9e9c4c345657f8cc15d4e94c.tar.gz dotfiles-f6fa63d6bce9ed3a9e9c4c345657f8cc15d4e94c.tar.bz2 dotfiles-f6fa63d6bce9ed3a9e9c4c345657f8cc15d4e94c.tar.xz dotfiles-f6fa63d6bce9ed3a9e9c4c345657f8cc15d4e94c.tar.zst dotfiles-f6fa63d6bce9ed3a9e9c4c345657f8cc15d4e94c.zip |
add vimrc with lsp support
-rw-r--r-- | .vimrc | 161 |
1 files changed, 63 insertions, 98 deletions
@@ -1,17 +1,27 @@ let mapleader="," +"Plug 'vim-airline/vim-airline' +"Plug 'vim-airline/vim-airline-themes' + " Plugins call plug#begin('~/.vim/plugged') Plug 'mbbill/undotree' -Plug 'vim-airline/vim-airline' -Plug 'vim-airline/vim-airline-themes' Plug 'jiangmiao/auto-pairs' +Plug 'preservim/nerdcommenter' +Plug 'preservim/nerdtree' +Plug 'prabirshrestha/vim-lsp' +Plug 'prabirshrestha/asyncomplete.vim' +Plug 'voldikss/vim-floaterm' call plug#end() + +set t_Co=256 +"set background=dark + " Some basics: "set bg=light set go=a - set mouse=a +" set mouse=a set nohlsearch set clipboard=unnamedplus set tabstop=4 @@ -25,7 +35,7 @@ call plug#end() set relativenumber set ruler syntax on - colo peachpuff + colo desert set hidden " Enable autocompletion: @@ -37,40 +47,28 @@ call plug#end() noremap <silent> <leader>w :w <BAR> :bp <BAR> :bd #<CR> " Airline - let g:airline#extensions#tabline#enabled = 1 - let g:airline#extensions#tabline#fnamemod = ':t' - let g:airline_detect_modified = 1 - let g:airline_detect_paste = 1 - let g:airline_detect_crypt = 1 - let g:airline_theme = 'term' - "let g:airline_powerline_fonts = 1 - let g:airline_symbols_ascii = 1 - let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]' +" let g:airline#extensions#tabline#enabled = 1 +" let g:airline#extensions#tabline#fnamemod = ':t' +" let g:airline_detect_modified = 1 +" let g:airline_detect_paste = 1 +" let g:airline_detect_crypt = 1 +" let g:airline_theme = 'term' +" let g:airline_powerline_fonts = 1 +" let g:airline_symbols_ascii = 1 +" let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]' " Cursor mode - let g:airline#extensions#cursormode#enabled = 1 - let g:cursormode_color_map = { - \ "i": "#7da9c7", - \ "n": "#eac179", - \ "R": "#bb5653", - \ "r": "#bb5653", - \ "v": "#b06597", - \ "V": "#b06597", - \ "\<C-V>": "#b06597", - \} - -" 10 buffers jump - let g:airline#extensions#tabline#buffer_idx_mode = 1 - nmap <leader>1 <Plug>AirlineSelectTab1 - nmap <leader>2 <Plug>AirlineSelectTab2 - nmap <leader>3 <Plug>AirlineSelectTab3 - nmap <leader>4 <Plug>AirlineSelectTab4 - nmap <leader>5 <Plug>AirlineSelectTab5 - nmap <leader>6 <Plug>AirlineSelectTab6 - nmap <leader>7 <Plug>AirlineSelectTab7 - nmap <leader>8 <Plug>AirlineSelectTab8 - nmap <leader>9 <Plug>AirlineSelectTab9 - nmap <leader>0 <Plug>AirlineSelectTab10 +" let g:airline#extensions#cursormode#enabled = 1 +" let g:cursormode_color_map = { +" \ "i": "#7da9c7", +" \ "n": "#eac179", +" \ "R": "#bb5653", +" \ "r": "#bb5653", +" \ "v": "#b06597", +" \ "V": "#b06597", +" \ "\<C-V>": "#b06597", +" \} + " Disables automatic commenting on newline: autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o @@ -81,21 +79,46 @@ call plug#end() " Runs a script that cleans out tex build files whenever I close out of a .tex file. autocmd VimLeave *.tex !texclear % +" Floaterm +nnoremap <silent> <F7> :FloatermNew <CR> +" Startify +let g:startify_custom_header_quotes = [ + \ ['Hey man'], + \ ['How are you ?'], + \ ['Happy coding'], + \] + + +"CCLS /LSP +" Register ccls C++ lanuage server. +if executable('ccls') + au User lsp_setup call lsp#register_server({ + \ 'name': 'ccls', + \ 'cmd': {server_info->['ccls']}, + \ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), '.ccls'))}, + \ 'initialization_options': {'cache': {'directory': '/tmp/ccls/cache' }}, + \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp', 'cc'], + \ }) +endif + +nn <silent> <M-d> :LspDefinition<cr> +nn <silent> <M-r> :LspReferences<cr> +nn <f2> :LspRename<cr> +nn <silent> <M-a> :LspWorkspaceSymbol<cr> +nn <silent> <M-l> :LspDocumentSymbol<cr> " Compile document, be it groff/LaTeX/markdown/etc. "map <leader>c :w! \| !compiler <c-r>%<CR> autocmd BufWritePost *.tex !compiler % " Compile C file - autocmd FileType c noremap <F5> :w<CR> :!clear<CR> :!~/.vim/c/f5.sh;<CR> - autocmd FileType c noremap <F6> :w<CR> :!clear<CR> :!~/.vim/c/f6.sh;<CR> + noremap <F5> :w<CR> :!make -j5 ASAN=1;<CR> + noremap <F6> :w<CR> :!./cub3d "map/map_one.cub"; ret=$?; echo "~> $ret\n\n.vimrc 3.0-release Tilde Edition by Joe\n";<CR> autocmd FileType c noremap <F8> :w<CR>:!gcc<space>-Wall<space>-Wextra<space>-Werror %<CR> autocmd FileType c noremap <F9> :w<CR> :!clear<CR> :!~/.vim/c/f9.sh % autocmd FileType c noremap <F10> :w<CR> :!clear<CR> :!~/.vim/c/f10.sh %<CR> " Compile C++ file - autocmd FileType cpp noremap <F5> :w<CR> :!clear<CR> :!~/.vim/cpp/f5.sh;<CR> - autocmd FileType cpp noremap <F6> :w<CR> :!clear<CR> :!~/.vim/cpp/f6.sh;<CR> autocmd FileType cpp noremap <F8> :w<CR>:!g++<space>-Wall<space>-Wextra<space>-Werror %<CR> autocmd FileType cpp noremap <F9> :w<CR> :!clear<CR> :!~/.vim/cpp/f9.sh % autocmd FileType cpp noremap <F10> :w<CR> :!clear<CR> :!~/.vim/cpp/f10.sh %<CR> @@ -135,61 +158,3 @@ call plug#end() autocmd FileType cpp nnoremap <Leader>m oint<space>main(void)<space>{<CR>return<space>0;<CR>}<up><ESC>O autocmd FileType cpp nnoremap <Leader>M oint<space>main(int<space>argc,<space>char<space>*argv[])<space>{<CR>if<space>(argc<space>!=<space>1)<CR>return<space>0;<CR>if<space>(argv[])<space>{}<CR>return<space>0;<CR>}<up><ESC>O autocmd FileType cpp nnoremap <Leader>M oint<space>main(int<space>argc,<space>char<space>*argv[])<space>{<CR>if<space>(argc<space>!=<space>1)<space>{<CR>cout<space><<<space>"NOT<space>ENOUGH<space>ARGS"<space><<<space>endl;<CR>return<space>1;<CR>}<CR>return<space>0;<CR>}<up><ESC>O - -" Java - ""autocmd FileType java inoremap " ""<left> - ""autocmd FileType java inoremap ' ''<left> - ""autocmd FileType java inoremap ( ()<left> - ""autocmd FileType java inoremap [ []<left> - ""autocmd FileType java inoremap { {}<left> - ""autocmd FileType java inoremap < <><left> - ""autocmd FileType java inoremap {<CR> {<CR>}<ESC>O - ""autocmd FileType java inoremap {;<CR> {<CR>};<ESC>O - ""autocmd FileType java inoremap <<space> <<space> - ""autocmd FileType java inoremap ><space> ><space> - ""autocmd FileType java inoremap <= <= - -" = Web = -" HTML - "autocmd FileType html inoremap " ""<left> - "autocmd FileType html inoremap ' ''<left> - "autocmd FileType html inoremap ( ()<left> - "autocmd FileType html inoremap [ []<left> - "autocmd FileType html inoremap { {}<left> - "autocmd FileType html inoremap {<CR> {<CR>}<ESC>O - "autocmd FileType html inoremap < <><left> - -" PHP - ""autocmd FileType php inoremap " ""<left> - ""autocmd FileType php inoremap ' ''<left> - ""autocmd FileType php inoremap ( ()<left> - ""autocmd FileType php inoremap [ []<left> - ""autocmd FileType php inoremap { {}<left> - ""autocmd FileType php inoremap {<CR> {<CR>}<ESC>O - ""autocmd FileType php inoremap < <><left> - ""autocmd FileType php inoremap <? <?php ?><left><left><left> - ""autocmd FileType php inoremap <?<CR> <?php<CR>?><ESC>O - -" CSS - "autocmd FileType css inoremap " ""<left> - "autocmd FileType css inoremap ' ''<left> - "autocmd FileType css inoremap ( ()<left> - "autocmd FileType css inoremap [ []<left> - "autocmd FileType css inoremap { {}<left> - "autocmd FileType css inoremap {<CR> {<CR>}<ESC>O - - -" Just in case - "inoremap " ""<left> - "inoremap ' ''<left> - "inoremap ( ()<left> - "inoremap [ []<left> - "inoremap { {}<left> - "inoremap "" "" - "inoremap '' '' - "inoremap () () - "inoremap [] [] - "inoremap {} {} - "inoremap <> <> - -" .vimrc 2.4.1-release | Copyright Joe 2k19 |