dotfiles/.vimrc

171 lines
3.7 KiB
VimL
Raw Normal View History

2019-07-20 12:08:57 +02:00
set nocompatible " be iMproved, required
filetype off " required
2019-09-19 17:22:53 +02:00
2019-07-20 12:08:57 +02:00
call plug#begin()
Plug 'itchyny/lightline.vim'
Plug 'vim-scripts/c.vim'
Plug 'arcticicestudio/nord-vim'
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'rhysd/vim-clang-format'
Plug 'kana/vim-operator-user'
2019-09-19 17:22:53 +02:00
Plug 'rust-lang/rust.vim'
Plug 'Shougo/deoplete.nvim'
2019-11-15 10:02:03 +01:00
Plug 'zchee/deoplete-clang'
Plug 'Shougo/neoinclude.vim'
2019-09-19 17:22:53 +02:00
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
2019-10-17 11:44:48 +02:00
"Plug 'tbodt/deoplete-tabnine', { 'do': './install.sh' }
2019-11-15 10:02:03 +01:00
Plug 'sebastianmarkow/deoplete-rust'
2019-10-12 09:49:51 +02:00
Plug 'jpalardy/vim-slime'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
Plug 'calviken/vim-gdscript3'
2019-07-20 12:08:57 +02:00
call plug#end() " required
2019-09-19 17:22:53 +02:00
2019-07-20 12:08:57 +02:00
filetype plugin indent on " required
2019-09-19 17:22:53 +02:00
let g:deoplete#enable_at_startup = 1
2019-11-15 10:02:03 +01:00
let g:deoplete#sources#clang#libclang_path = "/usr/lib/libclang.so"
let g:deoplete#sources#clang#clang_header = "/usr/lib/clang"
let g:deoplete#sources#rust#racer_binary='/usr/bin/racer'
let g:deoplete#sources#rust#rust_source_path='/usr/src/rust/src'
2019-11-04 08:36:43 +01:00
let g:LanguageClient_serverCommands = {
\ 'lua': ['lua-lsp'],
\ }
let g:LanguageClient_autoStart = 1
2019-07-20 12:08:57 +02:00
set tags+=./.tags
2019-10-17 11:44:48 +02:00
" Session management
set switchbuf=useopen,usetab
2019-11-04 08:36:43 +01:00
let g:session = 0
fu! AutoSaveSess()
if g:session == 1
call SaveSess()
endif
endfunction
2019-10-17 11:44:48 +02:00
fu! SaveSess()
2019-11-04 08:36:43 +01:00
execute 'NERDTreeTabsClose'
2019-10-17 11:44:48 +02:00
execute 'mksession! ' . getcwd() . '/.session.vim'
2019-11-04 08:36:43 +01:00
let g:session = 1
endfunction
fu! RemoveSess()
shell "rm " . getcwd() . "/.session.vim"
2019-10-17 11:44:48 +02:00
endfunction
fu! RestoreSess()
if filereadable(getcwd() . '/.session.vim')
let initial_args = argv()
execute 'so ' . getcwd() . '/.session.vim'
for file in initial_args
if bufloaded(file) != 1
execute 'tabnew ' . getcwd() . '/' . file
else
execute 'sb ' . file
endif
endfor
2019-11-04 08:36:43 +01:00
let g:session = 1
2019-10-17 11:44:48 +02:00
endif
endfunction
2019-11-04 08:36:43 +01:00
:command Savesess call SaveSess()
:command Restoresess call RestoreSess()
:command Removesess call RemoveSess()
2019-10-17 11:44:48 +02:00
" Save session on quitting Vim
2019-11-04 08:36:43 +01:00
autocmd VimLeave * call AutoSaveSess()
2019-10-17 11:44:48 +02:00
" Restore session on starting Vim
2019-11-04 08:36:43 +01:00
"autocmd VimEnter * nested call RestoreSess()
2019-10-17 11:44:48 +02:00
2019-07-20 12:08:57 +02:00
"----------------------
" move between tabs
2019-10-17 11:44:48 +02:00
nnoremap <A-Left> :tabprevious<CR>
nnoremap <A-Right> :tabnext<CR>
map <C-n> :NERDTreeMirrorToggle<CR>
2019-07-20 12:08:57 +02:00
" prevent mouse vanishing
set nomousehide
" toggles menu in graphical mode
function! ToggleGUICruft()
if &guioptions=='ir'
exec('set guioptions=imrLn')
else
exec('set guioptions=ir')
endif
endfunction
map <F12> <Esc>:call ToggleGUICruft()<cr>
set number
set linebreak
set nobackup
set noswapfile
"set shortmess+=I
set backspace=indent,eol,start
set visualbell t_vb=
set showmode
"set smartcase
nnoremap <F1> <nop>
nnoremap Q <nop>
nnoremap K <nop>
runtime! ftplugin/man.vim
nnoremap K :Man <cword>
set mouse=a
set nu
2019-10-16 12:05:20 +02:00
let g:clang_format#code_style="llvm"
2019-07-20 12:08:57 +02:00
set clipboard=unnamed
set backspace=indent,eol,start " allow backspacing over everything in insert mode
cmap w!! w !sudo tee > /dev/null %
set laststatus=2
let g:nord_uniform_diff_background = 1
let g:nord_cursor_line_number_background = 1
let g:lightline = {
\ 'colorscheme': 'nord',
\ }
colorscheme nord
filetype plugin indent on
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
2019-09-19 17:22:53 +02:00
:command WQ wq
:command Wq wq
:command W w
:command Q q
2019-07-20 12:08:57 +02:00
2019-10-12 09:49:51 +02:00
let g:C_Mapfeader = ','
2019-07-20 12:08:57 +02:00
nnoremap <cr> :noh<CR><CR>:<backspace>
2019-09-19 17:22:53 +02:00
let g:deoplete#enable_smart_case = 1
imap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
imap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<S-TAB>"
imap <expr><CR> pumvisible() ? deoplete#close_popup() : "\<CR>"
set completeopt=menu,noinsert