-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
158 lines (128 loc) · 3.86 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
" enable syntax highlighting
syntax on
" Highlight redundant whitespaces and tabs.
"highlight RedundantSpaces ctermbg=red guibg=red
"match RedundantSpaces /\s\+$\| \+\ze\t\|\t/
" use 4 spaces instead of tabs
set tabstop=2
set expandtab
set shiftwidth=2
set softtabstop=2
" always show ^M in DOS files
set fileformats=unix
" my terminal is white on black
set background=dark
highlight Comment ctermbg=blue
highlight Comment ctermfg=white
" always show line and col number and the current command, set title
set ruler
set showcmd
set title titlestring=vim\ %f
" caseinsensitive incremental search
set ignorecase
set incsearch
" Show matching brackets
set showmatch
" disable any autoindenting which could mess with your mouse pastes (and your head)
" (not useing 'set paste' here to keep fancy stuff like tab completion working)
set nocindent
set nosmartindent
set noautoindent
set indentexpr=
filetype indent on
"filetype plugin indent off
" Get rid of folding
set nofoldenable
" This function determines, wether we are on the start of the line text (then tab indents) or
" if we want to try autocompletion
func! InsertTabWrapper()
"let col = col('.') - 1
"if !col || getline('.')[col - 1] !~ '\k'
" return \<tab>
"else
" return \<c-p>
"endif
return "\<tab>"
endfunction
" Remap the tab key to select action with InsertTabWrapper
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
filetype on " Enable filetype detection
filetype plugin on
" function to cleanup a text -> mapped to F5
fun CleanText()
let curcol = col(".")
let curline = line(".")
exe ":retab"
exe ":%s/^M$//ge"
exe ":%s/^M/ /ge"
exe ":%s/ \\+$//e"
call cursor(curline, curcol)
endfun
map <F5> :call CleanText()<CR>
au BufNewFile,BufRead *.i set filetype=swig
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on
"
" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash
" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*
if (&tildeop)
nmap gc guiw~l
vmap gc gu~l
else
nmap gc guiw~h
vmap gc gu~h
endif
" Toggle function for spelling
" Read http://goo.gl/dE6PR before using!
func! ToggleSpl( lang )
if &l:spl =~ '\v(^|,)\V'.escape(a:lang,'\').'\v(,|$)'
"Alternatively, since 'spl' may not contain a comma this also
"works:
"if index(split(&l:spl,','),a:lang) != -1
exec 'setl spl-='.a:lang
else
exec 'setl spl+='.a:lang
endif
:setl spell spl
endfun
" Toggle german spelling
map <F3> :call ToggleSpl('de')<cr>
" Toggle english spelling
map <F4> :call ToggleSpl('en')<cr>
" Enable proper pasting, see http://goo.gl/YauET
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
" Enable 256 colors
set t_Co=256
" ruby autocompletion
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
let g:SuperTabDefaultCompletionType = "<C-X><C-O>"
"improve autocomplete menu color
highlight Pmenu ctermbg=238 gui=bold
" infect with pathogen, see https://github.com/tpope/vim-pathogen
" execute pathogen#infect()
" map Ctrl+c to toggle nerdtree
" map <C-c> :NERDTreeToggle<CR>
" respect dos line endings. when saving, use the same format. on mixed files,
" unix takes precedence
set ffs=dos,unix
" swap files (.swp) in a common location
" // means use the file's full path
set dir=~/.vim/_swap//
" backup files (~) in a common location if possible
set backup
set backupdir=~/.vim/_backup/,~/tmp,.
" turn on undo files, put them in a common location
"set undofile
"set undodir=~/.vim/_undo/
" set UTF-8 encoding
set encoding=utf-8