diff --git a/.vim/UltiSnips/ruby.snippets b/.vim/UltiSnips/ruby.snippets deleted file mode 100644 index 5b75722..0000000 --- a/.vim/UltiSnips/ruby.snippets +++ /dev/null @@ -1,3 +0,0 @@ -snippet bye "insert byebug" -require 'byebug'; byebug -endsnippet diff --git a/.vim/after/plugin/speeddating.vim b/.vim/after/plugin/speeddating.vim deleted file mode 100644 index da1f0e5..0000000 --- a/.vim/after/plugin/speeddating.vim +++ /dev/null @@ -1,34 +0,0 @@ -" https://gist.github.com/tpope/1290527 - -" In Vim, -4 % 3 == -1. Let's return 2 instead. -function! s:mod(a,b) - if (a:a < 0 && a:b > 0 || a:a > 0 && a:b < 0) && a:a % a:b != 0 - return (a:a % a:b) + a:b - else - return a:a % a:b - endif -endfunction - -let s:cycles = [ - \ ['true', 'false'], - \ ['TRUE', 'FALSE'], - \ ['True', 'False'], - \ ['on', 'off'], - \ ['ON', 'OFF'], - \ ['On', 'Off'], - \ ['yes', 'no'], - \ ['YES', 'NO'], - \ ['Yes', 'No']] - -function! KeywordIncrement(word, offset, increment) - for set in s:cycles - let index = index(set, a:word) - if index >= 0 - let index = s:mod(index + a:increment, len(set)) - return [set[index], -1] - endif - endfor -endfunction - -let s:handler = {'regexp': '\<\%('.join(map(copy(s:cycles),'join(v:val,"\\|")'),'\|').'\)\>', 'increment': function("KeywordIncrement")} -let g:speeddating_handlers += [s:handler] diff --git a/.vimrc b/.vimrc index 664658e..5b0f720 100644 --- a/.vimrc +++ b/.vimrc @@ -1,40 +1,16 @@ -" vimsy's .vimrc +" bare ~/.vimrc " +" This tries to make Vim as capable as possible without using any plugins. " Don't use abbreviations! Spelling things out makes grepping easy. -" After installing this .vimrc, run vim-update-bundles to install the -" plugins: https://github.com/bronson/vim-update-bundles - -" TODO: https://github.com/tpope/vim-sensible -" TODO: https://github.com/tpope/vim-sleuth set nocompatible filetype on " work around stupid osx bug filetype off - -" Use Vundle to manage runtime paths -"set rtp+=~/.vim/bundle/vundle/ -"call vundle#rc() -" Tell Vim to ignore BundleCommand until vundle supports it -"com! -nargs=? BundleCommand -"Bundle 'https://github.com/gmarik/vundle' - - -" stub out Vundle directives because we're using Pathogen -com! -nargs=? Bundle -com! -nargs=? BundleCommand -" or use Pathogen to manage runtime paths -Bundle 'tpope/vim-pathogen' -runtime bundle/vim-pathogen/autoload/pathogen.vim -call pathogen#infect() - - filetype indent plugin on syntax on -call yankstack#setup() " need to call before defining any yank/paste keybindings - set encoding=utf-8 fileencodings= " use utf8 by default set showcmd " show incomplete cmds down the bottom set showmode " show current mode down the bottom @@ -90,52 +66,31 @@ set shiftwidth=2 set softtabstop=2 set splitbelow " when splitting, cursor should stay in bottom window + " autocmd FileType ruby setlocal shiftwidth=2 softtabstop=2 " include ! and ? in Ruby method names so you can hit ^] on a.empty? +" TODO: is this necessary anymore? autocmd FileType ruby setlocal iskeyword+=!,? -" TODO? Turn on jquery syntax highlighting in jquery files -" autocmd BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery - -" TODO? save: marks from '10 files, "100 lines in each register -" :20 lines of command history, % the bufer list, and put it all in ~/.viminfo -" set viminfo='10,\"100,:20,%,n~/.viminfo - +" highlight rspec keywords properly +" modified from tpope and technicalpickles: https://gist.github.com/64635 +" TODO: is this needed anymore? +autocmd BufRead *_spec.rb syn keyword rubyRspec describe context it specify it_should_behave_like before after setup subject its shared_examples_for shared_context let +highlight def link rubyRspec Function -" fixes " Make the escape key bigger, keyboards move it all over. map imap -" Make kj exit insert mode, that's even easier. -" No, this is horrible. kj is typed a lot when defining a linewise visual selection, -" plus it delays 500msec every time you hit k to increase the selection upwards. Tedious! -" inoremap kj -" vnoremap kj -" redraws the screen and also turns off highlighting the current search -" NO, it conflicts with moving to different windows. -" nnoremap :nohlsearch - -" if you :e a file whose parent directories don't exist, run ":mk." -" HM, I don't like this. makes /m wait forever before returning results. -" http://stackoverflow.com/questions/4292733/vim-creating-parent-directories-on-save -" cnoremap mk. !mkdir -p =expand("%:h")/ +" if you :e a file whose parent directories don't exist, run ":Mk." command! Mk execute "!mkdir -p " . shellescape(expand('%:h'), 1) " .md files are markdown, not Modula-2 autocmd BufNewFile,BufReadPost *.md set filetype=markdown let g:markdown_fenced_languages = ['ruby', 'vim', 'c', 'css', 'coffee', 'html', 'javascript', 'perl', 'python', 'yaml', 'sh'] -" This command will allow us to save a file we don't have permission to save -" after we have already opened it. sudo :w! -cnoremap w!! w !sudo tee % >/dev/null - -" Scroll through the command history without leaving the home row -cnoremap -cnoremap - " Vim "Mistakes": @@ -184,289 +139,13 @@ autocmd BufWinEnter * if &buftype == 'quickfix' | setl wrap | endif autocmd BufWinEnter * if &buftype == 'quickfix' | map q :cclose | endif -" use Cmd-[ and Cmd-] to swtich panes, like iTerm2. -nmap :wincmd h -nmap :wincmd l - - -" highlight rspec keywords properly -" modified from tpope and technicalpickles: https://gist.github.com/64635 -autocmd BufRead *_spec.rb syn keyword rubyRspec describe context it specify it_should_behave_like before after setup subject its shared_examples_for shared_context let -highlight def link rubyRspec Function - - -" if no files specified, or a directory is specified, start with netrw showing -autocmd VimEnter * if !argc() | Explore | endif -autocmd VimEnter * if isdirectory(expand('')) | Explore | endif -" space e opens netrw on directory containing current file, space E opens root dir -nmap e :Explore! -nmap E :edit . - " Select most recent paste with gV (i.e. gV=) nmap gV `[v`] -" -" Plugins -" - runtime macros/matchit.vim " enable vim's built-in matchit script (make % bounce between tags, begin/end, etc) -" Text Manipulation: - -Bundle 'https://github.com/tpope/vim-commentary' -xmap Commentary -xmap Commentary -xmap Commentary -nmap CommentaryLine -nmap CommentaryLine -nmap CommentaryLine - -Bundle 'https://github.com/tpope/vim-surround' -Bundle 'https://github.com/tpope/vim-endwise' - -Bundle 'https://github.com/junegunn/vim-easy-align' -vmap (EasyAlign) -nmap a (EasyAlign) -" # aligns Ruby comments, d aligns C variable declarations -let g:easy_align_delimiters = { -\ '>': { 'pattern': '>>\|=>\|>' }, -\ '/': { 'pattern': '//\+\|/\*\|\*/', 'ignore_groups': ['String'] }, -\ '#': { 'pattern': '#\+', 'ignore_groups': ['String'], 'delimiter_align': 'l' }, -\ ']': { -\ 'pattern': '[[\]]', -\ 'left_margin': 0, -\ 'right_margin': 0, -\ 'stick_to_left': 0 -\ }, -\ ')': { -\ 'pattern': '[()]', -\ 'left_margin': 0, -\ 'right_margin': 0, -\ 'stick_to_left': 0 -\ }, -\ 'd': { -\ 'pattern': ' \(\S\+\s*[;=]\)\@=', -\ 'left_margin': 0, -\ 'right_margin': 0 -\ } -\ } - - -Bundle 'https://github.com/SirVer/ultisnips' -Bundle 'https://github.com/honza/vim-snippets' - - -" NO Bundle 'https://github.com/Valloric/YouCompleteMe' -" BundleCommand 'cd YouCompleteMe && git submodule update --init --recursive && ./install.sh --clang-completer' -" let g:ycm_collect_identifiers_from_tags_files = 1 -" let g:ycm_min_num_of_chars_for_completion = 1 - -" -- one attempt at getting YCM and US to play well together -" this kinda sucks (YCM should just allow return) but oh well -" let g:UltiSnipsExpandTrigger = "" -" let g:UltiSnipsJumpForwardTrigger = "" -" let g:UltiSnipsJumpBackwardTrigger = "" -" let g:ycm_key_list_select_completion=[] -" let g:ycm_key_list_previous_completion=[] - -" -- and the other attempt https://github.com/Valloric/YouCompleteMe/issues/36#issuecomment-46646204 -" let g:UltiSnipsExpandTrigger = "" -" let g:UltiSnipsJumpForwardTrigger = "" -" let g:UltiSnipsJumpBackwardTrigger = "" -" " let g:UltiSnipsSnippetDirectories = ["snips"] - -" function! g:UltiSnips_Complete() -" call UltiSnips#ExpandSnippet() -" if g:ulti_expand_res == 0 -" if pumvisible() -" return "\" -" else -" call UltiSnips#JumpForwards() -" if g:ulti_jump_forwards_res == 0 -" return "\" -" endif -" endif -" endif -" return "" -" endfunction - -" au InsertEnter * exec "inoremap " . g:UltiSnipsExpandTrigger . " =g:UltiSnips_Complete()" - - -" Navigation And Searching: - -Bundle 'https://github.com/kien/ctrlp.vim' -" caching continually gets completions wrong, even when I hit F5 -let g:ctrlp_use_caching = 0 -let g:ctrlp_match_window = 'min:4,max:72' -" search in .git/.hg if it exists, else the current working directory. -" (default is 'ra' which also searches in parent of current file, rarely -" what you want, especially if you're editing ~/.vimrc or browsing help) -let g:ctrlp_working_path_mode = 'r' -" use ag to generate ctrlp list since it obeys .gitignore -let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""' -nmap b :CtrlPBuffer - -" when browsing buffers, C-@ deletes the buffer or selected buffers -Bundle 'https://github.com/d11wtq/ctrlp_bdelete.vim' -call ctrlp_bdelete#init() - -Bundle 'https://github.com/rking/ag.vim' -set grepprg=ag\ --nogroup\ --nocolor -let g:agprg="ag --column --hidden" " --hidden lets ag search hidden files but ignore ~/.agignore -" hit K to do a recursive grep of the word under the cursor (probably no need, \* will do it better?) -nnoremap K :grep! "\b\b":cw - -Bundle 'https://github.com/tpope/vim-unimpaired' -" TODO: can yo and yO set `[ and `] so gV will select the area that was just pasted? -" control-arrows to move lines up and down -nmap [e -nmap ]e -vmap [egv -vmap ]egv - -Bundle 'https://github.com/majutsushi/tagbar' -nmap l :TagbarToggle - -Bundle 'https://github.com/bronson/vim-visual-star-search' -" use ag for recursive searching so we don't find 10,000 useless hits inside node_modules -nnoremap * :call ag#Ag('grep', '--literal ' . shellescape(expand(""))) -vnoremap * :call VisualStarSearchSet('/', 'raw'):call ag#Ag('grep', '--literal ' . shellescape(@/)) - - -" visual select an expression, hit + to expand selection, - to contract it -Bundle 'https://github.com/terryma/vim-expand-region' - - -" Utilities: - -Bundle 'https://github.com/bronson/vim-closebuffer' -Bundle 'https://github.com/vim-ruby/vim-ruby' -Bundle 'https://github.com/tpope/vim-rails' -Bundle 'https://github.com/tpope/vim-bundler' -Bundle 'https://github.com/tpope/vim-rake' -Bundle 'https://github.com/tpope/vim-vinegar' -Bundle 'https://github.com/tpope/vim-speeddating' -Bundle 'https://github.com/tpope/vim-projectionist' - - -Bundle 'https://github.com/vim-scripts/IndexedSearch' -Bundle 'https://github.com/maxbrunsfeld/vim-yankstack' -let g:yankstack_map_keys = 0 -nmap p yankstack_substitute_older_paste -nmap P yankstack_substitute_newer_paste - -Bundle 'https://github.com/sjl/gundo.vim' -Bundle 'https://github.com/tpope/vim-repeat' - -Bundle "https://github.com/editorconfig/editorconfig-vim" -" TODO: would I rather use https://github.com/tpope/vim-sleuth ? -Bundle 'https://github.com/Raimondi/YAIFA' -" verbosity=1 allows you to check YAIFA's results by running :messages -let g:yaifa_verbosity = 0 - -" Bundle: https://github.com/scrooloose/syntastic -let g:syntastic_check_on_open=1 -let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute \"ng-"] - -Bundle 'https://github.com/bronson/vim-toggle-wrap' - -Bundle 'https://github.com/sjl/clam.vim' -nnoremap ! :Clam -vnoremap ! :ClamVisual - - -" Running External Commands: - -Bundle 'https://github.com/tpope/vim-dispatch' " used by vim-rspec - -Bundle 'https://github.com/tpope/vim-fugitive' -" make :gs and :Gs pull up git status -cabbrev gs ((getcmdtype() == ':' && getcmdpos() <= 3) ? 'Gstatus' : 'gs') -command! Gs Gstatus - -Bundle 'https://github.com/bronson/vim-runtest' - -Bundle 'https://github.com/suan/vim-instant-markdown' - - -" Text Objects: - -" TODO: rewrite ruby-block-conv to use textobj-rubyblock -Bundle 'https://github.com/bronson/vim-ruby-block-conv' -Bundle 'https://github.com/glts/vim-textobj-comment' -Bundle 'https://github.com/kana/vim-textobj-user' -" Ruby text objects: ar, ir -Bundle 'https://github.com/nelstrom/vim-textobj-rubyblock' -" Paramter text objects (between parens and commas): a, / i, -Bundle 'https://github.com/sgur/vim-textobj-parameter' -" indent text objects: ai, ii, (include line below) aI, iI -" ai,ii work best for Python, aI,II work best for Ruby/C/Perl -Bundle 'https://github.com/michaeljsmith/vim-indent-object' -" ay,iy for the currently syntax highlighted item -Bundle 'https://github.com/kana/vim-textobj-syntax' -" av,iv for the variable segment (between _ or camelCase) -Bundle 'https://github.com/Julian/vim-textobj-variable-segment' -" au,iu for a url # TODO: make 'go' work on visual mode, and also on the mac, maybe use xolox/vim-misc -Bundle 'https://github.com/jceb/vim-textobj-uri' - - -" Syntax Files: - -Bundle 'https://github.com/bronson/Arduino-syntax-file' -Bundle 'https://github.com/pangloss/vim-javascript' -Bundle 'https://github.com/vim-scripts/jQuery' -Bundle 'https://github.com/tpope/vim-git' -Bundle 'https://github.com/kchmck/vim-coffee-script' -Bundle 'https://github.com/AndrewRadev/vim-eco' -Bundle 'https://github.com/ajf/puppet-vim' -Bundle 'https://github.com/groenewege/vim-less' -Bundle 'https://github.com/slim-template/vim-slim' - - -" Appearance: - -Bundle 'https://github.com/bling/vim-airline' -Bundle 'https://github.com/bronson/vim-crosshairs' -Bundle 'https://github.com/bronson/vim-trailing-whitespace' - - -" Color Schemes: - -Bundle 'https://github.com/tpope/vim-vividchalk' -Bundle 'https://github.com/wgibbs/vim-irblack' -Bundle 'https://github.com/altercation/vim-colors-solarized' -Bundle 'https://github.com/jgdavey/vim-railscasts' -Bundle 'https://github.com/vim-scripts/twilight' -Bundle 'https://github.com/chriskempson/base16-vim' -Bundle 'https://github.com/chriskempson/vim-tomorrow-theme' - - -" TODO: http://vimcasts.org/blog/2010/12/a-text-object-for-ruby-blocks/ -" TODO: a path textobject? vi/, va/ -" TODO: Bundle: https://github.com/hallettj/jslint.vim -" TODO: Bundle: https://github.com/ecomba/vim-ruby-refactoring -" TODO: Bundle: https://github.com/int3/vim-extradite -" TODO: Bundle: https://github.com/rson/vim-conque -" TODO: the only decent gdb frontend looks to be pyclewn? -" TODO: another bufclose, how did I not find this? https://github.com/vim-scripts/BufClose.vim - - -" from https://github.com/nelstrom/dotfiles/blob/448f710b855970a8565388c6665a96ddf4976f9f/vimrc -command! Path :call EchoPath() -function! EchoPath() - echo join(split(&path, ","), "\n") -endfunction - -command! TagFiles :call EchoTags() -function! EchoTags() - echo join(split(&tags, ","), "\n") -endfunction - - - " Random Personal Stuff: " hitting :MP will make and program the firmware command! MP make program @@ -476,9 +155,3 @@ command! MPP make program ENVIRONMENT=production " some goddamn plugin is messing this up? set textwidth=0 - - -" No need for https://github.com/yanick/environment/commit/2b06e50f8c700a4476e946562c3cae13556ef36c -" since unimpaired's [n and ]n navigate conflicts and d[n and d]n resolves them. -" (don't suppose there's a d]^n to interleave both...?) -