aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Christian Pohle2015-09-09 17:29:01 +0200
committerMax Christian Pohle2015-09-09 17:29:01 +0200
commitd1f054ef1a601b81054f74e18520a2bc8075c3d8 (patch)
treece7f1e14b81d40ee066f0f8d26c46ba8635df8a4
parent2572ae93322fc8cde33beb54e92290d1831836df (diff)
downloadvim-d1f054ef1a601b81054f74e18520a2bc8075c3d8.tar.bz2
vim-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.
-rw-r--r--doc/shortcuts.txt6
-rw-r--r--vimrc132
2 files changed, 73 insertions, 65 deletions
diff --git a/doc/shortcuts.txt b/doc/shortcuts.txt
index c0911e1..9f4325f 100644
--- a/doc/shortcuts.txt
+++ b/doc/shortcuts.txt
@@ -1,9 +1,13 @@
1 1
2[visual mode] - with selected lines 2[visual mode] - with selected lines
3gq - format text so that it fits in whatever :set textwidth was set 3gq - format text so that it fits in whatever :set textwidth was set
4 4
5[commands] 5[commands]
6:spell [word] - adds a word to the current dictionary (no mistake any more) 6:spell [word] - adds a word to the current dictionary (no mistake any more)
7:set list - display non printable characters 7:set list - display non printable characters
8:retab - replaces tabs with spaces 8:retab - replaces tabs with spaces
9:set expandtab - in insert mode: replace tab with spaces 9:set expandtab - in insert mode: replace tab with spaces
10
11[navigation]
12<CTRL-]> - go to tag under the cursor (help links as well)
13<CTRL-T> - return back from tag under the cursor
diff --git a/vimrc b/vimrc
index 7a0910f..d66c1ba 100644
--- a/vimrc
+++ b/vimrc
@@ -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...
3set nocompatible| " do not try to be vi, be vim 4set nocompatible | " do not try to be vi, be vim (required by Vundle)
4filetype off| " Vundle needs this 5filetype off | " Vundle needs this
5set rtp+=~/.vim/plugins/Vundle.vim 6set rtp+=~/.vim/plugins/Vundle.vim | " set runtimepath (required by Vundle)
6call vundle#begin('~/.vim/plugins/') 7call vundle#begin('~/.vim/plugins/') | " location where Vundle searches&installs plugins
7 8
8" Plugin dependant configurations... 9" Plugin dependant configurations...
9Plugin 'VundleVim/Vundle.vim' 10Plugin 'VundleVim/Vundle.vim' | " Vundle itself (required)
10Plugin 'cscope_plus.vim' | " run cscope -R -b in project folder then use 11Plugin 'cscope_plus.vim' | " run cscope -R -b in project folder then use
11Plugin 'autoload_cscope.vim' | " CTRL+\ s searches word under cursor, CTRL+T back 12Plugin 'autoload_cscope.vim' | " CTRL+\ s searches word under cursor, CTRL+T back
12Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin 13Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin
13Plugin 'taglist-plus' | " quick code navigator 14
14let Tlist_Compact_Format = 1 | " 15Plugin 'taglist-plus' | " quick code navigator
16let Tlist_Compact_Format = 1 | "
15let Tlist_GainFocus_On_ToggleOpen = 1 | " 17let Tlist_GainFocus_On_ToggleOpen = 1 | "
16let Tlist_Close_On_Select = 1 | " 18let Tlist_Close_On_Select = 1 | "
19
17Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion 20Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion
18let g:ycm_global_ycm_extra_conf = '' | " fallback, right one should be in the applications path 21let g:ycm_global_ycm_extra_conf = '' | " fallback, right one should be in the applications path
19let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?' 22let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?'
20let g:ycm_key_select_completion = '<Tab>' | " key completion key 23let g:ycm_key_select_completion = '<Tab>' | " key completion key
21let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar 24let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar
22let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar 25let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar
23let g:ycm_collect_identifiers_from_tags_files = 1 | " 26let g:ycm_collect_identifiers_from_tags_files = 1 | "
24let g:ycm_autoclose_preview_window_after_insertion=1 | " close the window when leaving insert mode 27let 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
27let b:html_omni_flavor='xhtml' | " prever xhtml over html because that makes inline php code possible without hassle 30let b:html_omni_flavor='xhtml' | " prever xhtml over html because that makes inline php code possible without hassle
28 31
29call vundle#end() | " required 32call vundle#end() | " required by Vundle
30filetype plugin indent on | " required 33filetype plugin indent on | " required by Vundle
31"================================================================================ 34"================================================================================
32" custom config 35" custom config
33scriptencoding utf-8 | " tell vim that we are using utf-8 here 36colorscheme coderonline
37syntax enable
34 38
35set noswapfile | " noundofile, nobackup, nowritebackup 39set noswapfile | " noundofile, nobackup, nowritebackup
36set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory 40set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory
@@ -42,8 +46,6 @@ set autoindent | " always set autoindenting on
42set copyindent | " copy the previous indentation on autoindenting 46set copyindent | " copy the previous indentation on autoindenting
43set scrolloff=2 | " always keeps at least two lines visible (when seeking) 47set scrolloff=2 | " always keeps at least two lines visible (when seeking)
44 48
45set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well)
46set number | " toggle line numbers
47set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap 49set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap
48set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap 50set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap
49set diffopt+=iwhite,filler | " lets diff ignore white spaces 51set diffopt+=iwhite,filler | " lets diff ignore white spaces
@@ -55,34 +57,32 @@ set showcmd | " displays status line messages while selecting
55set nofoldenable | " do not fold code automatically 57set nofoldenable | " do not fold code automatically
56set tags+=~/.vim/systags | " ctags -R -f ~/.vim/systags /usr/include /usr/local/include 58set tags+=~/.vim/systags | " ctags -R -f ~/.vim/systags /usr/include /usr/local/include
57 59
58set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below)
59set showbreak+=› | " symbol used in the beginning of a wrapped line
60set listchars=eol:↲ | " symbols used when using :set list (which displays non-printable chars)
61set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars)
62set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars)
63set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars)
64set listchars+=tab:▸\ | " symbols used when using :set list (which displays non-printable chars)
65
66
67nnoremap $ g$| " and make the $ key position the cursor after the last char of that line, not before
68nnoremap <End> g$| " and make the <End> key position the cursor after the last char of that line
69
70" search... 60" search...
71set ignorecase|set smartcase " if search pattern contains uppercase then search is case sensitive 61set ignorecase|set smartcase | " if search pattern contains uppercase then search is case sensitive
72set incsearch " do incremental searching 62set incsearch | " do incremental searching
73set showmatch|set matchtime=4 " blinks matching braces 63set showmatch|set matchtime=4 | " blinks matching braces
64
65set novisualbell | " don't beep
66set noerrorbells | " don't beep
67set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well)
68set number | " toggle line numbers
74 69
75set novisualbell " don't beep 70if has("multi_byte")
76set noerrorbells " don't beep 71 scriptencoding utf-8 | " tell vim that we are using utf-8 here
77set 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)
79endif
78 80
79if has("autocmd") 81if 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=
107endif 107endif
108 108
109"================================================================================ 109"================================================================================
110" gui stuff and appearance 110" gui stuff and appearance
111if &t_Co > 2 111if &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
114endif 114endif
115 115
116if has('mouse') 116if has('mouse')
@@ -118,29 +118,28 @@ if has('mouse')
118endif 118endif
119 119
120if has("gui_running") 120if 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)
131else 132else
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
140endif 141endif
141 142
142colorscheme coderonline
143syntax 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
150cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user 149cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user
151 150
152" custom hotkeys... 151" custom hotkeys...
153nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs 152nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs
154nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab 153nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab
155 154
156nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines 155nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines
157 156
157nnoremap $ g$| " and make the $ key position the cursor after the last char of that line, not before
158nnoremap <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
159map <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L 162map <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L
160inoremap <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) 163inoremap <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"
..