1
0
Fork 0

Mostly vim stuff

This commit is contained in:
Gregory Eremin 2013-07-20 13:11:49 +07:00
parent e419081db0
commit e16b75347d
8 changed files with 123 additions and 3805 deletions

View File

@ -1,3 +1,6 @@
alias vi="vim"
alias v="vim"
alias reload! ". $HOME/.config/fish/config.fish"
alias b "bundle exec"

View File

@ -1,7 +1,6 @@
set -x PATH /usr/local/bin $PATH
set -x PATH /usr/local/sbin $PATH
set -x PATH /usr/local/share/npm/bin $PATH
set -x PATH /usr/local/share/python $PATH
set -x PATH $HOME/.dotfiles/bin $PATH
set -x PATH $HOME/.rbenv/plugins/ruby-build/bin $PATH
set -x PATH $HOME/.rbenv/bin $PATH

View File

@ -10,7 +10,8 @@
br = checkout -b
st = status -sb
ci = commit
up = !sh -c 'git pull --rebase --prune && git log --pretty=format:\"%Cred%ae %Creset- %C(yellow)%s %Creset(%ar)\" HEAD@{1}..'
rd = rebase -i development
rh = rebase -i HEAD~5
[color]
diff = auto
status = auto

View File

@ -13,3 +13,4 @@ vendor/gems
# Vim
*.swp
*.swo

File diff suppressed because it is too large Load Diff

View File

@ -150,10 +150,10 @@ defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# Set a small before-repeat delay
defaults write NSGlobalDomain InitialKeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 15
# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
defaults write NSGlobalDomain KeyRepeat -int 2
# Automatically illuminate built-in MacBook keyboard in low light
defaults write com.apple.BezelServices kDim -bool true

View File

@ -16,3 +16,4 @@ ln -s ~/.dotfiles/ruby/aprc ~/.aprc
# THE VIM
ln -s ~/.dotfiles/vim/vim ~/.vim
ln -s ~/.dotfiles/vim/vimrc ~/.vimrc
mkdir -p ~/.dotfiles/vim/bundle

150
vim/vimrc
View File

@ -2,12 +2,7 @@ set nocompatible " vi improved
filetype off " do not load Filetype file
set shell=/bin/bash
" Uncomment this when ready for hardcore
for prefix in ['i', 'n', 'v']
for key in ['<Up>', '<Down>', '<Left>', '<Right>']
exe prefix . "noremap " . key . " <Nop>"
endfor
endfor
" ####################
" ### Vundle setup ###
@ -17,18 +12,42 @@ set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" ##############
" ### Colors ###
" ##############
Bundle "daylerees/colour-schemes", { "rtp": "vim-themes/" }
Bundle "chriskempson/tomorrow-theme", { "rtp": "vim/" }
" Bundle "altercation/solarized", { "rtp": "vim-colors-solarized/" }
Bundle "thinkpixellab/flatland", { "rtp": "Vim/" }
Bundle "sjl/badwolf"
Bundle "tomasr/molokai"
Bundle "nanotech/jellybeans.vim"
Bundle "chriskempson/base16-vim"
syntax on
filetype plugin on
filetype indent on
colorscheme Peacock
function! SetRandomColorScheme()
let schemes ='peacock grunge freshcut molokai badwolf flatland jellybeans Tomorrow-Night Tomorrow-Night-Eighties '
let schemes.='base16-eighties '
let seconds=str2nr(strftime('%S'))
let scheme=split(schemes)[seconds%10]
set background=dark
execute 'colorscheme '.scheme
redraw
echo 'Color scheme is now set to "'.scheme.'"'
endfunction
" call SetRandomColorScheme()
colorscheme peacock
nmap <Leader>cs :call SetRandomColorScheme()<CR>
" #################
" ### Powerline ###
@ -39,13 +58,15 @@ let g:Powerline_symbols = 'compatible' " (compatible, unicode, fancy)
set laststatus=2
set noshowmode
" #################
" ### Nerd Tree ###
" #################
Bundle 'scrooloose/nerdtree'
nmap <C-n> :NERDTreeToggle<CR>
let NERDTreeIgnore=['\.DS_Store$', '\.swp$', '\.git$', '\.bundle$', '\.pyc$']
nmap <silent> <C-n> :NERDTreeToggle<CR>
let NERDTreeIgnore=['\.DS_Store$', '\.swp$', '\.git$', '\.bundle$', '\.pyc$', '\.sass-cache']
let NERDTreeHighlightCursorline=1
let NERDTreeShowHidden=1
let NERDTreeMinimalUI=1
@ -53,7 +74,9 @@ let NERDTreeDirArrows=1
let NERDChristmasTree=1
let NERDTreeChDirMode=2
let NERDTreeQuitOnOpen=1
let g:NERDTreeWinSize=50
let g:NERDTreeWinSize=40
" ######################
" ### Nerd Commenter ###
@ -63,40 +86,73 @@ Bundle 'scrooloose/nerdcommenter'
let g:NERDCreateDefaultMappings=0
let g:NERDCompactSexyComs=1
let g:NERDSpaceDelims=1
nmap <Leader>/ <plug>NERDCommenterToggle
vmap <Leader>/ <plug>NERDCommenterToggle
nmap <silent> <Leader>/ <plug>NERDCommenterToggle
vmap <silent> <Leader>/ <plug>NERDCommenterToggle
" #########################
" ### Fuzzy File Search ###
" #########################
Bundle 'kien/ctrlp.vim'
let g:ctrlp_match_window_bottom=0
let g:ctrlp_match_window_reversed=0
let g:ctrlp_match_window_bottom=1
let g:ctrlp_match_window_reversed=1
" ###########################
" ### Ruby Syntax Support ###
" ###########################
" ######################
" ### Syntax Support ###
" ######################
Bundle 'vim-ruby/vim-ruby'
Bundle 'tpope/vim-markdown'
" Sugar
Bundle 'wavded/vim-stylus'
Bundle 'kchmck/vim-coffee-script'
Bundle 'slim-template/vim-slim'
" ###################
" ### Rails Tools ###
" ###################
Bundle 'tpope/vim-rails'
" Usage
" :Rmodel, :Rcontroller, :Rspec
" ###########################
" ### Magic Code Aligning ###
" ###########################
Bundle 'godlygeek/tabular'
" Usage
" :Tabularize /=
nmap <silent> <Leader>t :Tabularize /
" ###################
" ### Git Wrapper ###
" ###################
Bundle 'tpope/vim-fugitive'
" Usage
" :Gblame, :Gdiff, :Gcommit etc.
" ###########################
" ### The Silver Searcher ###
" ###########################
Bundle 'rking/ag.vim'
" ###################
" ### Preferences ###
@ -129,7 +185,13 @@ set mousehide " Hide mouse when typing
set guioptions-=L " Disable scrollbars
set guioptions-=r " Disable scrollbars
set wildignore+=*/tmp/* " Index ignoresa
set gfn=Menlo:h14 " Set font family and size
set gfn=Inconsolata:h18 " Set font family and size
set hidden " Allow switching unsaved buffers
" Sexy highlighting colors
highlight Search cterm=none ctermbg=198 ctermfg=7
" ########################
" ### MacVim Specific ###
@ -138,11 +200,13 @@ set gfn=Menlo:h14 " Set font family and size
if has("gui_macvim")
" Use Mac option key as meta key
set macmeta
" MacVIM shift+arrow-keys behavior (required in .vimrc)
let macvim_hig_shift_movement=1
endif
" ################
" ### Triggers ###
" ################
@ -155,12 +219,23 @@ if has("autocmd")
" When vimrc is edited, reload it
autocmd! BufWritePost $MYVIMRC source $MYVIMRC
" Cleanup trailing whitespaces before save
autocmd BufWritePre * :call PreservePosition('%s/\s\+$//e')
" Line number (relative/absolute) magic
autocmd FocusLost * :set number
autocmd FocusGained * :set relativenumber
autocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
autocmd BufNewFile,BufRead *.styl set syntax=stylus
autocmd BufNewFile,BufRead *.slim set syntax=slim
autocmd BufNewFile,BufRead *.coffee set syntax=coffee
autocmd BufNewFile,BufRead *.md set syntax=markdown
endif
" ##########################
" ### Follow Your Leader ###
" ##########################
@ -171,11 +246,11 @@ let mapleader = ","
nmap <Leader>v :e $MYVIMRC<CR>
nmap <Leader>s :w<CR>
nmap <Leader>qq :q!<CR>
nmap <Leader>x :q!<CR>
nmap <Leader>rr :source $MYVIMRC<CR>
nmap <Leader>gu :!git up<CR>
nmap <Leader>mkb :!mkbundle<CR>
" Search for the word under cursor
nmap <Leader>d /<C-r><C-w><CR>zz
" Toggle search highlight
nmap <Leader>h :set hlsearch!<CR>
@ -186,21 +261,9 @@ nmap <Leader>o :set paste!<CR>
nmap <Leader>w :set wrap! list! linebreak!<CR>
" Rails helpers
nmap <Leader>rm :Rmodel
nmap <Leader>rc :Rcontroller
nmap <Leader>rs :Rspec
" Splitting windows iTerm style
nmap <D-d> :vs<CR>
nmap <D-D> :sp<CR>
" Vertical window resizing
map <M-<gt>> :vertical res +1^M<CR>
nmap <M-<lt>> :vertical res -1^M<CR>
" Horizontal window rezising
nmap <M-=> :res +1^M<CR>
nmap <M--> :res -1^M<CR>
nmap <Leader>rm :Rmodel
nmap <Leader>rc :Rcontroller
nmap <Leader>rs :Rspec
" Center line with the find occurance
nmap n nzz
@ -213,22 +276,23 @@ nmap <Leader>ev :vsp <C-R>=expand("%:p:h")."/"<CR>
nmap <Leader>et :tabedit <C-R>=expand("%:p:h")."/"<CR>
" Convert Ruby 1.8 hash syntax to 1.9
nmap <Leader>r18 :%s/:\(\w\+\)\(\s\+\)=>/\1:\2/ge<CR>
nmap <Leader>r18 :%s/:\(\w\+\)\(\s\+\)=>\s\+/\1:\2/ge<CR>
" Buffers
nmap <Leader>b :ls<CR>:b
" #######################
" ### Visual Mappings ###
" #######################
" Indentation TextMate style
vmap <D-[> <gv
vmap <D-]> >gv
vmap <M-[> <gv
vmap <M-]> >gv
" Sudo to write
cmap w!! w !sudo tee % >/dev/null
" Centerize current line
nmap j jzz
nmap k kzz
" Move 10 lines with Option key
nmap <Esc>j 10j
nmap <Esc>k 10k