autocmd BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main
"ctags
map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
"omnicppcomplete
imap <C-Space> <C-x><C-o>
let OmniCpp_MayCompleteDot = 0
let OmniCpp_MayCompleteArrow = 0
Software, web, and programming tips: C++, Java, C, Linux, Windows, Cygwin, Firefox, Vim, WWW, RSS
Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts
Thursday, October 11, 2007
VIM - omnicppcomplete
I had to put these in my ~/.vimrc to get omnicppcomplete to work
VIM - NERDTree plugin
Good file explorer.
plugin: link
Add this to ~/.vimrc
plugin: link
Add this to ~/.vimrc
"NERDTree Toggle
noremap <Leader>][ :NERDTreeToggle
Thursday, August 23, 2007
VIM - Search to end of word
This will leave your cursor at the end of the searched phrase:
/search phrase/e
Monday, August 13, 2007
VIM - format lines to certain width
First,
:set textwidth=80 (or :set tw=80)
Then,
For more help,
:help gq
:set textwidth=80 (or :set tw=80)
Then,
gqq | Format a single line |
{Visual}gq | Format visual selection. (ctrl+v to get to visual mode then use hjkl to navigate) |
For more help,
:help gq
Wednesday, June 20, 2007
VIM - minibufexpl
Script: minibufexpl.vim
"MINIBUFEXPLORER Stuff (Enter "\mbe" minus quotes quickly to bring it up)
""Commands:
" Ctrl-PgDown - goto next buffer
" Ctrl-PgUp - goto prev buffer
" \-Backspace-= - toggle minibufexplorer
"let g:miniBufExplMaxSize = 3 "allow up to 3 lines of buffers
let g:miniBufExplModSelTarget=1
"mapmbo :MiniBufExplorer
noremap:bn
inoremap:bn
cnoremap:bn
noremap:bp
inoremap:bp
cnoremap:bp
noremap= :TMiniBufExplorer
noremapu :UMiniBufExplorer
set hid "Hide abandoned buffers in order to not loose undo history
Thursday, June 7, 2007
Wednesday, May 9, 2007
Wednesday, May 2, 2007
VIM - Using cscope
Install cscope.
At your project directory, to recursively build the database
Place cscope_maps.vim into ~/.vim/plugin.
CTRL+] to search for the word under the cursor.
See the cscope vim tutorial for more details.
At your project directory, to recursively build the database
cscope -Rb
Place cscope_maps.vim into ~/.vim/plugin.
CTRL+] to search for the word under the cursor.
See the cscope vim tutorial for more details.
VIM - Recursively set the path of the project
Put this in your
.vimrc
to" Recursively set the path of the project
set path=$PWD/**
Wednesday, April 18, 2007
VIM - Shifting and code formatting
You can shift (indent) code right or left by typing >> or <<, respectively, with your cursor on the line you want to shift.
You can use VIM automatic formating by typing == on the line you want to format.
You can also set the amount of spaces to shift.
You can also shift and format in visual mode (To get into visual mode: SHIFT+V, then j and k to select rows) by selecting the lines you want, then typing >, <, or =.
You can use VIM automatic formating by typing == on the line you want to format.
You can also set the amount of spaces to shift.
You can also shift and format in visual mode (To get into visual mode: SHIFT+V, then j and k to select rows) by selecting the lines you want, then typing >, <, or =.
VIM - Inserting spaces instead of tabs
Insert spaces instead of tabs
set expandtab
orset et
Set the width of shifts to 4 for autoindenting and shifting: >> and <<
set shiftwidth=4
orset sw=4
Set where to stop tabs to 4
set tabstop=4
orset ts=4
This is what I have in my
~/.vimrc
:Set expanded tabs with shiftwidth=4 and tabstop=4 for Java, Perl, C, and C++ files
autocmd BufNewFile,BufRead *.java,*.pl,*.c,*.h,*.cc,*.cpp,*.hpp set sw=4 ts=4 et
Thursday, March 8, 2007
VIM - Doxygen Syntax Highlighting
To have vim highlight Doxygen comments, add this to your
For more help, try
vimrc
:let g:load_doxygen_syntax=1
For more help, try
:help doxygen
Labels:
Comments,
Doxygen,
Highlighting,
programming,
software,
Syntax,
vim
Friday, February 23, 2007
VIM - Advanced Tips
Here are some advanced tips I've learned from coworkers and working with VIM:
Command | Description |
---|---|
:%s *$== | Delete end of line spaces |
:'a,'bs/str1/str2/g | Replace "str1" with "str2" from marker a to marker b |
:%s/\(.*\):\(.*\)/\2:\1/g | Replace the first field (\1) with the second field (\2) separated by the : |
zf | Fold a selected block of code |
zd | Unfold a block of folded code |
:make | Run Makefile |
:w|make | Write (save) current file and then run Makefile |
:grep regexp files | Find regexp in files |
:copen | Open quickfix list. Helpful after doing :make or :grep. Press Enter on entry in quickfix list to jump to that location |
:cclose | Close quickfix list |
:colder | Display contents of previous quickfix list |
:cnewer | Display contents of next quickfix list |
:!cmd | Run cmd as if on command line. Example: :!ls |
:bw | Close current buffer |
ctrl+o | Go back once through visited lines |
ctrl+i | Go forward once through visited lines |
:h topic | Get help for topic |
Subscribe to:
Posts (Atom)