Skip to content

Instantly share code, notes, and snippets.

@rjlynch
Last active August 30, 2018 10:01
Show Gist options
  • Select an option

  • Save rjlynch/c4d9b1968c9b0378982aa8cbcb008bd1 to your computer and use it in GitHub Desktop.

Select an option

Save rjlynch/c4d9b1968c9b0378982aa8cbcb008bd1 to your computer and use it in GitHub Desktop.
dotfiles
# mac version
# swap panes round ctrl+b o (hold cntrl)
setw -g mode-keys vi
unbind-key j
bind-key j select-pane -D
unbind-key k
bind-key k select-pane -U
unbind-key h
bind-key h select-pane -L
unbind-key l
bind-key l select-pane -R
unbind-key J
bind-key J resize-pane -D
unbind-key K
bind-key K resize-pane -U
unbind-key L
bind-key L resize-pane -R 20
unbind-key H
bind-key H resize-pane -L 20
unbind-key i
bind-key i resize-pane -Z
unbind-key v
bind-key v split-window -h -c "#{pane_current_path}"
unbind-key s
bind-key s split-window -c "#{pane_current_path}"
bind -T copy-mode-vi y send-keys -X copy-pipe 'pbcopy'
bind -T copy-mode-vi H send-keys -X start-of-line
bind -T copy-mode-vi L send-keys -X end-of-line
set -g mouse on
# swap panes round ctrl+b o (hold cntrl)
setw -g mode-keys vi
unbind-key j
bind-key j select-pane -D
unbind-key k
bind-key k select-pane -U
unbind-key h
bind-key h select-pane -L
unbind-key l
bind-key l select-pane -R
unbind-key J
bind-key J resize-pane -D
unbind-key K
bind-key K resize-pane -U
unbind-key L
bind-key L resize-pane -R 20
unbind-key H
bind-key H resize-pane -L 20
unbind-key i
bind-key i resize-pane -Z
unbind-key v
bind-key v split-window -h -c "#{pane_current_path}"
unbind-key s
bind-key s split-window -c "#{pane_current_path}"
bind -t vi-copy y copy-pipe 'xclip -in -selection clipboard'
bind -t vi-copy H start-of-line
bind -t vi-copy L end-of-line
set -g mouse on
call pathogen#infect()
runtime macros/matchit.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Settings
"-----------------------------------------------------------------------------
set nocompatible
set path+=**
set tabstop=2
set shiftwidth=2
set expandtab
set norelativenumber
set nobackup
set nowritebackup
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set splitright
set backspace=indent,eol,start
set colorcolumn=80
set nowrap
set laststatus=2
set runtimepath^=~/.vim/bundle/ctrlp.vim
set complete-=i "ignore included files in tab completion
set incsearch
set diffopt+=vertical
highlight Visual cterm=NONE ctermbg=Yellow ctermfg=Black guibg=DarkYellow
let g:ctrlp_match_window = 'min:1,max:50'
let g:ctrlp_max_files = 20000
let g:jsx_ext_required = 0
" https://github.com/diepm/vim-rest-console
let g:vrc_curl_opts = { '-i': '', }
let g:vrc_split_request_body = 1
ab _tableflip (╯°□°)╯︵ ┻━┻
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" COLOUR SCHEME
"-----------------------------------------------------------------------------
"set background light
"colorscheme cake
colorscheme monokai
filetype plugin on
filetype plugin indent on
syntax enable
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Mappings
"-----------------------------------------------------------------------------
let mapleader=","
inoremap jj <ESC>
nnoremap <S-l> $
nnoremap <S-h> ^
nnoremap <leader>hh <C-w><C-v><C-l>:e ~/.vim/myvim_help.md<cr>
nnoremap <leader>ev <C-w><C-v><C-l>:e $MYVIMRC<cr>
nnoremap <leader>tn <C-w><C-v><C-l>:e ~/notepad.txt<cr>
nnoremap <leader>rc :tabe ~/rest_console.rest<cr>
nnoremap <leader>jf <S-v>:!python -m json.tool
nnoremap <leader>pbp :r !pbpaste<cr>
nnoremap <leader><Space> /<\*\*>/<cr>ca<
nnoremap <Space><Space> q:
" run the current spec file
map <Leader>r :execute "!bundle exec rspec %:" . line(".")
map <Leader>rr :execute "!bundle exec rspec %"
" view issue in jira
map <Leader>vij yiw:!jira <C-r>"
" run ctags
map <Leader>ct :!ctags -R --languages=ruby --exclude=.git --exclude=log . $(bundle list --paths)
" dump default search buffer into ctrl p
map <Leader>ss <C-p><C-\>r"
map <Leader>run :!bin/rails runner %
map <Leader>doc :!ri <cword>
map <Leader>is :r !issue
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" MULTIPURPOSE TAB KEY
" Indent if we're at the beginning of a line. Else, do completion.
"-----------------------------------------------------------------------------
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<space>\<space>"
else
return "\<c-n>"
endif
endfunction
inoremap <expr> <tab> InsertTabWrapper()
inoremap <s-tab> <c-p>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Highlight trailing white space.
"-----------------------------------------------------------------------------
highlight ws ctermbg=DarkGrey guibg=DarkGrey
match ws /\s\+$/
autocmd BufWinEnter * match ws / \+$/
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Open cwindow after grep
"-----------------------------------------------------------------------------
augroup myvimrc
autocmd!
autocmd QuickFixCmdPost [^l]* :vert cwindow
autocmd QuickFixCmdPost l* lwindow
augroup END
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vagrant file syntax highlighting
"-----------------------------------------------------------------------------
augroup vagrant
au!
au BufRead,BufNewFile Vagrantfile set filetype=ruby
augroup END
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment