Skip to content

Instantly share code, notes, and snippets.

@nickdotht
Last active November 28, 2020 19:24
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickdotht/c7853c0711b0e77ed6561dc4121f0f5a to your computer and use it in GitHub Desktop.
Save nickdotht/c7853c0711b0e77ed6561dc4121f0f5a to your computer and use it in GitHub Desktop.
" Lets you press F6 to add the standard 42 header to your file
nnoremap <F6> :Stdheader<CR>
" Sets UTF-8 encoding
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
" Disables vi compatibility (emulation of old bugs)
set nocompatible
" Uses indentation of previous line
set autoindent
" Uses intelligent indentation for C
set smartindent
" Shows line numbers
set number
" Sets a ruler at line 80
set colorcolumn=80
" Lets you change the ruler color
" Change the value of ctermbg to any other color code you want
" The colors range from 0 (black) to 250 (white)
highlight ColorColumn ctermbg=39
" Removes all trailing whitespace by pressing F5
" If you want to understand how it works, read this:
" http://vi.stackexchange.com/a/2285
nnoremap <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar> :let @/=_s<Bar><CR>
" turn syntax highlighting on
set t_Co=256
syntax on
" highlight matching braces
set showmatch
" intelligent comments
set comments=sl:/*,mb:\ *,elx:\ */
" Read syntax-highlighted man pages inside Vim by running :Man
" In the 'First step in C' video, he uses emacs to open Man from his editor
" You will be able to do the same just by doing, for example:
" :Man 2 write
runtime! ftplugin/man.vim
@nickdotht
Copy link
Author

Hey guys, I found this page useful when it comes to browsing around vim, maybe it will be for you too:
https://dzone.com/articles/130-essential-vim-commands

@Shankhara
Copy link

Thx !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment