Skip to content

Instantly share code, notes, and snippets.

@yankcrime
Created July 24, 2018 13:00
Show Gist options
  • Select an option

  • Save yankcrime/349be3a2b009cc6ec6c718770d0574f1 to your computer and use it in GitHub Desktop.

Select an option

Save yankcrime/349be3a2b009cc6ec6c718770d0574f1 to your computer and use it in GitHub Desktop.
" minimal++ .vimrc
"
" filetype detection and syntax highlighting
filetype plugin indent on
syntax on
" it's there so let's activate it
runtime macros/matchit.vim
" various settings
set nocompatible
set autoindent
set backspace=indent,eol,start
set hidden
set incsearch
set path=.,**
set ruler
set shiftround
set smarttab
set wildmenu
" various adjustments of the default colorscheme
hi ModeMsg ctermbg=green ctermfg=black cterm=NONE
hi StatusLineNC ctermbg=darkgrey cterm=bold
hi Visual ctermbg=lightcyan ctermfg=black cterm=bold
" statusline
set laststatus=2
set statusline=%t\ %m%r%h%w%=\ %{&ft}\ %{&ff}\ %{&fenc}\ %l,%v\ -\ %L
" buffers
nnoremap ,b :buffer *
nnoremap ,B :sbuffer *
nnoremap <PageUp> :bprevious<CR>
nnoremap <PageDown> :bnext<CR>
nnoremap <BS> :buffer#<CR>
" quickfix
nnoremap <End> :cnext<CR>
nnoremap <Home> :cprevious<CR>
" super quick search and replace
nnoremap <Space><Space> :'{,'}s/\<<C-r>=expand("<cword>")<CR>\>/
nnoremap <Space>% :%s/\<<C-r>=expand("<cword>")<CR>\>/
" better grep
command! -nargs=+ -complete=file_in_path -bar Grep silent! grep! <args> | redraw!
" better listings
cnoremap <expr> <CR> <SID>CCR()
function! s:CCR()
command! -bar Z silent set more|delcommand Z
if getcmdtype() == ":"
let cmdline = getcmdline()
if cmdline =~ '\v\C^(dli|il)' | return "\<CR>:" . cmdline[0] . "jump " . split(cmdline, " ")[1] . "\<S-Left>\<Left>\<Left>"
elseif cmdline =~ '\v\C^(cli|lli)' | return "\<CR>:silent " . repeat(cmdline[0], 2) . "\<Space>"
elseif cmdline =~ '\C^changes' | set nomore | return "\<CR>:Z|norm! g;\<S-Left>"
elseif cmdline =~ '\C^ju' | set nomore | return "\<CR>:Z|norm! \<C-o>\<S-Left>"
elseif cmdline =~ '\v\C(#|nu|num|numb|numbe|number)$' | return "\<CR>:"
elseif cmdline =~ '\C^ol' | set nomore | return "\<CR>:Z|e #<"
elseif cmdline =~ '\v\C^(ls|files|buffers)' | return "\<CR>:b"
elseif cmdline =~ '\C^marks' | return "\<CR>:norm! `"
elseif cmdline =~ '\C^undol' | return "\<CR>:u "
else | return "\<CR>" | endif
else | return "\<CR>" | endif
endfunction
" clear searches
nnoremap ,/ :sil noh<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment