-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc.symlink
223 lines (173 loc) · 6.17 KB
/
vimrc.symlink
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
" Pathogen plugin
call pathogen#infect()
" Colors
set t_Co=256
" colorscheme molokai
colorscheme solarized
set background=dark
" swap/backup files
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
" Spelling
set spelllang=el,en_us
" Prefer ISO8859-7 over ISO8859-1:
set fileencodings-=latin1
set fileencodings+=greek
" Path setting for finding files
set path+=**,
function SetupWrapping()
set wrap
set wrapmargin=2
set textwidth=80
endfunction
" -----------------------------------------------------------------------------
" Text Format
" -----------------------------------------------------------------------------
syntax on
filetype plugin indent on
set autoindent
set smartindent " go with smartindent if there is no plugin indent file
set nowrap " don't wrap lines
set formatoptions+=n " support for numbered/bullet lists
" Hard tabs
set shiftwidth=4
set tabstop=4
set noexpandtab
" -----------------------------------------------------------------------------
" User Interface
" -----------------------------------------------------------------------------
set showcmd
set number " line numbers
set ruler
set cursorline
set mouse=a " enable mouse in terminal
set backspace=2 " allow backspacing over everything in insert mode
set showmatch " brackets/braces that is
set mat=5 " duration to show matching brace (1/10 sec)
set scrolloff=3 " lines to always seeable when scrolling
set laststatus=1 " enable status line always
set wildmenu " way cooler command line mode completion
set wildmode=list:longest " complete like shell
set wildignore+=*.o,+=*.obj,+=*.bak,+=*.exe,+=*~,+=*.hi
"set foldenable foldcolumn=2 foldlevelstart=99 foldmethod=syntax
" -----------------------------------------------------------------------------
" Searching
" -----------------------------------------------------------------------------
set incsearch " do incremental searching
set hlsearch
set ignorecase " make this default, turn on case in search with /<search>\C/
" type small case will search case independent, type mixed case will use exact
set smartcase
" -----------------------------------------------------------------------------
" Specail File Cases
" -----------------------------------------------------------------------------
if has("autocmd")
" In Makefiles, use real tabs, not tabs expanded to spaces
au FileType make set noexpandtab
" Make sure all mardown files have the correct filetype set and setup wrapping
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} setf markdown | call SetupWrapping()
" Treat JSON files like JavaScript
au BufNewFile,BufRead *.json set ft=javascript
" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79 expandtab
" Remember last location in file, but not for commit messages.
" see :help last-position-jump
au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g`\"" | endif
endif
" -----------------------------------------------------------------------------
" Mapping
" -----------------------------------------------------------------------------
" setup mapleader
let mapleader=","
imap jj <Esc>
map <silent> bb :ToggleBookmark<CR>
map <silent> bn :NextBookmark<CR>
map <silent> bp :PreviousBookmark<CR>
" map - to end of line, _ to start
noremap - ^
noremap _ $
" Better way to enter command line (get rid of pointless shift)
nnoremap ; :
cnoremap ; <C-C>
"---------------------
"# New Movement Keys #
"---------------------
" normally nothing
noremap <C-k> 2<C-Y>
noremap <C-j> 2<C-E>
" sudo write
ca w!! w !sudo tee > /dev/null "%"
"-------------------------------------
"# File/Window/Buffer Managment Keys #
"-------------------------------------
"" quick file browse mapping
map <Leader>e :e %:p:h<CR>
map <Leader>E :lcd %:p:h<CR>
"" new tab
""nmap <Leader>t :tabe %:p:h<CR>
nmap <Leader>t :tabe .<CR>
nmap <Leader>n :tabnew<CR>
"" Give tab cycling nicer keys (normally these just do same as j & k)
map <Leader><Tab> :tabnext<CR>
map <Leader><S-Tab> :tabprevious<CR>
"" close window
map <Leader>q :q<CR>
"" quit vim
map <Leader>Q :qall!<CR>
" -----------------------------------------------------------------------------
" Whitespace
" -----------------------------------------------------------------------------
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
"Highlight more than 80 chars
if exists('+colorcolumn')
set colorcolumn=80
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
function StripTrailingWhitespace()
if !&binary && &filetype != 'diff'
normal mz
normal Hmy
%s/\s\+$//e
normal 'yz<CR>
normal `z
endif
endfunction
map <silent> cc :call Flake8()<CR>
" ---------
" Powerline
" ---------
"to fix the font and lot of strange characters and colors
set encoding=utf-8
set laststatus=2 " Always display the statusline in all windows
set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
if ! has('gui_running')
set ttimeoutlen=10
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
endif
let g:Powerline_colorscheme="solarized256"
" Git commit message
function! CommitMessages()
set spelllang=en_us spell
let g:git_ci_msg_user = substitute(system("git config --get user.name"),
\ '\n$', '', '')
let g:git_ci_msg_email = substitute(system("git config --get user.email"),
\ '\n$', '', '')
nmap S oSigned-off-by: <C-R>=printf("%s <%s>",
\ g:git_ci_msg_user, g:git_ci_msg_email)<CR><CR><ESC>
nmap R oReviewed-by: <C-R>=printf("%s <%s>",
\ g:git_ci_msg_user, g:git_ci_msg_email)<CR><ESC>
endf
au FileType gitcommit call CommitMessages()
autocmd BufWinEnter COMMIT_EDITMSG,*.diff,*.patch,*.patches.txt call CommitMessages()
autocmd Filetype gitcommit,mail,rst setlocal spell spelllang=en_us,el