-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
158 lines (137 loc) · 3.99 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
set nocompatible
set termencoding=utf8
"set clipboard=unnamedplus
" Spaces and tabs
syntax enable
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent
set smartindent
set nowrap
set list listchars=tab:→\ ,trail:·
set textwidth=79
set statusline=%<%f%h%m%r\ %b\ %{&encoding}\ 0x\ \ %l,%c%V\ %P
set laststatus=2
" UI config
set number
set showcmd
set cursorline
filetype indent on
set wildmenu
set lazyredraw
set showmatch
set noerrorbells visualbell t_vb=
autocmd GUIEnter * set visualbell t_vb=
set mouse=a
set mousemodel=popup
" Searching
set incsearch
set hlsearch
nnoremap <leader><space> :nohlsearch<CR>
" Search down into subfolders
" Provides tab-completion for all file-related tasks
set path+=**
" Display all matching files when we tab complete
set wildmenu
" Search down into subfolders
" Provides tab-completion for all file-related tasks
set path+=**
" Display all matching files when we tab complete
set wildmenu
" Folding
set foldenable
set foldlevelstart=10
set foldnestmax=10
set foldmethod=indent
" Movement
nnoremap gV `[v`]
" Edit vimrc/bashrc and load vimrc bindings
nnoremap <leader>ev :vsp $MYVIMRC<CR>
nnoremap <leader>eb :vsp ~/.bashrc<CR>
nnoremap <leader>sv :source $MYVIMRC<CR>
" Save session
nnoremap <leader>s :mksession<CR>
" Autogroups
augroup configgroup
autocmd!
autocmd VimEnter * highlight clear SignColumn
autocmd BufWritePre *.php,*.c,*.cpp,*.h,*.py,*.js,*.txt,*.hs,*.java,*.md :call <SID>StripTrailingWhitespaces()
autocmd FileType python setlocal commentstring=#\ %s
autocmd BufEnter *.zsh-theme setlocal filetype=zsh
autocmd BufEnter Makefile setlocal noexpandtab
autocmd BufEnter Makefile set tabstop=8
autocmd BufEnter Makefile set softtabstop=8
autocmd BufEnter Makefile set shiftwidth=8
autocmd BufEnter *.sh setlocal tabstop=2
autocmd BufEnter *.sh setlocal shiftwidth=2
autocmd BufEnter *.sh setlocal softtabstop=2
augroup END
" Tweaks for browsing
let g:netrw_banner=0 " disable annoying banner
let g:netrw_browse_split=4 " open in prior window
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=3 " tree view
let g:netrw_hide=0 " show all files
let g:netrw_winsize=25 " 25% split width
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
" toggle between number and relativenumber
function! ToggleNumber()
if(&relativenumber == 1)
set norelativenumber
set number
else
set relativenumber
endif
endfunc
" strips trailing whitespace at the end of files. this
" is called on buffer write in the autogroup above.
function! <SID>StripTrailingWhitespaces()
" save last search & cursor position
let _s=@/
let l = line(".")
let c = col(".")
%s/\s\+$//e
let @/=_s
call cursor(l, c)
endfunction
if filereadable(".vim_config")
source .vim_config
endif
" Plugins
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'majutsushi/tagbar'
Plugin 'w0rp/ale'
Plugin 'tpope/vim-surround'
Plugin 'rust-lang/rust.vim'
" color schemes
Plugin 'morhetz/gruvbox'
Plugin 'arcticicestudio/nord-vim'
Plugin 'ayu-theme/ayu-vim'
call vundle#end() " required
filetype plugin indent on " required
if filereadable(expand("$HOME/.vim/bundle/gruvbox/colors/gruvbox.vim"))
" set termguicolors
set background=dark
" let ayucolor="dark"
colorscheme gruvbox
endif
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:ale_python_flake8_executable = 'python3' " or 'python' for Python 2
let g:ale_python_flake8_options = '-m flake8'
let g:ale_python_pylint_executable = 'python3' " or 'python' for Python 2
let g:ale_python_pylint_use_global = 0
nmap <F4> :TagbarToggle<CR>
nmap <F3> :Vexplore<CR>
set tags=tags;/
command! MakeTags !ctags -R .
" cnoremap @ <c-r>=expand("%:h")<cr>/