Skip to content

Instantly share code, notes, and snippets.

@AndyDangerous
Created December 22, 2015 20:20
Show Gist options
  • Save AndyDangerous/71d53235dd42520cf405 to your computer and use it in GitHub Desktop.
Save AndyDangerous/71d53235dd42520cf405 to your computer and use it in GitHub Desktop.
Old .vimrc from turing. Last updated Nov. 2014
execute pathogen#infect()
set rtp+=/usr/local/go/misc/vim
colorscheme spacegray
"" ========== These come from Mislav (http://mislav.uniqpath.com/2011/12/vim-revisited/) ==========
set nocompatible " choose no compatibility with legacy vi
syntax enable
set encoding=utf-8
set showcmd " display incomplete commands
filetype plugin indent on " load file type plugins + indentation
"" Whitespace
set nowrap " don't wrap lines
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4)
set expandtab " use spaces, not tabs (optional)
set backspace=indent,eol,start " backspace through everything in insert mode
"" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
"" ========== NERDTree ==========
"autocmd vimenter * NERDTree
"autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif " close vim if NERDTree is the only open buffer
map <C-m> :NERDTreeToggle<CR>
"" ========== Josh's shit ==========
set nobackup " no backup files
set nowritebackup " only in case you don't want a backup file while editing
set noswapfile " no swap files
set scrolloff=4 " adds top/bottom buffer between cursor and window
set cursorline " colours the line the cursor is on
set number " line numbers
nmap <Leader>p orequire "pry"<CR>binding.pry<ESC>; " pry insertion
vnoremap . :norm.<CR> " in visual mode, "." will for each line, go into normal mode and execute the "."
"" ============== My Shit ============
set pastetoggle = " Sets '=' to toggle between paste modes
" easier navigation between split windows
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
" Emacs/Readline keybindings for commandline mode
" http://tiswww.case.edu/php/chet/readline/readline.html#SEC4
" many of these taken from vimacs http://www.vim.org/scripts/script.php?script_id=300
"
" navigation
cnoremap <C-a> <Home>
cnoremap <C-e> <End>
cnoremap <C-f> <Right>
cnoremap <C-b> <Left>
cnoremap <Esc>b <S-Left> " commenting out b/c makes it pause
cnoremap <Esc>f <S-Right>
cnoremap <M-b> <S-Left>
cnoremap <M-f> <S-Right>
" editing
cnoremap <M-p> <Up>
cnoremap <M-n> <Down>
cnoremap <C-k> <C-f>d$<C-c><End>
cnoremap <C-y> <C-r><C-o>"
cnoremap <C-d> <Right><C-h>
"" strip trailing whitespace
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment