aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Christian Pohle2016-09-13 16:33:51 +0200
committerMax Christian Pohle2016-09-13 16:33:51 +0200
commit190811dccbcaee6bd2b55b1f2e5b75f910be31be (patch)
tree514901e22001a3b46171ea6ac7a4d32c1fa6324d
parentbcf8550afc38a4005f9c53e8a2c4af879e04831b (diff)
downloadvim-190811dccbcaee6bd2b55b1f2e5b75f910be31be.tar.bz2
vim-190811dccbcaee6bd2b55b1f2e5b75f910be31be.zip
started over
Dropped YouCompleteMe, because its deployment is too complicated for a default configuration.
-rw-r--r--doc/UPDATE4
-rw-r--r--vimrc377
-rw-r--r--vimrc-old303
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 @@
1git submodule -q foreach git pull -q origin master
2
3In Vim:
4:VundleUpdate
diff --git a/vimrc b/vimrc
index 75d7aac..467a1f3 100644
--- a/vimrc
+++ b/vimrc
@@ -1,115 +1,136 @@
1" vi:columns=160:list:ts=2:sts=2:sw=2 1set nocompatible " be iMproved, required
2"================================================================================ 2filetype off " required
3" Vundle: plugin manager...
4set nocompatible | " do not try to be vi, be vim (required by Vundle)
5filetype off | " Vundle needs this
6set rtp+=~/.vim/bundle/Vundle.vim | " set runtimepath (required by Vundle)
7call 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
10Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion 5set rtp+=~/.vim/bundle/Vundle.vim
11Plugin 'cscope_plus.vim' | " run cscope -R -b in project folder then use 6call vundle#begin()
12Plugin 'autoload_cscope.vim' | " CTRL+\ s searches word under cursor, CTRL+T back 7
8" let Vundle manage Vundle, required
9Plugin 'VundleVim/Vundle.vim'
10
11" Brilliant Plugins by tpope =========================.
12Plugin 'tpope/vim-sensible' | " a sane and modern default configuration
13Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin 13Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin
14Plugin 'jeaye/color_coded' | " semantic highlighting with vim
15Plugin 'terryma/vim-multiple-cursors' | " displays visual block mode as cursors
16Plugin 'taglist-plus' | " quick code navigator
17Plugin 'jdonaldson/vaxe' | " code completion for haxe
18Plugin 'sheerun/vim-polyglot' | " better syntax highlighting/indentation for multiple languages
19Plugin 'loremipsum' | " Sample text generator
20Plugin 'vim-airline/vim-airline' | " beautification of the mode line
21Plugin 'nathanaelkane/vim-indent-guides' | " shows indentation guidelines by pressing <leader>ig
22Plugin 'gregsexton/matchtag' | " highlights closing ML tags like braces
23Plugin 'indenthtml.vim' | " works better with mixed html/css/javascript
24Plugin 'easymotion/vim-easymotion' | " speed up navigation: try \\w or \\f, then one of the highlighted chars
25Plugin 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with ' 14Plugin 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with '
26Plugin 'Shougo/vimproc.vim' 15Plugin 'tpope/vim-repeat' | " lets . (dot) repeat plugin macros as well, specifically vim-surround
27Plugin 'Shougo/vimshell.vim' 16Plugin 'tpope/vim-vinegar' | " Improves :Explore
28Plugin 'jeetsukumaran/vim-buffergator' | " switch buffers with \b or <\-Left> <\-Right> 17Plugin 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values)
18
19" Colorschemes =======================================.
20Plugin 'tpope/vim-vividchalk' | " dark theme
21Plugin 'nelstrom/vim-mac-classic-theme' | " light theme
22
23" AIRLINE ============================================.
24Plugin 'vim-airline/vim-airline' | " beautification of the mode line
25Plugin 'vim-airline/vim-airline-themes' | " airline themes to match any light and dark terminal using :AirlineTheme
26let g:airline_powerline_fonts = 1 | "
27let g:airline_inactive_collapse = 1 | "
28let g:airline#extensions#tabline#enabled = 1 | "
29let g:airline#extensions#tabline#show_buffers = 1 | "
30let g:airline#extensions#tabline#show_tabs = 1 | "
31let g:airline#extensions#tabline#fnamemod = ':t' | " let airline just show the filename without its path
32let g:airline_theme='papercolor' | " specifies which colorscheme should airline uses
29 33
30let g:airline_powerline_fonts = 1
31 34
32let Tlist_Compact_Format = 1 | " 35" Additional =========================================.
33let Tlist_GainFocus_On_ToggleOpen = 1 | " 36Plugin 'sheerun/vim-polyglot' | " better syntax highlighting/indentation for multiple languages
34let Tlist_Close_On_Select = 1 | " 37Plugin 'gregsexton/matchtag' | " highlights closing ML tags like braces
38Plugin 'loremipsum' | " Sample text generator
39" Plugin 'davidhalter/jedi-vim' | " best autocompletion for python
40Plugin 'klen/python-mode'
41Plugin 'tweekmonster/django-plus.vim' | " django helper
35 42
36Plugin 'VundleVim/Vundle.vim' | " Vundle itself (required)
37let g:ycm_global_ycm_extra_conf = '~/.vim/ycm_extra_conf.py' | " fallback, right one should be in the applications path
38let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?'
39let g:ycm_key_select_completion = '<Tab>' | " key completion key
40let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar
41let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar
42let g:ycm_collect_identifiers_from_tags_files = 1 | "
43let 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
46let b:html_omni_flavor='xhtml' | " prever xhtml over html because that makes inline php code possible without hassle 44" Autocompleter ======================================.
47let html_use_css = 1 | " when using :TOhtml no font-tags will be used, but proper css 45Plugin 'Shougo/vimproc.vim' | " dependency for other Shougo plugins
48let g:vim_markdown_folding_disabled=1 | " disable code folding with vimdiff (also see set nofoldenable) 46Plugin 'Shougo/neocomplete.vim'
47Plugin 'Shougo/neosnippet-snippets'
48Plugin 'Rip-Rip/clang_complete'
49 49
50let g:netrw_liststyle=3 | " Explore mode: 3 shows a complete tree instead of the current directory 50filetype plugin on
51let g:netrw_list_hide='^\..*' | " Explore mode: hide files starting with dot 51set omnifunc=syntaxcomplete#Complete
52inoremap <C-Space> <C-x><C-o>
53inoremap <C-@> <C-Space>
52 54
55" keep selection when indenting a selected block:
56vnoremap < <gv
57vnoremap > >gv
53 58
54" speed up CTRL-P Menu...
55let 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
63call vundle#end() | " required by Vundle 60nnoremap <C-Tab> :bn<CR>| " lets one use CTRL+Tab to switch between tabs
64filetype plugin indent on | " required by Vundle 61nnoremap <C-S-Tab> :bp<CR>| " use CTRL+Shift+Tab to switch to preview tab
65"================================================================================
66" custom config
67colorscheme mac_classic
68" colorscheme coderonline
69syntax enable
70 62
71set noswapfile | " noundofile, nobackup, nowritebackup
72set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory
73set directory=~/.vim/temp | "
74set undodir=~/.vim/temp | "
75 63
76set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth) 64" Disabled ===========================================.
77set autoindent | " always set autoindenting on 65"# Plugin 'indenthtml.vim' | " works better with mixed html/css/javascript
78set copyindent | " copy the previous indentation on autoindenting 66"# Plugin 'evanmiller/nginx-vim-syntax'
79set scrolloff=2 | " always keeps at least two lines visible (when seeking)
80" set selectmode=mouse | " avoid using select mode (only with mouse)
81set mousemodel=popup_setpos | " display a default right click menu for the selection (that is c&p is possible)
82set selection=exclusive | " includes last character of the selection into following command (like x or d)
83 67
84set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap 68" All of your Plugins must be added before the following line
85set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap 69call vundle#end() | " required
86set diffopt+=vertical,iwhite,filler | " lets diff ignore white spaces 70filetype plugin indent on | " required
87set spell spelllang=en,de | " enable spell checker 71" colorscheme mac_classic | " finally set which colorscheme to use
88set 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
89set breakindent cpoptions+=n | " when wrapping lines indent wrapped line to align with the previews 73colorscheme mac_classic
90set linebreak | " do not wrap in the middle of words
91set display+=lastline | " do not show the @ symbol in the end of a long line
92set showcmd | " displays status line messages while selecting (matrix size)
93set nofoldenable | " do not fold code automatically
94set tags+=~/.vim/systags | " ctags -R -f ~/.vim/systags /usr/include /usr/local/include
95set wildmenu wildmode=full | " wildmenu code completion
96set guifont="Droid Sans Mono for Powerline 10"
97 74
98" search... 75" set term=xtermc | " required on solaris
99set ignorecase smartcase | " if search pattern contains uppercase then search is case sensitive 76set t_Co=256 | " required on some ssh sessions
100set incsearch | " do incremental searching
101set showmatch matchtime=4 | " blinks matching braces
102 77
103set novisualbell | " don't beep 78
104set noerrorbells | " don't beep 79syntax on | " enable syntax highlighting
80set hidden | " allow switiching buffers even if the current buffer contains changes (displays +)
81set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth)
82set encoding=utf-8 | " set up vim's cosole encoding (not file encoding, for which there is fileencoding=)
83set ignorecase smartcase | " search with ignorecase by default, but use case sensitive search when one captical char is contained
84set ttimeoutlen=10 | " set esc key timeout in ms-
85set linebreak | " wrap long lines at char 'breakat', not inside words
105set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) 86set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well)
106set number | " toggle line numbers 87set number | " toggle line numbers
107set formatprg=par | " set external formatting program to par, use gwip to format with this
108set laststatus=2 | " this is required for airline
109set cmdheight=1 | " controls how many lines the command line has
110set relativenumber | " displays current lines line no as zero point from where relative numbers are getting counted 88set relativenumber | " displays current lines line no as zero point from where relative numbers are getting counted
89set list | " shows unprinable characters in the current line
111 90
91set spell spelllang=en,de | " enable spell checker
112set splitbelow | " open new windows below the current one (i find that more intuitive) 92set splitbelow | " open new windows below the current one (i find that more intuitive)
93set colorcolumn=80 | " show an indicator (different background in column 80)
94highlight ColorColumn guibg=#F0F0E0
95
96if (&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
99endif
100
101if 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
106endif
107
108
109if 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
122endif
123
124let &titlestring = hostname() . "[vim(" . expand("%:t") . ")]"
125" set window title for screen(3)
126if &term == "screen"
127 set t_ts=k
128 set t_fs=\
129endif
130if &term == "screen" || &term == "xterm"
131 set title
132endif
133
113 134
114if has("multi_byte") 135if 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)
123endif 144endif
124 145
125if 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
155endif
156
157"================================================================================
158" gui stuff and appearance
159if &t_Co > 2
160 set hlsearch | " highlight all search matches
161 set cursorline | " highlight currently selected line
162endif
163 147
164 148" set title
165if 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)
179else
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
191endif
192
193
194"================================================================================
195" custom commands...
196" 154"
197" assign selection keys (these i missed a lot) 155" Brief help
198nmap <S-Left> vh| " shift-left selects to the left 156" :PluginList - lists configured plugins
199xmap <S-Left> h| " ^^ 157" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
200nmap <S-Right> vl| " shift-right selects to the right 158" :PluginSearch foo - searches for foo; append `!` to refresh local cache
201xmap <S-Right> l| " ^^ 159" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
202nmap <S-Up> vk| " shift-up selects like other text editors
203xmap <S-Up> k| " ^^
204nmap <S-Down> vj| " shift down selects like other text editors
205xmap <S-Down> j| " ^^
206nmap <Home> ^| " default homing in code editors is the first letter of a line
207xmap <Home> 0| " go to the beginning of the line
208xmap <S-Home> 0| " ^^
209xmap <Tab> >gv| " indent lines (and retain selection)
210xmap <S-Tab> <gv| " unindent lines (and retain selection)
211nmap <S-PageUp> VH| " selects predessing paragraph
212nmap <S-PageDown> VL| " selects following paragraph
213nmap <C-S-PageUp> V{| " selects predessing paragraph
214nmap <C-S-PageDown> V}| " selects following paragraph
215
216
217
218
219
220map <C-h> <C-w>h|map <C-j> <C-w>j| " window navigation shortcuts
221map <C-k> <C-w>k|map <C-l> <C-w>l| " window navigation shortcuts
222
223cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user
224
225" custom hotkeys...
226nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs
227nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab
228
229nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines
230
231nnoremap $ g$| " and make the $ key position the cursor after the last char of that line, not before
232nnoremap <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
242nnoremap <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
252map <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L
253inoremap <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
256set makeprg=make\ test
257nnoremap <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...
4set nocompatible | " do not try to be vi, be vim (required by Vundle)
5filetype off | " Vundle needs this
6set rtp+=~/.vim/bundle/Vundle.vim | " set runtimepath (required by Vundle)
7call vundle#begin('~/.vim/bundle/') | " location where Vundle searches&installs plugins
8
9" Plugin dependant configurations...
10Plugin 'tpope/vim-sensible' | " a sane and modern default configuration
11Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin
12Plugin 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with '
13Plugin 'tpope/vim-repeat' | " lets . (dot) repeat plugin macros as well, specifically vim-surround
14Plugin 'tpope/vim-vinegar' | " Improves :Explore
15Plugin 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values)
16
17Plugin 'tpope/vim-vividchalk' | " dark theme
18Plugin 'nelstrom/vim-mac-classic-theme' | " light theme
19
20Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion
21Plugin 'cscope_plus.vim' | " run cscope -R -b in project folder then use
22Plugin 'autoload_cscope.vim' | " CTRL+\ s searches word under cursor, CTRL+T back
23Plugin 'jeaye/color_coded' | " semantic highlighting with vim
24Plugin 'terryma/vim-multiple-cursors' | " displays visual block mode as cursors
25Plugin 'taglist-plus' | " quick code navigator
26Plugin 'jdonaldson/vaxe' | " code completion for haxe
27Plugin 'sheerun/vim-polyglot' | " better syntax highlighting/indentation for multiple languages
28Plugin 'loremipsum' | " Sample text generator
29Plugin 'vim-airline/vim-airline' | " beautification of the mode line
30Plugin 'nathanaelkane/vim-indent-guides' | " shows indentation guidelines by pressing <leader>ig
31Plugin 'gregsexton/matchtag' | " highlights closing ML tags like braces
32Plugin 'indenthtml.vim' | " works better with mixed html/css/javascript
33Plugin 'easymotion/vim-easymotion' | " speed up navigation: try \\w or \\f, then one of the highlighted chars
34Plugin 'Shougo/vimproc.vim'
35Plugin 'Shougo/vimshell.vim'
36Plugin 'jeetsukumaran/vim-buffergator' | " switch buffers with \b or <\-Left> <\-Right>
37
38let g:airline_powerline_fonts = 1
39
40let Tlist_Compact_Format = 1 | "
41let Tlist_GainFocus_On_ToggleOpen = 1 | "
42let Tlist_Close_On_Select = 1 | "
43
44Plugin 'VundleVim/Vundle.vim' | " Vundle itself (required)
45let g:ycm_global_ycm_extra_conf = '~/.vim/ycm_extra_conf.py' | " fallback, right one should be in the applications path
46let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?'
47let g:ycm_key_select_completion = '<Tab>' | " key completion key
48let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar
49let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar
50let g:ycm_collect_identifiers_from_tags_files = 1 | "
51let 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
54let b:html_omni_flavor='xhtml' | " prever xhtml over html because that makes inline php code possible without hassle
55let html_use_css = 1 | " when using :TOhtml no font-tags will be used, but proper css
56let g:vim_markdown_folding_disabled=1 | " disable code folding with vimdiff (also see set nofoldenable)
57
58let g:netrw_liststyle=3 | " Explore mode: 3 shows a complete tree instead of the current directory
59let g:netrw_list_hide='^\..*' | " Explore mode: hide files starting with dot
60
61
62" speed up CTRL-P Menu...
63let 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
71call vundle#end() | " required by Vundle
72filetype plugin indent on | " required by Vundle
73"================================================================================
74" custom config
75colorscheme mac_classic
76" colorscheme coderonline
77syntax enable
78
79set noswapfile | " noundofile, nobackup, nowritebackup
80set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory
81set directory=~/.vim/temp | "
82set undodir=~/.vim/temp | "
83
84set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth)
85set autoindent | " always set autoindenting on
86set autochdir | " change to the current files working dir (might break some plugins!)
87set copyindent | " copy the previous indentation on autoindenting
88set scrolloff=2 | " always keeps at least two lines visible (when seeking)
89" set selectmode=mouse | " avoid using select mode (only with mouse)
90set mousemodel=popup_setpos | " display a default right click menu for the selection (that is c&p is possible)
91set selection=exclusive | " includes last character of the selection into following command (like x or d)
92
93set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap
94set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap
95set diffopt+=vertical,iwhite,filler | " lets diff ignore white spaces
96set spell spelllang=en,de | " enable spell checker
97set virtualedit=onemore | " one character beyond the line length should be navigatable (options: all,insert,block,onemore)
98set breakindent cpoptions+=n | " when wrapping lines indent wrapped line to align with the previews
99set linebreak | " do not wrap in the middle of words
100set display+=lastline | " do not show the @ symbol in the end of a long line
101set showcmd | " displays status line messages while selecting (matrix size)
102set nofoldenable | " do not fold code automatically
103set tags+=~/.vim/systags | " ctags -R -f ~/.vim/systags /usr/include /usr/local/include
104set wildmenu wildmode=full | " wildmenu code completion
105set guifont="Droid Sans Mono for Powerline 10"
106
107" search...
108set ignorecase smartcase | " if search pattern contains uppercase then search is case sensitive
109set incsearch | " do incremental searching
110set showmatch matchtime=4 | " blinks matching braces
111
112set novisualbell | " don't beep
113set noerrorbells | " don't beep
114set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well)
115set number | " toggle line numbers
116set formatprg=par | " set external formatting program to par, use gwip to format with this
117set laststatus=2 | " this is required for airline
118set cmdheight=1 | " controls how many lines the command line has
119set relativenumber | " displays current lines line no as zero point from where relative numbers are getting counted
120set timeoutlen=500 | " time between keys e.g. 80i=
121set ttimeoutlen=10 | " set esc key timeout in ms
122
123set splitbelow | " open new windows below the current one (i find that more intuitive)
124
125if 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)
134endif
135
136if 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
166endif
167
168"================================================================================
169" gui stuff and appearance
170if &t_Co > 2
171 set hlsearch | " highlight all search matches
172 set cursorline | " highlight currently selected line
173endif
174
175
176if 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)
190else
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
202endif
203
204
205"================================================================================
206" custom commands...
207"
208" assign selection keys (these i missed a lot)
209nmap <S-Left> vh| " shift-left selects to the left
210xmap <S-Left> h| " ^^
211nmap <S-Right> vl| " shift-right selects to the right
212xmap <S-Right> l| " ^^
213nmap <S-Up> vk| " shift-up selects like other text editors
214xmap <S-Up> k| " ^^
215nmap <S-Down> vj| " shift down selects like other text editors
216xmap <S-Down> j| " ^^
217nmap <Home> ^| " default homing in code editors is the first letter of a line
218xmap <Home> 0| " go to the beginning of the line
219xmap <S-Home> 0| " ^^
220xmap <Tab> >gv| " indent lines (and retain selection)
221xmap <S-Tab> <gv| " unindent lines (and retain selection)
222nmap <S-PageUp> VH| " selects predessing paragraph
223nmap <S-PageDown> VL| " selects following paragraph
224nmap <C-S-PageUp> V{| " selects predessing paragraph
225nmap <C-S-PageDown> V}| " selects following paragraph
226
227nmap <C-o> :24vs.<CR>| " means the same as :vsplit. and opens the :Exlore -window with a width of 24
228
229
230
231
232
233map <C-h> <C-w>h|map <C-j> <C-w>j| " window navigation shortcuts
234map <C-k> <C-w>k|map <C-l> <C-w>l| " window navigation shortcuts
235
236cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user
237
238" custom hotkeys...
239nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs
240nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab
241
242nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines
243
244nnoremap $ g$| " and make the $ key position the cursor after the last char of that line, not before
245nnoremap <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
255nnoremap <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
265map <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L
266inoremap <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
269set makeprg=make\ test
270nnoremap <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
..