summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2021-03-09 18:10:28 +0100
committersalad <fmoenne-@student.le-101.fr>2021-03-09 18:10:28 +0100
commit1cd6aba49b0aecbb83a4120fb74090314e41dc9d (patch)
tree5fd6073e9de8f4bb7d540c020f63f476bb7bc325
parentadd vimrc with lsp support (diff)
downloaddotfiles-1cd6aba49b0aecbb83a4120fb74090314e41dc9d.tar.gz
dotfiles-1cd6aba49b0aecbb83a4120fb74090314e41dc9d.tar.bz2
dotfiles-1cd6aba49b0aecbb83a4120fb74090314e41dc9d.tar.xz
dotfiles-1cd6aba49b0aecbb83a4120fb74090314e41dc9d.tar.zst
dotfiles-1cd6aba49b0aecbb83a4120fb74090314e41dc9d.zip
-rw-r--r--vimrc148
1 files changed, 148 insertions, 0 deletions
diff --git a/vimrc b/vimrc
new file mode 100644
index 0000000..aba9d2f
--- /dev/null
+++ b/vimrc
@@ -0,0 +1,148 @@
+let mapleader=","
+
+"Plug 'vim-airline/vim-airline'
+"Plug 'vim-airline/vim-airline-themes'
+
+" Plugins
+call plug#begin('~/.vim/plugged')
+Plug 'vim-airline/vim-airline'
+Plug 'vim-airline/vim-airline-themes'
+Plug 'mbbill/undotree'
+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 nohlsearch
+ set clipboard=unnamedplus
+ set tabstop=4
+ set softtabstop=4
+ set shiftwidth=4
+ nnoremap c "_c
+ set nocompatible
+ filetype plugin indent on
+ set encoding=utf-8
+ set number
+ set relativenumber
+ set ruler
+ syntax on
+ colo desert
+ set hidden
+
+" Enable autocompletion:
+ set wildmode=longest,list,full
+
+" Previous / next buffer
+ noremap <silent> <C-k> :bprevious<CR>
+ noremap <silent> <C-j> :bnext<CR>
+ 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 = 'base16'
+ "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",
+" \}
+
+
+" Disables automatic commenting on newline:
+ autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
+
+" Powerline
+ set laststatus=2
+ set t_Co=256
+
+" 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 rust-analyzer as rust language server
+
+
+if executable('/home/salad/.emacs.d/.local/etc/lsp/rust/rust-analyzer')
+ au User lsp_setup call lsp#register_server({
+ \ 'name': 'Rust Language Server',
+ \ 'cmd': {server_info->['/home/salad/.emacs.d/.local/etc/lsp/rust/rust-analyzer']},
+ \ 'whitelist': ['rust'],
+ \ })
+endif
+
+" Register ccls as C/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
+ 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 <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>
+" === Comfy ===
+ autocmd FileType c nnoremap <Leader>m o#include<space><stdio.h><CR>#include<space><string.h><CR>#include<space><stdlib.h><CR>#include<space><stddef.h><CR>int<space>main(void)<space>{<CR>return<space>0;<CR>}<up><ESC>O
+ autocmd FileType c nnoremap <Leader>M o#include<space><stdio.h><CR>#include<space><string.h><CR>#include<space><stdlib.h><CR>#include<space><stddef.h><CR>int<space>main(int<space>argc,<space>char<space>*argv[])<space>{<CR>if<space>(argc<space>!=<space>1)<space>{<CR>printf("NOT<space>ENOUGH<space>ARGS\n");<CR>return<space>1;<CR>}<CR>return<space>0;<CR>}<up><ESC>Oprintf();<left><left>
+
+" C++
+ autocmd FileType cpp noremap <silent> <F8> :w<CR>:!g++<space>-Wall<space>-Wextra<space>-Werror -O3 % <CR>
+ autocmd FileType cpp noremap <F9> :w<CR>:!g++ -Wall -Wextra -Werror -O3 %; ./a.out ; echo "~>\n\n.vimrc 2.3.1-release Tilde Edition by Joe"; rm a.out<left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left>
+ autocmd FileType cpp noremap <F10> :w<CR>:!g++ -Wall -Wextra -Werror -O3 %; ./a.out; echo "~>\n\n.vimrc 2.3.1-release Tilde Edition by Joe"; rm a.out<CR>
+ 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