Skip to content

Instantly share code, notes, and snippets.

@aschyiel
Created October 2, 2015 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aschyiel/1732fdea2113c8a7ab25 to your computer and use it in GitHub Desktop.
Save aschyiel/1732fdea2113c8a7ab25 to your computer and use it in GitHub Desktop.
"
" Uly's .vimrc
"
" references:
" http://tottinge.blogsome.com/use-vim-like-a-pro
" https://raw.github.com/nvie/vimrc/master/vimrc
" http://spf13.com/post/the-15-best-vim-plugins
"
set nocompatible "..set not compatible first!..
colorscheme koehler
set shiftwidth=2
set shiftround
set softtabstop=2
set tabstop=2
set expandtab
set backspace=indent,eol,start
set diffopt+=iwhite
set whichwrap=b,s,<,>
set encoding=utf-8
set number
set mouse=a
set autoindent
set copyindent
set smarttab
"set smartindent
set linebreak
set ignorecase
set incsearch
set hlsearch
set spelllang=en_us
set smartcase
set showmatch
set showmode
set wildmenu
set showcmd
set ruler<
"set nowrap
set pastetoggle=<F2> " when in insert mode, press <F2> to go to
" paste mode, where you can paste mass data
" " that
" won't be
" autoindented
"
set title
set visualbell
set noerrorbells
set cursorline "..underline the current line..
"
" ctags settings.
"
set tags=./tags,/work/PlatformBundle/tags,/work/XDM/tags,/work/apps/tags
"""""""""""""""""""
"
"custom key mappings.
"
"""""""""""""""""""
" Remap j and k to act as expected when used on long, wrapped, lines
nnoremap j gj
nnoremap k gk
" Avoid accidental hits of <F1> while aiming for <Esc>
map! <F1> <Esc>
map <leader><F2> :NERDTreeToggle<CR>
"..quick shared copy and paste..
vmap <silent> ,y y:new<CR>:call setline(1,getregtype())<CR>o<Esc>P:wq! ~/reg.txt<CR>
nmap <silent> ,y :new<CR>:call setline(1,getregtype())<CR>o<Esc>P:wq! ~/reg.txt<CR>
map <silent> ,p :sview ~/reg.txt<CR>"zdddG:q!<CR>:call setreg('"', @", @z)<CR>p
map <silent> ,P :sview ~/reg.txt<CR>"zdddG:q!<CR>:call setreg('"', @", @z)<CR>P
"..normalize xml..
nmap <leader>xml :set filetype=xml<CR>gg=G
" Yank/paste to the OS clipboard with ,y and ,p
nmap <leader>y "+y
nmap <leader>Y "+yy
nmap <leader>p "+p
nmap <leader>P "+P
" Edit the vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<CR>
" load vimrc
nmap <silent> <leader>sv :so $MYVIMRC<CR>
" Clears the search register
nmap <silent> <leader>/ :nohlsearch<CR>
" Keep search matches in the middle of the window and pulse the line when
" moving to them.
nnoremap n n:call PulseCursorLine()<cr>
nnoremap N N:call PulseCursorLine()<cr>
" Quickly get out of insert mode without your fingers having to leave the
" home row (either use 'jj' or 'jk')
"inoremap jj <Esc>
"inoremap jk <Esc>
" Sudo to write
cmap w!! w !sudo tee % >/dev/null
"..quick tab style changing..
nmap <silent> ,m <Esc>:set tabstop=2 softtabstop=2 shiftwidth=2 <CR>
nmap <silent> ,M <Esc>:set tabstop=4 softtabstop=4 shiftwidth=4 <CR>
syntax enable
"""""""""""""""""""
"
" custom templating
"
"""""""""""""""""""
":iab zxml <?xml version="1.0" encoding="utf-8"?>
""""""""""""""""""
"
" vim functions
"
""""""""""""""""""
" Pulse ------------------------------------------------------------------- {{{
function! PulseCursorLine()
let current_window = winnr()
windo set nocursorline
execute current_window . 'wincmd w'
setlocal cursorline
redir => old_hi
silent execute 'hi CursorLine'
redir END
let old_hi = split(old_hi, '\n')[0]
let old_hi = substitute(old_hi, 'xxx', '', '')
hi CursorLine guibg=#2a2a2a
redraw
sleep 5m
hi CursorLine guibg=#3a3a3a
redraw
sleep 5m
hi CursorLine guibg=#4a4a4a
redraw
sleep 5m
hi CursorLine guibg=#3a3a3a
redraw
sleep 5m
hi CursorLine guibg=#2a2a2a
redraw
sleep 5m
execute 'hi ' . old_hi
windo set cursorline
execute current_window . 'wincmd w'
endfunction
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment