浏览代码

Merge remote-tracking branch 'origin/master' into temp

Samuel Jaffe 8 年之前
父节点
当前提交
e76be59988
共有 8 个文件被更改,包括 1197 次插入469 次删除
  1. 9 0
      README.md
  2. 3 0
      UltiSnips/all.snippets
  3. 4 0
      UltiSnips/cpp.snippets
  4. 820 384
      autoload/plug.vim
  5. 0 0
      init.vim
  6. 3 0
      make_links.sh
  7. 67 0
      vimoutlinerrc
  8. 291 85
      vimrc

+ 9 - 0
README.md

@@ -0,0 +1,9 @@
+# vimrc
+My Vim configuration
+
+##Install
+```bash
+git clone https://github.com/wreed4/vimrc.git ~/.vim
+cd ~/.vim
+./make_links.sh
+```

+ 3 - 0
UltiSnips/all.snippets

@@ -0,0 +1,3 @@
+snippet todo "TODO tags" 
+TODO(`whoami`): ${1:got stuff to do}
+endsnippet

+ 4 - 0
UltiSnips/cpp.snippets

@@ -0,0 +1,4 @@
+# std::cerr
+snippet cerr
+std::cerr << ${1} << std::endl;
+endsnippet

文件差异内容过多而无法显示
+ 820 - 384
autoload/plug.vim


nvimrc → init.vim


+ 3 - 0
make_links.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+ln -s ~/.vim ~/.config/nvim 

+ 67 - 0
vimoutlinerrc

@@ -0,0 +1,67 @@
+"Extra configurations and mappings  ******************************************
+"This mapping is fold-level and fold-state dependent 
+"map <S-Down> dd p
+"map <S-Up> dd <up>P
+
+"Common Plugins
+" The vo_modules_load variable holds name of all VO modules you want to load. 
+" If you do not want to load any VO modules leave it blank
+
+" This setting loads the checkboxes, tags and smart_paste plugins as default.
+let g:vo_modules_load = "checkbox:tags:smart_paste"
+
+" Uncomment the following line to enable the math plugin.
+let g:vo_modules_load .= ':math'
+
+" Uncomment the following line to enable new hoisting.
+let g:vo_modules_load .= ':newhoist'
+
+" Uncomment the following line to enable the format plugin.
+let g:vo_modules_load .= ':format'
+
+" Uncomment the following line to enable clocking.
+"let g:vo_modules_load .= ':clock'
+
+"User Preferences ***************************************************
+"let maplocalleader = ',,'		" uncomment for compatibility with
+                                        " previous versions of VO
+
+"setlocal ignorecase			" searches ignore case
+"setlocal smartcase			" searches use smart case
+"setlocal wrapmargin=5
+"setlocal tw=78
+"setlocal tabstop=4			" tabstop and shiftwidth must match
+"setlocal shiftwidth=4			" values from 2 to 8 work well
+"setlocal background=dark		" for dark backgrounds
+"setlocal nowrap
+
+" colorscheme votl_light			" set a VO specific colorscheme
+
+"Checkbox Tags
+" Tags can contain any word characters (:help word)
+" tags must not contain whitespace
+" tags must be unique
+"    there can be no intersections between lists
+"   'high', 'High', and 'HIGH' are considered to be unique and nonintersecting
+" each sub-list represents a unique circular 'ring' of tags
+" currently, these options do not affect checkboxes
+"    status indicators like DONE, NOT DONE and CANCELED are
+"    refelected in the checkbox state: [X], [_] and [-], respectively
+" each tag is a [] block, just like a checkbox; chosen for possible future integration
+" each tag must be delimited by whitespace
+"    [TODO] [Feature] <-- this
+"    [TODO][Feature] <-- not this
+
+let g:cbTags = [
+\ ['TODO','FEEDBACK','VERIFY','DELEGATED','HOLDING']
+\,['Feature','Enhancement','Bug']
+\,['Low','Normal','High','URGENT']
+\,['@Home','@Lab','@Work','@Shopping']
+\]
+
+
+"Hoisting ***********************************************************
+"Uncomment and set to 1 to debug hoisting
+"let g:hoistParanoia=0
+
+" vim: filetype=vim

+ 291 - 85
vimrc

@@ -1,10 +1,7 @@
 " wreed vimrc
-" vim: set foldmethod=marker:
+" vim:foldmethod=marker:foldlevel=0:
 
