Skip to content

Instantly share code, notes, and snippets.

@shardator
Last active August 17, 2022 10:50
Show Gist options
  • Save shardator/87f033aee24ac2c5647a4fae6cb2d4c2 to your computer and use it in GitHub Desktop.
Save shardator/87f033aee24ac2c5647a4fae6cb2d4c2 to your computer and use it in GitHub Desktop.
My favourite .vimrc (a mess)
set history=10000
set smartcase
set ignorecase
set expandtab
set shiftwidth=3
set softtabstop=3
set smartindent
let hlstate=1
set hlsearch
nmap <silent> <C-N> :silent nohlsearch<CR>
nnoremap <F12> :set invpaste paste?<CR>
set pastetoggle=<F12>
set showmode
:command Wq wq
:command W w
:command Q q
syntax on
set viminfo='2000,\"20000
set backup
set backupdir=$HOME/.vim_backup
set showmatch
set nowrap
set background=dark
if &diff
colorscheme ron
else
colorscheme elflord
endif
let mapleader = ","
map <Leader>W :set nowrap<CR>
map <Leader>w :set wrap<CR>
map <Leader>, :q<CR>
map <Leader>k :call SwitchHeader()<CR>
map <Leader>n :tnext<CR>
map <Leader>N :tprev<CR>
map <C-h> <C-]>
map <C-c> :TC<CR>j
imap <C-c> <ESC>:TC<CR>j
map zE zR
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
" syntax highlight for .launch xml files
filetype on
au BufNewFile,BufRead *.launch set filetype=xml
se modeline
se mouse=a
se modeline
set include=^\\s*#\\s*include\ \\(<boost/\\)\\@!
set diffopt+=iwhite
set ts=3
autocmd BufEnter * :syntax sync fromstart
" This should enable walking INSIDE of wrapped lines instead of jumping over
" the rest when moving up/down
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment