diff options
Diffstat (limited to 'experimental/vimrc-old')
-rw-r--r-- | experimental/vimrc-old | 303 |
1 files changed, 303 insertions, 0 deletions
diff --git a/experimental/vimrc-old b/experimental/vimrc-old new file mode 100644 index 0000000..c5bd4e6 --- /dev/null +++ b/experimental/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 | ||