Created
April 27, 2012 21:28
-
-
Save rocarvaj/2513367 to your computer and use it in GitHub Desktop.
Minimal .vimrc for C/C++ developers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" VIM Configuration File | |
" Description: Optimized for C/C++ development, but useful also for other things. | |
" Author: Gerhard Gappmeier | |
" | |
" set UTF-8 encoding | |
set enc=utf-8 | |
set fenc=utf-8 | |
set termencoding=utf-8 | |
" disable vi compatibility (emulation of old bugs) | |
set nocompatible | |
" use indentation of previous line | |
set autoindent | |
" use intelligent indentation for C | |
set smartindent | |
" configure tabwidth and insert spaces instead of tabs | |
set tabstop=4 " tab width is 4 spaces | |
set shiftwidth=4 " indent also with 4 spaces | |
set expandtab " expand tabs to spaces | |
" wrap lines at 120 chars. 80 is somewaht antiquated with nowadays displays. | |
set textwidth=120 | |
" turn syntax highlighting on | |
set t_Co=256 | |
syntax on | |
" colorscheme wombat256 | |
" turn line numbers on | |
set number | |
" highlight matching braces | |
set showmatch | |
" intelligent comments | |
set comments=sl:/*,mb:\ *,elx:\ */ | |
" Install OmniCppComplete like described on http://vim.wikia.com/wiki/C++_code_completion | |
" This offers intelligent C++ completion when typing ‘.’ ‘->’ or <C-o> | |
" Load standard tag files | |
set tags+=~/.vim/tags/cpp | |
set tags+=~/.vim/tags/gl | |
set tags+=~/.vim/tags/sdl | |
set tags+=~/.vim/tags/qt4 | |
" Install DoxygenToolkit from http://www.vim.org/scripts/script.php?script_id=987 | |
let g:DoxygenToolkit_authorName="John Doe <[email protected]>" | |
" Enhanced keyboard mappings | |
" | |
" in normal mode F2 will save the file | |
nmap <F2> :w<CR> | |
" in insert mode F2 will exit insert, save, enters insert again | |
imap <F2> <ESC>:w<CR>i | |
" switch between header/source with F4 | |
map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR> | |
" recreate tags file with F5 | |
map <F5> :!ctags -R –c++-kinds=+p –fields=+iaS –extra=+q .<CR> | |
" create doxygen comment | |
map <F6> :Dox<CR> | |
" build using makeprg with <F7> | |
map <F7> :make<CR> | |
" build using makeprg with <S-F7> | |
map <S-F7> :make clean all<CR> | |
" goto definition with F12 | |
map <F12> <C-]> | |
" in diff mode we use the spell check keys for merging | |
if &diff | |
” diff settings | |
map <M-Down> ]c | |
map <M-Up> [c | |
map <M-Left> do | |
map <M-Right> dp | |
map <F9> :new<CR>:read !svn diff<CR>:set syntax=diff buftype=nofile<CR>gg | |
else | |
" spell settings | |
:setlocal spell spelllang=en | |
" set the spellfile - folders must exist | |
set spellfile=~/.vim/spellfile.add | |
map <M-Down> ]s | |
map <M-Up> [s | |
endif |
Thanks a lot
Awesome!
Thank you!
P.S.
It seems there is small typo in 20th line: somewaht
--> somewhat
Hi
Any idea how can I disable highlight (I only want my searched pattern to get highlighted). For some reason, few keywords in my code are getting highlight by default.
Thank you! Simplicity is the key! Regards
Hi
Any idea how can I disable highlight (I only want my searched pattern to get highlighted). For some reason, few keywords in my code are getting highlight by default.
Hi
Any idea how can I disable highlight (I only want my searched pattern to get highlighted). For some reason, few keywords in my code are getting highlight by default.
In VIM editor, type :verbose set spell? to check the line number, then remove it.
Thanks. I didn't know about it.
Now I can read my code in a much cleaner way :)
…On Wed, Jul 7, 2021 at 6:54 PM LOC LAM ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
No Luck.
I want to remove highlights like these. It makes code unreadable.
[image: image]
<https://user-images.githubusercontent.com/55446334/124809345-0593e400-df2e-11eb-9d4e-37add04169aa.png>
if you use the above command, you would see:
:setlocal spell spelllang=en
then comment the line out, the spell checking would not show anymore.
This command help check spelling in English, btw
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/2513367#gistcomment-3805702>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANHAWPVPEEIUYKXVD3DHBXDTWTLI7ANCNFSM4KAVVT4Q>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks.
It helps. It is working without any issue on WSL linux 18.04 LTS.