diff options
author | Max Christian Pohle | 2016-05-09 17:00:35 +0200 |
---|---|---|
committer | Max Christian Pohle | 2016-05-09 17:00:35 +0200 |
commit | c2a13ef3f498d90fb9f46b830e14c31156635676 (patch) | |
tree | e125ca03554399949d6ca0fd27b7cf1953cbf02c /vimrc | |
parent | 8fd5f60d660f385b766b9c0e7ac874632c1cea1f (diff) | |
download | vim-karlmarks-c2a13ef3f498d90fb9f46b830e14c31156635676.tar.bz2 vim-karlmarks-c2a13ef3f498d90fb9f46b830e14c31156635676.zip |
moved repository up again
this repo shell be used for vim exclusively
Diffstat (limited to 'vimrc')
-rw-r--r-- | vimrc | 233 |
1 files changed, 233 insertions, 0 deletions
@@ -0,0 +1,233 @@ | |||
1 | " vi:columns=160:list:ts=2:sts=2:sw=2 | ||
2 | "================================================================================ | ||
3 | " Vundle: plugin manager... | ||
4 | set nocompatible | " do not try to be vi, be vim (required by Vundle) | ||
5 | filetype off | " Vundle needs this | ||
6 | set rtp+=~/.vim/plugins/Vundle.vim | " set runtimepath (required by Vundle) | ||
7 | call vundle#begin('~/.vim/plugins/') | " location where Vundle searches&installs plugins | ||
8 | |||
9 | " Plugin dependant configurations... | ||
10 | Plugin 'VundleVim/Vundle.vim' | " Vundle itself (required) | ||
11 | Plugin 'cscope_plus.vim' | " run cscope -R -b in project folder then use | ||
12 | Plugin 'autoload_cscope.vim' | " CTRL+\ s searches word under cursor, CTRL+T back | ||
13 | Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin | ||
14 | Plugin 'jeaye/color_coded' | " semantic highlighting with vim | ||
15 | Plugin 'terryma/vim-multiple-cursors' | " displays visual block mode as cursors | ||
16 | |||
17 | Plugin 'taglist-plus' | " quick code navigator | ||
18 | Plugin 'jdonaldson/vaxe' | " code completion for haxe | ||
19 | Plugin 'sheerun/vim-polyglot' | " better syntax highlighting/indentation for multiple languages | ||
20 | Plugin 'loremipsum' | " Sample text generator | ||
21 | let Tlist_Compact_Format = 1 | " | ||
22 | let Tlist_GainFocus_On_ToggleOpen = 1 | " | ||
23 | let Tlist_Close_On_Select = 1 | " | ||
24 | |||
25 | Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion | ||
26 | let g:ycm_global_ycm_extra_conf = '~/.vim/ycm_extra_conf.py' | " fallback, right one should be in the applications path | ||
27 | let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?' | ||
28 | let g:ycm_key_select_completion = '<Tab>' | " key completion key | ||
29 | let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar | ||
30 | let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar | ||
31 | let g:ycm_collect_identifiers_from_tags_files = 1 | " | ||
32 | let g:ycm_autoclose_preview_window_after_insertion=1 | " close the window when leaving insert mode | ||
33 | "let g:ycm_semantic_triggers = {'c' : ['(', ',']} | " add additional triggers (not recommend) | ||
34 | |||
35 | let b:html_omni_flavor='xhtml' | " prever xhtml over html because that makes inline php code possible without hassle | ||
36 | let html_use_css = 1 | " when using :TOhtml no font-tags will be used, but proper css | ||
37 | |||
38 | call vundle#end() | " required by Vundle | ||
39 | filetype plugin indent on | " required by Vundle | ||
40 | "================================================================================ | ||
41 | " custom config | ||
42 | colorscheme coderonline | ||
43 | syntax enable | ||
44 | |||
45 | set noswapfile | " noundofile, nobackup, nowritebackup | ||
46 | set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory | ||
47 | set directory=~/.vim/temp | " | ||
48 | set undodir=~/.vim/temp | " | ||
49 | |||
50 | set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth) | ||
51 | set autoindent | " always set autoindenting on | ||
52 | set copyindent | " copy the previous indentation on autoindenting | ||
53 | set scrolloff=2 | " always keeps at least two lines visible (when seeking) | ||
54 | " set selectmode=mouse | " avoid using select mode (only with mouse) | ||
55 | set mousemodel=popup_setpos | " display a default right click menu for the selection (that is c&p is possible) | ||
56 | set selection=exclusive | " includes last character of the selection into following command (like x or d) | ||
57 | |||
58 | set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap | ||
59 | set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap | ||
60 | set diffopt+=iwhite,filler | " lets diff ignore white spaces | ||
61 | set spell spelllang=en,de | " enable spell checker | ||
62 | set virtualedit=onemore | " one character beyond the line length should be navigatable (options: all,insert,block,onemore) | ||
63 | set breakindent cpoptions+=n | " when wrapping lines indent wrapped line to align with the previews | ||
64 | set linebreak | " do not wrap in the middle of words | ||
65 | set showcmd | " displays status line messages while selecting (matrix size) | ||
66 | set nofoldenable | " do not fold code automatically | ||
67 | set tags+=~/.vim/systags | " ctags -R -f ~/.vim/systags /usr/include /usr/local/include | ||
68 | set wildmenu wildmode=full | " wildmenu code completion | ||
69 | |||
70 | " search... | ||
71 | set ignorecase smartcase | " if search pattern contains uppercase then search is case sensitive | ||
72 | set incsearch | " do incremental searching | ||
73 | set showmatch matchtime=4 | " blinks matching braces | ||
74 | |||
75 | set novisualbell | " don't beep | ||
76 | set noerrorbells | " don't beep | ||
77 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) | ||
78 | set number | " toggle line numbers | ||
79 | |||
80 | if has("multi_byte") | ||
81 | set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) | ||
82 | scriptencoding utf-8 | " tell vim that we are using utf-8 here | ||
83 | set showbreak+=› | " symbol used in the beginning of a wrapped line | ||
84 | set listchars=eol:↲ | " symbols used when using :set list (which displays non-printable chars) | ||
85 | set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) | ||
86 | set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) | ||
87 | set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) | ||
88 | set listchars+=tab:▸\ | " symbols used when using :set list (which displays non-printable chars) | ||
89 | endif | ||
90 | |||
91 | if has("autocmd") | ||
92 | set modeline | " set variables specific to a file, like indentation by adding a comment | ||
93 | set modelines=3 | " how many lines in the beginning and end of the file can be mode lines? | ||
94 | |||
95 | augroup resCur | " make cursor appear in its previous position when reopening a file... | ||
96 | autocmd BufReadPost * call setpos(".", getpos("'\"")) | ||
97 | augroup END | ||
98 | |||
99 | augroup PreviewOnBottom | " will open new windows below the current (only in insert mode, so that the preview window is drawn below) | ||
100 | autocmd InsertEnter * set splitbelow | ||
101 | autocmd InsertLeave * set splitbelow! | ||
102 | augroup END | ||
103 | |||
104 | augroup OmniFunc | " this will enable omnicomplete just in case this configuration runs somewhere, where YouCompleteMe is not compiled | ||
105 | if exists("+omnifunc") | ||
106 | autocmd Filetype * | ||
107 | \ if &omnifunc == "" | | ||
108 | \ setlocal omnifunc=syntaxcomplete#Complete | | ||
109 | \ setlocal completeopt=longest,menuone | | ||
110 | \ endif | ||
111 | endif | ||
112 | augroup END | ||
113 | |||
114 | autocmd FileType text setlocal textwidth=78 | " text files: set 'textwidth' to 78 | ||
115 | autocmd FileType gitcommit set tw=72 | " longer commit messages without auto line wrapping | ||
116 | autocmd FileType LaTeX let g:tex_flavor = "latex"| set conceallevel=1| set concealcursor= | ||
117 | autocmd BufNewFile,BufReadPost *.config set filetype=xml | " visual studio config file | ||
118 | autocmd BufNewFile,BufReadPost *.csproj set filetype=xml | " visual studio project file | ||
119 | autocmd BufNewFile,BufReadPost *.sln set filetype=xml | " visual studio solution file | ||
120 | endif | ||
121 | |||
122 | "================================================================================ | ||
123 | " gui stuff and appearance | ||
124 | if &t_Co > 2 | ||
125 | set hlsearch | " highlight all search matches | ||
126 | set cursorline | " highlight currently selected line | ||
127 | endif | ||
128 | |||
129 | |||
130 | if has("gui_running") | ||
131 | set mouse=a | " use mouse in gui-mode (which is default) | ||
132 | set mouseshape+=n:beam,v:beam | " display a text input cursor even in normal and selection mode | ||
133 | set guicursor=n-v-c:ver30-Cursor-blinkon500-blinkoff500 | " how the caret looks like | ||
134 | set guitablabel=%t | " do not display full path as tabname | ||
135 | set guioptions+=m | " menu bar | ||
136 | set guioptions+=T | " toolbar | ||
137 | set guioptions+=r | " right-hand scroll bar | ||
138 | set guioptions-=c | " use console dialogs instead of popups | ||
139 | set guioptions+=a | " autoselect: copy&paste using middleclick | ||
140 | set guioptions+=e | " add tab pages | ||
141 | set guioptions+=p | " use gui pointer callback for x11 | ||
142 | set toolbariconsize=large | " make the icon toolbar as big as possible | ||
143 | "set columns=80 | " set initial window width (so that it fits the terminals) | ||
144 | else | ||
145 | if &term =~? 'mlterm\|xterm\|screen' | ||
146 | set t_Co=256 | " fixes incompatibilities with our color scheme | ||
147 | endif | ||
148 | set mouse=nh | " limits mouse usage to normal mode and help files, so that middle click text insertion works in insert mode | ||
149 | set title | " set the terminal caption | ||
150 | set icon | " sets the terminal icon to vim | ||
151 | set ttyfast | " modern terminals are all fast in a way | ||
152 | "set titleold="vim ended" | " set terminal title after closing vim | ||
153 | "set titlestring="VIM-CONSOLE" | " set window title | ||
154 | "if has('mouse') | ||
155 | "endif | ||
156 | endif | ||
157 | |||
158 | |||
159 | "================================================================================ | ||
160 | " custom commands... | ||
161 | map <C-h> <C-w>h|map <C-j> <C-w>j| " window navigation shortcuts | ||
162 | map <C-k> <C-w>k|map <C-l> <C-w>l| " window navigation shortcuts | ||
163 | |||
164 | cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user | ||
165 | |||
166 | " custom hotkeys... | ||
167 | nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs | ||
168 | nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab | ||
169 | |||
170 | nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines | ||
171 | |||
172 | nnoremap $ g$| " and make the $ key position the cursor after the last char of that line, not before | ||
173 | nnoremap <End> g$| " and make the <End> key position the cursor after the last char of that line | ||
174 | function ExtendedHome() | ||
175 | let column = col('.') | ||
176 | normal! ^ | ||
177 | if column == col('.') | ||
178 | normal! 0 | ||
179 | endif | ||
180 | endfunction | ||
181 | noremap <Home> ^ | ||
182 | noremap <silent> <Home> :call ExtendedHome()<CR> | ||
183 | |||
184 | nnoremap <C-z> u | ||
185 | |||
186 | |||
187 | "map <C-Right> el | ||
188 | "map <C-left> hgel | ||
189 | "vnoremap <C-S-Right> e | ||
190 | "vnoremap <C-S-left> b | ||
191 | |||
192 | |||
193 | " plugin hotkeys | ||
194 | map <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L | ||
195 | inoremap <buffer> ( <C-X><C-o><C-p>(| " when opening a bracket: call the OmniComplete function, display the menu, but deselect the first entry (C-p) | ||
196 | |||
197 | |||
198 | set makeprg=make\ test | ||
199 | nnoremap <F5> :!make<CR>| " classic key binding: press F5 to compile and execute (if you have a Makefile with make test doing that) | ||
200 | |||
201 | |||
202 | "================================================================================ | ||
203 | " deactivated on-demand commands (just in case one needs them one day) | ||
204 | " | ||
205 | " code completion: http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE | ||
206 | " reacts on CTRL+P, CTRL+Space | ||
207 | "inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | ||
208 | "inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" | ||
209 | "inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>" | ||
210 | "inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>" | ||
211 | "inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>" | ||
212 | "inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>" | ||
213 | " set guiheadroom=0| " do not fill non-functional area of the empty editor with gtk background | ||
214 | " map shift-right to visually select and so on | ||
215 | "nnoremap <C-Right> El | ||
216 | "nnoremap <S-Right> vl | ||
217 | "nnoremap <S-Left> vj | ||
218 | "nnoremap <S-Up> vk | ||
219 | "nnoremap <S-Down> vj | ||
220 | " noremap % v% " jump between braces and highlight | ||
221 | "nnoremap <Home> ^ | ||
222 | "vmap <Home> ^ | ||
223 | "nnoremap <End> $ | ||
224 | "vmap <End> $ | ||
225 | "nnoremap <C-Tab> <C-PageDown> | ||
226 | "nnoremap <C-S-Tab> <C-PageUp> | ||
227 | ":inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | ||
228 | "inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>" " breaks cursor keys! | ||
229 | " binding ESC can easily break cursor key movement on the console (tricky, because gvim works) | ||
230 | "inoremap <C-Space> <C-x><C-o> | ||
231 | "inoremap <C-@> <C-Space> | ||
232 | " | ||
233 | "map <Esc>OA k|map <Esc>OB j|map <Esc>OC l|map <Esc>OD h| " allow cursor keys in insert mode | ||