Skip to content

Instantly share code, notes, and snippets.

@dylanerichards
Created October 21, 2020 14:31
Show Gist options
  • Save dylanerichards/42d399825fcd89dca73a445b52b20ba3 to your computer and use it in GitHub Desktop.
Save dylanerichards/42d399825fcd89dca73a445b52b20ba3 to your computer and use it in GitHub Desktop.
vimrc
execute pathogen#infect()
call pathogen#helptags()
syntax enable
set background=light
colorscheme solarized
set guifont="Inconsolata"
set smartindent
set cursorline
set tabstop=2
set shiftwidth=2
set colorcolumn=80
set expandtab
set t_Co=256
set relativenumber
set number
set noswapfile
set splitbelow
set splitright
set incsearch
set hlsearch
set backspace=indent,eol,start
hi cursorLine cterm=NONE
let mapleader=","
filetype on
filetype plugin indent on
nnoremap <leader><leader> <c-^>
" map <Leader> <Plug>(easymotion-s2)
" Quick mapping to clear the highlighting of previous search pattern matches
nmap <leader>h :nohlsearch<cr>
"make powerline show up by default
set laststatus=2
"Reset TSLIME settings
nmap <C-e> <Plug>SetTmuxVars
nnoremap <C-n> :NERDTreeToggle<CR>
" Run Ruby
nnoremap <C-b> :!ruby %<CR>
" Run Python
nnoremap <C-p> :!python %<CR>
"
" Run Node
nnoremap <C-i> :!node %<CR>
" map ,t :CommandT<CR>
" Move modifier key
let g:move_key_modifier = 'C'
" Map s to save
nmap s :w <enter>
" Map Q to quit
nmap Q :q <enter>
" K to split lines
nmap K i<cr><esc>k$
" Map jk to go from insert mode to normal mode
:imap jk <Esc>
" Space to bring current line to middle of screen
nmap <space> zz
" Searches stay in middle of screen
nmap n nzz
nmap N Nzz
" Switch between the last two files
" Get off my lawn
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" Dem trailing spaces
set list lcs=trail:·
"apply vimrc changes with leader av
nmap <silent> <leader>av :so $MYVIMRC<CR>
"edit vimrc with leader ev
nmap <silent> <leader>ev :e $MYVIMRC<CR>
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
"TMUX pane switching with vim
if exists('$TMUX')
function! TmuxOrSplitSwitch(wincmd, tmuxdir)
let previous_winnr = winnr()
silent! execute "wincmd " . a:wincmd
if previous_winnr == winnr()
call system("tmux select-pane -" . a:tmuxdir)
redraw!
endif
endfunction
let previous_title = substitute(system("tmux display-message -p '#{pane_title}'"), '\n', '', '')
let &t_ti = "\<Esc>]2;vim\<Esc>\\" . &t_ti
let &t_te = "\<Esc>]2;". previous_title . "\<Esc>\\" . &t_te
nnoremap <silent> <C-h> :call TmuxOrSplitSwitch('h', 'L')<cr>
nnoremap <silent> <C-j> :call TmuxOrSplitSwitch('j', 'D')<cr>
nnoremap <silent> <C-k> :call TmuxOrSplitSwitch('k', 'U')<cr>
nnoremap <silent> <C-l> :call TmuxOrSplitSwitch('l', 'R')<cr>
else
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
endif
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" " 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 "\<tab>"
" else
" return "\<c-p>"
" endif
" endfunction
" inoremap <expr> <tab> InsertTabWrapper()
" inoremap <s-tab> <c-n>
" """""""""""""""""""""""""""""""""""""""
"
" FZF
set rtp+=/usr/local/opt/fzf
nnoremap ,t :FZF<Cr>
" map ,t :CommandT<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment