aboutsummaryrefslogtreecommitdiff
path: root/vimrc
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 /vimrc
parentbcf8550afc38a4005f9c53e8a2c4af879e04831b (diff)
downloadvim-karlmarks-190811dccbcaee6bd2b55b1f2e5b75f910be31be.tar.bz2
vim-karlmarks-190811dccbcaee6bd2b55b1f2e5b75f910be31be.zip
started over
Dropped YouCompleteMe, because its deployment is too complicated for a default configuration.
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc377
1 files changed, 125 insertions, 252 deletions
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
..