Skip to content

Instantly share code, notes, and snippets.

@ngpestelos
Created April 3, 2013 22:56
Show Gist options
  • Save ngpestelos/5306222 to your computer and use it in GitHub Desktop.
Save ngpestelos/5306222 to your computer and use it in GitHub Desktop.
keikun17's vimrc.after
" Many stuff from http://www.drbunsen.org/text-triumvirate.html
" Visual mode unmap
" Bring back the functionality to press shift+e, shift+w, shift+b
" while in visual mode to go to the character right before the next
" whitespace
vunmap E
vunmap W
vunmap B
" Normal mode unmap
" Bring back the functionality to press shift+e, shift+w, shift+b
" while in normal mode to go to the character right before the next
" whitespace
nunmap E
nunmap W
nunmap B
" Reinstate the camelcase movement to command+shift+w/e/b
map <D-W> <Plug>CamelCaseMotion_w
map <D-B> <Plug>CamelCaseMotion_b
map <D-E> <Plug>CamelCaseMotion_e
if has('gui_running')
set gfn=Monaco:h13
else
let g:solarized_termcolors=256
colorscheme solarized
set background=dark
let g:solarized_termtrans = 1
endif
autocmd BufRead,BufNewFile *.md,*.MD,*.txt,*.TXT,*.markdown,*.markerb set filetype=markdown
" http://mattkirman.com/2012/04/18/relative-line-numbers-in-vim/
set relativenumber
au InsertEnter * :set nu
au InsertLeave * :set rnu
" ======== Solarize ========
syntax enable
let g:solarized_termtrans = 1
colorscheme solarized
" ======== Glorious background toggling ========
" requires solarizedLightLC theme from :
" https://github.com/pearofducks/vim-powerline/blob/develop/autoload/Powerline/Colorschemes/solarizedLightLC.vim
" put this theme under this directory :
" ~/.yadr/vim/bundle/skwp-vim-powerline/autoload/Powerline/Colorschemes/
let g:powerline_dark_theme = 'skwp'
let g:powerline_light_theme = 'solarizedLightLC'
function! EmoModeOn()
set background=dark
let g:Powerline_colorscheme = g:powerline_dark_theme
endfunction
function! EmoModeOff()
set background=light
let g:Powerline_colorscheme = g:powerline_light_theme
endfunction
function! ToggleEmoMode()
echo 'emo mode called'
if &background == "dark"
call EmoModeOff()
elseif &background == "light"
call EmoModeOn()
end
PowerlineReloadColorscheme
endfunction
nnoremap <F6> :call ToggleEmoMode()<CR>
" ======== Sane copy/paste ========
" Yank text to the OS X clipboard
noremap <leader>y "*y
noremap <leader>yy "*Y
" Preserve indentation while pasting text from the OS X clipboard
noremap <leader>p :set paste<CR>:put *<CR>:set nopaste<CR>
" ======== Vim plugin for switching between absolute and relative line numbers ========
" depending on the mode
" source : https://github.com/myusuf3/numbers.vim
nnoremap <F3> :NumbersToggle<CR>
" ======== keep cursor centered ========
set so=999
" ======== highlight 80th character ========
autocmd BufRead,BufNewFile *.sass,*.scss,*.css,*.js,*.coffee,*.sh,*.rb,*.textile set textwidth=80
set colorcolumn=+1
" ======== font size ========
set guifont=Monaco:h18
" Disable row limit when editing text files
autocmd BufRead,BufNewFile *.md,*.MD,*.txt,*.TXT,*.markdown,*.markerb,*.textile set textwidth=0
" Turn wrap on when editing text files
autocmd BufRead,BufNewFile *.md,*.MD,*.txt,*.TXT,*.markdown,*.markerb,*.textile set wrap
" From http://jeetworks.org/node/89
" ======== Disable arrow keys ========
" function! DelEmptyLineAbove()
" if line(".") == 1
" return
" endif
" let l:line = getline(line(".") - 1)
" if l:line =~ '^\s*$'
" let l:colsave = col(".")
" .-1d
" silent normal!
" call cursor(line("."), l:colsave)
" endif
" endfunction
"
" function! AddEmptyLineAbove()
" let l:scrolloffsave = &scrolloff
" " Avoid jerky scrolling with ^E at top of window
" set scrolloff=0
" call append(line(".") - 1, "")
" if winline() != winheight(0)
" silent normal!
" endif
" let &scrolloff = l:scrolloffsave
" endfunction
"
" function! DelEmptyLineBelow()
" if line(".") == line("$")
" return
" endif
" let l:line = getline(line(".") + 1)
" if l:line =~ '^\s*$'
" let l:colsave = col(".")
" .+1d
" ''
" call cursor(line("."), l:colsave)
" endif
" endfunction
"
" function! AddEmptyLineBelow()
" call append(line("."), "")
" endfunction
"
" " Arrow key remapping: Up/Dn = move line up/dn; Left/Right = indent/unindent
" function! SetArrowKeysAsTextShifters()
" " normal mode
" nmap >>
" nnoremap :call DelEmptyLineAbove()
" nnoremap :call AddEmptyLineAbove()
" nnoremap :call DelEmptyLineBelow()
" nnoremap :call AddEmptyLineBelow()
"
" " visual mode
" vmap >
" vnoremap :call DelEmptyLineAbove()gv
" vnoremap :call AddEmptyLineAbove()gv
" vnoremap :call DelEmptyLineBelow()gv
" vnoremap :call AddEmptyLineBelow()gv
"
" " insert mode
" imap
" imap
" inoremap :call DelEmptyLineAbove()a
" inoremap :call AddEmptyLineAbove()a
" inoremap :call DelEmptyLineBelow()a
" inoremap :call AddEmptyLineBelow()a
"
" " disable modified versions we are not using
" nnoremap
" nnoremap
" nnoremap
" nnoremap
" vnoremap
" vnoremap
" vnoremap
" vnoremap
" inoremap
" inoremap
" inoremap
" inoremap
" endfunction
"
" call SetArrowKeysAsTextShifters()
"
" pbcopy for vim
nmap <F1> :set paste<CR>:r !pbpaste<CR>:set nopaste<CR>
imap <F1> <Esc>:set paste<CR>:r !pbpaste<CR>:set nopaste<CR>
nmap <F2> :.w !pbcopy<CR><CR>
vmap <F2> :w !pbcopy<CR><CR>
" Make Ack use Ag
" https://github.com/ggreer/the_silver_searcher
let g:ackprg = 'ag --nogroup --nocolor --column'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment