Skip to content

Instantly share code, notes, and snippets.

@oneamtu oneamtu/.editorconfig
Last active Dec 15, 2015

Embed
What would you like to do?
my .vimrc
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
indent_style = space
tab_width = 2
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[user]
name = Octavian Neamtu
email = octavian.neamtu@annkissam.com
[color]
ui = true
[alias]
ci = commit
st = status
br = branch
co = checkout
[core]
editor = vim -f
[push]
default = current
[rerere]
enabled = true
#!/usr/bin/ruby
if defined? IRB
require 'irb/completion'
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
IRB.conf[:PROMPT_MODE] = :SIMPLE
end
#!/usr/bin/ruby
require 'ripl/multi_line'
require 'ripl/irb'
require 'ripl/commands'
require 'ripl/shell_commands'
require 'ripl/color_result'
require 'ripl/auto_indent'
require 'ripl/hirb'
require 'ripl/short_errors'
require 'ripl/color_error'
Ripl.config[:irb_verbose] = false
module Ripl::HistorySize
def write_history
if (limit = config[:history_size]) && limit >= 0
saved_history = Array(history).reverse.slice(0, limit).reverse
File.open(history_file, 'w') {|f| f.write saved_history.join("\n") }
else
super
end
end
end
Ripl::Shell.send :include, Ripl::HistorySize
unbind C-b
set -g prefix C-a
set -g history-limit 20000
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
#Highlight active window
set-window-option -g window-status-current-bg red
# vim-like bindings
unbind-key %
bind s split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"
# resize panes like vim
# feel free to change the "1" to however many lines you want to resize by, only
# one at a time can be slow
bind < resize-pane -L 1
bind > resize-pane -R 1
bind - resize-pane -D 1
bind + resize-pane -U 1
# vi-style controls for copy mode
setw -g mode-keys vi
# List of plugins
# Supports `github_username/repo` or full git URLs
set -g @tpm_plugins " \
tmux-plugins/tpm \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-copycat \
tmux-plugins/tmux-open \
tmux-plugins/tmux-online-status \
tmux-plugins/tmux-yank \
"
set -g @almost-sensible 'on'
# Initializes TMUX plugin manager.
# Keep this line at the very bottom of tmux.conf.
run-shell ~/.tmux/plugins/tpm/tpm
set hidden
set tabstop=2
set autoindent
set copyindent
set number
set shiftwidth=2
set shiftround
set ignorecase
set hlsearch
set incsearch
set expandtab
set ls=2 " Always show status line
" bash-like tabbing
set wildmode=longest,list,full
set wildmenu
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set wildignore=*.swp,*.bak,*.pyc,*.class
set title " change the terminal's title
set novisualbell " don't beep
set noerrorbells " don't beep
" disable backup buffers
set nobackup
set noswapfile
" highlight evil whitespaces
set list
set listchars=tab:>.,trail:.,extends:#,nbsp:.
" leader
let mapleader = ","
" key maps
imap jj <Esc>
imap jk <Esc>
imap kj <Esc>
imap kk <Esc>
nnoremap ; :
nnoremap j gj
nnoremap k gk
" center search display
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
nnoremap g* g*zz
nnoremap g# g#z
" keep selection after in/outdent
vnoremap < <gv
vnoremap > >gv
" sudo save a file after editing it
cmap w!! w !sudo tee % >/dev/null
" Ctrl+C, Ctrl+V copy paste
nmap <C-V> "+gP
imap <C-V> <ESC><C-V>i
vmap <C-C> "+y
" for snipmate
filetype plugin on
" Strip trailing whitespaces
" fun! StripTrailingWhitespaces()
" let l = line(".")
" let c = col(".")
" %s/\s\+$//e
" call cursor(l, c)
" endfun
" autocmd FileType c,cpp,java,php,ruby,python,sql autocmd BufWritePre <buffer> :call StripTrailingWhitespaces()
" runtime macros/matchit.vim
" VAM
set nocompatible | filetype indent plugin on | syn on
set t_RV= " http://bugs.debian.org/608242, http://groups.google.com/group/vim_dev/browse_thread/thread/9770ea844cec3282
fun! SetupVAM()
let c = get(g:, 'vim_addon_manager', {})
let g:vim_addon_manager = c
let c.plugin_root_dir = expand('$HOME') . '/.vim/vim-addons'
let &rtp.=(empty(&rtp)?'':',').c.plugin_root_dir.'/vim-addon-manager'
" let g:vim_addon_manager = { your config here see "commented version" example and help
if !isdirectory(c.plugin_root_dir.'/vim-addon-manager/autoload')
execute '!git clone --depth=1 git://github.com/MarcWeber/vim-addon-manager '
\ shellescape(c.plugin_root_dir.'/vim-addon-manager', 1)
endif
call vam#ActivateAddons([], {'auto_install' : 1})
" git
VAMActivate fugitive
VAMActivate github:junkblocker/patchreview-vim
VAMActivate github:codegram/vim-codereview
" universal language file rules
VAMActivate editorconfig-vim
" UI
VAMActivate github:airblade/vim-gitgutter
VAMActivate github:Lokaltog/vim-powerline
VAMActivate Syntastic
" Theme
VAMActivate Solarized
" Editing
VAMActivate abolish
VAMActivate github:ervandew/supertab
VAMActivate The_NERD_Commenter
VAMActivate github:skwp/greplace.vim
VAMActivate delimitMate
VAMActivate github:terryma/vim-multiple-cursors
VAMActivate surround
VAMActivate YankRing
" Navigating
VAMActivate ctrlp
VAMActivate camelcasemotion
VAMActivate github:christoomey/vim-tmux-navigator
VAMActivate ag
" Other syntax
VAMActivate scss-syntax
VAMActivate vim-coffee-script
VAMActivate github:freitass/todo.txt-vim
VAMActivate sql_iabbr
VAMActivate changesqlcase
VAMActivate github:tmux-plugins/vim-tmux
VAMActivate github:honza/dockerfile.vim
" Ruby
VAMActivate vim-ruby
VAMActivate Conque_Shell github:skwp/vim-ruby-conque
VAMActivate github:jgdavey/vim-blockle
VAMActivate github:danchoi/ri.vim
VAMActivate endwise
VAMActivate rails
VAMActivate github:KurtPreston/vim-autoformat-rails
" clojure & overtone
VAMActivate github:guns/vim-clojure-static
VAMActivate github:tpope/vim-fireplace
VAMActivate github:tpope/vim-classpath
" Old, activate w/ caution and as needed
" 'snipmate',
" 'repeat',
" 'rsi',
" 'taglist',
" 'bufkill',
" 'vim-seek',
" 'github:skammer/vim-css-color',
" 'github:greyblake/vim-preview',
" 'PA_ruby_ri',
" 'dbext',
" 'vim-scala',
" 'Switch'
" 'textobj-user',
" 'textobj-rubyblock',
" 'vim-ruby',
" 'closetag',
endfun
call SetupVAM()
" Solarized color scheme
syntax on
set background=dark
colorscheme solarized
se t_Co=256
" Fixes signs for vim-gitgutter
highlight clear SignColumn
" http://stackoverflow.com/questions/901313
set synmaxcol=120
" Camel case motion ovrride default maps
map w <Plug>CamelCaseMotion_w
map b <Plug>CamelCaseMotion_b
map e <Plug>CamelCaseMotion_e
sunmap w
sunmap b
sunmap e
" Note: Must allow nesting of autocmds to enable any customizations for quickfix
" buffers.
" Note: Normally, :cwindow jumps to the quickfix window if the command opens it
" (but not if it's already open). However, as part of the autocmd, this doesn't
" seem to happen.
autocmd QuickFixCmdPost [^l]* nested cwindow
autocmd QuickFixCmdPost l* nested lwindow
" Add 1 space to comments
let NERDSpaceDelims=1
" grep and gsearch
set grepprg=ag
let g:grep_cmd_opts = '--line-numbers --noheading'
" ruby conque runner
let g:ruby_conque_rspec_runner='zeus rspec'
let g:ruby_conque_rspec_options=''
" snipmate rebinding
" let g:snips_trigger_key='<c-space>'
" Ruby conque shortcuts
nmap <silent> <Leader>j :call RunRspecCurrentFileConque()<CR>
nmap <silent> <Leader>l :call RunRspecCurrentLineConque()<CR>
nmap <silent> ,<Leader>j :call RunLastConqueCommand()<CR>
" CtrlP shortcut
nmap <silent> <Leader>f :CtrlP<CR>
" quickfix jump bindings
nmap <silent> <Leader>n :cn<CR>
nmap <silent> <Leader>N :cp<CR>
" open file from same directory
nnoremap <Leader>e :e <C-R>=expand('%:p:h') . '/'<CR>
" replace visual selection
vnoremap <Leader>r "hy:%Subvert/<C-r>h//gc<left><left><left>
nnoremap <Leader>r "hyiw:%Subvert/<C-r>h//gc<left><left><left>
vnoremap <C-g> "hy:Ggrep <C-r>h
nnoremap <C-g> "hyiw:Ggrep <C-r>h
" clipboard yank/paste
vnoremap <Leader>y "+y
vnoremap <Leader>p "+p
" Qargs
command! -nargs=0 -bar Qargs execute 'args ' . QuickfixFilenames()
function! QuickfixFilenames()
" Building a hash ensures we get each buffer only once
let buffer_numbers = {}
for quickfix_item in getqflist()
let buffer_numbers[quickfix_item['bufnr']] = bufname(quickfix_item['bufnr'])
endfor
return join(values(buffer_numbers))
endfunction
command! -nargs=0 -bar Tig execute '! tig %'
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="geoffgarside"
COMPLETION_WAITING_DOTS="true"
plugins=(jump tmux cp gitfast git-extras web-search rbenv gem bundler capistrano zeus rand-quote nyan)
source $ZSH/oh-my-zsh.sh
# stop it from annoying autocorrects
unsetopt correct_all
bindkey 'jj' vi-cmd-mode
bindkey 'kk' vi-cmd-mode
# navigation shortcuts
bindkey '^j' undefined-key
bindkey '^k' undefined-key
bindkey '^l' undefined-key
bindkey '^h' undefined-key
bindkey '^r' history-incremental-search-backward
alias git-clean="git branch --merged master | grep -v '\* master' | xargs -n 1 git branch -d"
alias todo="vim ~/todo.txt"
export LOCAL_GEMS_DIR=~/
export EDITOR=vim
export RAILS_MYSQL_USER=rails
export RAILS_MYSQL_PASSWORD=railspw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.