diff options
author | Max Christian Pohle | 2015-09-06 05:08:14 +0200 |
---|---|---|
committer | Max Christian Pohle | 2015-09-06 05:08:14 +0200 |
commit | 64436bf70832028052dd278760761230d7d0bc77 (patch) | |
tree | 29c90b25369169b85417009626da1713edcc9a30 /vimrc | |
parent | 4a3e984105a960556bd727662c349170a61eb4fb (diff) | |
download | vim-karlmarks-64436bf70832028052dd278760761230d7d0bc77.tar.bz2 vim-karlmarks-64436bf70832028052dd278760761230d7d0bc77.zip |
switched to vundle, cleaned and commented the vimrc
Diffstat (limited to 'vimrc')
-rw-r--r-- | vimrc | 767 |
1 files changed, 166 insertions, 601 deletions
@@ -1,622 +1,187 @@ | |||
1 | call pathogen#infect() | 1 | "================================================================================ |
2 | " Pathogen | 2 | " Vundle: plugin manager... |
3 | set nocompatible| " do not try to be vi, be vim | ||
4 | filetype off| " Vundle needs this | ||
5 | set rtp+=~/.vim/plugins/Vundle.vim | ||
6 | call vundle#begin('~/.vim/plugins/') | ||
7 | |||
8 | " Plugin dependant configurations... | ||
9 | Plugin 'VundleVim/Vundle.vim' | ||
10 | Plugin 'cscope_plus.vim' " run cscope -R -b in project folder then use | ||
11 | Plugin 'autoload_cscope.vim' " CTRL+\ s searches word under cursor, CTRL+T back | ||
12 | Plugin 'tpope/vim-fugitive' " the most complete GIT integration plugin | ||
13 | Plugin 'taglist-plus' " quick code navigator | ||
14 | let Tlist_Compact_Format = 1 | ||
15 | let Tlist_GainFocus_On_ToggleOpen = 1 | ||
16 | let Tlist_Close_On_Select = 1 | ||
17 | Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion | ||
18 | let g:ycm_global_ycm_extra_conf = '/home/max/.vim/_ycm_extra_conf.py' | " fallback, right one should be in the applications path | ||
19 | let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?' | ||
20 | let g:ycm_key_select_completion = '<Tab>' | " key completion key | ||
21 | let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar | ||
22 | let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar | ||
23 | let g:ycm_collect_identifiers_from_tags_files = 1 | " | ||
24 | let g:ycm_autoclose_preview_window_after_insertion=1 | " close the window when leaving insert mode | ||
25 | inoremap <buffer> ( <C-X><C-o>( | ||
26 | "if !exists("g:ycm_semantic_triggers") | ||
27 | " let g:ycm_semantic_triggers = {} | ||
28 | "endif | ||
29 | "let g:ycm_semantic_triggers['c'] = ['('] | " | ||
30 | |||
31 | |||
32 | call vundle#end() | " required | ||
33 | filetype plugin indent on | " required | ||
34 | |||
35 | "================================================================================ | ||
36 | " custom config | ||
37 | |||
38 | set noswapfile | " noundofile, nobackup, nowritebackup | ||
39 | set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory | ||
40 | set directory=~/.vim/temp | " | ||
41 | set undodir=~/.vim/temp | " | ||
42 | |||
43 | set ts=2 sts=2 sw=2 expandtab | " indentation which i like | ||
44 | set autoindent | " always set autoindenting on | ||
45 | set copyindent | " copy the previous indentation on autoindenting | ||
46 | set scrolloff=2 | " always keeps at least two lines visible (when seeking) | ||
47 | |||
48 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) | ||
49 | set number | " toggle line numbers | ||
50 | set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap | ||
51 | set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap | ||
52 | set diffopt+=iwhite,filler | " lets diff ignore white spaces | ||
53 | set spell| set spelllang=en,de| " enable spell checker | ||
54 | set showcmd | " displays status line messages while selecting (matrix size) | ||
55 | set breakindent cpoptions+=n | " when wrapping lines indent wrapped line to align with the previews | ||
56 | set linebreak | " do not wrap in the middle of words | ||
57 | set showbreak=› | " symbol used in the beginning of a wrapped line | ||
58 | set listchars=tab:▸\ ,eol:¬ | " symbols used when using :set list (which displays non-printable chars) | ||
59 | |||
60 | |||
61 | set virtualedit=onemore " one character beyond the line length should be navigatable (options: all,insert,block,onemore) | ||
62 | nnoremap <End> g$| " and make the <End> key position the cursor after the last char of that line:w | ||
63 | |||
64 | " search... | ||
65 | set ignorecase|set smartcase " if search pattern contains uppercase then search is case sensitive | ||
66 | set incsearch " do incremental searching | ||
67 | set showmatch|set matchtime=4 " blinks matching braces | ||
68 | |||
69 | set novisualbell " don't beep | ||
70 | set noerrorbells " don't beep | ||
71 | set guicursor=n-v-c:ver30-Cursor-blinkon500-blinkoff500 " how the caret looks like | ||
3 | 72 | ||
4 | filetype plugin indent on | 73 | if has("autocmd") |
5 | set omnifunc=syntaxcomplete#Complete | 74 | set modeline " set variables specific to a file, like indentation by adding a comment |
6 | 75 | set modelines=3 " how many lines in the beginning and end of the file can be mode lines? | |
7 | " conceal displays LaTeX formulars inline with UTF8 | ||
8 | set conceallevel=0 " 1,2 to enable it | ||
9 | set concealcursor= | ||
10 | |||
11 | set linebreak | ||
12 | |||
13 | "set wrap | ||
14 | set nowrap | ||
15 | |||
16 | set noswapfile | ||
17 | "set noundofile | ||
18 | "set nobackup | ||
19 | "set nowritebackup | ||
20 | set backupdir=~/.vim/temp | ||
21 | set directory=~/.vim/temp | ||
22 | set undodir=~/.vim/temp | ||
23 | |||
24 | " [code completion] | ||
25 | set completeopt=longest,menuone | ||
26 | |||
27 | " [spell checker] | ||
28 | "set spell " enable spell checking | ||
29 | set spelllang=en,de | ||
30 | |||
31 | set guifont=DejaVu\ Sans\ Mono\ bold\ 11 | ||
32 | "set guifont=Liberation\ Mono\ for\ Powerline\ 11 | ||
33 | |||
34 | |||
35 | |||
36 | " [Kopieren und Einfuegen] | ||
37 | " verwendet das x-window-clipboard <3 | ||
38 | set clipboard=unnamedplus | ||
39 | "set clipboard=autoselectplus | ||
40 | |||
41 | |||
42 | " [SUCHEN] | ||
43 | " When 'ignorecase' and 'smartcase' are both on, if a pattern contains an uppercase letter, it is case sensitive, otherwise, it is not. For example, /The would find only "The", while /the would find "the" or "The" etc. | ||
44 | set ignorecase | ||
45 | set smartcase | ||
46 | |||
47 | " [VIEW] | ||
48 | syntax on | ||
49 | |||
50 | |||
51 | " machen, dass der befehl wie z.B. " a p fuer register a | ||
52 | set showcmd | ||
53 | set number | ||
54 | |||
55 | set guioptions+=m "show menu bar | ||
56 | set guioptions-=T "remove toolbar | ||
57 | set guioptions+=r "show right-hand scroll bar | ||
58 | set guioptions-=c "use console dialogs instead of popups | ||
59 | set guioptions+=a "autoselect: copy&paste using middleclick | ||
60 | set guioptions+=e "add tab pages | ||
61 | set guioptions+=p "use gui pointer callback for x11 | ||
62 | |||
63 | |||
64 | " ohne den naechsten eintrag verschwindet die powerline manchmal... | ||
65 | set laststatus=2 | ||
66 | |||
67 | " set width for indentation | ||
68 | "set tabstop=2 | ||
69 | "set softtabstop=2 | ||
70 | "set shiftwidth=2 | ||
71 | " replace tabstop by space | ||
72 | "set expandtab | ||
73 | |||
74 | " same in short... | ||
75 | set ts=2 sts=2 sw=2 expandtab | ||
76 | |||
77 | |||
78 | let $PAGER='' | ||
79 | |||
80 | "set <S-Up>=^[[1;2A <S-Down>=^[[1;2B <S-Right>=^[[1;2C <S-Left>=^[[1;2D | ||
81 | "set <F13>=^[[24~ | ||
82 | "map <F13> <S-Down> | ||
83 | "nnoremap <F13> :test | ||
84 | "set <F13>=^[9;0011 | ||
85 | " map <F13> <xF1> | ||
86 | |||
87 | " q: ist der befehlseditor, damit kann man befehle kopieren in den textblock" | ||
88 | " q/ ist die history fuer die letzten suchen | ||
89 | " | ||
90 | " au=auto command, vimenter=event, *=filetype, NERDTree=command | ||
91 | " au vimenter * NERDTree | ||
92 | |||
93 | "nnoremap <Tab> :tabnext | ||
94 | "nnoremap <S-Tab> :tabpreviews | ||
95 | |||
96 | "nnoremap <C-Tab> :bnext<CR> | ||
97 | "nnoremap <C-S-Tab> :bprevious<CR> | ||
98 | |||
99 | "nnoremap <C-Tab> <C-PageDown> | ||
100 | "nnoremap <C-S-Tab> <C-PageUp> | ||
101 | " | ||
102 | nnoremap <C-Tab> :tabnext<CR> | ||
103 | nnoremap <C-S-Tab> :tabprevious<CR> | ||
104 | " do not display full path as tabname | ||
105 | set guitablabel=%t | ||
106 | |||
107 | "nnoremap <C-Tab> :bnext<CR> | ||
108 | "nnoremap <C-S-Tab> :bprevious<CR> | ||
109 | |||
110 | "nnoremap <C-Space> :call s:LaunchCompletion() | ||
111 | "inoremap <C-space> <C-x><C-o><C-p> | ||
112 | nnoremap <C-space> <C-n><C-n><C-p> | ||
113 | "inoremap <C-Space> <C-x><C-o> | ||
114 | inoremap <C-Space> <C-n> | ||
115 | "inoremap <C-@> <C-Space> | ||
116 | " open omni completion menu closing previous if open and opening new menu without changing the text | ||
117 | " | ||
118 | " simulate CTRL+C | ||
119 | vnoremap <C-c> y | ||
120 | "vnoremap <C-x> d | ||
121 | "noremap <C-v> gP " interfers with VISUAL BLOCK mode | ||
122 | |||
123 | " activate visual mode in normal mode | ||
124 | "map <S-Up> V | ||
125 | ":map <S-Down> V | ||
126 | " these are mapped in visual mode | ||
127 | "map <S-Up> k | ||
128 | "map <S-Down> j | ||
129 | " increase/decrease indent in visual mode by tab and shift-tab | ||
130 | vmap <Tab> >gv | ||
131 | vmap <S-Tab> <gv | ||
132 | |||
133 | " make arrow keys work in visual mode | ||
134 | vmap <Esc>OA k | ||
135 | vmap <Esc>OB j | ||
136 | vmap <Esc>OC l | ||
137 | vmap <Esc>OD h | ||
138 | " map shift-right to visually select and so on | ||
139 | nnoremap <C-Right> El | ||
140 | nnoremap <S-Right> vl | ||
141 | nnoremap <S-Left> vj | ||
142 | nnoremap <S-Up> vk | ||
143 | nnoremap <S-Down> vj | ||
144 | |||
145 | " quickfix list (lists errors and warnings) | ||
146 | " nnoremap <F5> :cw<CR> | ||
147 | nnoremap <F5> :call ToggleQuickfixList()<CR> | ||
148 | |||
149 | |||
150 | "nnoremap <Tab> :MBEbf<CR> | ||
151 | "nnoremap <S-Tab> :MBEbb<CR> | ||
152 | nnoremap <Tab> <C-w>w | ||
153 | nnoremap <S-Tab> <C-w>W | ||
154 | |||
155 | |||
156 | " nnoremap <C-w> :q<CR> | ||
157 | noremap! <C-s> <ESC>:w<CR> | ||
158 | |||
159 | "nnoremap <C-]> :PREVCOLOR<CR> | ||
160 | nnoremap <C-K> :NEXTCOLOR<CR> | ||
161 | |||
162 | |||
163 | nnoremap <Home> ^ | ||
164 | vmap <Home> ^ | ||
165 | 76 | ||
166 | nnoremap <End> $ | 77 | |
167 | vmap <End> $ | 78 | augroup resCur | " make cursor appear in its previous position when reopening a file... |
79 | "autocmd! | ||
80 | autocmd BufReadPost * call setpos(".", getpos("'\"")) | ||
81 | augroup END | ||
168 | 82 | ||
169 | nnoremap <Leader> \ | 83 | augroup PreviewOnBottom | " will open new windows below the current (only in insert mode, so that the preview window is drawn below) |
84 | autocmd InsertEnter * set splitbelow | ||
85 | autocmd InsertLeave * set splitbelow! | ||
86 | augroup END | ||
170 | 87 | ||
171 | " nnoremap <C-o> :NERDTreeToggle<CR> | 88 | augroup OmniFunc | " this will enable omnicomplete just in case this configuration runs somewhere, where YouCompleteMe is not compiled |
172 | nnoremap <C-o> :browse e<CR> | 89 | if exists("+omnifunc") |
173 | let NERDTreeShowHidden=1 | 90 | autocmd Filetype * |
174 | let NERDTreeQuiToNopen=1 | 91 | \ if &omnifunc == "" | |
175 | let NERDChristmasTree=1 | 92 | \ setlocal omnifunc=syntaxcomplete#Complete | |
176 | let NERDTreeMinimalUI=1 | 93 | \ setlocal completeopt=longest,menuone | |
177 | let NERDTreeWinSize = 40 | 94 | \ endif |
178 | let NERDTreeMapToggleHidden='\h' | 95 | endif |
96 | augroup END | ||
179 | 97 | ||
180 | " -------------------------------------------------------------------- | 98 | autocmd FileType text setlocal textwidth=78 " text files: set 'textwidth' to 78 |
181 | let g:airline_left_sep = '▶' | 99 | autocmd FileType gitcommit set tw=72 " longer commit messages without auto line wrapping |
182 | let g:airline_right_sep = '◀' | 100 | autocmd FileType LaTeX let g:tex_flavor = "latex" |set conceallevel=1| set concealcursor= |
183 | "let g:airline_theme = 'powerlineish' | ||
184 | "let g:airline_theme = 'tomorrow' | ||
185 | let g:airline_theme = 'light' | ||
186 | let g:airline_powerline_fonts = 1 | ||
187 | if !exists('g:airline_symbols') | ||
188 | let g:airline_symbols = {} | ||
189 | endif | 101 | endif |
190 | let g:airline_symbols.space = "\ua0" | ||
191 | |||
192 | |||
193 | let g:miniBufExplAutoStart = 1 | ||
194 | "let g:miniBufExplVSplit = 20 " column width in chars | ||
195 | "let g:miniBufExplBRSplit = 1 " Put new window below | ||
196 | let g:miniBufExplShowBufNumbers = 0 | ||
197 | let g:miniBufExplUseSingleClick = 1 | ||
198 | let g:miniBufExplCycleArround = 1 | ||
199 | let g:miniBufExplMapWindowNavVim = 1 | ||
200 | let g:miniBufExplMapWindowNavArrows = 1 | ||
201 | let g:miniBufExplMapCTabSwitchBufs = 1 | ||
202 | let g:miniBufExplModSelTarget = 1 | ||
203 | " MiniBufExpl Colors | ||
204 | hi MBENormal guifg=fg guibg=bg | ||
205 | hi MBEChanged guifg=red guibg=bg | ||
206 | hi MBEVisibleNormal guifg=bg guibg=fg | ||
207 | hi MBEVisibleChanged guifg=bg guibg=FG | ||
208 | hi MBEVisibleActiveNormal guifg=bg guibg=fg | ||
209 | hi MBEVisibleActiveChanged guifg=bg guibg=fg | ||
210 | 102 | ||
211 | 103 | "================================================================================ | |
212 | if v:version >= 700 | 104 | " gui stuff and appearance |
213 | au BufLeave * let b:winview = winsaveview() | 105 | if &t_Co > 2 |
214 | au BufEnter * if(exists('b:winview')) | call winrestview(b:winview) | endif | 106 | set hlsearch " |
107 | set cursorline " highlight currently selected line | ||
215 | endif | 108 | endif |
216 | 109 | ||
217 | " function! PlaySound() | 110 | if has('mouse') |
218 | " silent! exec '!play ~/.vim/support/tape.aiff &' | 111 | set mouse=a |
219 | " endfunction | 112 | endif |
220 | "autocmd CursorMovedI * call PlaySound() | ||
221 | |||
222 | |||
223 | set nocompatible | ||
224 | set modeline | ||
225 | set modelines=3 | ||
226 | " vim: syntax=vim | ||
227 | " | ||
228 | " | ||
229 | " | ||
230 | " clang_autocomplete options | ||
231 | |||
232 | |||
233 | let g:clang_use_library=1 | ||
234 | "let g:clang_library_path='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib' | ||
235 | let g:clang_auto_select=0 | ||
236 | let g:clang_complete_auto=1 " automatically complete after ->, ., :: | ||
237 | let g:clang_periodic_quickfix=1 | ||
238 | let g:clang_close_preview=1 " If equal to 1, the preview window will be close automatically after a completion | ||
239 | "let g:clang_snippets=1 | ||
240 | "let g:clang_conceal_snippets=1 | ||
241 | "let g:clang_snippets_engine='clang_complete' | ||
242 | "let g:clang_complete_macros=1 | ||
243 | "let g:clang_complete_patterns=1 | ||
244 | "let g:clang_close_preview=1 | ||
245 | |||
246 | " Show clang errors in the quickfix window | ||
247 | "let g:clang_complete_copen = 1 | ||
248 | " | ||
249 | " | ||
250 | let g:clang_user_options='|| exit 0' | ||
251 | let g:clang_sort_algo="alpha" | ||
252 | |||
253 | |||
254 | |||
255 | " muss am ende stehen, macht das INSERT nicht angezeigt wird. macht ja airline | ||
256 | " auch schon. | ||
257 | set noshowmode " hide --INSERT-- from command line (as its already shown in airline) | ||
258 | set cursorline " highlight currently selected line | ||
259 | |||
260 | set wildmenu " displays command options in status line / airline when pressing TAB | ||
261 | set wildmode=longest:full,full | ||
262 | |||
263 | set scrolloff=2 " always keep at least two lines visible (when seeking) | ||
264 | |||
265 | "noremap help vert help | ||
266 | cabbrev help tab help | ||
267 | "autocmd FileType help,* wincmd L | ||
268 | |||
269 | "autocmd BufNew * if winnr('$') == 1 | tab sball | endif | ||
270 | "autocmd BufReadPost * tab ball | ||
271 | map ,e :e <C-R>=expand("%:p:h") . "/" <CR> | ||
272 | |||
273 | " If wanted, auto commenting can be disabled for all files with: | ||
274 | autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | ||
275 | 113 | ||
276 | colorscheme maxvb6 | ||
277 | if has("gui_running") | 114 | if has("gui_running") |
278 | "colorscheme Tomorrow-Night-Blue | 115 | set guitablabel=%t " do not display full path as tabname |
279 | "colorscheme bclear | 116 | set guioptions+=m " menu bar |
117 | set guioptions+=T " toolbar | ||
118 | set guioptions+=r " right-hand scroll bar | ||
119 | set guioptions-=c " use console dialogs instead of popups | ||
120 | set guioptions+=a " autoselect: copy&paste using middleclick | ||
121 | set guioptions+=e " add tab pages | ||
122 | set guioptions+=p " use gui pointer callback for x11 | ||
123 | set toolbariconsize=large " make the icon toolbar as big as possible | ||
280 | else | 124 | else |
281 | " use 256 colors in Console mode if we think the terminal supports it | ||
282 | if &term =~? 'mlterm\|xterm\|screen' | 125 | if &term =~? 'mlterm\|xterm\|screen' |
283 | set t_Co=256 | 126 | set t_Co=256 | " fixes incompatibilities with our color scheme |
284 | endif | 127 | endif |
285 | "set t_Co=256 | 128 | set title | " set the terminal caption |
286 | "set t_AB=^[[48;5;%dm | 129 | set titleold="vim ended" | " set terminal title after closing vim |
287 | "set t_AF=^[[38;5;%dm | 130 | set titlestring="VIM-CONSOLE" | " set window title |
288 | "set term=ansi | 131 | set icon | " sets the terminal icon to vim |
289 | "colorscheme ibmedit | 132 | set ttyfast | " modern terminals are all fast in a way |
290 | "colorscheme h80 | ||
291 | "colorscheme greyhouse | ||
292 | "colorscheme tango-morning | ||
293 | "colorscheme jhlight | ||
294 | "colorscheme newspaper | ||
295 | "colorscheme relaxedgreen | ||
296 | let g:airline_theme = 'hybrid' | ||
297 | "highlight LineNr ctermfg=grey ctermbg=black | ||
298 | endif | 133 | endif |
299 | 134 | ||
300 | 135 | colorscheme maxvb6 | |
301 | " ex command for toggling hex mode - define mapping if desired | 136 | syntax enable |
302 | command -bar Hexmode call ToggleHex() | 137 | |
303 | 138 | "================================================================================ | |
304 | " helper function to toggle hex mode | 139 | " plugin hotkeys |
305 | function ToggleHex() | 140 | nnoremap <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L |
306 | " hex mode should be considered a read-only operation | 141 | |
307 | " save values for modified and read-only for restoration later, | 142 | " code completion: http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE |
308 | " and clear the read-only flag for now | 143 | " reacts on CTRL+P, CTRL+Space |
309 | let l:modified=&mod | 144 | inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" |
310 | let l:oldreadonly=&readonly | 145 | inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" |
311 | let &readonly=0 | 146 | inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>" |
312 | let l:oldmodifiable=&modifiable | 147 | inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>" |
313 | let &modifiable=1 | 148 | inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>" |
314 | if !exists("b:editHex") || !b:editHex | 149 | inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>" |
315 | " save old options | 150 | |
316 | let b:oldft=&ft | 151 | " custom commands... |
317 | let b:oldbin=&bin | 152 | cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user |
318 | " set new options | 153 | |
319 | setlocal binary " make sure it overrides any textwidth, etc. | 154 | " custom hotkeys... |
320 | let &ft="xxd" | 155 | nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs |
321 | " set status | 156 | nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab |
322 | let b:editHex=1 | 157 | nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines... |
323 | " switch to hex editor | 158 | map <C-h> <C-w>h|map <C-j> <C-w>j|map <C-k> <C-w>k|map <C-l> <C-w>l| " window navigation shortcut |
324 | %!xxd | 159 | |
325 | else | 160 | |
326 | " restore old options | 161 | "================================================================================ |
327 | let &ft=b:oldft | 162 | " deactivated on-demand commands (just in case one needs them one day) |
328 | if !b:oldbin | 163 | " set guiheadroom=0| " do not fill non-functional area of the empty editor with gtk background |
329 | setlocal nobinary | 164 | " map shift-right to visually select and so on |
330 | endif | 165 | "nnoremap <C-Right> El |
331 | " set status | 166 | "nnoremap <S-Right> vl |
332 | let b:editHex=0 | 167 | "nnoremap <S-Left> vj |
333 | " return to normal editing | 168 | "nnoremap <S-Up> vk |
334 | %!xxd -r | 169 | "nnoremap <S-Down> vj |
335 | endif | 170 | " noremap % v% " jump between braces and highlight |
336 | " restore values for modified and read only state | 171 | "nnoremap <Home> ^ |
337 | let &mod=l:modified | 172 | "vmap <Home> ^ |
338 | let &readonly=l:oldreadonly | 173 | "nnoremap <End> $ |
339 | let &modifiable=l:oldmodifiable | 174 | "vmap <End> $ |
340 | endfunction | 175 | "nnoremap <C-Tab> <C-PageDown> |
341 | 176 | "nnoremap <C-S-Tab> <C-PageUp> | |
342 | 177 | ":inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | |
343 | " Show syntax highlighting groups for word under cursor | 178 | "map <Esc>OA k|map <Esc>OB j|map <Esc>OC l|map <Esc>OD h| " allow cursor keys in insert mode |
344 | map <C-S-P> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' | ||
345 | \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" | ||
346 | \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR> | ||
347 | |||
348 | |||
349 | " Append modeline after last line in buffer using \ml | ||
350 | " Use substitute() instead of printf() to handle '%%s' modeline in LaTeX | ||
351 | " files. | ||
352 | function! AppendModeline() | ||
353 | let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", | ||
354 | \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') | ||
355 | let l:modeline = substitute(&commentstring, "%s", l:modeline, "") | ||
356 | call append(line("$"), l:modeline) | ||
357 | endfunction | ||
358 | nnoremap <silent> <Leader>ml :call AppendModeline()<CR> | ||
359 | |||
360 | |||
361 | " make vimdiff ignore white spaces | ||
362 | set diffopt+=iwhite | ||
363 | set diffopt+=filler | ||
364 | set diffexpr="" | ||
365 | set nocompatible | ||
366 | |||
367 | |||
368 | set diffopt+=iwhite | ||
369 | |||
370 | |||
371 | set guicursor=n-v-c:ver30-Cursor-blinkon500-blinkoff500 | ||
372 | highlight Cursor guifg=black guibg=lightgreen | ||
373 | |||
374 | |||
375 | |||
376 | set virtualedit=onemore | ||
377 | " damit das highlight der klammern nicht genauso aussieht wie der cursor | ||
378 | hi MatchParen cterm=none ctermbg=yellow ctermfg=yellow | ||
379 | |||
380 | |||
381 | " An example for a vimrc file. | ||
382 | " | 179 | " |
383 | " Maintainer: Bram Moolenaar <Bram@vim.org> | 180 | "inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>" " breaks cursor keys! |
384 | " Last change: 2014 Nov 05 | 181 | " binding ESC can easily break cursor key movement on the console (tricky, because gvim works) |
385 | " | 182 | " |
386 | " To use it, copy it to | ||
387 | " for Unix and OS/2: ~/.vimrc | ||
388 | " for Amiga: s:.vimrc | ||
389 | " for MS-DOS and Win32: $VIM\_vimrc | ||
390 | " for OpenVMS: sys$login:.vimrc | ||
391 | |||
392 | " When started as "evim", evim.vim will already have done these settings. | ||
393 | if v:progname =~? "evim" | ||
394 | finish | ||
395 | endif | ||
396 | |||
397 | " Use Vim settings, rather than Vi settings (much better!). | ||
398 | " This must be first, because it changes other options as a side effect. | ||
399 | set nocompatible | ||
400 | |||
401 | " allow backspacing over everything in insert mode | ||
402 | set backspace=indent,eol,start | ||
403 | |||
404 | if has("vms") | ||
405 | set nobackup " do not keep a backup file, use versions instead | ||
406 | else | ||
407 | set backup " keep a backup file (restore to previous version) | ||
408 | set undofile " keep an undo file (undo changes after closing) | ||
409 | endif | ||
410 | set history=50 " keep 50 lines of command line history | ||
411 | set ruler " show the cursor position all the time | ||
412 | set showcmd " display incomplete commands | ||
413 | set incsearch " do incremental searching | ||
414 | |||
415 | " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries | ||
416 | " let &guioptions = substitute(&guioptions, "t", "", "g") | ||
417 | |||
418 | " Don't use Ex mode, use Q for formatting | ||
419 | map Q gq | ||
420 | |||
421 | " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, | ||
422 | " so that you can undo CTRL-U after inserting a line break. | ||
423 | inoremap <C-U> <C-G>u<C-U> | ||
424 | |||
425 | " In many terminal emulators the mouse works just fine, thus enable it. | ||
426 | if has('mouse') | ||
427 | set mouse=a | ||
428 | endif | ||
429 | |||
430 | " Switch syntax highlighting on, when the terminal has colors | ||
431 | " Also switch on highlighting the last used search pattern. | ||
432 | if &t_Co > 2 || has("gui_running") | ||
433 | syntax on | ||
434 | set hlsearch | ||
435 | endif | ||
436 | |||
437 | " Only do this part when compiled with support for autocommands. | ||
438 | if has("autocmd") | ||
439 | |||
440 | " Enable file type detection. | ||
441 | " Use the default filetype settings, so that mail gets 'tw' set to 72, | ||
442 | " 'cindent' is on in C files, etc. | ||
443 | " Also load indent files, to automatically do language-dependent indenting. | ||
444 | filetype plugin indent on | ||
445 | |||
446 | " Put these in an autocmd group, so that we can delete them easily. | ||
447 | augroup vimrcEx | ||
448 | au! | ||
449 | |||
450 | " For all text files set 'textwidth' to 78 characters. | ||
451 | autocmd FileType text setlocal textwidth=78 | ||
452 | |||
453 | " When editing a file, always jump to the last known cursor position. | ||
454 | " Don't do it when the position is invalid or when inside an event handler | ||
455 | " (happens when dropping a file on gvim). | ||
456 | " Also don't do it when the mark is in the first line, that is the default | ||
457 | " position when opening a file. | ||
458 | autocmd BufReadPost * | ||
459 | \ if line("'\"") > 1 && line("'\"") <= line("$") | | ||
460 | \ exe "normal! g`\"" | | ||
461 | \ endif | ||
462 | |||
463 | augroup END | ||
464 | |||
465 | else | ||
466 | |||
467 | set autoindent " always set autoindenting on | ||
468 | |||
469 | endif " has("autocmd") | ||
470 | |||
471 | " Convenient command to see the difference between the current buffer and the | ||
472 | " file it was loaded from, thus the changes you made. | ||
473 | " Only define it when not defined already. | ||
474 | if !exists(":DiffOrig") | ||
475 | command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis | ||
476 | \ | wincmd p | diffthis | ||
477 | endif | ||
478 | |||
479 | if has('langmap') && exists('+langnoremap') | ||
480 | " Prevent that the langmap option applies to characters that result from a | ||
481 | " mapping. If unset (default), this may break plugins (but it's backward | ||
482 | " compatible). | ||
483 | set langnoremap | ||
484 | endif | ||
485 | |||
486 | |||
487 | |||
488 | |||
489 | |||
490 | |||
491 | |||
492 | |||
493 | |||
494 | |||
495 | |||
496 | |||
497 | |||
498 | |||
499 | |||
500 | |||
501 | |||
502 | |||
503 | |||
504 | |||
505 | |||
506 | |||
507 | |||
508 | |||
509 | |||
510 | |||
511 | |||
512 | |||
513 | |||
514 | |||
515 | |||
516 | |||
517 | |||
518 | |||
519 | " An example for a vimrc file. | ||
520 | " | 183 | " |
521 | " Maintainer: Bram Moolenaar <Bram@vim.org> | ||
522 | " Last change: 2014 Nov 05 | ||
523 | " | 184 | " |
524 | " To use it, copy it to | ||
525 | " for Unix and OS/2: ~/.vimrc | ||
526 | " for Amiga: s:.vimrc | ||
527 | " for MS-DOS and Win32: $VIM\_vimrc | ||
528 | " for OpenVMS: sys$login:.vimrc | ||
529 | |||
530 | " When started as "evim", evim.vim will already have done these settings. | ||
531 | if v:progname =~? "evim" | ||
532 | finish | ||
533 | endif | ||
534 | |||
535 | " Use Vim settings, rather than Vi settings (much better!). | ||
536 | " This must be first, because it changes other options as a side effect. | ||
537 | set nocompatible | ||
538 | |||
539 | " allow backspacing over everything in insert mode | ||
540 | set backspace=indent,eol,start | ||
541 | |||
542 | if has("vms") | ||
543 | set nobackup " do not keep a backup file, use versions instead | ||
544 | else | ||
545 | set backup " keep a backup file (restore to previous version) | ||
546 | set undofile " keep an undo file (undo changes after closing) | ||
547 | endif | ||
548 | set history=50 " keep 50 lines of command line history | ||
549 | set ruler " show the cursor position all the time | ||
550 | set showcmd " display incomplete commands | ||
551 | set incsearch " do incremental searching | ||
552 | |||
553 | " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries | ||
554 | " let &guioptions = substitute(&guioptions, "t", "", "g") | ||
555 | |||
556 | " Don't use Ex mode, use Q for formatting | ||
557 | map Q gq | ||
558 | 185 | ||
559 | " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, | 186 | "inoremap <C-Space> <C-x><C-o> |
560 | " so that you can undo CTRL-U after inserting a line break. | 187 | "inoremap <C-@> <C-Space> |
561 | inoremap <C-U> <C-G>u<C-U> | ||
562 | |||
563 | " In many terminal emulators the mouse works just fine, thus enable it. | ||
564 | if has('mouse') | ||
565 | set mouse=a | ||
566 | endif | ||
567 | |||
568 | " Switch syntax highlighting on, when the terminal has colors | ||
569 | " Also switch on highlighting the last used search pattern. | ||
570 | if &t_Co > 2 || has("gui_running") | ||
571 | syntax on | ||
572 | set hlsearch | ||
573 | endif | ||
574 | |||
575 | " Only do this part when compiled with support for autocommands. | ||
576 | if has("autocmd") | ||
577 | |||
578 | " Enable file type detection. | ||
579 | " Use the default filetype settings, so that mail gets 'tw' set to 72, | ||
580 | " 'cindent' is on in C files, etc. | ||
581 | " Also load indent files, to automatically do language-dependent indenting. | ||
582 | filetype plugin indent on | ||
583 | |||
584 | " Put these in an autocmd group, so that we can delete them easily. | ||
585 | augroup vimrcEx | ||
586 | au! | ||
587 | |||
588 | " For all text files set 'textwidth' to 78 characters. | ||
589 | autocmd FileType text setlocal textwidth=78 | ||
590 | |||
591 | " When editing a file, always jump to the last known cursor position. | ||
592 | " Don't do it when the position is invalid or when inside an event handler | ||
593 | " (happens when dropping a file on gvim). | ||
594 | " Also don't do it when the mark is in the first line, that is the default | ||
595 | " position when opening a file. | ||
596 | autocmd BufReadPost * | ||
597 | \ if line("'\"") > 1 && line("'\"") <= line("$") | | ||
598 | \ exe "normal! g`\"" | | ||
599 | \ endif | ||
600 | |||
601 | augroup END | ||
602 | |||
603 | else | ||
604 | |||
605 | set autoindent " always set autoindenting on | ||
606 | |||
607 | endif " has("autocmd") | ||
608 | |||
609 | " Convenient command to see the difference between the current buffer and the | ||
610 | " file it was loaded from, thus the changes you made. | ||
611 | " Only define it when not defined already. | ||
612 | if !exists(":DiffOrig") | ||
613 | command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis | ||
614 | \ | wincmd p | diffthis | ||
615 | endif | ||
616 | |||
617 | if has('langmap') && exists('+langnoremap') | ||
618 | " Prevent that the langmap option applies to characters that result from a | ||
619 | " mapping. If unset (default), this may break plugins (but it's backward | ||
620 | " compatible). | ||
621 | set langnoremap | ||
622 | endif | ||