From d1f054ef1a601b81054f74e18520a2bc8075c3d8 Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Wed, 9 Sep 2015 17:29:01 +0200 Subject: 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. --- doc/shortcuts.txt | 6 ++- vimrc | 132 ++++++++++++++++++++++++++++-------------------------- 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 @@ [visual mode] - with selected lines -gq - format text so that it fits in whatever :set textwidth was set +gq - format text so that it fits in whatever :set textwidth was set [commands] :spell [word] - adds a word to the current dictionary (no mistake any more) :set list - display non printable characters :retab - replaces tabs with spaces :set expandtab - in insert mode: replace tab with spaces + +[navigation] + - go to tag under the cursor (help links as well) + - 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 @@ -"================================================================================ +" vi:columns=160:list:ts=2:sts=2:sw=2 +"================================================================================ " Vundle: plugin manager... -set nocompatible| " do not try to be vi, be vim -filetype off| " Vundle needs this -set rtp+=~/.vim/plugins/Vundle.vim -call vundle#begin('~/.vim/plugins/') +set nocompatible | " do not try to be vi, be vim (required by Vundle) +filetype off | " Vundle needs this +set rtp+=~/.vim/plugins/Vundle.vim | " set runtimepath (required by Vundle) +call vundle#begin('~/.vim/plugins/') | " location where Vundle searches&installs plugins " Plugin dependant configurations... -Plugin 'VundleVim/Vundle.vim' -Plugin 'cscope_plus.vim' | " run cscope -R -b in project folder then use -Plugin 'autoload_cscope.vim' | " CTRL+\ s searches word under cursor, CTRL+T back -Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin -Plugin 'taglist-plus' | " quick code navigator -let Tlist_Compact_Format = 1 | " +Plugin 'VundleVim/Vundle.vim' | " Vundle itself (required) +Plugin 'cscope_plus.vim' | " run cscope -R -b in project folder then use +Plugin 'autoload_cscope.vim' | " CTRL+\ s searches word under cursor, CTRL+T back +Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin + +Plugin 'taglist-plus' | " quick code navigator +let Tlist_Compact_Format = 1 | " let Tlist_GainFocus_On_ToggleOpen = 1 | " let Tlist_Close_On_Select = 1 | " + Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion let g:ycm_global_ycm_extra_conf = '' | " fallback, right one should be in the applications path let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?' let g:ycm_key_select_completion = '' | " key completion key let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar -let g:ycm_collect_identifiers_from_tags_files = 1 | " +let g:ycm_collect_identifiers_from_tags_files = 1 | " let g:ycm_autoclose_preview_window_after_insertion=1 | " close the window when leaving insert mode "let g:ycm_semantic_triggers = {'c' : ['(', ',']} | " add additional triggers (not recommend) let b:html_omni_flavor='xhtml' | " prever xhtml over html because that makes inline php code possible without hassle -call vundle#end() | " required -filetype plugin indent on | " required +call vundle#end() | " required by Vundle +filetype plugin indent on | " required by Vundle "================================================================================ " custom config -scriptencoding utf-8 | " tell vim that we are using utf-8 here +colorscheme coderonline +syntax enable set noswapfile | " noundofile, nobackup, nowritebackup set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory @@ -42,8 +46,6 @@ set autoindent | " always set autoindenting on set copyindent | " copy the previous indentation on autoindenting set scrolloff=2 | " always keeps at least two lines visible (when seeking) -set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) -set number | " toggle line numbers set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap set diffopt+=iwhite,filler | " lets diff ignore white spaces @@ -55,34 +57,32 @@ set showcmd | " displays status line messages while selecting set nofoldenable | " do not fold code automatically set tags+=~/.vim/systags | " ctags -R -f ~/.vim/systags /usr/include /usr/local/include -set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) -set showbreak+=› | " symbol used in the beginning of a wrapped line -set listchars=eol:↲ | " symbols used when using :set list (which displays non-printable chars) -set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) -set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) -set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) -set listchars+=tab:▸\ | " symbols used when using :set list (which displays non-printable chars) - - -nnoremap $ g$| " and make the $ key position the cursor after the last char of that line, not before -nnoremap g$| " and make the key position the cursor after the last char of that line - " search... -set ignorecase|set smartcase " if search pattern contains uppercase then search is case sensitive -set incsearch " do incremental searching -set showmatch|set matchtime=4 " blinks matching braces +set ignorecase|set smartcase | " if search pattern contains uppercase then search is case sensitive +set incsearch | " do incremental searching +set showmatch|set matchtime=4 | " blinks matching braces + +set novisualbell | " don't beep +set noerrorbells | " don't beep +set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) +set number | " toggle line numbers -set novisualbell " don't beep -set noerrorbells " don't beep -set guicursor=n-v-c:ver30-Cursor-blinkon500-blinkoff500 " how the caret looks like +if has("multi_byte") + scriptencoding utf-8 | " tell vim that we are using utf-8 here + set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) + set showbreak+=› | " symbol used in the beginning of a wrapped line + set listchars=eol:↲ | " symbols used when using :set list (which displays non-printable chars) + set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) + set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) + set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) + set listchars+=tab:▸\ | " symbols used when using :set list (which displays non-printable chars) +endif if has("autocmd") - set modeline " set variables specific to a file, like indentation by adding a comment - set modelines=3 " how many lines in the beginning and end of the file can be mode lines? - + set modeline | " set variables specific to a file, like indentation by adding a comment + set modelines=3 | " how many lines in the beginning and end of the file can be mode lines? augroup resCur | " make cursor appear in its previous position when reopening a file... - "autocmd! autocmd BufReadPost * call setpos(".", getpos("'\"")) augroup END @@ -95,22 +95,22 @@ if has("autocmd") if exists("+omnifunc") autocmd Filetype * \ if &omnifunc == "" | - \ setlocal omnifunc=syntaxcomplete#Complete | - \ setlocal completeopt=longest,menuone | + \ setlocal omnifunc=syntaxcomplete#Complete | + \ setlocal completeopt=longest,menuone | \ endif endif augroup END - autocmd FileType text setlocal textwidth=78 " text files: set 'textwidth' to 78 - autocmd FileType gitcommit set tw=72 " longer commit messages without auto line wrapping - autocmd FileType LaTeX let g:tex_flavor = "latex" |set conceallevel=1| set concealcursor= + autocmd FileType text setlocal textwidth=78 | " text files: set 'textwidth' to 78 + autocmd FileType gitcommit set tw=72 | " longer commit messages without auto line wrapping + autocmd FileType LaTeX let g:tex_flavor = "latex"| set conceallevel=1| set concealcursor= endif "================================================================================ " gui stuff and appearance if &t_Co > 2 - set hlsearch " - set cursorline " highlight currently selected line + set hlsearch | " highlight all search matches + set cursorline | " highlight currently selected line endif if has('mouse') @@ -118,29 +118,28 @@ if has('mouse') endif if has("gui_running") - set guitablabel=%t " do not display full path as tabname - set guioptions+=m " menu bar - set guioptions+=T " toolbar - set guioptions+=r " right-hand scroll bar - set guioptions-=c " use console dialogs instead of popups - set guioptions+=a " autoselect: copy&paste using middleclick - set guioptions+=e " add tab pages - set guioptions+=p " use gui pointer callback for x11 - set toolbariconsize=large " make the icon toolbar as big as possible - + set guicursor=n-v-c:ver30-Cursor-blinkon500-blinkoff500 | " how the caret looks like + set guitablabel=%t | " do not display full path as tabname + set guioptions+=m | " menu bar + set guioptions+=T | " toolbar + set guioptions+=r | " right-hand scroll bar + set guioptions-=c | " use console dialogs instead of popups + set guioptions+=a | " autoselect: copy&paste using middleclick + set guioptions+=e | " add tab pages + set guioptions+=p | " use gui pointer callback for x11 + set toolbariconsize=large | " make the icon toolbar as big as possible + "set columns=80 | " set initial window width (so that it fits the terminals) else - if &term =~? 'mlterm\|xterm\|screen' + if &term =~? 'mlterm\|xterm\|screen' set t_Co=256 | " fixes incompatibilities with our color scheme endif - set title | " set the terminal caption - set titleold="vim ended" | " set terminal title after closing vim - set titlestring="VIM-CONSOLE" | " set window title + set title | " set the terminal caption set icon | " sets the terminal icon to vim set ttyfast | " modern terminals are all fast in a way + "set titleold="vim ended" | " set terminal title after closing vim + "set titlestring="VIM-CONSOLE" | " set window title endif -colorscheme coderonline -syntax enable "================================================================================ " custom commands... @@ -150,17 +149,21 @@ map k|map l| " window navigation shortcuts cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user " custom hotkeys... -nnoremap :tabnext| " lets one use CTRL+Tab to switch between tabs +nnoremap :tabnext| " lets one use CTRL+Tab to switch between tabs nnoremap :tabprevious| " use CTRL+Shift+Tab to switch to preview tab nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines +nnoremap $ g$| " and make the $ key position the cursor after the last char of that line, not before +nnoremap g$| " and make the key position the cursor after the last char of that line + + " plugin hotkeys map :TlistToggle| " bind TagList to Hotkey Ctrl+L inoremap ( (| " when opening a bracket: call the OmniComplete function, display the menu, but deselect the first entry (C-p) -"================================================================================ +"================================================================================ " deactivated on-demand commands (just in case one needs them one day) " " code completion: http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE @@ -191,3 +194,4 @@ inoremap ( (| " when opening a bracket: call the OmniCo " binding ESC can easily break cursor key movement on the console (tricky, because gvim works) "inoremap "inoremap +" -- cgit v1.2.3