.vimrc review
This commit is contained in:
@@ -264,6 +264,11 @@ function! s:clearOutputWindow()
|
|||||||
execute cwinnr . 'wincmd w'
|
execute cwinnr . 'wincmd w'
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Public interface.
|
||||||
|
""
|
||||||
|
|
||||||
"
|
"
|
||||||
" Load compile instructions and call window or linux compiler. {{{1
|
" Load compile instructions and call window or linux compiler. {{{1
|
||||||
"
|
"
|
||||||
@@ -292,4 +297,16 @@ function! CF5Compile(run)
|
|||||||
"
|
"
|
||||||
call s:Compile(a:run)
|
call s:Compile(a:run)
|
||||||
endfunction
|
endfunction
|
||||||
|
"
|
||||||
|
" Load compile instructions and call window or linux compiler.
|
||||||
|
"
|
||||||
|
function! CF5CompileAndRun()
|
||||||
|
call CF5Compile(1)
|
||||||
|
endfunction
|
||||||
|
"
|
||||||
|
" Load compile instructions and call window or linux compiler.
|
||||||
|
"
|
||||||
|
function! CF5CompileOnly()
|
||||||
|
call CF5Compile(0)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|||||||
97
vim/vimrc
97
vim/vimrc
@@ -18,7 +18,7 @@ set fileformat=unix
|
|||||||
set nobackup
|
set nobackup
|
||||||
"set backupdir="~/tmp,." git commit doesn't work.
|
"set backupdir="~/tmp,." git commit doesn't work.
|
||||||
" Try to set up UTF-8 encoding.
|
" Try to set up UTF-8 encoding.
|
||||||
if has("multi_byte")
|
if has('multi_byte')
|
||||||
if &termencoding == ""
|
if &termencoding == ""
|
||||||
let &termencoding = &encoding
|
let &termencoding = &encoding
|
||||||
endif
|
endif
|
||||||
@@ -85,11 +85,20 @@ set cino+=(0
|
|||||||
" enable omni completion
|
" enable omni completion
|
||||||
set omnifunc=syntaxcomplete#Complete
|
set omnifunc=syntaxcomplete#Complete
|
||||||
|
|
||||||
|
" If modlines available then turn it on so each file could set its settings.
|
||||||
|
" ex. # vim: set expandtab:
|
||||||
|
if exists('+modeline')
|
||||||
|
set modeline
|
||||||
|
set modelines=5
|
||||||
|
endif
|
||||||
|
" read/write a .viminfo file, don't store more
|
||||||
|
if exists('+viminfo')
|
||||||
|
set viminfo='20,\"50
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
|
|
||||||
" than 50 lines of registers
|
" than 50 lines of registers
|
||||||
let g:netrw_preview = 1 " netrw open window to the right
|
let g:netrw_preview = 1 " netrw open window to the right
|
||||||
let g:netrw_browse_split = 3 " open in a tab
|
let g:netrw_browse_split = 3 " open in a tab
|
||||||
@@ -102,8 +111,6 @@ set ttyfast "tf "smooths redraw by using more bandwidth
|
|||||||
" Set timeout for detecting command key sequence
|
" Set timeout for detecting command key sequence
|
||||||
set timeoutlen=400
|
set timeoutlen=400
|
||||||
|
|
||||||
"set autoread "update file modified outside of vim
|
|
||||||
|
|
||||||
" Quickly time out on keycodes, but never time out on mappings
|
" Quickly time out on keycodes, but never time out on mappings
|
||||||
set notimeout ttimeout ttimeoutlen=200
|
set notimeout ttimeout ttimeoutlen=200
|
||||||
" Use <F11> to toggle between 'paste' and 'nopaste'
|
" Use <F11> to toggle between 'paste' and 'nopaste'
|
||||||
@@ -125,7 +132,7 @@ endif
|
|||||||
"
|
"
|
||||||
" Configure color theme, fonts and other graphics.
|
" Configure color theme, fonts and other graphics.
|
||||||
"
|
"
|
||||||
if has("gui_running")
|
if has('gui_running')
|
||||||
" set color scheme
|
" set color scheme
|
||||||
colorscheme darkblue
|
colorscheme darkblue
|
||||||
"set guioptions-=m
|
"set guioptions-=m
|
||||||
@@ -147,7 +154,7 @@ endif
|
|||||||
|
|
||||||
" Switch syntax highlighting on, when the terminal has colors
|
" Switch syntax highlighting on, when the terminal has colors
|
||||||
" Also switch on highlighting the last used search pattern.
|
" Also switch on highlighting the last used search pattern.
|
||||||
if &t_Co > 2 || has("gui_running")
|
if &t_Co > 2 || has('gui_running')
|
||||||
syntax on
|
syntax on
|
||||||
set hlsearch
|
set hlsearch
|
||||||
endif
|
endif
|
||||||
@@ -168,16 +175,16 @@ set cmdheight=2
|
|||||||
set laststatus=2
|
set laststatus=2
|
||||||
" Display the cursor position on the last line of the screen or in the status
|
" Display the cursor position on the last line of the screen or in the status
|
||||||
" line of a window
|
" line of a window
|
||||||
if exists('&ruler')
|
if exists('+ruler')
|
||||||
set ruler
|
set ruler
|
||||||
endif
|
endif
|
||||||
" Instead of failing a command because of unsaved changes, raise a dialogue
|
" Instead of failing a command because of unsaved changes, raise a dialogue
|
||||||
" asking if you wish to save changed files.
|
" asking if you wish to save changed files.
|
||||||
if exists('&confirm')
|
if exists('+confirm')
|
||||||
set confirm
|
set confirm
|
||||||
endif
|
endif
|
||||||
" Use visual bell instead of beeping when doing something wrong
|
" Use visual bell instead of beeping when doing something wrong
|
||||||
if exists('&visualbell')
|
if exists('+visualbell')
|
||||||
set visualbell
|
set visualbell
|
||||||
" And reset the terminal code for the visual bell. If visualbell is set, and
|
" And reset the terminal code for the visual bell. If visualbell is set, and
|
||||||
" this line is also included, vim will neither flash nor beep. If visualbell
|
" this line is also included, vim will neither flash nor beep. If visualbell
|
||||||
@@ -185,17 +192,17 @@ if exists('&visualbell')
|
|||||||
set t_vb=
|
set t_vb=
|
||||||
endif
|
endif
|
||||||
" Display line numbers on the left
|
" Display line numbers on the left
|
||||||
if exists('&number')
|
if exists('+number')
|
||||||
set number
|
set number
|
||||||
endif
|
endif
|
||||||
" Turn on spell check.
|
" Turn on spell check.
|
||||||
if exists("+spell") && &diff=="nodiff"
|
if exists('+spell') && !&diff
|
||||||
set spell
|
set spell
|
||||||
highlight clear SpellBad
|
highlight clear SpellBad
|
||||||
highlight SpellBad cterm=underline ctermfg=red
|
highlight SpellBad cterm=underline ctermfg=red
|
||||||
endif
|
endif
|
||||||
" Show 80th column.
|
" Show 80th column.
|
||||||
if exists("+colorcolumn")
|
if exists('+colorcolumn')
|
||||||
set colorcolumn=+1 " color textwidth+1-th line
|
set colorcolumn=+1 " color textwidth+1-th line
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -227,14 +234,12 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" vimdiff
|
" vimdiff
|
||||||
"
|
"
|
||||||
|
|
||||||
" Turn on spell check.
|
" Turn on spell check.
|
||||||
if &diff=="diff"
|
if &diff
|
||||||
|
|
||||||
"turn off spelling
|
"turn off spelling
|
||||||
set nospell
|
set nospell
|
||||||
@@ -245,6 +250,9 @@ if &diff=="diff"
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" TODO: review
|
||||||
|
"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -267,12 +275,6 @@ if exists('&hidden')
|
|||||||
set hidden
|
set hidden
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Modelined are used to configure files.
|
|
||||||
if exists('&modeline')
|
|
||||||
set modeline
|
|
||||||
set modelines=10
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Set fold method if supported
|
" Set fold method if supported
|
||||||
if has('folding')
|
if has('folding')
|
||||||
set nofoldenable
|
set nofoldenable
|
||||||
@@ -290,7 +292,7 @@ if has('folding')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Only do this part when compiled with support for autocommands.
|
" Only do this part when compiled with support for autocommands.
|
||||||
if has("autocmd")
|
if has('autocmd')
|
||||||
|
|
||||||
" Enable file type detection.
|
" Enable file type detection.
|
||||||
" Use the default filetype settings, so that mail gets 'tw' set to 72,
|
" Use the default filetype settings, so that mail gets 'tw' set to 72,
|
||||||
@@ -332,7 +334,7 @@ endif " has("autocmd")
|
|||||||
|
|
||||||
"
|
"
|
||||||
"
|
"
|
||||||
if has("gui_running")
|
if has('gui_running')
|
||||||
":tab drop {file}
|
":tab drop {file}
|
||||||
|
|
||||||
" Hide show menu and toolbar.
|
" Hide show menu and toolbar.
|
||||||
@@ -354,9 +356,24 @@ map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
|
|||||||
"map <silent> <C-F3> :tabnew<CR>
|
"map <silent> <C-F3> :tabnew<CR>
|
||||||
|
|
||||||
"
|
"
|
||||||
" F4 grep the word under cursor.
|
" Grep the word under cursor.
|
||||||
"
|
"
|
||||||
map <C-F3> :execute "grep " . expand("<cword>") . " -r --include \*.h --include \*.cpp --include \*.c --include \*.f ." <Bar> cw<CR>
|
" Grep options affect GNU grep. The intend is that greps not supporting the
|
||||||
|
" options will continue working without options.
|
||||||
|
"
|
||||||
|
let $GREP_OPTIONS.=' --exclude-dir=.git --exclude-dir=.svn'
|
||||||
|
let $GREP_OPTIONS.=' --exclude=tags --exclude=*.o --exclude=*.log'
|
||||||
|
let $GREP_OPTIONS.=' --exclude=*.swp'
|
||||||
|
let $GREP_OPTIONS.=' --exclude-dir=llcalc* --exclude-dir=00*'
|
||||||
|
"let $GREP_OPTIONS.=' --include *.sh'
|
||||||
|
"let $GREP_OPTIONS.=' --include *.php'
|
||||||
|
"let $GREP_OPTIONS.=' --include *.h --include *.cpp --include *.c'
|
||||||
|
"let $GREP_OPTIONS.=' --include *.py'
|
||||||
|
"let $GREP_OPTIONS.=' --include *.java'
|
||||||
|
"let $GREP_OPTIONS.=' --include *.f'
|
||||||
|
"let $GREP_OPTIONS.=' --include *.xsd --include *.xml'
|
||||||
|
"let $GREP_OPTIONS.=' --include Makefile'
|
||||||
|
map af :execute "grep! ".expand("<cword>")." -r ." <Bar> cw<CR>
|
||||||
|
|
||||||
"
|
"
|
||||||
" Loads CF5Compile
|
" Loads CF5Compile
|
||||||
@@ -365,8 +382,8 @@ map <C-F3> :execute "grep " . expand("<cword>") . " -r --include \*.h --include
|
|||||||
if !exists('*CF5Compile')
|
if !exists('*CF5Compile')
|
||||||
runtime plugin/cf5-compiler.vim
|
runtime plugin/cf5-compiler.vim
|
||||||
endif
|
endif
|
||||||
map <silent> <C-F5> :call CF5Compile(1)<CR>
|
map <silent> a4 :call CF5CompileOnly()<CR>
|
||||||
map <silent> <F5> :call CF5Compile(0)<CR>
|
map <silent> a5 :call CF5CompileAndRun()<CR>
|
||||||
"
|
"
|
||||||
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
|
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
|
||||||
" so that you can undo CTRL-U after inserting a line break.
|
" so that you can undo CTRL-U after inserting a line break.
|
||||||
@@ -377,8 +394,8 @@ inoremap <C-U> <C-G>u<C-U>
|
|||||||
"
|
"
|
||||||
noremap <Up> gk
|
noremap <Up> gk
|
||||||
noremap <Down> gj
|
noremap <Down> gj
|
||||||
imap <Up> <C-O>gk
|
"imap <Up> <C-O>gk
|
||||||
imap <Down> <C-O>gj
|
"imap <Down> <C-O>gj
|
||||||
"
|
"
|
||||||
" Working with tabs especially if using console version.
|
" Working with tabs especially if using console version.
|
||||||
"
|
"
|
||||||
@@ -389,6 +406,14 @@ nnoremap tl :tablast<CR>
|
|||||||
nnoremap tm :tabm<Space>
|
nnoremap tm :tabm<Space>
|
||||||
nnoremap td :tabclose<CR>
|
nnoremap td :tabclose<CR>
|
||||||
|
|
||||||
|
"
|
||||||
|
" Locate and load .vimrc.local from curent directory.
|
||||||
|
"
|
||||||
|
if !exists('*LocalVimrcLoad')
|
||||||
|
runtime plugin/local-vimrc.vim
|
||||||
|
endif
|
||||||
|
call LocalVimrcLoad( getcwd() )
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" Plugins
|
" Plugins
|
||||||
"
|
"
|
||||||
@@ -396,7 +421,7 @@ nnoremap td :tabclose<CR>
|
|||||||
"
|
"
|
||||||
" Vundle experimental stuff here.
|
" Vundle experimental stuff here.
|
||||||
"
|
"
|
||||||
if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md"))
|
if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md'))
|
||||||
filetype off
|
filetype off
|
||||||
set rtp+=~/.vim/bundle/Vundle.vim
|
set rtp+=~/.vim/bundle/Vundle.vim
|
||||||
call vundle#begin()
|
call vundle#begin()
|
||||||
@@ -416,8 +441,8 @@ if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md"))
|
|||||||
Plugin 'vim-scripts/Buffergator'
|
Plugin 'vim-scripts/Buffergator'
|
||||||
let g:buffergator_suppress_keymaps = 1
|
let g:buffergator_suppress_keymaps = 1
|
||||||
let g:buffergator_viewport_split_policy = "L"
|
let g:buffergator_viewport_split_policy = "L"
|
||||||
map <C-b> :BuffergatorToggle<CR>
|
map ab :BuffergatorToggle<CR>
|
||||||
map <C-B> :BuffergatorTabsToggle<CR>
|
"map at :BuffergatorTabsToggle<CR>
|
||||||
|
|
||||||
"
|
"
|
||||||
"
|
"
|
||||||
@@ -439,9 +464,11 @@ if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md"))
|
|||||||
Plugin 'scrooloose/nerdtree'
|
Plugin 'scrooloose/nerdtree'
|
||||||
let g:NERDTreeQuitOnOpen = 1
|
let g:NERDTreeQuitOnOpen = 1
|
||||||
let g:NERDTreeDirArrows = 1
|
let g:NERDTreeDirArrows = 1
|
||||||
|
let g:NERDTreeDirArrowExpandable = '+'
|
||||||
|
let g:NERDTreeDirArrowCollapsible = '-'
|
||||||
let g:NERDTreeIgnore = ['\.o$', '\.so$', '\.tsk$']
|
let g:NERDTreeIgnore = ['\.o$', '\.so$', '\.tsk$']
|
||||||
map <C-n> :NERDTreeToggle<CR>
|
map at :NERDTreeToggle<CR>
|
||||||
map <C-m> :NERDTreeFind<CR>
|
"map am :NERDTreeFind<CR>
|
||||||
|
|
||||||
"
|
"
|
||||||
" :A switches to the header file (or vise versa)
|
" :A switches to the header file (or vise versa)
|
||||||
@@ -463,7 +490,7 @@ if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md"))
|
|||||||
let g:alternateExtensions_h = "cpp,c"
|
let g:alternateExtensions_h = "cpp,c"
|
||||||
let g:alternateExtensions_cpp = "h"
|
let g:alternateExtensions_cpp = "h"
|
||||||
let g:alternateExtensions_c = "h"
|
let g:alternateExtensions_c = "h"
|
||||||
|
map ah :A<CR>
|
||||||
|
|
||||||
"
|
"
|
||||||
" Comment code.
|
" Comment code.
|
||||||
|
|||||||
Reference in New Issue
Block a user