diff options
author | Max Christian Pohle | 2015-09-09 17:29:01 +0200 |
---|---|---|
committer | Max Christian Pohle | 2015-09-09 17:29:01 +0200 |
commit | d1f054ef1a601b81054f74e18520a2bc8075c3d8 (patch) | |
tree | ce7f1e14b81d40ee066f0f8d26c46ba8635df8a4 /vimrc | |
parent | 2572ae93322fc8cde33beb54e92290d1831836df (diff) | |
download | vim-karlmarks-d1f054ef1a601b81054f74e18520a2bc8075c3d8.tar.bz2 vim-karlmarks-d1f054ef1a601b81054f74e18520a2bc8075c3d8.zip |
added modeline to vimrc, commented vimrc further
modeline says, that the window should be 160 columns width. It is
usually bad habit to write lines that long, but in this case it improves
the situation, because comments and corresponding commands can stay
together in this way.
Diffstat (limited to 'vimrc')
-rw-r--r-- | vimrc | 132 |
1 files changed, 68 insertions, 64 deletions
@@ -1,36 +1,40 @@ | |||
1 | "================================================================================ | 1 | " vi:columns=160:list:ts=2:sts=2:sw=2 |
2 | "================================================================================ | ||
2 | " Vundle: plugin manager... | 3 | " Vundle: plugin manager... |
3 | set nocompatible| " do not try to be vi, be vim | 4 | set nocompatible | " do not try to be vi, be vim (required by Vundle) |
4 | filetype off| " Vundle needs this | 5 | filetype off | " Vundle needs this |
5 | set rtp+=~/.vim/plugins/Vundle.vim | 6 | set rtp+=~/.vim/plugins/Vundle.vim | " set runtimepath (required by Vundle) |
6 | call vundle#begin('~/.vim/plugins/') | 7 | call vundle#begin('~/.vim/plugins/') | " location where Vundle searches&installs plugins |
7 | 8 | ||
8 | " Plugin dependant configurations... | 9 | " Plugin dependant configurations... |
9 | Plugin 'VundleVim/Vundle.vim' | 10 | Plugin 'VundleVim/Vundle.vim' | " Vundle itself (required) |
10 | Plugin 'cscope_plus.vim' | " run cscope -R -b in project folder then use | 11 | Plugin 'cscope_plus.vim' | " run cscope -R -b in project folder then use |
11 | Plugin 'autoload_cscope.vim' | " CTRL+\ s searches word under cursor, CTRL+T back | 12 | Plugin 'autoload_cscope.vim' | " CTRL+\ s searches word under cursor, CTRL+T back |
12 | Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin | 13 | Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin |
13 | Plugin 'taglist-plus' | " quick code navigator | 14 | |
14 | let Tlist_Compact_Format = 1 | " | 15 | Plugin 'taglist-plus' | " quick code navigator |
16 | let Tlist_Compact_Format = 1 | " | ||
15 | let Tlist_GainFocus_On_ToggleOpen = 1 | " | 17 | let Tlist_GainFocus_On_ToggleOpen = 1 | " |
16 | let Tlist_Close_On_Select = 1 | " | 18 | let Tlist_Close_On_Select = 1 | " |
19 | |||
17 | Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion | 20 | Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion |
18 | let g:ycm_global_ycm_extra_conf = '' | " fallback, right one should be in the applications path | 21 | let g:ycm_global_ycm_extra_conf = '' | " fallback, right one should be in the applications path |
19 | let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?' | 22 | let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?' |
20 | let g:ycm_key_select_completion = '<Tab>' | " key completion key | 23 | let g:ycm_key_select_completion = '<Tab>' | " key completion key |
21 | let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar | 24 | let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar |
22 | let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar | 25 | let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar |
23 | let g:ycm_collect_identifiers_from_tags_files = 1 | " | 26 | let g:ycm_collect_identifiers_from_tags_files = 1 | " |
24 | let g:ycm_autoclose_preview_window_after_insertion=1 | " close the window when leaving insert mode | 27 | let g:ycm_autoclose_preview_window_after_insertion=1 | " close the window when leaving insert mode |
25 | "let g:ycm_semantic_triggers = {'c' : ['(', ',']} | " add additional triggers (not recommend) | 28 | "let g:ycm_semantic_triggers = {'c' : ['(', ',']} | " add additional triggers (not recommend) |
26 | 29 | ||
27 | let b:html_omni_flavor='xhtml' | " prever xhtml over html because that makes inline php code possible without hassle | 30 | let b:html_omni_flavor='xhtml' | " prever xhtml over html because that makes inline php code possible without hassle |
28 | 31 | ||
29 | call vundle#end() | " required | 32 | call vundle#end() | " required by Vundle |
30 | filetype plugin indent on | " required | 33 | filetype plugin indent on | " required by Vundle |
31 | "================================================================================ | 34 | "================================================================================ |
32 | " custom config | 35 | " custom config |
33 | scriptencoding utf-8 | " tell vim that we are using utf-8 here | 36 | colorscheme coderonline |
37 | syntax enable | ||
34 | 38 | ||
35 | set noswapfile | " noundofile, nobackup, nowritebackup | 39 | set noswapfile | " noundofile, nobackup, nowritebackup |
36 | set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory | 40 | set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory |
@@ -42,8 +46,6 @@ set autoindent | " always set autoindenting on | |||
42 | set copyindent | " copy the previous indentation on autoindenting | 46 | set copyindent | " copy the previous indentation on autoindenting |
43 | set scrolloff=2 | " always keeps at least two lines visible (when seeking) | 47 | set scrolloff=2 | " always keeps at least two lines visible (when seeking) |
44 | 48 | ||
45 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) | ||
46 | set number | " toggle line numbers | ||
47 | set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap | 49 | set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap |
48 | set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap | 50 | set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap |
49 | set diffopt+=iwhite,filler | " lets diff ignore white spaces | 51 | set diffopt+=iwhite,filler | " lets diff ignore white spaces |
@@ -55,34 +57,32 @@ set showcmd | " displays status line messages while selecting | |||
55 | set nofoldenable | " do not fold code automatically | 57 | set nofoldenable | " do not fold code automatically |
56 | set tags+=~/.vim/systags | " ctags -R -f ~/.vim/systags /usr/include /usr/local/include | 58 | set tags+=~/.vim/systags | " ctags -R -f ~/.vim/systags /usr/include /usr/local/include |
57 | 59 | ||
58 | set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) | ||
59 | set showbreak+=› | " symbol used in the beginning of a wrapped line | ||
60 | set listchars=eol:↲ | " symbols used when using :set list (which displays non-printable chars) | ||
61 | set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) | ||
62 | set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) | ||
63 | set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) | ||
64 | set listchars+=tab:▸\ | " symbols used when using :set list (which displays non-printable chars) | ||
65 | |||
66 | |||
67 | nnoremap $ g$| " and make the $ key position the cursor after the last char of that line, not before | ||
68 | nnoremap <End> g$| " and make the <End> key position the cursor after the last char of that line | ||
69 | |||
70 | " search... | 60 | " search... |
71 | set ignorecase|set smartcase " if search pattern contains uppercase then search is case sensitive | 61 | set ignorecase|set smartcase | " if search pattern contains uppercase then search is case sensitive |
72 | set incsearch " do incremental searching | 62 | set incsearch | " do incremental searching |
73 | set showmatch|set matchtime=4 " blinks matching braces | 63 | set showmatch|set matchtime=4 | " blinks matching braces |
64 | |||
65 | set novisualbell | " don't beep | ||
66 | set noerrorbells | " don't beep | ||
67 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) | ||
68 | set number | " toggle line numbers | ||
74 | 69 | ||
75 | set novisualbell " don't beep | 70 | if has("multi_byte") |
76 | set noerrorbells " don't beep | 71 | scriptencoding utf-8 | " tell vim that we are using utf-8 here |
77 | set guicursor=n-v-c:ver30-Cursor-blinkon500-blinkoff500 " how the caret looks like | 72 | set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) |
73 | set showbreak+=› | " symbol used in the beginning of a wrapped line | ||
74 | set listchars=eol:↲ | " symbols used when using :set list (which displays non-printable chars) | ||
75 | set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) | ||
76 | set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) | ||
77 | set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) | ||
78 | set listchars+=tab:▸\ | " symbols used when using :set list (which displays non-printable chars) | ||
79 | endif | ||
78 | 80 | ||
79 | if has("autocmd") | 81 | if has("autocmd") |
80 | set modeline " set variables specific to a file, like indentation by adding a comment | 82 | set modeline | " set variables specific to a file, like indentation by adding a comment |
81 | set modelines=3 " how many lines in the beginning and end of the file can be mode lines? | 83 | set modelines=3 | " how many lines in the beginning and end of the file can be mode lines? |
82 | |||
83 | 84 | ||
84 | augroup resCur | " make cursor appear in its previous position when reopening a file... | 85 | augroup resCur | " make cursor appear in its previous position when reopening a file... |
85 | "autocmd! | ||
86 | autocmd BufReadPost * call setpos(".", getpos("'\"")) | 86 | autocmd BufReadPost * call setpos(".", getpos("'\"")) |
87 | augroup END | 87 | augroup END |
88 | 88 | ||
@@ -95,22 +95,22 @@ if has("autocmd") | |||
95 | if exists("+omnifunc") | 95 | if exists("+omnifunc") |
96 | autocmd Filetype * | 96 | autocmd Filetype * |
97 | \ if &omnifunc == "" | | 97 | \ if &omnifunc == "" | |
98 | \ setlocal omnifunc=syntaxcomplete#Complete | | 98 | \ setlocal omnifunc=syntaxcomplete#Complete | |
99 | \ setlocal completeopt=longest,menuone | | 99 | \ setlocal completeopt=longest,menuone | |
100 | \ endif | 100 | \ endif |
101 | endif | 101 | endif |
102 | augroup END | 102 | augroup END |
103 | 103 | ||
104 | autocmd FileType text setlocal textwidth=78 " text files: set 'textwidth' to 78 | 104 | autocmd FileType text setlocal textwidth=78 | " text files: set 'textwidth' to 78 |
105 | autocmd FileType gitcommit set tw=72 " longer commit messages without auto line wrapping | 105 | autocmd FileType gitcommit set tw=72 | " longer commit messages without auto line wrapping |
106 | autocmd FileType LaTeX let g:tex_flavor = "latex" |set conceallevel=1| set concealcursor= | 106 | autocmd FileType LaTeX let g:tex_flavor = "latex"| set conceallevel=1| set concealcursor= |
107 | endif | 107 | endif |
108 | 108 | ||
109 | "================================================================================ | 109 | "================================================================================ |
110 | " gui stuff and appearance | 110 | " gui stuff and appearance |
111 | if &t_Co > 2 | 111 | if &t_Co > 2 |
112 | set hlsearch " | 112 | set hlsearch | " highlight all search matches |
113 | set cursorline " highlight currently selected line | 113 | set cursorline | " highlight currently selected line |
114 | endif | 114 | endif |
115 | 115 | ||
116 | if has('mouse') | 116 | if has('mouse') |
@@ -118,29 +118,28 @@ if has('mouse') | |||
118 | endif | 118 | endif |
119 | 119 | ||
120 | if has("gui_running") | 120 | if has("gui_running") |
121 | set guitablabel=%t " do not display full path as tabname | 121 | set guicursor=n-v-c:ver30-Cursor-blinkon500-blinkoff500 | " how the caret looks like |
122 | set guioptions+=m " menu bar | 122 | set guitablabel=%t | " do not display full path as tabname |
123 | set guioptions+=T " toolbar | 123 | set guioptions+=m | " menu bar |
124 | set guioptions+=r " right-hand scroll bar | 124 | set guioptions+=T | " toolbar |
125 | set guioptions-=c " use console dialogs instead of popups | 125 | set guioptions+=r | " right-hand scroll bar |
126 | set guioptions+=a " autoselect: copy&paste using middleclick | 126 | set guioptions-=c | " use console dialogs instead of popups |
127 | set guioptions+=e " add tab pages | 127 | set guioptions+=a | " autoselect: copy&paste using middleclick |
128 | set guioptions+=p " use gui pointer callback for x11 | 128 | set guioptions+=e | " add tab pages |
129 | set toolbariconsize=large " make the icon toolbar as big as possible | 129 | set guioptions+=p | " use gui pointer callback for x11 |
130 | 130 | set toolbariconsize=large | " make the icon toolbar as big as possible | |
131 | "set columns=80 | " set initial window width (so that it fits the terminals) | ||
131 | else | 132 | else |
132 | if &term =~? 'mlterm\|xterm\|screen' | 133 | if &term =~? 'mlterm\|xterm\|screen' |
133 | set t_Co=256 | " fixes incompatibilities with our color scheme | 134 | set t_Co=256 | " fixes incompatibilities with our color scheme |
134 | endif | 135 | endif |
135 | set title | " set the terminal caption | 136 | set title | " set the terminal caption |
136 | set titleold="vim ended" | " set terminal title after closing vim | ||
137 | set titlestring="VIM-CONSOLE" | " set window title | ||
138 | set icon | " sets the terminal icon to vim | 137 | set icon | " sets the terminal icon to vim |
139 | set ttyfast | " modern terminals are all fast in a way | 138 | set ttyfast | " modern terminals are all fast in a way |
139 | "set titleold="vim ended" | " set terminal title after closing vim | ||
140 | "set titlestring="VIM-CONSOLE" | " set window title | ||
140 | endif | 141 | endif |
141 | 142 | ||
142 | colorscheme coderonline | ||
143 | syntax enable | ||
144 | 143 | ||
145 | "================================================================================ | 144 | "================================================================================ |
146 | " custom commands... | 145 | " custom commands... |
@@ -150,17 +149,21 @@ map <C-k> <C-w>k|map <C-l> <C-w>l| " window navigation shortcuts | |||
150 | cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user | 149 | cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user |
151 | 150 | ||
152 | " custom hotkeys... | 151 | " custom hotkeys... |
153 | nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs | 152 | nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs |
154 | nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab | 153 | nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab |
155 | 154 | ||
156 | nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines | 155 | nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines |
157 | 156 | ||
157 | nnoremap $ g$| " and make the $ key position the cursor after the last char of that line, not before | ||
158 | nnoremap <End> g$| " and make the <End> key position the cursor after the last char of that line | ||
159 | |||
160 | |||
158 | " plugin hotkeys | 161 | " plugin hotkeys |
159 | map <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L | 162 | map <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L |
160 | 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) | 163 | 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) |
161 | 164 | ||
162 | 165 | ||
163 | "================================================================================ | 166 | "================================================================================ |
164 | " deactivated on-demand commands (just in case one needs them one day) | 167 | " deactivated on-demand commands (just in case one needs them one day) |
165 | " | 168 | " |
166 | " code completion: http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE | 169 | " code completion: http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE |
@@ -191,3 +194,4 @@ inoremap <buffer> ( <C-X><C-o><C-p>(| " when opening a bracket: call the OmniCo | |||
191 | " binding ESC can easily break cursor key movement on the console (tricky, because gvim works) | 194 | " binding ESC can easily break cursor key movement on the console (tricky, because gvim works) |
192 | "inoremap <C-Space> <C-x><C-o> | 195 | "inoremap <C-Space> <C-x><C-o> |
193 | "inoremap <C-@> <C-Space> | 196 | "inoremap <C-@> <C-Space> |
197 | " | ||