-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
185 lines (143 loc) · 4.24 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
"
" _ _ _
" (_) ___ ___| |__ _ __ ___ ___| |_
" | |/ _ \/ __| '_ \| '__/ _ \/ __| __|
" | | (_) \__ \ | | | | | (_) \__ \ |_
" _/ |\___/|___/_| |_|_| \___/|___/\__|
" |__/
"
"
" Josh's vim configuration.
" https://github.com/joshrost/.vim
"
" disable compatibility mode to improve vim experience
set nocompatible
" Use comma as the leader key
let mapleader=","
" enable modeline for in-file vim configurations
set modeline
" use 256 ANSI color palette
set t_Co=256
" enable syntax highlighting
syntax on
" clear all highlighting
highlight clear
"let g:javascript_plugin_jsdoc = 1
" detect filetypes
filetype plugin indent on
" indentation settings {{{
set expandtab
set shiftwidth=4
set softtabstop=4
set cindent
set autoindent
set smartindent
" }}}
" enable folding
set foldmethod=marker
set foldenable
" clipboard settings {{{
set clipboard=unnamedplus
" }}}
" use UNIX fileformat
set fileformat=unix
" use utf-8 encoding
set encoding=utf-8
" cursor line highlighting
hi CursorLine cterm=NONE ctermfg=white guifg=white
hi CursorColumn cterm=NONE ctermfg=white guifg=white
":nnoremap <Leader>c :set cursorline! cursorcolumn!<CR>
set cursorline! cursorcolumn!
" search settings {{{
set hlsearch " highlight search matches
set incsearch " incremental search
set ignorecase " ignore case by default
set smartcase " if upper carachters are used the search becomes case sensitive
" }}}
" disable backup files
set nobackup
" wild menu and completion settings {{{
set wildmenu
set wildmode=longest,list
set completeopt=menuone,menu,longest,preview
" }}}
" language settings
set spelllang=en_us,de_ch
" ignore some file endings for various searches
set wildignore+=*.o,*.lo,*.la,*.obj,.git,*.pyc,*.so,*/.git/*,*.zip,*.tar.gz,*__pycache__/*,
" set correct number formats for Ctrl+A and Ctrl+X
set nrformats=alpha,octal,hex
" configure undo files {{{
set undodir=~/.vim/undodir
set undofile
" }}}
" configure tags {{{
set tags=~/.vim/tags/
" }}}
" enable line numbering
set number
" disable to show mode (airline does it)
set noshowmode
" match opening and closing angle brackets
set matchpairs+=<:>
"Colorscheme {{{
let g:onedark_termcolors=16
colorscheme onedark
"}}}
" general Key Bindings {{{
" Navigate buffers {{{
map <C-j> :bp<CR>
imap <C-j> <ESC>:bp<CR>
map <C-k> :bn<CR>
imap <C-k> <ESC>:bn<CR>
" }}}
" Line numbering {{{
map <S-F2> :set number! relativenumber!<CR>
imap <S-F2> <ESC>:set number! relativenumber!<CR>
" }}}
" Spelling {{{
map <S-F9> :set spell!<CR>
imap <S-F9> <ESC>:set spell!<CR>
" }}}
" Search and Replace {{{
" Search and Replace word under cursor
nnoremap <leader>* :%s/<c-r><c-w>/<c-r><c-w>/gc<Left><Left><Left>
vnoremap <leader>* :s/<c-r><c-w>/<c-r><c-w>/gc<Left><Left><Left>
" }}}
" Code Completion {{{
" completion to Ctrl+Space
inoremap <Nul> <C-x><C-o>
" }}}
" }}}
" general autocmd commands {{{
" set otherwise unsupported filetypes
autocmd BufNewFile,BufRead *.gv set filetype=dot
" open files at last opened position
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" automatically open and close the popup menu
autocmd CursorMovedI,InsertLeave * if pumvisible() == 0 | silent! pclose | endif
" remove trailing whitespaces on write
autocmd BufWritePre * :%s/\s\+$//e
" set <F5> filetype to proper tool {{{
autocmd FileType c,cpp map <F5> :w<CR>:make<CR>
autocmd FileType c,cpp imap <F5> <ESC>:w<CR>:make<CR>
autocmd FileType python map <F5> :w<CR>:!python "%"<CR>
autocmd FileType python imap <F5> <ESC>:w<CR>:!python "%"<CR>
autocmd FileType sh map <F5> :w<CR>:!$SHELL "%"<CR>
autocmd FileType sh imap <F5> <ESC>:w<CR>:!$SHELL "%"<CR>
" }}}
" configure options for tex files {{{
autocmd FileType tex setl spell cursorline
" }}}
" enable spell check for rst and markdown {{{
autocmd FileType markdown,rst set spell
" }}}
" }}}
" load config modules {{{
runtime! config/**/*.vim
" }}}
" Load all plugins {{{
packloadall
" generate all helptag documentation
silent! helptags ALL
" }}}