-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
executable file
·130 lines (108 loc) · 2.92 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
set nocompatible " be iMproved, required
call plug#begin()
Plug 'altercation/vim-colors-solarized'
Plug 'jlanzarotta/bufexplorer'
Plug 'myusuf3/numbers.vim'
Plug 'jremmen/vim-ripgrep'
Plug 'steffanc/cscopemaps.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-vinegar'
Plug 'racer-rust/vim-racer'
Plug 'haya14busa/incsearch.vim'
Plug 'ntpeters/vim-better-whitespace'
Plug 'felixhummel/setcolors.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
call plug#end()
" General
set linebreak
set textwidth=120
set shiftwidth=4
set softtabstop=4
set showmatch
set visualbell
set autoindent
set smartindent
set smarttab
set cindent
set number
set ignorecase
set smartcase
set incsearch
set splitbelow
set splitright
" Colors
set t_Co=256
let g:solarized_termcolors=256
highlight clear
syntax enable
set background=dark
colorscheme solarized
set laststatus=2
set ttimeoutlen=50
" Swap, backup and undo files
set undodir=~/.vim/undo//
set backupdir=~/.vim/backup//
set directory=~/.vim/swap//
" File type specific mods
autocmd Filetype text setlocal fo=qwarntc tw=68 autoindent nocindent nosmartindent
autocmd Filetype mail setlocal fo=qwarntc tw=68 autoindent nocindent nosmartindent
autocmd Filetype cpp setlocal fo=qwarntc tw=72 smartindent autoindent tabstop=4 shiftwidth=4 expandtab
au BufEnter *.cpp setf cpp
" Advanced
set showtabline=2
set ruler
let mapleader=","
set backspace=indent,eol,start
set timeout timeoutlen=3000 ttimeoutlen=100
set clipboard=unnamedplus
let g:netrw_bufsettings = 'noma nomod nu nobl nowrap ro'
" Rust
set hidden
let g:racer_cmd = "/home/robin/.cargo/bin/racer"
filetype plugin indent on " required
" FZF mods
nnoremap <C-p> :FZF<CR>
nnoremap <C-l> :Rg<CR>
nnoremap <C-w>p :call SplitOutPaneToggle()<CR>
let g:pane_is_split_out = 0
function! SplitOutPaneToggle()
if g:pane_is_split_out
let savex=winsaveview()
tabclose
call winrestview(savex)
let g:pane_is_split_out = 0
else
let savex=winsaveview()
tabedit %
let g:pane_is_split_out = 1
call winrestview(savex)
endif
endfunction
function! OpenTerminal()
vsplit
:call term_start('bash', {'curwin' : 1, 'term_finish' : 'close'})
endfunction
nnoremap <C-w>t :call OpenTerminal()<cr>
" Auto resize splits when parent window size changes
:autocmd VimResized * wincmd =
" Incsearch plugin mods
set hlsearch
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
let g:incsearch#auto_nohlsearch = 1
map n <Plug>(incsearch-nohl-n)
map N <Plug>(incsearch-nohl-N)
map * <Plug>(incsearch-nohl-*)
map # <Plug>(incsearch-nohl-#)
map g* <Plug>(incsearch-nohl-g*)
map g# <Plug>(incsearch-nohl-g#)
function! BGToggle()
let &background = ( &background == "dark"? "light" : "dark" )
endfunction
nnoremap <leader>t :call BGToggle()<cr>
nnoremap <leader>q :Rg <cword><cr>
nnoremap gF :vsplit <cfile><cr>