diff options
author | Max Christian Pohle | 2016-09-13 16:33:51 +0200 |
---|---|---|
committer | Max Christian Pohle | 2016-09-13 16:33:51 +0200 |
commit | 190811dccbcaee6bd2b55b1f2e5b75f910be31be (patch) | |
tree | 514901e22001a3b46171ea6ac7a4d32c1fa6324d | |
parent | bcf8550afc38a4005f9c53e8a2c4af879e04831b (diff) | |
download | vim-karlmarks-190811dccbcaee6bd2b55b1f2e5b75f910be31be.tar.bz2 vim-karlmarks-190811dccbcaee6bd2b55b1f2e5b75f910be31be.zip |
started over
Dropped YouCompleteMe, because its deployment is too complicated for a
default configuration.
-rw-r--r-- | doc/UPDATE | 4 | ||||
-rw-r--r-- | vimrc | 377 | ||||
-rw-r--r-- | vimrc-old | 303 |
3 files changed, 432 insertions, 252 deletions
diff --git a/doc/UPDATE b/doc/UPDATE new file mode 100644 index 0000000..6321b85 --- /dev/null +++ b/doc/UPDATE | |||
@@ -0,0 +1,4 @@ | |||
1 | git submodule -q foreach git pull -q origin master | ||
2 | |||
3 | In Vim: | ||
4 | :VundleUpdate | ||
@@ -1,115 +1,136 @@ | |||
1 | " vi:columns=160:list:ts=2:sts=2:sw=2 | 1 | set nocompatible " be iMproved, required |
2 | "================================================================================ | 2 | filetype off " required |
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/bundle/Vundle.vim | " set runtimepath (required by Vundle) | ||
7 | call vundle#begin('~/.vim/bundle/') | " location where Vundle searches&installs plugins | ||
8 | 3 | ||
9 | " Plugin dependant configurations... | 4 | " set the runtime path to include Vundle and initialize |
10 | Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion | 5 | set rtp+=~/.vim/bundle/Vundle.vim |
11 | Plugin 'cscope_plus.vim' | " run cscope -R -b in project folder then use | 6 | call vundle#begin() |
12 | Plugin 'autoload_cscope.vim' | " CTRL+\ s searches word under cursor, CTRL+T back | 7 | |
8 | " let Vundle manage Vundle, required | ||
9 | Plugin 'VundleVim/Vundle.vim' | ||
10 | |||
11 | " Brilliant Plugins by tpope =========================. | ||
12 | Plugin 'tpope/vim-sensible' | " a sane and modern default configuration | ||
13 | Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin | 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 | Plugin 'taglist-plus' | " quick code navigator | ||
17 | Plugin 'jdonaldson/vaxe' | " code completion for haxe | ||
18 | Plugin 'sheerun/vim-polyglot' | " better syntax highlighting/indentation for multiple languages | ||
19 | Plugin 'loremipsum' | " Sample text generator | ||
20 | Plugin 'vim-airline/vim-airline' | " beautification of the mode line | ||
21 | Plugin 'nathanaelkane/vim-indent-guides' | " shows indentation guidelines by pressing <leader>ig | ||
22 | Plugin 'gregsexton/matchtag' | " highlights closing ML tags like braces | ||
23 | Plugin 'indenthtml.vim' | " works better with mixed html/css/javascript | ||
24 | Plugin 'easymotion/vim-easymotion' | " speed up navigation: try \\w or \\f, then one of the highlighted chars | ||
25 | Plugin 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with ' | 14 | Plugin 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with ' |
26 | Plugin 'Shougo/vimproc.vim' | 15 | Plugin 'tpope/vim-repeat' | " lets . (dot) repeat plugin macros as well, specifically vim-surround |
27 | Plugin 'Shougo/vimshell.vim' | 16 | Plugin 'tpope/vim-vinegar' | " Improves :Explore |
28 | Plugin 'jeetsukumaran/vim-buffergator' | " switch buffers with \b or <\-Left> <\-Right> | 17 | Plugin 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values) |
18 | |||
19 | " Colorschemes =======================================. | ||
20 | Plugin 'tpope/vim-vividchalk' | " dark theme | ||
21 | Plugin 'nelstrom/vim-mac-classic-theme' | " light theme | ||
22 | |||
23 | " AIRLINE ============================================. | ||
24 | Plugin 'vim-airline/vim-airline' | " beautification of the mode line | ||
25 | Plugin 'vim-airline/vim-airline-themes' | " airline themes to match any light and dark terminal using :AirlineTheme | ||
26 | let g:airline_powerline_fonts = 1 | " | ||
27 | let g:airline_inactive_collapse = 1 | " | ||
28 | let g:airline#extensions#tabline#enabled = 1 | " | ||
29 | let g:airline#extensions#tabline#show_buffers = 1 | " | ||
30 | let g:airline#extensions#tabline#show_tabs = 1 | " | ||
31 | let g:airline#extensions#tabline#fnamemod = ':t' | " let airline just show the filename without its path | ||
32 | let g:airline_theme='papercolor' | " specifies which colorscheme should airline uses | ||
29 | 33 | ||
30 | let g:airline_powerline_fonts = 1 | ||
31 | 34 | ||
32 | let Tlist_Compact_Format = 1 | " | 35 | " Additional =========================================. |
33 | let Tlist_GainFocus_On_ToggleOpen = 1 | " | 36 | Plugin 'sheerun/vim-polyglot' | " better syntax highlighting/indentation for multiple languages |
34 | let Tlist_Close_On_Select = 1 | " | 37 | Plugin 'gregsexton/matchtag' | " highlights closing ML tags like braces |
38 | Plugin 'loremipsum' | " Sample text generator | ||
39 | " Plugin 'davidhalter/jedi-vim' | " best autocompletion for python | ||
40 | Plugin 'klen/python-mode' | ||
41 | Plugin 'tweekmonster/django-plus.vim' | " django helper | ||
35 | 42 | ||
36 | Plugin 'VundleVim/Vundle.vim' | " Vundle itself (required) | ||
37 | let g:ycm_global_ycm_extra_conf = '~/.vim/ycm_extra_conf.py' | " fallback, right one should be in the applications path | ||
38 | let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?' | ||
39 | let g:ycm_key_select_completion = '<Tab>' | " key completion key | ||
40 | let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar | ||
41 | let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar | ||
42 | let g:ycm_collect_identifiers_from_tags_files = 1 | " | ||
43 | let g:ycm_autoclose_preview_window_after_insertion=1 | " close the window when leaving insert mode | ||
44 | "let g:ycm_semantic_triggers = {'c' : ['(', ',']} | " add additional triggers (not recommend) | ||
45 | 43 | ||
46 | let b:html_omni_flavor='xhtml' | " prever xhtml over html because that makes inline php code possible without hassle | 44 | " Autocompleter ======================================. |
47 | let html_use_css = 1 | " when using :TOhtml no font-tags will be used, but proper css | 45 | Plugin 'Shougo/vimproc.vim' | " dependency for other Shougo plugins |
48 | let g:vim_markdown_folding_disabled=1 | " disable code folding with vimdiff (also see set nofoldenable) | 46 | Plugin 'Shougo/neocomplete.vim' |
47 | Plugin 'Shougo/neosnippet-snippets' | ||
48 | Plugin 'Rip-Rip/clang_complete' | ||
49 | 49 | ||
50 | let g:netrw_liststyle=3 | " Explore mode: 3 shows a complete tree instead of the current directory | 50 | filetype plugin on |
51 | let g:netrw_list_hide='^\..*' | " Explore mode: hide files starting with dot | 51 | set omnifunc=syntaxcomplete#Complete |
52 | inoremap <C-Space> <C-x><C-o> | ||
53 | inoremap <C-@> <C-Space> | ||
52 | 54 | ||
55 | " keep selection when indenting a selected block: | ||
56 | vnoremap < <gv | ||
57 | vnoremap > >gv | ||
53 | 58 | ||
54 | " speed up CTRL-P Menu... | ||
55 | let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --hidden | ||
56 | \ --ignore .git | ||
57 | \ --ignore .svn | ||
58 | \ --ignore .hg | ||
59 | \ --ignore .DS_Store | ||
60 | \ --ignore "**/*.pyc" | ||
61 | \ -g ""' | ||
62 | 59 | ||
63 | call vundle#end() | " required by Vundle | 60 | nnoremap <C-Tab> :bn<CR>| " lets one use CTRL+Tab to switch between tabs |
64 | filetype plugin indent on | " required by Vundle | 61 | nnoremap <C-S-Tab> :bp<CR>| " use CTRL+Shift+Tab to switch to preview tab |
65 | "================================================================================ | ||
66 | " custom config | ||
67 | colorscheme mac_classic | ||
68 | " colorscheme coderonline | ||
69 | syntax enable | ||
70 | 62 | ||
71 | set noswapfile | " noundofile, nobackup, nowritebackup | ||
72 | set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory | ||
73 | set directory=~/.vim/temp | " | ||
74 | set undodir=~/.vim/temp | " | ||
75 | 63 | ||
76 | set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth) | 64 | " Disabled ===========================================. |
77 | set autoindent | " always set autoindenting on | 65 | "# Plugin 'indenthtml.vim' | " works better with mixed html/css/javascript |
78 | set copyindent | " copy the previous indentation on autoindenting | 66 | "# Plugin 'evanmiller/nginx-vim-syntax' |
79 | set scrolloff=2 | " always keeps at least two lines visible (when seeking) | ||
80 | " set selectmode=mouse | " avoid using select mode (only with mouse) | ||
81 | set mousemodel=popup_setpos | " display a default right click menu for the selection (that is c&p is possible) | ||
82 | set selection=exclusive | " includes last character of the selection into following command (like x or d) | ||
83 | 67 | ||
84 | set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap | 68 | " All of your Plugins must be added before the following line |
85 | set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap | 69 | call vundle#end() | " required |
86 | set diffopt+=vertical,iwhite,filler | " lets diff ignore white spaces | 70 | filetype plugin indent on | " required |
87 | set spell spelllang=en,de | " enable spell checker | 71 | " colorscheme mac_classic | " finally set which colorscheme to use |
88 | set virtualedit=onemore | " one character beyond the line length should be navigatable (options: all,insert,block,onemore) | 72 | " colorscheme vividchalk | " finally set which colorscheme to use |
89 | set breakindent cpoptions+=n | " when wrapping lines indent wrapped line to align with the previews | 73 | colorscheme mac_classic |
90 | set linebreak | " do not wrap in the middle of words | ||
91 | set display+=lastline | " do not show the @ symbol in the end of a long line | ||
92 | set showcmd | " displays status line messages while selecting (matrix size) | ||
93 | set nofoldenable | " do not fold code automatically | ||
94 | set tags+=~/.vim/systags | " ctags -R -f ~/.vim/systags /usr/include /usr/local/include | ||
95 | set wildmenu wildmode=full | " wildmenu code completion | ||
96 | set guifont="Droid Sans Mono for Powerline 10" | ||
97 | 74 | ||
98 | " search... | 75 | " set term=xtermc | " required on solaris |
99 | set ignorecase smartcase | " if search pattern contains uppercase then search is case sensitive | 76 | set t_Co=256 | " required on some ssh sessions |
100 | set incsearch | " do incremental searching | ||
101 | set showmatch matchtime=4 | " blinks matching braces | ||
102 | 77 | ||
103 | set novisualbell | " don't beep | 78 | |
104 | set noerrorbells | " don't beep | 79 | syntax on | " enable syntax highlighting |
80 | set hidden | " allow switiching buffers even if the current buffer contains changes (displays +) | ||
81 | set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth) | ||
82 | set encoding=utf-8 | " set up vim's cosole encoding (not file encoding, for which there is fileencoding=) | ||
83 | set ignorecase smartcase | " search with ignorecase by default, but use case sensitive search when one captical char is contained | ||
84 | set ttimeoutlen=10 | " set esc key timeout in ms- | ||
85 | set linebreak | " wrap long lines at char 'breakat', not inside words | ||
105 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) | 86 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) |
106 | set number | " toggle line numbers | 87 | set number | " toggle line numbers |
107 | set formatprg=par | " set external formatting program to par, use gwip to format with this | ||
108 | set laststatus=2 | " this is required for airline | ||
109 | set cmdheight=1 | " controls how many lines the command line has | ||
110 | set relativenumber | " displays current lines line no as zero point from where relative numbers are getting counted | 88 | set relativenumber | " displays current lines line no as zero point from where relative numbers are getting counted |
89 | set list | " shows unprinable characters in the current line | ||
111 | 90 | ||
91 | set spell spelllang=en,de | " enable spell checker | ||
112 | set splitbelow | " open new windows below the current one (i find that more intuitive) | 92 | set splitbelow | " open new windows below the current one (i find that more intuitive) |
93 | set colorcolumn=80 | " show an indicator (different background in column 80) | ||
94 | highlight ColorColumn guibg=#F0F0E0 | ||
95 | |||
96 | if (&t_Co > 2) | " running in a terminal with colorterm support? (here: always true, defined above) | ||
97 | set hlsearch | " highlight all search matches | ||
98 | set cursorline | " highlight currently selected line | ||
99 | endif | ||
100 | |||
101 | if has("gui_running") | ||
102 | set guioptions+=eig | ||
103 | set guioptions-=T | " toolbar | ||
104 | set guioptions+=c | " use console dialogs instead of popups | ||
105 | set guioptions+=a | " autoselect: copy&paste using middleclick | ||
106 | endif | ||
107 | |||
108 | |||
109 | if has("autocmd") | ||
110 | set modeline | " set variables specific to a file, like indentation by adding a comment | ||
111 | " automatically reload this file when it gets edited | ||
112 | autocmd BufWritePost $MYVIMRC source $MYVIMRC | ||
113 | " automatically remove trailing white spaces on save.. | ||
114 | autocmd BufWritePre * %s/\s\+$//e | ||
115 | " au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main | ||
116 | " Enable omni completion. | ||
117 | " autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS | ||
118 | autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags | ||
119 | autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS | ||
120 | autocmd FileType python setlocal omnifunc=pythoncomplete#Complete | ||
121 | autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags | ||
122 | endif | ||
123 | |||
124 | let &titlestring = hostname() . "[vim(" . expand("%:t") . ")]" | ||
125 | " set window title for screen(3) | ||
126 | if &term == "screen" | ||
127 | set t_ts=k | ||
128 | set t_fs=\ | ||
129 | endif | ||
130 | if &term == "screen" || &term == "xterm" | ||
131 | set title | ||
132 | endif | ||
133 | |||
113 | 134 | ||
114 | if has("multi_byte") | 135 | if has("multi_byte") |
115 | set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) | 136 | set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) |
@@ -122,169 +143,21 @@ if has("multi_byte") | |||
122 | set listchars+=tab:▸\ | " symbols used when using :set list (which displays non-printable chars) | 143 | set listchars+=tab:▸\ | " symbols used when using :set list (which displays non-printable chars) |
123 | endif | 144 | endif |
124 | 145 | ||
125 | if has("autocmd") | ||
126 | set modeline | " set variables specific to a file, like indentation by adding a comment | ||
127 | set modelines=3 | " how many lines in the beginning and end of the file can be mode lines? | ||
128 | |||
129 | augroup resCur | " make cursor appear in its previous position when reopening a file... | ||
130 | autocmd BufReadPost * call setpos(".", getpos("'\"")) | ||
131 | augroup END | ||
132 | |||
133 | augroup PreviewOnBottom | " will open new windows below the current (only in insert mode, so that the preview window is drawn below) | ||
134 | autocmd InsertEnter * set splitbelow | ||
135 | autocmd InsertLeave * set splitbelow! | ||
136 | augroup END | ||
137 | 146 | ||
138 | augroup OmniFunc | " this will enable omnicomplete just in case this configuration runs somewhere, where YouCompleteMe is not compiled | ||
139 | if exists("+omnifunc") | ||
140 | autocmd Filetype * | ||
141 | \ if &omnifunc == "" | | ||
142 | \ setlocal omnifunc=syntaxcomplete#Complete | | ||
143 | \ setlocal completeopt=longest,menuone | | ||
144 | \ endif | ||
145 | autocmd FileType html set omnifunc=htmlcomplete#CompleteTags | ||
146 | endif | ||
147 | augroup END | ||
148 | |||
149 | autocmd FileType text setlocal textwidth=78 | " text files: set 'textwidth' to 78 | ||
150 | autocmd FileType gitcommit set tw=72 | " longer commit messages without auto line wrapping | ||
151 | autocmd FileType LaTeX let g:tex_flavor = "latex"| set conceallevel=1| set concealcursor= | ||
152 | autocmd BufNewFile,BufReadPost *.config set filetype=xml | " visual studio config file | ||
153 | autocmd BufNewFile,BufReadPost *.csproj set filetype=xml | " visual studio project file | ||
154 | autocmd BufNewFile,BufReadPost *.sln set filetype=xml | " visual studio solution file | ||
155 | endif | ||
156 | |||
157 | "================================================================================ | ||
158 | " gui stuff and appearance | ||
159 | if &t_Co > 2 | ||
160 | set hlsearch | " highlight all search matches | ||
161 | set cursorline | " highlight currently selected line | ||
162 | endif | ||
163 | 147 | ||
164 | 148 | " set title | |
165 | if has("gui_running") | 149 | " set t_ts=^[k |
166 | set mouse=a | " use mouse in gui-mode (which is default) | 150 | " set t_fs=^[\ |
167 | set mouseshape+=n:beam,v:beam | " display a text input cursor even in normal and selection mode | 151 | " auto BufEnter * :set title | let &titlestring = 'v:' . expand('%') |
168 | set guicursor=n-v-c:ver20-Cursor-blinkon500-blinkoff500 | " how the caret looks like | 152 | " auto VimLeave * :set t_ts=^[k^[\ |
169 | set guitablabel=%t | " do not display full path as tabname | 153 | " To ignore plugin indent changes, instead use: |
170 | set guioptions+=m | " menu bar | ||
171 | set guioptions-=T | " toolbar | ||
172 | set guioptions+=r | " right-hand scroll bar | ||
173 | set guioptions-=c | " use console dialogs instead of popups | ||
174 | set guioptions+=a | " autoselect: copy&paste using middleclick | ||
175 | set guioptions+=e | " add tab pages | ||
176 | set guioptions+=p | " use gui pointer callback for x11 | ||
177 | set toolbariconsize=large | " make the icon toolbar as big as possible | ||
178 | "set columns=80 | " set initial window width (so that it fits the terminals) | ||
179 | else | ||
180 | if &term =~? 'mlterm\|xterm\|screen' | ||
181 | set t_Co=256 | " fixes incompatibilities with our color scheme | ||
182 | endif | ||
183 | set mouse=nh | " limits mouse usage to normal mode and help files, so that middle click text insertion works in insert mode | ||
184 | set title | " set the terminal caption | ||
185 | set icon | " sets the terminal icon to vim | ||
186 | set ttyfast | " modern terminals are all fast in a way | ||
187 | "set titleold="vim ended" | " set terminal title after closing vim | ||
188 | "set titlestring="VIM-CONSOLE" | " set window title | ||
189 | "if has('mouse') | ||
190 | "endif | ||
191 | endif | ||
192 | |||
193 | |||
194 | "================================================================================ | ||
195 | " custom commands... | ||
196 | " | 154 | " |
197 | " assign selection keys (these i missed a lot) | 155 | " Brief help |
198 | nmap <S-Left> vh| " shift-left selects to the left | 156 | " :PluginList - lists configured plugins |
199 | xmap <S-Left> h| " ^^ | 157 | " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate |
200 | nmap <S-Right> vl| " shift-right selects to the right | 158 | " :PluginSearch foo - searches for foo; append `!` to refresh local cache |
201 | xmap <S-Right> l| " ^^ | 159 | " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal |
202 | nmap <S-Up> vk| " shift-up selects like other text editors | ||
203 | xmap <S-Up> k| " ^^ | ||
204 | nmap <S-Down> vj| " shift down selects like other text editors | ||
205 | xmap <S-Down> j| " ^^ | ||
206 | nmap <Home> ^| " default homing in code editors is the first letter of a line | ||
207 | xmap <Home> 0| " go to the beginning of the line | ||
208 | xmap <S-Home> 0| " ^^ | ||
209 | xmap <Tab> >gv| " indent lines (and retain selection) | ||
210 | xmap <S-Tab> <gv| " unindent lines (and retain selection) | ||
211 | nmap <S-PageUp> VH| " selects predessing paragraph | ||
212 | nmap <S-PageDown> VL| " selects following paragraph | ||
213 | nmap <C-S-PageUp> V{| " selects predessing paragraph | ||
214 | nmap <C-S-PageDown> V}| " selects following paragraph | ||
215 | |||
216 | |||
217 | |||
218 | |||
219 | |||
220 | map <C-h> <C-w>h|map <C-j> <C-w>j| " window navigation shortcuts | ||
221 | map <C-k> <C-w>k|map <C-l> <C-w>l| " window navigation shortcuts | ||
222 | |||
223 | cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user | ||
224 | |||
225 | " custom hotkeys... | ||
226 | nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs | ||
227 | nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab | ||
228 | |||
229 | nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines | ||
230 | |||
231 | nnoremap $ g$| " and make the $ key position the cursor after the last char of that line, not before | ||
232 | nnoremap <End> g$| " and make the <End> key position the cursor after the last char of that line | ||
233 | " function ExtendedHome() | ||
234 | " let column = col('.') | ||
235 | " normal! ^ | ||
236 | " if column == col('.') | ||
237 | " normal! 0 | ||
238 | " endif | ||
239 | " endfunction | ||
240 | " noremap <silent> <Home> :call ExtendedHome()<CR> | ||
241 | |||
242 | nnoremap <C-z> u | ||
243 | |||
244 | |||
245 | "map <C-Right> el | ||
246 | "map <C-left> hgel | ||
247 | "vnoremap <C-S-Right> e | ||
248 | "vnoremap <C-S-left> b | ||
249 | |||
250 | |||
251 | " plugin hotkeys | ||
252 | map <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L | ||
253 | 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) | ||
254 | |||
255 | |||
256 | set makeprg=make\ test | ||
257 | nnoremap <F5> :!make<CR>| " classic key binding: press F5 to compile and execute (if you have a Makefile with make test doing that) | ||
258 | |||
259 | "================================================================================ | ||
260 | " deactivated on-demand commands (just in case one needs them one day) | ||
261 | " | 160 | " |
262 | " code completion: http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE | 161 | " see :h vundle for more details or wiki for FAQ |
263 | " reacts on CTRL+P, CTRL+Space | 162 | " Put your non-Plugin stuff after this line |
264 | "inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | ||
265 | "inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" | ||
266 | "inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>" | ||
267 | "inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>" | ||
268 | "inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>" | ||
269 | "inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>" | ||
270 | " set guiheadroom=0| " do not fill non-functional area of the empty editor with gtk background | ||
271 | " map shift-right to visually select and so on | ||
272 | "nnoremap <C-Right> El | ||
273 | "nnoremap <S-Right> vl | ||
274 | "nnoremap <S-Left> vj | ||
275 | "nnoremap <S-Up> vk | ||
276 | "nnoremap <S-Down> vj | ||
277 | " noremap % v% " jump between braces and highlight | ||
278 | "nnoremap <Home> ^ | ||
279 | "vmap <Home> ^ | ||
280 | "nnoremap <End> $ | ||
281 | "vmap <End> $ | ||
282 | "nnoremap <C-Tab> <C-PageDown> | ||
283 | "nnoremap <C-S-Tab> <C-PageUp> | ||
284 | ":inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | ||
285 | "inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>" " breaks cursor keys! | ||
286 | " binding ESC can easily break cursor key movement on the console (tricky, because gvim works) | ||
287 | "inoremap <C-Space> <C-x><C-o> | ||
288 | "inoremap <C-@> <C-Space> | ||
289 | " | 163 | " |
290 | "map <Esc>OA k|map <Esc>OB j|map <Esc>OC l|map <Esc>OD h| " allow cursor keys in insert mode | ||
diff --git a/vimrc-old b/vimrc-old new file mode 100644 index 0000000..c5bd4e6 --- /dev/null +++ b/vimrc-old | |||
@@ -0,0 +1,303 @@ | |||
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/bundle/Vundle.vim | " set runtimepath (required by Vundle) | ||
7 | call vundle#begin('~/.vim/bundle/') | " location where Vundle searches&installs plugins | ||
8 | |||
9 | " Plugin dependant configurations... | ||
10 | Plugin 'tpope/vim-sensible' | " a sane and modern default configuration | ||
11 | Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin | ||
12 | Plugin 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with ' | ||
13 | Plugin 'tpope/vim-repeat' | " lets . (dot) repeat plugin macros as well, specifically vim-surround | ||
14 | Plugin 'tpope/vim-vinegar' | " Improves :Explore | ||
15 | Plugin 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values) | ||
16 | |||
17 | Plugin 'tpope/vim-vividchalk' | " dark theme | ||
18 | Plugin 'nelstrom/vim-mac-classic-theme' | " light theme | ||
19 | |||
20 | Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion | ||
21 | Plugin 'cscope_plus.vim' | " run cscope -R -b in project folder then use | ||
22 | Plugin 'autoload_cscope.vim' | " CTRL+\ s searches word under cursor, CTRL+T back | ||
23 | Plugin 'jeaye/color_coded' | " semantic highlighting with vim | ||
24 | Plugin 'terryma/vim-multiple-cursors' | " displays visual block mode as cursors | ||
25 | Plugin 'taglist-plus' | " quick code navigator | ||
26 | Plugin 'jdonaldson/vaxe' | " code completion for haxe | ||
27 | Plugin 'sheerun/vim-polyglot' | " better syntax highlighting/indentation for multiple languages | ||
28 | Plugin 'loremipsum' | " Sample text generator | ||
29 | Plugin 'vim-airline/vim-airline' | " beautification of the mode line | ||
30 | Plugin 'nathanaelkane/vim-indent-guides' | " shows indentation guidelines by pressing <leader>ig | ||
31 | Plugin 'gregsexton/matchtag' | " highlights closing ML tags like braces | ||
32 | Plugin 'indenthtml.vim' | " works better with mixed html/css/javascript | ||
33 | Plugin 'easymotion/vim-easymotion' | " speed up navigation: try \\w or \\f, then one of the highlighted chars | ||
34 | Plugin 'Shougo/vimproc.vim' | ||
35 | Plugin 'Shougo/vimshell.vim' | ||
36 | Plugin 'jeetsukumaran/vim-buffergator' | " switch buffers with \b or <\-Left> <\-Right> | ||
37 | |||
38 | let g:airline_powerline_fonts = 1 | ||
39 | |||
40 | let Tlist_Compact_Format = 1 | " | ||
41 | let Tlist_GainFocus_On_ToggleOpen = 1 | " | ||
42 | let Tlist_Close_On_Select = 1 | " | ||
43 | |||
44 | Plugin 'VundleVim/Vundle.vim' | " Vundle itself (required) | ||
45 | let g:ycm_global_ycm_extra_conf = '~/.vim/ycm_extra_conf.py' | " fallback, right one should be in the applications path | ||
46 | let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?' | ||
47 | let g:ycm_key_select_completion = '<Tab>' | " key completion key | ||
48 | let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar | ||
49 | let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar | ||
50 | let g:ycm_collect_identifiers_from_tags_files = 1 | " | ||
51 | let g:ycm_autoclose_preview_window_after_insertion=1 | " close the window when leaving insert mode | ||
52 | "let g:ycm_semantic_triggers = {'c' : ['(', ',']} | " add additional triggers (not recommend) | ||
53 | |||
54 | let b:html_omni_flavor='xhtml' | " prever xhtml over html because that makes inline php code possible without hassle | ||
55 | let html_use_css = 1 | " when using :TOhtml no font-tags will be used, but proper css | ||
56 | let g:vim_markdown_folding_disabled=1 | " disable code folding with vimdiff (also see set nofoldenable) | ||
57 | |||
58 | let g:netrw_liststyle=3 | " Explore mode: 3 shows a complete tree instead of the current directory | ||
59 | let g:netrw_list_hide='^\..*' | " Explore mode: hide files starting with dot | ||
60 | |||
61 | |||
62 | " speed up CTRL-P Menu... | ||
63 | let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --hidden | ||
64 | \ --ignore .git | ||
65 | \ --ignore .svn | ||
66 | \ --ignore .hg | ||
67 | \ --ignore .DS_Store | ||
68 | \ --ignore "**/*.pyc" | ||
69 | \ -g ""' | ||
70 | |||
71 | call vundle#end() | " required by Vundle | ||
72 | filetype plugin indent on | " required by Vundle | ||
73 | "================================================================================ | ||
74 | " custom config | ||
75 | colorscheme mac_classic | ||
76 | " colorscheme coderonline | ||
77 | syntax enable | ||
78 | |||
79 | set noswapfile | " noundofile, nobackup, nowritebackup | ||
80 | set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory | ||
81 | set directory=~/.vim/temp | " | ||
82 | set undodir=~/.vim/temp | " | ||
83 | |||
84 | set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth) | ||
85 | set autoindent | " always set autoindenting on | ||
86 | set autochdir | " change to the current files working dir (might break some plugins!) | ||
87 | set copyindent | " copy the previous indentation on autoindenting | ||
88 | set scrolloff=2 | " always keeps at least two lines visible (when seeking) | ||
89 | " set selectmode=mouse | " avoid using select mode (only with mouse) | ||
90 | set mousemodel=popup_setpos | " display a default right click menu for the selection (that is c&p is possible) | ||
91 | set selection=exclusive | " includes last character of the selection into following command (like x or d) | ||
92 | |||
93 | set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap | ||
94 | set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap | ||
95 | set diffopt+=vertical,iwhite,filler | " lets diff ignore white spaces | ||
96 | set spell spelllang=en,de | " enable spell checker | ||
97 | set virtualedit=onemore | " one character beyond the line length should be navigatable (options: all,insert,block,onemore) | ||
98 | set breakindent cpoptions+=n | " when wrapping lines indent wrapped line to align with the previews | ||
99 | set linebreak | " do not wrap in the middle of words | ||
100 | set display+=lastline | " do not show the @ symbol in the end of a long line | ||
101 | set showcmd | " displays status line messages while selecting (matrix size) | ||
102 | set nofoldenable | " do not fold code automatically | ||
103 | set tags+=~/.vim/systags | " ctags -R -f ~/.vim/systags /usr/include /usr/local/include | ||
104 | set wildmenu wildmode=full | " wildmenu code completion | ||
105 | set guifont="Droid Sans Mono for Powerline 10" | ||
106 | |||
107 | " search... | ||
108 | set ignorecase smartcase | " if search pattern contains uppercase then search is case sensitive | ||
109 | set incsearch | " do incremental searching | ||
110 | set showmatch matchtime=4 | " blinks matching braces | ||
111 | |||
112 | set novisualbell | " don't beep | ||
113 | set noerrorbells | " don't beep | ||
114 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) | ||
115 | set number | " toggle line numbers | ||
116 | set formatprg=par | " set external formatting program to par, use gwip to format with this | ||
117 | set laststatus=2 | " this is required for airline | ||
118 | set cmdheight=1 | " controls how many lines the command line has | ||
119 | set relativenumber | " displays current lines line no as zero point from where relative numbers are getting counted | ||
120 | set timeoutlen=500 | " time between keys e.g. 80i= | ||
121 | set ttimeoutlen=10 | " set esc key timeout in ms | ||
122 | |||
123 | set splitbelow | " open new windows below the current one (i find that more intuitive) | ||
124 | |||
125 | if has("multi_byte") | ||
126 | set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) | ||
127 | scriptencoding utf-8 | " tell vim that we are using utf-8 here | ||
128 | set showbreak+=› | " symbol used in the beginning of a wrapped line | ||
129 | set listchars=eol:↲ | " symbols used when using :set list (which displays non-printable chars) | ||
130 | set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) | ||
131 | set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) | ||
132 | set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) | ||
133 | set listchars+=tab:▸\ | " symbols used when using :set list (which displays non-printable chars) | ||
134 | endif | ||
135 | |||
136 | if has("autocmd") | ||
137 | set modeline | " set variables specific to a file, like indentation by adding a comment | ||
138 | set modelines=3 | " how many lines in the beginning and end of the file can be mode lines? | ||
139 | |||
140 | augroup resCur | " make cursor appear in its previous position when reopening a file... | ||
141 | autocmd BufReadPost * call setpos(".", getpos("'\"")) | ||
142 | augroup END | ||
143 | |||
144 | augroup PreviewOnBottom | " will open new windows below the current (only in insert mode, so that the preview window is drawn below) | ||
145 | autocmd InsertEnter * set splitbelow | ||
146 | autocmd InsertLeave * set splitbelow! | ||
147 | augroup END | ||
148 | |||
149 | augroup OmniFunc | " this will enable omnicomplete just in case this configuration runs somewhere, where YouCompleteMe is not compiled | ||
150 | if exists("+omnifunc") | ||
151 | autocmd Filetype * | ||
152 | \ if &omnifunc == "" | | ||
153 | \ setlocal omnifunc=syntaxcomplete#Complete | | ||
154 | \ setlocal completeopt=longest,menuone | | ||
155 | \ endif | ||
156 | autocmd FileType html set omnifunc=htmlcomplete#CompleteTags | ||
157 | endif | ||
158 | augroup END | ||
159 | |||
160 | autocmd FileType text setlocal textwidth=78 | " text files: set 'textwidth' to 78 | ||
161 | autocmd FileType gitcommit set tw=72 | " longer commit messages without auto line wrapping | ||
162 | autocmd FileType LaTeX let g:tex_flavor = "latex"| set conceallevel=1| set concealcursor= | ||
163 | autocmd BufNewFile,BufReadPost *.config set filetype=xml | " visual studio config file | ||
164 | autocmd BufNewFile,BufReadPost *.csproj set filetype=xml | " visual studio project file | ||
165 | autocmd BufNewFile,BufReadPost *.sln set filetype=xml | " visual studio solution file | ||
166 | endif | ||
167 | |||
168 | "================================================================================ | ||
169 | " gui stuff and appearance | ||
170 | if &t_Co > 2 | ||
171 | set hlsearch | " highlight all search matches | ||
172 | set cursorline | " highlight currently selected line | ||
173 | endif | ||
174 | |||
175 | |||
176 | if has("gui_running") | ||
177 | set mouse=a | " use mouse in gui-mode (which is default) | ||
178 | set mouseshape+=n:beam,v:beam | " display a text input cursor even in normal and selection mode | ||
179 | set guicursor=n-v-c:ver20-Cursor-blinkon500-blinkoff500 | " how the caret looks like | ||
180 | set guitablabel=%t | " do not display full path as tabname | ||
181 | set guioptions+=m | " menu bar | ||
182 | set guioptions-=T | " toolbar | ||
183 | set guioptions+=r | " right-hand scroll bar | ||
184 | set guioptions-=c | " use console dialogs instead of popups | ||
185 | set guioptions+=a | " autoselect: copy&paste using middleclick | ||
186 | set guioptions+=e | " add tab pages | ||
187 | set guioptions+=p | " use gui pointer callback for x11 | ||
188 | set toolbariconsize=large | " make the icon toolbar as big as possible | ||
189 | "set columns=80 | " set initial window width (so that it fits the terminals) | ||
190 | else | ||
191 | if &term =~? 'mlterm\|xterm\|screen' | ||
192 | set t_Co=256 | " fixes incompatibilities with our color scheme | ||
193 | endif | ||
194 | set mouse=nh | " limits mouse usage to normal mode and help files, so that middle click text insertion works in insert mode | ||
195 | set title | " set the terminal caption | ||
196 | set icon | " sets the terminal icon to vim | ||
197 | set ttyfast | " modern terminals are all fast in a way | ||
198 | "set titleold="vim ended" | " set terminal title after closing vim | ||
199 | "set titlestring="VIM-CONSOLE" | " set window title | ||
200 | "if has('mouse') | ||
201 | "endif | ||
202 | endif | ||
203 | |||
204 | |||
205 | "================================================================================ | ||
206 | " custom commands... | ||
207 | " | ||
208 | " assign selection keys (these i missed a lot) | ||
209 | nmap <S-Left> vh| " shift-left selects to the left | ||
210 | xmap <S-Left> h| " ^^ | ||
211 | nmap <S-Right> vl| " shift-right selects to the right | ||
212 | xmap <S-Right> l| " ^^ | ||
213 | nmap <S-Up> vk| " shift-up selects like other text editors | ||
214 | xmap <S-Up> k| " ^^ | ||
215 | nmap <S-Down> vj| " shift down selects like other text editors | ||
216 | xmap <S-Down> j| " ^^ | ||
217 | nmap <Home> ^| " default homing in code editors is the first letter of a line | ||
218 | xmap <Home> 0| " go to the beginning of the line | ||
219 | xmap <S-Home> 0| " ^^ | ||
220 | xmap <Tab> >gv| " indent lines (and retain selection) | ||
221 | xmap <S-Tab> <gv| " unindent lines (and retain selection) | ||
222 | nmap <S-PageUp> VH| " selects predessing paragraph | ||
223 | nmap <S-PageDown> VL| " selects following paragraph | ||
224 | nmap <C-S-PageUp> V{| " selects predessing paragraph | ||
225 | nmap <C-S-PageDown> V}| " selects following paragraph | ||
226 | |||
227 | nmap <C-o> :24vs.<CR>| " means the same as :vsplit. and opens the :Exlore -window with a width of 24 | ||
228 | |||
229 | |||
230 | |||
231 | |||
232 | |||
233 | map <C-h> <C-w>h|map <C-j> <C-w>j| " window navigation shortcuts | ||
234 | map <C-k> <C-w>k|map <C-l> <C-w>l| " window navigation shortcuts | ||
235 | |||
236 | cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user | ||
237 | |||
238 | " custom hotkeys... | ||
239 | nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs | ||
240 | nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab | ||
241 | |||
242 | nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines | ||
243 | |||
244 | nnoremap $ g$| " and make the $ key position the cursor after the last char of that line, not before | ||
245 | nnoremap <End> g$| " and make the <End> key position the cursor after the last char of that line | ||
246 | " function ExtendedHome() | ||
247 | " let column = col('.') | ||
248 | " normal! ^ | ||
249 | " if column == col('.') | ||
250 | " normal! 0 | ||
251 | " endif | ||
252 | " endfunction | ||
253 | " noremap <silent> <Home> :call ExtendedHome()<CR> | ||
254 | |||
255 | nnoremap <C-z> u | ||
256 | |||
257 | |||
258 | "map <C-Right> el | ||
259 | "map <C-left> hgel | ||
260 | "vnoremap <C-S-Right> e | ||
261 | "vnoremap <C-S-left> b | ||
262 | |||
263 | |||
264 | " plugin hotkeys | ||
265 | map <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L | ||
266 | 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) | ||
267 | |||
268 | |||
269 | set makeprg=make\ test | ||
270 | nnoremap <F5> :!make<CR>| " classic key binding: press F5 to compile and execute (if you have a Makefile with make test doing that) | ||
271 | |||
272 | "================================================================================ | ||
273 | " deactivated on-demand commands (just in case one needs them one day) | ||
274 | " | ||
275 | " code completion: http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE | ||
276 | " reacts on CTRL+P, CTRL+Space | ||
277 | "inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | ||
278 | "inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" | ||
279 | "inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>" | ||
280 | "inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>" | ||
281 | "inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>" | ||
282 | "inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>" | ||
283 | " set guiheadroom=0| " do not fill non-functional area of the empty editor with gtk background | ||
284 | " map shift-right to visually select and so on | ||
285 | "nnoremap <C-Right> El | ||
286 | "nnoremap <S-Right> vl | ||
287 | "nnoremap <S-Left> vj | ||
288 | "nnoremap <S-Up> vk | ||
289 | "nnoremap <S-Down> vj | ||
290 | " noremap % v% " jump between braces and highlight | ||
291 | "nnoremap <Home> ^ | ||
292 | "vmap <Home> ^ | ||
293 | "nnoremap <End> $ | ||
294 | "vmap <End> $ | ||
295 | "nnoremap <C-Tab> <C-PageDown> | ||
296 | "nnoremap <C-S-Tab> <C-PageUp> | ||
297 | ":inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | ||
298 | "inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>" " breaks cursor keys! | ||
299 | " binding ESC can easily break cursor key movement on the console (tricky, because gvim works) | ||
300 | "inoremap <C-Space> <C-x><C-o> | ||
301 | "inoremap <C-@> <C-Space> | ||
302 | " | ||
303 | "map <Esc>OA k|map <Esc>OB j|map <Esc>OC l|map <Esc>OD h| " allow cursor keys in insert mode | ||