-"enable python
-python << end
-import vim
-end
+let g:python3_host_skip_check = 1
 
 "{{{ ***** PLUGINS INSTALLATION ***** "
 
@@ -14,8 +11,8 @@ call plug#begin('~/.vim/bundle')
 
 " ***** plugins that require more stuff (compilation)
 " As-you-type semantic completion. 
-Plug 'Valloric/YouCompleteMe', { 'frozen': 1, 'for': ['cpp', 'c', 'java', 'python'], 'on': ['YcmCompleter', 'YcmDiags', 'YcmForceCompileAndDiagnostics']}
-autocmd! User YouCompleteMe call youcompleteme#Enable()
+Plug 'Valloric/YouCompleteMe', { 'frozen': 0, 'for': ['cpp', 'c', 'java', 'python', 'xonsh', 'sh'], 'on': ['YcmCompleter', 'YcmDiags', 'YcmForceCompileAndDiagnostics']}
+autocmd! User YouCompleteMe if !has('vim_starting') | call youcompleteme#Enable() | endif
 
 
 " ***** simple plugins
@@ -23,12 +20,19 @@ autocmd! User YouCompleteMe call youcompleteme#Enable()
 "Plugin 'jlanzarotta/bufexplorer'
 " supposedly make '%' more powerful
 Plug 'tmhedberg/matchit'
+
+" Comments
 " Provides awesome commenting shortcuts
-Plug 'scrooloose/nerdcommenter'
+" Plug 'scrooloose/nerdcommenter'
+" Way more lightweight comment plugin
+Plug 'tpope/vim-commentary'
+" Comment text objects (depends on the following
+Plug 'glts/vim-textobj-comment'
+" define you're own text objects!!
+Plug 'kana/vim-textobj-user'
+
 " Shows file browser. (replaces netrw and :Explore)
 Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind']}
-" the Solarized colorscheme
-Plug 'altercation/vim-colors-solarized'
 " show tabs up on top prettily 
 Plug 'mkitt/tabline.vim'
 " shows an outline of all Tags in a file 
@@ -37,12 +41,12 @@ Plug 'majutsushi/tagbar'
 Plug 'SirVer/ultisnips' ", { 'on': []}
 " Make vim priiiiity
 Plug 'bling/vim-airline'
-" about 3 billion colorschemes
-Plug 'flazz/vim-colorschemes'
+Plug 'vim-airline/vim-airline-themes'
 " Asynchonous building and launching of programs
 Plug 'tpope/vim-dispatch'
 " Makes motions way better.  lets you jump anywhere on the screen
-Plug 'Lokaltog/vim-easymotion'
+" Plug 'Lokaltog/vim-easymotion'
+Plug 'justinmk/vim-sneak'
 " Allows multiple cursors at once.  very useful
 Plug 'wreed4/vim-multiple-cursors'
 " Dependency for vim-snippets
@@ -52,26 +56,25 @@ Plug 'honza/vim-snippets'
 " ability to surround text objects with things like quotes or parens
 Plug 'tpope/vim-surround'
 " Amazing plugin that makes a lot of things obsolete...
-Plug 'unite.vim'
+Plug 'Shougo/unite.vim'
+Plug 'Shougo/neomru.vim'
+Plug 'Shougo/neoyank.vim'
+Plug 'Shougo/unite-outline'
 " Make Tmux pretty
 Plug 'edkolev/tmuxline.vim'
 " switch between header files easily
-Plug 'a.vim'
+Plug 'vim-scripts/a.vim'
 " pretty JSON stuff
 Plug 'elzr/vim-json'
 " Diff directories quickly and powerfully
-Plug 'DirDiff.vim'
+Plug 'will133/vim-dirdiff'
 " Enable nested vimrc files
-Plug 'wreed4/vim-lvimrc'
+" Plug 'wreed4/vim-lvimrc'
 " Gives a graphical view of vim's undo tree (replaced by neovim-compatible
 " fork)
 "Plugin 'sjl/gundo.vim'
-" Plug 'simnalamburt/vim-mundo'
-Plug 'mbbill/undotree'
-" New colorscheme
-Plug 'morhetz/gruvbox'
-" New colorscheme
-Plug 'NLKNguyen/papercolor-theme'
+Plug 'simnalamburt/vim-mundo'
+" Plug 'mbbill/undotree'
 " Git integration
 Plug 'tpope/vim-fugitive'
 " Matching things in insert mode
@@ -79,14 +82,39 @@ Plug 'Raimondi/delimitMate'
 " Easy alignment
 Plug 'junegunn/vim-easy-align'
 " Semantic highlighting
-Plug 'jaxbot/semantic-highlight.vim'
+" Plug 'jaxbot/semantic-highlight.vim'
 " Additional highlighting for cpp
 Plug 'octol/vim-cpp-enhanced-highlight'
 " Fancy start screen
 Plug 'mhinz/vim-startify'
 " Better text objects
 Plug 'wellle/targets.vim'
-
+" Diff individual sections of code
+Plug 'AndrewRadev/linediff.vim'
+" Pull in code from the internet
+" Plug 'kasandell/Code-Pull'
+" Heuristically set indent settings
+Plug 'tpope/vim-sleuth'
+" Show differences with style
+Plug 'mhinz/vim-signify'
+" Write outlines in vim
+Plug 'vimoutliner/vimoutliner'
+" Better diffs (optionaly)
+Plug 'chrisbra/vim-diff-enhanced'
+" command line fuzzy finder
+Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
+" Startup time analyzer
+Plug 'tweekmonster/startuptime.vim'
+
+
+"SYNTAX Files
+" Plug 'linkinpark342/xonsh-vim'
+
+"COLORSCHEMES
+Plug 'vim-scripts/devbox-dark-256'
+
+"Machine-specific plugins
+Plug 'gisraptor/vim-lilypond-integrator', {'frozen': 1, 'for': ['lilypond']}
 
 
 " end installed plugins
@@ -110,25 +138,39 @@ call plug#end()
 
 "{{{ ***** PLUGIN SETTINGS ***** "
 
-" #####PyMode##### 
+" {{{##### PyMode ##### 
 "let pymode_lint_ignore="E501,E401,E225,W191,W391,W404"
 " use rope code assist instead of a complete function
 " au FileType python inoremap <expr> <S-Space> '<C-r>=RopeCodeAssistInsertMode()<CR><C-r>=pumvisible() ? "\<lt>C-p>\<lt>Down>" : ""<CR>'
-
-" Tlist
+" }}}
+" {{{##### Tlist #####
 " Toggle tag list
 "nnoremap <C-T> :TlistToggle<CR>
-
-" #####EasyMotion#####
-nmap <Leader><Leader>s <Plug>(easymotion-sn)
-
-" #####Tagbar##### 
+"}}}
+" {{{##### EasyMotion #####
+" nmap <Leader><Leader>s <Plug>(easymotion-sn)
+" }}}
+" {{{##### Vim-Sneak #####
+nmap <Leader>s <Plug>Sneak_s
+xmap <Leader>s <Plug>Sneak_s
+omap <Leader>s <Plug>Sneak_s
+
+nmap <Leader>S <Plug>Sneak_S
+xmap <Leader>S <Plug>Sneak_S
+omap <Leader>S <Plug>Sneak_S
+
+" this seems weird, but it's to maintain motor memory with EasyMotion
+nmap <Leader>w <Plug>(SneakStreak)
+nmap <Leader>W <Plug>(SneakStreakBackward)
+"}}}
+" {{{##### Tagbar ##### 
 let g:tagbar_autofocus = 1
 let g:tagbar_left = 1
 let g:tagbar_zoomwidth = 0
 let g:tagbar_show_linenumbers = -1
 let g:tagbar_foldlevel = 0
 let g:tagbar_autoshowtag = 1
+let g:tagbar_sort = 0
 
 " open Tagbar automatically when viewing a supported file/files
 "autocmd VimEnter * nested :call tagbar#autoopen(1)
@@ -137,15 +179,18 @@ let g:tagbar_autoshowtag = 1
 
 " Toggle Tagbar
 nnoremap <leader>tt :TagbarToggle<CR>
-
-
-" #####Airline#####
+"}}}
+" {{{##### Airline #####
 let g:airline_powerline_fonts=1
 
+" only if YCM is enabled
+" autocmd User YouCompleteMe let g:airline#extensions#ycm#enabled = 1 | AirlineRefresh
+
 let g:airline#extensions#tabline#enabled = 1
 let g:airline#extensions#tabline#show_tab_nr = 1
 let g:airline#extensions#tabline#tab_nr_type = 1
 let g:airline#extensions#tabline#show_close_button =1
+let g:airline#extensions#ycm#enabled = 1
 
 let g:airline#extensions#tagbar#flags = 'f'
 let g:airline#extensions#tagbar#enabled = 1
@@ -154,8 +199,20 @@ let g:airline#extensions#whitespace#enabled = 0
 
 let g:airline#extensions#tmuxline#enabled = 1
 
+let g:airline#extensions#tabline#buffer_idx_mode = 1
+nmap <silent> <leader>1 <Plug>AirlineSelectTab1
+nmap <silent> <leader>2 <Plug>AirlineSelectTab2
+nmap <silent> <leader>3 <Plug>AirlineSelectTab3
+nmap <silent> <leader>4 <Plug>AirlineSelectTab4
+nmap <silent> <leader>5 <Plug>AirlineSelectTab5
+nmap <silent> <leader>6 <Plug>AirlineSelectTab6
+nmap <silent> <leader>7 <Plug>AirlineSelectTab7
+nmap <silent> <leader>8 <Plug>AirlineSelectTab8
+nmap <silent> <leader>9 <Plug>AirlineSelectTab9
+
 
-" #####NERDTree#####
+" }}}
+" {{{##### NERDTree #####
 let g:NERDTreeHijackNetrw = 1
 let g:NERDTreeDirArrows = 1
 let g:NERDTreeWinPos = "right"
@@ -166,25 +223,27 @@ nnoremap <leader>nt :NERDTreeToggle<CR>
 nnoremap <leader>nf :NERDTreeFind<CR>
 
 
-" #####NerdCommenter#####
+" }}}
+" {{{##### NerdCommenter #####
 imap <C-c> <plug>NERDCommenterInsert
 
 let g:NERDSpaceDelims = 1
 
 
-" #####UltiSnips#####
+" }}}
+" {{{##### UltiSnips #####
 let g:UltiSnipsEditSplit = "vertical"
-let g:UltiSnipsExpandTrigger = "<C-@>"
+let g:UltiSnipsExpandTrigger = "<C-Space>"
 let g:UltiSnipsJumpForwardTrigger="<TAB>"
 let g:UltiSnipsJumpBackwardTrigger="<S-TAB>"
 let g:UltiSnipsSnippetsDir="~/.vim/UltiSnips"
 
+" }}}
+" {{{##### CCTree #####
+" nnoremap <leader>ct :CCTreeWindowToggle<CR>
 
-
-" #####CCTree#####
-nnoremap <leader>ct :CCTreeWindowToggle<CR>
-
-" #####ConqueTerm#####
+" }}}
+" {{{##### ConqueTerm #####
 let g:ConqueTerm_CloseOnEnd = 1
 "Conque spits out an error about CursorHoldI making it run slow.  repress
 "these warnings
@@ -193,7 +252,8 @@ let g:ConqueTerm_ReadUnfocused = 1
 let g:ConqueTerm_ToggleKey = '<F8>'
 
 
-" #####Pyclewn#####
+" }}}
+" {{{##### Pyclewn #####
 " Only map keys if we're in Pyclewn
 if has("netbeans_enabled")
     "nmap <silent> <C-p> :exe ":Cprint " .  expand("<cword>")<CR>
@@ -202,7 +262,8 @@ if has("netbeans_enabled")
     vmap <silent> <C-p> "py :Cprint <C-R>p<CR>
 endif
 
-" #####YouCompleteMe#####
+" }}}
+" {{{##### YouCompleteMe #####
 " Do not open preview window when completing
 set completeopt=menuone
 let g:ycm_add_preview_to_completeopt = 0
@@ -232,16 +293,28 @@ let g:ycm_filetype_blacklist = {
             \ 'mail' : 1
             \}
 
+" Python3 completion by default
+" let g:ycm_python_binary_path = system('readlink -f ' . system('which python3'))
+let g:ycm_python_binary_path = 'python3'
+
+" Mappings
 nnoremap <leader>] :YcmCompleter GoTo<CR>
-nnoremap <F1> :YcmDiags<CR>
+nnoremap <leader>[ :YcmCompleter GoToReferences<CR>
+nnoremap <leader>gt :YcmCompleter GetType<CR>
+nnoremap <leader>gp :YcmCompleter GetParent<CR>
+nnoremap <leader>gd :YcmCompleter GetDoc<CR>
+nnoremap <leader>= :YcmCompleter FixIt<CR>
+
+nnoremap <F1> :YcmDiags<CR>:map <buffer> q cl<CR>
 nnoremap <leader><F1> :YcmForceCompileAndDiagnostics<CR>
 
 
-" #####Multiple Cursors#####
+" }}}
+" {{{##### Multiple Cursors #####
 let g:multi_cursor_exit_from_insert_mode = 0
 
-
-" #####Unite#####
+" }}}
+" {{{##### Unite #####
 let g:unite_source_history_yank_enable = 1
 call unite#filters#matcher_default#use(['matcher_fuzzy'])
 "nnoremap <leader>t :<C-u>Unite  -buffer-name=files   -start-insert file_rec/async:!<CR>
@@ -250,45 +323,51 @@ nnoremap <leader>r :<C-u>Unite  -buffer-name=mru  -start-insert  file_mru<CR>
 nnoremap <leader>y :<C-u>Unite -buffer-name=yank    history/yank<CR>
 nnoremap <leader>j :<C-u>Unite  -buffer-name=jump    jump<CR>
 nnoremap <leader>be :<C-u>Unite -buffer-name=buffer buffer<CR>
-nnoremap <leader>/ :<C-u>Unite -keep-focus -no-quit -buffer-name=search vimgrep:%<CR>
+nnoremap <leader>/ :<C-u>Unite -keep-focus -no-quit -buffer-name=search -start-insert line:all<CR>
+nnoremap <leader>vg :<C-u>Unite -buffer-name=vimgrep vimgrep<CR>
 "
-"Doesn't work.  Can't get plugins to play nice
-"nnoremap <leader>t :<C-u>Unite -buffer-name=outline -start-insert outline<CR>
+nnoremap <leader>t :<C-u>Unite -buffer-name=outline -no-split -start-insert outline<CR>
 
-
-" #####JSON.vim#####
+" }}}
+" {{{##### JSON.vim #####
 augroup json_autocmd
   autocmd!
   autocmd FileType json set autoindent
   autocmd FileType json set formatoptions=tcq2l
-  autocmd FileType json set textwidth=78 shiftwidth=2
-  autocmd FileType json set softtabstop=2 tabstop=8
-  autocmd FileType json set expandtab
   autocmd FileType json set foldmethod=indent
 augroup END
 
 autocmd filetype crontab setlocal nobackup nowritebackup
 
-" #####DirDiff#####
+" }}}
+" {{{##### DirDiff #####
 let g:DirDiffExcludes = ".*.*.swp,*.d"
 
+" }}}
+" {{{##### Mundo #####
+nnoremap <leader>u :MundoToggle<CR>
+let g:mundo_playback_delay = 300
+let g:mundo_preview_bottom = 1
 
-" ##### Gundo #####
-" nnoremap <leader>u :GundoToggle<CR>
-" let g:gundo_playback_delay = 300
-" let g:gundo_preview_bottom = 1
-
-" ##### UndoTree #####
-nnoremap <leader>u :UndotreeToggle<CR>
-let g:undotree_WindowLayout = 2
-let g:undotree_SetFocusWhenToggle = 1
+" }}}
+" {{{##### UndoTree #####
+" nnoremap <leader>u :UndotreeToggle<CR>
+" let g:undotree_WindowLayout = 2
+" let g:undotree_SetFocusWhenToggle = 1
 
 
-" ##### EasyAlign #####
+" }}}
+" {{{##### EasyAlign #####
 vmap <Enter> <Plug>(LiveEasyAlign)
 
+" }}}
+" {{{##### DelimitMate #####
+let delimitMate_expand_space = 1
+let delimitMate_expand_cr = 1
+imap <c-l> <Plug>delimitMateS-Tab
 
-" ##### Semantic-Highlight.vim #####
+" }}}
+" {{{##### Semantic-Highlight.vim #####
 let g:semanticBlacklistOverride = {
     \'cpp': [
     \   'auto', 'const', 'double', 'float', 'int', 'short',
@@ -305,11 +384,13 @@ let g:semanticBlacklistOverride = {
     \ ]
 \ }
 
-" ##### vim-cpp-enhanced-highlight #####
-let g:cpp_class_scope_highlight=1
+" }}}
+" {{{##### vim-cpp-enhanced-highlight #####
+let g:cpp_class_scope_highlight=0
 let g:cpp_experimental_template_highlight = 0
 
-" ##### Startify #####
+" }}}
+" {{{##### Startify #####
 let g:startify_list_order = [
         \ ['    MRU files in current directory  [ ' . tlib#string#Strip(system('pwd')) . ' ]'], 'dir',
         \ ['    MRU files'], 'files', 
@@ -323,11 +404,21 @@ let g:startify_custom_header =
         " \ map(split(system('toilet Welcome to VIM -t -W -F border'), '\n'), '"   ". v:val') + ['','']
         " \ map(split(system('fortune | cowsay'), '\n'), '"   ". v:val') + ['','']
 
+" }}}
+" {{{##### Signify #####
+let g:signify_vcs_list = ['git', 'hg', 'perforce', 'svn']
+
+omap ih <plug>(signify-motion-inner-pending)
+xmap ih <plug>(signify-motion-inner-visual)
+omap ah <plug>(signify-motion-outer-pending)
+xmap ah <plug>(signify-motion-outer-visual)
+" }}}
+
 " }}}
 
 "{{{ ***** VIM FEATURES ***** "
 " allow project-specific .vimrc files
-"set exrc
+set exrc
 set secure
 " allow the use of a modeline
 set modeline
@@ -340,6 +431,9 @@ set ruler
 " set incremental search
 set hlsearch
 set incsearch
+if has('nvim')
+  set inccommand=split
+endif
 " set status line always on
 set laststatus=2
 " turn vim's mode printing off.  Airline takes care of this
@@ -363,8 +457,10 @@ if &term =~ '^screen'
 endif
 
 " set utf8
-set encoding=utf-8
-set fileencoding=utf-8
+if !has('nvim')
+    set encoding=utf-8
+endif
+" set fileencoding=utf-8
 
 " New Splits default to right, or below
 set splitbelow
@@ -378,8 +474,38 @@ set omnifunc=syntaxcomplete#Complete
 set undofile
 set undodir=~/.vim/undodir
 
+" format options
+" set expandtab
+" set shiftwidth=4
+" set softtabstop=4
+set autoindent
+set nosmartindent
+set cindent
+set cino=t0,(0,
+
+set breakindent
+set showbreak=↳     
+set breakindentopt=min:20
+
+" TOhtml settings
+let g:html_ignore_conceal=1
+let g:html_dynamic_folds=1
+
+" folding options
+set foldlevelstart=99
+set foldmethod=syntax
+augroup folding_settings
+  autocmd FileType python,xonsh set foldmethod=indent
+augroup END
+
+" see xonsh files as python files
+au BufNewFile,BufRead *.xsh set filetype=python
+
+set wildmode=longest:full
+
 " }}}
 
+
 "{{{ ***** VISUALS ***** "
 set number
 set norelativenumber
@@ -393,10 +519,10 @@ set foldmethod=indent
 
 set background=dark
 
-colorscheme devbox-dark-256
-
 syntax on
 
+colorscheme devbox-dark-256
+
 set showcmd
 "}}}
 
@@ -413,7 +539,8 @@ set backspace=eol,start,indent
 set whichwrap+=<,>,h,l
 set whichwrap+=<,>,h,l
 
-nnoremap <silent> <F5> :so ~/.vim/vimrc<CR>:LvimrcReload<CR>
+" nnoremap <silent> <F5> :so ~/.vim/vimrc<CR>:LvimrcReload<CR>
+nnoremap <silent> <F5> :so ~/.vim/vimrc<CR>
 nnoremap <silent> <F6> :redraw!<CR>
 set pastetoggle=<F7>
 nmap <F8> :mks!<CR>
@@ -425,18 +552,32 @@ map k gk
 " Scroll the window more intuitively
 nnoremap <M-j> <C-e>
 nnoremap <M-k> <C-y>
-nnoremap j <C-e>
-nnoremap k <C-y>
 nnoremap <M-h> 10zh
 nnoremap <M-l> 10zl
+nnoremap j <C-e>
+nnoremap k <C-y>
+nnoremap h 10zh
+nnoremap l 10zl
+
+vnoremap <M-j> <C-e>
+vnoremap <M-k> <C-y>
+vnoremap <M-h> 10zh
+vnoremap <M-l> 10zl
+vnoremap j <C-e>
+vnoremap k <C-y>
+vnoremap h 10zh
+vnoremap l 10zl
 
 " Open a new line and exit insert mode, staying on the same line
-nnoremap <leader>o o<ESC>k
-nnoremap <leader>O O<ESC>j
+nnoremap <leader>o o<ESC>
+nnoremap <leader>O O<ESC>
 
 " Clean a line and exit insert mode
 nnoremap <leader>c cc<ESC>
 
+" Exit insert mode and put ';' at the end of the line
+inoremap ;<Esc> <Esc>A;<Esc>
+
 " Open tag in new tab
 nnoremap <M-]> <C-W><C-]><C-W>T
 
@@ -477,11 +618,35 @@ nnoremap cq :cclose<CR>
 nnoremap cl :lclose<CR>
 nnoremap cp :pclose<CR>
 
+" Call CopyMode
+vnoremap <C-c> :call CopyMode()<CR><CR>
+
+" Visual mode pressing * or # searches for the current selection
+" Super useful! From an idea by Michael Naumann
+vnoremap <silent> * :call VisualSelection('f')<CR>
+vnoremap <silent> # :call VisualSelection('b')<CR>
+
+" Default building/running options
+let g:run_command = 'echo No run command defined'
+autocmd FileType lilypond setlocal makeprg=lilypond
+autocmd FileType python setlocal makeprg=mypy
+nnoremap <F3> :Make %<CR>
+nnoremap <leader>` :execute "Start " . g:run_command<CR>
+
+" Quickly edit a macro
+nnoremap <leader>@  :<c-u><c-r><c-r>='let @'. v:register .' = '. string(getreg(v:register))<cr><c-f><left>
+" Quickly edit the Q macro
+nnoremap <leader>q :<c-u><c-r><c-r>='let @q = '. string(getreg('q'))<cr><c-f><left>
+
+" go back and delete last buffer (dangerous if the going back doesn't bring
+" you to another buffer
+nnoremap <M-C-O> <C-o>:bd! #<CR>
+
 " }}}
 
 "{{{ ***** COMMANDS ***** " 
 " make todo list
-command! -nargs=* -complete=file Todos Unite -keep-focus -auto-resize -no-quit -buffer-name=Todos vimgrep:*:TODO(sjaffe)
+command! -nargs=* -complete=file Todos execute "Unite -keep-focus -auto-resize -no-quit -buffer-name=Todos vimgrep:*:TODO(" . expand("$USER") . ")"
 
 "Wrapper for make sequence
 "replaced by vim-dispatch plugin
@@ -514,10 +679,51 @@ function! Swap(l1, l2)
 
 endfunction
 
+function! CopyMode() range
+    execute a:firstline . "," . a:lastline . "yank c"
+    tabnew
+    setlocal nonumber
+    setlocal norelativenumber
+    setlocal showbreak=
+    map <buffer> <silent> <C-V> :bd!<CR>
+    normal [p
+endfunction
+
 " Diff original file (from help)
 command! DiffOrig vert new | set bt=nofile | r ++edit # | 0d_
             \ | diffthis | wincmd p | diffthis
 
+" from https://amix.dk/vim/vimrc.html
+function! VisualSelection(direction) range
+    let l:saved_reg = @"
+    execute "normal! vgvy"
+
+    let l:pattern = escape(@", '\\/.*$^~[]')
+    let l:pattern = substitute(l:pattern, "\n$", "", "")
+    let l:pattern = '\<'.l:pattern.'\>'
+
+    if a:direction == 'b'
+        execute "normal ?" . l:pattern . "^M"
+    " elseif a:direction == 'gv'
+        " call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.')
+    " elseif a:direction == 'replace'
+        " call CmdLine("%s" . '/'. l:pattern . '/')
+    elseif a:direction == 'f'
+        " execute "normal /" . l:pattern . "^M"
+        execute "normal /" . l:pattern 
+    endif
+
+    let @/ = l:pattern
+    let @" = l:saved_reg
+endfunction
+
+
 " }}}
 
 
+"{{{ ***** MACHINE SPECIFIC CONFIG ***** " 
+if filereadable($HOME . "/.vimrc_custom")
+  source ~/.vimrc_custom
+  command! -nargs=0 EditCustomVimrc tabedit ~/.vimrc_custom
+endif
+"}}}