From 6266c5d32f9ff651fcfc3a4cc0c68e89da56ca65 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 11 Apr 2021 17:53:27 -0400 Subject: refactor(users/glittershark): Rename to grfn Rename my //users directory and all places that refer to glittershark to grfn, including nix references and documentation. This may require some extra attention inside of gerrit's database after it lands to allow me to actually push things. Change-Id: I4728b7ec2c60024392c1c1fa6e0d4a59b3e266fa Reviewed-on: https://cl.tvl.fyi/c/depot/+/2933 Tested-by: BuildkiteCI Reviewed-by: tazjin Reviewed-by: lukegb Reviewed-by: glittershark --- users/glittershark/system/home/modules/vimrc | 1121 -------------------------- 1 file changed, 1121 deletions(-) delete mode 100644 users/glittershark/system/home/modules/vimrc (limited to 'users/glittershark/system/home/modules/vimrc') diff --git a/users/glittershark/system/home/modules/vimrc b/users/glittershark/system/home/modules/vimrc deleted file mode 100644 index 3e33b5e2bee7..000000000000 --- a/users/glittershark/system/home/modules/vimrc +++ /dev/null @@ -1,1121 +0,0 @@ -" vim:set fdm=marker fmr={{{,}}} ts=2 sts=2 sw=2 expandtab: - - -" Basic Options {{{ -set nocompatible -set modeline -set modelines=10 -syntax enable -filetype plugin indent on -set ruler -set showcmd -set number -set incsearch -set smartcase -set ignorecase -set scrolloff=10 -set tabstop=4 -set shiftwidth=4 -set softtabstop=4 -set nosmartindent -set expandtab -set noerrorbells visualbell t_vb= -set laststatus=2 -set hidden -let mapleader = ',' -let maplocalleader = '\' -set undofile -" set undodir=~/.vim/undo -set wildignore=*.pyc,*.o,.git -set clipboard=unnamedplus -" set backupdir=$HOME/.vim/backup -" set directory=$HOME/.vim/tmp -set foldmarker={{{,}}} -set colorcolumn=+1 -set concealcursor= -set formatoptions+=j -set wildmenu -set wildmode=longest,list:full -set noincsearch -" }}} - -" GUI options {{{ -set go-=m -set go-=T -set go-=r -set go-=L -set go-=e -set guifont=Meslo\ LG\ S\ DZ\ 9 -" }}} - -" Colors {{{ -" set t_Co=256 - -fu! ReverseBackground() - if &bg=="light" - se bg=dark - else - se bg=light - endif -endf -com! BgToggle call ReverseBackground() -nm :BgToggle - -set background=light -colorscheme solarized -" }}} - -" --------------------------------------------------------------------------- - -" CtrlP {{{ -let g:ctrlp_custom_ignore = { - \ 'dir': '(node_modules|target)' - \ } -let g:ctrlp_max_files = 0 -let g:ctrlp_max_depth = 100 -" }}} - -" YouCompleteMe {{{ -let g:ycm_semantic_triggers = { - \ 'c' : ['->', '.'], - \ 'objc' : ['->', '.'], - \ 'ocaml' : ['.', '#'], - \ 'cpp,objcpp' : ['->', '.', '::'], - \ 'perl' : ['->'], - \ 'php' : ['->', '::'], - \ 'cs,java,javascript,d,python,perl6,scala,vb,elixir,go' : ['.'], - \ 'vim' : ['re![_a-zA-Z]+[_\w]*\.'], - \ 'lua' : ['.', ':'], - \ 'erlang' : [':'], - \ 'clojure' : [], - \ 'haskell' : ['re!.*', '.', ' ', '('] - \ } - " \ 'haskell' : ['.', '(', ' '] - " \ 'ruby' : ['.', '::'], - " \ 'clojure' : ['(', '.', '/', '['] -" }}} - -" Neocomplete {{{ -if !has('nvim') - " Use neocomplete. - let g:neocomplete#enable_at_startup = 1 - " Use smartcase. - let g:neocomplete#enable_smart_case = 1 - " Set minimum syntax keyword length. - let g:neocomplete#sources#syntax#min_keyword_length = 3 - let g:neocomplete#lock_buffer_name_pattern = '\*ku\*' - - " Define dictionary. - " let g:neocomplete#sources#dictionary#dictionaries = { - " \ 'default' : '', - " \ 'vimshell' : $HOME.'/.vimshell_hist', - " \ 'scheme' : $HOME.'/.gosh_completions' - " \ } - - " Define keyword. - if !exists('g:neocomplete#keyword_patterns') - let g:neocomplete#keyword_patterns = {} - endif - let g:neocomplete#keyword_patterns['default'] = '\h\w*' - - " Plugin key-mappings. - inoremap neocomplete#undo_completion() - inoremap neocomplete#complete_common_string() - - " Recommended key-mappings. - " : close popup and save indent. - inoremap =my_cr_function() - function! s:my_cr_function() - return (pumvisible() ? "\" : "" ) . "\" - " For no inserting key. - "return pumvisible() ? "\" : "\" - endfunction - " : completion. - inoremap pumvisible() ? "\" : "\" - " , : close popup and delete backword char. - inoremap neocomplete#smart_close_popup()."\" - inoremap neocomplete#smart_close_popup()."\" - " Close popup by . - "inoremap pumvisible() ? "\" : "\" - - " AutoComplPop like behavior. - "let g:neocomplete#enable_auto_select = 1 - - " Shell like behavior(not recommended). - "set completeopt+=longest - "let g:neocomplete#enable_auto_select = 1 - "let g:neocomplete#disable_auto_complete = 1 - "inoremap pumvisible() ? "\" : "\\" - - " Enable omni completion. - " autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS - " autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags - " autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS - " autocmd FileType python setlocal omnifunc=pythoncomplete#Complete - " autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags - - " Enable heavy omni completion. - if !exists('g:neocomplete#sources#omni#input_patterns') - let g:neocomplete#sources#omni#input_patterns = {} - endif -endif -" }}} - -" Deoplete {{{ -if has('nvim') - let g:deoplete#enable_at_startup = 1 - - inoremap =my_cr_function() - function! s:my_cr_function() - return (pumvisible() ? "\" : "" ) . "\" - " For no inserting key. - "return pumvisible() ? "\" : "\" - endfunction - " : completion. - inoremap pumvisible() ? "\" : "\" - inoremap pumvisible() ? "\" : "\" -endif -" }}} - -" Neovim Terminal mode {{{ -if has('nvim') - tnoremap - nnoremap \\ :tabedit term://zsh - nnoremap q\ :call OpenRepl() - - if !exists('g:repl_size') - let g:repl_size=9 - endif - - function! s:OpenRepl() " {{{ - " Check if buffer exists and is open - if exists('s:repl_bufname') && bufexists(s:repl_bufname) && bufwinnr(s:repl_bufname) >=? 0 - " If so, just switch to it - execute bufwinnr(s:repl_bufname) . 'wincmd' 'w' - norm i - return - endif - - if !exists('b:console') - let b:console=$SHELL - endif - - let l:console_cmd = b:console - - execute 'bot' g:repl_size . 'new' - set winfixheight nobuflisted - call termopen(l:console_cmd) - let s:repl_bufname = bufname('%') - norm i - endfunction " }}} -endif -" }}} - -" Tagbar options {{{ -let g:tagbar_autoclose = 1 -let g:tagbar_autofocus = 1 -let g:tagbar_compact = 1 -" }}} - -" delimitMate options {{{ -let g:delimitMate_expand_cr = 1 -" }}} - -" UltiSnips options {{{ -let g:UltiSnipsExpandTrigger = '' - "g:UltiSnipsJumpForwardTrigger - "g:UltiSnipsJumpBackwardTrigger -" }}} - -" VDebug Options {{{ -let g:vdebug_options = {'server': '192.168.56.1'} -" }}} - -" Statusline {{{ -let g:airline_powerline_fonts=1 - -if !exists('g:airline_symbols') - let g:airline_symbols = {} -endif -let g:airline_symbols.space = "\ua0" - -let g:airline#extensions#tagbar#flags = 'f' -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#tabline#show_buffers = 0 -let g:airline#extensions#tabline#show_tabs = 1 -let g:airline#extensions#tabline#tab_min_count = 2 -let g:airline#extensions#tmuxline#enabled = 0 - -let g:tmuxline_theme = 'airline' -let g:tmuxline_preset = 'full' - -"set statusline= -"set statusline+=%2*[%n%H%M%R%W]%*\ " flags and buf no -"set statusline+=%-40f%<\ " path -"set statusline+=%=%40{fugitive#statusline()}\ " Vim status -"set statusline+=%1*%y%*%*\ " file type -"set statusline+=%10((%l,%c)%)\ " line and column -"set statusline+=%P " percentage of file -" }}} - -" Code review mode {{{ -fun! GetFontName() - return substitute(&guifont, '^\(.\{-}\)[0-9]*$', '\1', '') -endfun - -fun! CodeReviewMode() - let &guifont = GetFontName() . ' 15' -endfun -com! CodeReviewMode call CodeReviewMode() -" }}} - -" Syntastic {{{ -let g:syntastic_enable_signs = 0 - -" Python {{{ -let g:syntastic_python_checkers = ['flake8'] -let g:syntastic_python_flake8_post_args = "--ignore=E101,E223,E224,E301,E302,E303,E501,E701,W,F401,E111,E261" - -" }}} -" Javascript {{{ -let g:syntastic_javascript_checkers = ['eslint'] -let g:flow#autoclose = 1 -let g:flow#enable = 1 - -" augroup syntastic_javascript_jsx -" autocmd! -" autocmd BufReadPre,BufNewFile *.js -" autocmd BufReadPre,BufNewFile *.jsx -" \ let g:syntastic_javascript_checkers = ['jsxhint'] -" augroup END - -" }}} -" Haml {{{ -let g:syntastic_haml_checkers = ['haml_lint'] - -" }}} -" Html {{{ -let g:syntastic_html_checkers = [] - -" }}} -" Ruby {{{ -let g:syntastic_ruby_checkers = ['rubocop'] -" }}} -" SASS/SCSS {{{ -let g:syntastic_scss_checkers = ['scss_lint'] -" }}} -" Haskell {{{ -" let g:syntastic_haskell_checkers = ['ghc-mod'] -" }}} -" Elixir {{{ -let g:syntastic_elixir_checkers = ['elixir'] -let g:syntastic_enable_elixir_checker = 1 -" }}} -" }}} - -" Bufferline {{{ -let g:bufferline_echo=0 -" }}} - -" Eclim {{{ -let g:EclimCompletionMethod = 'omnifunc' -augroup eclim - au! - au FileType java call JavaSetup() - au FileType java set textwidth=120 -augroup END - -function! s:JavaSetup() abort - noremap :JavaImport - nnoremap K :JavaDocPreview - nnoremap ]d :JavaSearchContext - nnoremap [d :JavaSearchContext - nnoremap g :JUnit - nnoremap g\ :Mvn test -endfunction -" }}} - -" Signify options {{{ -let g:signify_mapping_next_hunk = ']h' -let g:signify_mapping_prev_hunk = '[h' -let g:signify_vcs_list = ['git'] -let g:signify_sign_change = '~' -let g:signify_sign_delete = '-' -" }}} - -" Simplenote {{{ -let g:SimplenoteFiletype = 'markdown' -let g:SimplenoteSortOrder = 'pinned,modifydate,tagged,createdate' -let g:SimplenoteVertical = 1 - -nnoremap nn :Simplenote -n -nnoremap nl :Simplenote -l -nnoremap nw :Simplenote -l work -nnoremap nt :Simplenote -t -" }}} - -" Emmet {{{ -" Expand abbreviation -let g:user_emmet_leader_key = '' -" }}} - -" Startify {{{ -let g:startify_bookmarks=[ '~/.vimrc', '~/.zshrc' ] -" }}} - -" Abolish {{{ -let g:abolish_save_file = expand('~/.vim/after/plugin/abolish.vim') -" }}} - -" Rails projections {{{ - -if !exists('g:rails_projections') - let g:rails_projections = {} -endif - -call extend(g:rails_projections, { - \ "config/routes.rb": { "command": "routes" }, - \ "config/structure.sql": { "command": "structure" } - \ }, 'keep') - -if !exists('g:rails_gem_projections') - let g:rails_gem_projections = {} -endif - -call extend(g:rails_gem_projections, { - \ "active_model_serializers": { - \ "app/serializers/*_serializer.rb": { - \ "command": "serializer", - \ "template": "class %SSerializer < ActiveModel::Serializer\nend", - \ "affinity": "model"}}, - \ "react-rails": { - \ "app/assets/javascripts/components/*.jsx": { - \ "command": "component", - \ "template": "var %S = window.%S = React.createClass({\n render: function() {\n }\n});", - \ "alternate": "spec/javascripts/components/%s_spec.jsx" }, - \ "spec/javascripts/components/*_spec.jsx": { - \ "alternate": "app/assets/javascripts/components/{}.jsx" }}, - \ "rspec": { - \ "spec/**/support/*.rb": { - \ "command": "support"}}, - \ "cucumber": { - \ "features/*.feature": { - \ "command": "feature", - \ "template": "Feature: %h"}, - \ "features/support/*.rb": { - \ "command": "support"}, - \ "features/support/env.rb": { - \ "command": "support"}, - \ "features/step_definitions/*_steps.rb": { - \ "command": "steps"}}, - \ "carrierwave": { - \ "app/uploaders/*_uploader.rb": { - \ "command": "uploader", - \ "template": "class %SUploader < CarrierWave::Uploader::Base\nend"}}, - \ "draper": { - \ "app/decorators/*_decorator.rb": { - \ "command": "decorator", - \ "affinity": "model", - \ "template": "class %SDecorator < Draper::Decorator\nend"}}, - \ "fabrication": { - \ "spec/fabricators/*_fabricator.rb": { - \ "command": ["fabricator", "factory"], - \ "alternate": "app/models/%s.rb", - \ "related": "db/schema.rb#%p", - \ "test": "spec/models/%s_spec.rb", - \ "template": "Fabricator :%s do\nend", - \ "affinity": "model"}}, - \ "factory_girl": { - \ "spec/factories/*.rb": { - \ "command": "factory", - \ "alternate": "app/models/%i.rb", - \ "related": "db/structure.sql#%s", - \ "test": "spec/models/%s_spec.rb", - \ "template": "FactoryGirl.define do\n factory :%i do\n end\nend", - \ "affinity": "model"}, - \ "spec/factories.rb": { - \ "command": "factory"}, - \ "test/factories.rb": { - \ "command": "factory"}} - \ }, 'keep') -" }}} - -" Other projections {{{ -let g:projectionist_heuristics = { - \ "config.ru&docker-compose.yml&app/&config/&OWNERS": { - \ "app/jobs/*.rb": { - \ "type": "job", - \ "alternate": "spec/jobs/{}_spec.rb" - \ }, - \ "app/models/*.rb": { - \ "type": "model", - \ "alternate": "spec/models/{}_spec.rb" - \ }, - \ "app/resources/*_resource.rb": { - \ "type": "resource", - \ "alternate": "spec/resources/{}_resource_spec.rb" - \ }, - \ "config/*.yml": { - \ "type": "config" - \ }, - \ "spec/*_spec.rb": { - \ "type": "spec", - \ "alternate": "app/{}.rb" - \ }, - \ "spec/factories/*.rb": { - \ "type": "factory", - \ } - \ }, - \ "svc-gateway.cabal": { - \ "src/*.hs": { - \ "type": "src", - \ "alternate": "test/{}Spec.hs" - \ }, - \ "test/*Spec.hs": { - \ "type": "spec", - \ "alternate": "src/{}.hs", - \ "template": [ - \ "module Gateway.Resource.HierarchySpec (main, spec) where", - \ "", - \ "import Prelude", - \ "import Test.Hspec", - \ "import Data.Aeson", - \ "", - \ "import Gateway.Resource.Hierarchy", - \ "", - \ "main :: IO ()", - \ "main = hspec spec", - \ "", - \ "spec :: Spec", - \ "spec = do", - \ " describe \"something\" $ undefined" - \ ] - \ }, - \ "svc-gateway.cabal": { - \ "type": "cabal" - \ } - \ }, - \ "package.json&.flowconfig": { - \ "src/*.*": { - \ "type": "src", - \ "alternate": "test/{}_spec.js" - \ } - \ }, - \ "pom.xml&src/main/clj/|src/main/cljs": { - \ "*": { - \ "start": "USE_NREPL=1 bin/run -m elephant.dev-system" , - \ "connect": "nrepl://localhost:5554", - \ "piggieback": "(figwheel-sidecar.repl-api/repl-env)" - \ }, - \ "pom.xml": { "type": "pom" }, - \ "src/main/clj/*.clj": { - \ "alternate": "src/test/clj/{}_test.clj", - \ "template": ["(ns {dot|hyphenate})"] - \ }, - \ "src/test/clj/*_test.clj": { - \ "alternate": "src/main/clj/{}.clj", - \ "dispatch": ":RunTests {dot|hyphenate}-test", - \ "template": ["(ns {dot|hyphenate}-test", - \ " (:require [clojure.test :refer :all]))"] - \ }, - \ "src/main/cljs/*.cljs": { - \ "alternate": "src/test/cljs/{}_test.cljs" - \ }, - \ "src/main/cljs/*_test.cljs": { - \ "alternate": "src/main/cljs/{}.cljs", - \ "dispatch": ":RunTests {dot|hyphenate}-test" - \ }, - \ "src/main/clj/*.cljc": { - \ "alternate": "src/test/clj/{}_test.cljc" - \ }, - \ "src/main/clj/*_test.cljc": { - \ "alternate": "src/test/clj/{}.cljc", - \ "dispatch": ":RunTests {dot|hyphenate}-test" - \ } - \ }} -" }}} - -" AutoPairs {{{ -let g:AutoPairsCenterLine = 0 -" }}} - -" Filetypes {{{ - -" Python {{{ -aug Python - au! - au FileType python set tabstop=4 shiftwidth=4 softtabstop=4 expandtab -aug END -let g:python_highlight_all=1 -" }}} - -" PHP {{{ -aug PHP - au! - "au FileType php setlocal fdm=marker fmr={{{,}}} -aug END " }}} - -" Mail {{{ -aug Mail - au FileType mail setlocal spell -aug END " }}} - -" Haskell {{{ -let g:haskell_conceal_wide = 1 -let g:haskellmode_completion_ghc = 0 -let g:necoghc_enable_detailed_browse = 1 - -augroup Haskell - autocmd! - autocmd FileType haskell setlocal textwidth=110 shiftwidth=2 - autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc - autocmd FileType haskell call HaskellSetup() - autocmd FileType haskell setlocal keywordprg=hoogle\ -cie -augroup END - -function! s:HaskellSetup() - set sw=4 - " compiler cabal - " let b:start='cabal run' - " let b:console='cabal repl' - " let b:dispatch='cabal test' - compiler stack - let b:start='stack run' - let b:console='stack ghci' - let b:dispatch='stack test' - nnoremap gy :HdevtoolsType - nnoremap yu :HdevtoolsClear -endfunction -" }}} - -" Ruby {{{ - -function! s:RSpecSyntax() - syn keyword rspecMethod describe context it its specify shared_context - \ shared_examples shared_examples_for shared_context include_examples - \ include_context it_should_behave_like it_behaves_like before after - \ around fixtures controller_name helper_name scenario feature - \ background given described_class - syn match rspecMethod '\!\=' - syn match rspecMethod '\!\=' - syn keyword rspecMethod violated pending expect expect_any_instance_of allow - \ allow_any_instance_of double instance_double mock mock_model - \ stub_model xit - syn match rspecMethod '\.\@!\@!' - - call s:RSpecHiDefaults() -endfunction - -function! s:RSpecHiDefaults() - hi def link rspecMethod rubyFunction -endfunction - -augroup Ruby - au! - " au FileType ruby let b:surround_114 = "\\(module|class,def,if,unless,case,while,until,begin,do) \r end" - " au FileType ruby set fdm=syntax - au FileType ruby set tw=110 - au FileType ruby set omnifunc= - au FileType ruby nnoremap gy orequire 'pry'; binding.pry^ - au FileType ruby nnoremap gY Orequire 'pry'; binding.pry^ - au FileType ruby nnoremap yu :g/require 'pry'; binding.pry/d - au BufNewFile,BufRead *_spec.rb call RSpecSyntax() -augroup END - -let ruby_operators = 1 -let ruby_space_errors = 1 - -let g:rubycomplete_rails = 1 -command! -range ConvertHashSyntax ,s/:(\S{-})(\s{-})=> /\1:\2/ -" }}} - -" Clojure {{{ - -aug Clojure - au! - autocmd FileType clojure nnoremap :Slamhound - autocmd FileType clojure nnoremap gr :w Require e - let g:clojure_align_multiline_strings = 1 - let g:clojure_fuzzy_indent_patterns = - \ ['^with', '^def', '^let', '^fact'] - let g:clojure_special_indent_words = - \ 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn,html' - - autocmd FileType clojure setlocal textwidth=80 - autocmd FileType clojure setlocal lispwords+=GET,POST,PATCH,PUT,DELETE | - \ setlocal lispwords+=context,select - autocmd BufNewFile,BufReadPost *.cljx setfiletype clojure - autocmd BufNewFile,BufReadPost *.cljx setlocal omnifunc= - autocmd BufNewFile,BufReadPost *.cljs setlocal omnifunc= - autocmd FileType clojure call TangentInit() - autocmd FileType clojure call sexp_mappings() - autocmd BufRead *.cljc ClojureHighlightReferences - autocmd FileType clojure let b:AutoPairs = { - \ '"': '"', - \ '{': '}', - \ '(': ')', - \ '[': ']'} - " Don't auto-pair quote reader macros - " \'`': '`', - " \ '''': '''', - - autocmd User ProjectionistActivate call s:projectionist_connect() - - function! s:projectionist_connect() abort - let connected = !empty(fireplace#path()) - if !connected - for [root, value] in projectionist#query('connect') - try - silent execute "FireplaceConnect" value root - let connected = 1 - break - catch /.*Connection refused.*/ - endtry - endfor - endif - - " if connected && exists(':Piggieback') - " for [root, value] in projectionist#query('piggieback') - " silent execute "Piggieback" value - " break - " endfor - " endif - endfunction - - " autocmd BufNewFile,BufReadPost *.cljx setlocal omnifunc= - " autocmd BufNewFile,BufReadPost *.cljs setlocal omnifunc= - - autocmd FileType clojure let b:console='lein repl' - autocmd FileType clojure call ClojureMaps() - - function! s:ClojureMaps() abort - nnoremap [m :call search('^(def', 'Wzb') - nnoremap ]m :call search('^(def', 'Wz') - endfunction - - command! Scratch call OpenScratch() - autocmd FileType clojure nnoremap \s :Scratch - - let g:scratch_buffer_name = 'SCRATCH' - - function! s:OpenScratch() - if bufwinnr(g:scratch_buffer_name) > 0 - execute bufwinnr(g:scratch_buffer_name) . 'wincmd' 'w' - return - endif - - vsplit SCRATCH - set buftype=nofile - set filetype=clojure - let b:scratch = 1 - endfunction -aug END - -function! s:sexp_mappings() abort - if !exists('g:sexp_loaded') - return - endif - - nmap cfo (sexp_raise_list) - nmap cfO (sexp_raise_element) - nmap cfe (sexp_raise_element) -endfunction - -function! s:TangentInit() abort - set textwidth=80 - command! TReset call fireplace#session_eval('(user/reset)') - command! TGo call fireplace#session_eval('(user/go)') - command! TMigrate call fireplace#session_eval('(user/migrate)') - command! TRollback call fireplace#session_eval('(user/rollback)') - nnoremap g\ :TReset -endfunction - -" }}} - -" Go {{{ - -let g:go_highlight_functions = 1 -let g:go_highlight_methods = 1 -let g:go_highlight_structs = 1 -let g:go_highlight_operators = 1 -let g:go_highlight_build_constraints = 1 - -augroup Go - autocmd! - autocmd FileType go setlocal omnifunc=go#complete#Complete - autocmd FileType go setlocal foldmethod=syntax - autocmd FileType go setlocal foldlevel=100 - autocmd FileType go nnoremap :GoTest - autocmd FileType go inoremap :GoTesti -augroup END - -" }}} - -" RAML {{{ - -function! s:buffer_syntax() " {{{ - syn keyword ramlRAML RAML contained - syn match ramlVersionString '^#%RAML \d\.\d' contains=ramlRAML -endfunction " }}} - -augroup RAML - autocmd! - autocmd BufRead,BufNewFile *.raml set filetype=yaml - autocmd BufRead,BufNewFile *.raml call s:buffer_syntax() -augroup END - -hi def link ramlVersionString Special -hi def link ramlRAML Error -" }}} - -" Mustache/Handlebars {{{ -let g:mustache_abbreviations = 1 -" }}} - -" Netrw {{{ -augroup netrw - autocmd! - autocmd FileType netrw nnoremap Q :Rexplore - - " Hee hee, oil and vinegar - function! s:setup_oil() abort - nnoremap q - xnoremap q - endfunction -augroup END -" }}} -" }}} - -" Remove trailing whitespace {{{ -fun! StripTrailingWhitespaces() - let l = line(".") - let c = col(".") - %s/\s\+$//e - call cursor(l, c) -endfun - -augroup striptrailingwhitespaces " {{{ -autocmd FileType c,cpp,java,php,ruby,python,sql,javascript,sh,jst,less,haskell,haml,coffee,scss,clojure,objc,elixir,yaml,json,eruby - \ autocmd BufWritePre :call StripTrailingWhitespaces() -augroup END " }}} - -" }}} - -" Goyo {{{ -let g:limelight_conceal_ctermfg = "10" -let g:limelight_conceal_guifg = "#586e75" -autocmd! User GoyoEnter Limelight -autocmd! User GoyoLeave Limelight! -" }}} - -"----------------------------------------------------------------------------- - -" Commands {{{ - -" Edit temporary SQL files {{{ -let s:curr_sql = 0 -fun! EditSqlTempFile() - let l:fname = '/tmp/q' . s:curr_sql . '.sql' - execute 'edit' l:fname - let s:curr_sql = s:curr_sql + 1 -endfun -com! EditSqlTempFile call EditSqlTempFile() -" }}} - -" Double Indentation -command! -range DoubleIndentation ,s/^\(\s.\{-}\)\(\S\)/\1\1\2/ - -" Quick-and-dirty fix capitalization of sql files -command! -range FixSqlCapitalization ,v/\v(^\s*--.*$)|(TG_)/norm guu - -" VimPipe Commands {{{ -" let g:sql_type_default = 'pgsql' -command! SqlLive let b:vimpipe_command="vagrant ssh -c '~/mysql'" -command! SqlRails let b:vimpipe_command="bin/rails dbconsole" -command! SqlHeroku let b:vimpipe_command="heroku pg:psql" -command! SqlEntities let b:vimpipe_command="psql -h 127.1 entities nomi" -command! SqlUsers let b:vimpipe_command="psql -h 127.1 users nomi" -command! SqlTangent let b:vimpipe_command="psql -h local.docker tangent super" -" }}} - -" Git commands {{{ -command! -nargs=* Gpf Gpush -f -command! -nargs=* Gcv Gcommit --verbose -" }}} - -" Focus dispatch to only the last failures -command! -nargs=* FocusFailures FocusDispatch rspec --only-failures - -" }}} - -" Autocommands {{{ - -augroup fugitive " {{{ - au! - autocmd BufNewFile,BufRead fugitive://* set bufhidden=delete -augroup END " }}} - -augroup omni " {{{ - au! - " autocmd FileType javascript setlocal omnifunc=tern#Complete - "autocmd FileType python setlocal omnifunc=pythoncomplete#Complete - autocmd FileType php setlocal omnifunc= -augroup END " }}} - -augroup sql " {{{ - au! - autocmd FileType sql let b:vimpipe_command="psql -h 127.0.0.1 landlordsny_development landlordsny" - autocmd FileType sql let b:vimpipe_filetype="postgresql" - autocmd FileType sql set syntax=postgresql - autocmd FileType postgresql set nowrap - autocmd BufNewFile,BufReadPost *.sql set syntax=pgsql -augroup END " }}} - -augroup markdown " {{{ - au! - autocmd FileType markdown let b:vimpipe_command='markdown' - autocmd FileType markdown let b:vimpipe_filetype='html' - autocmd FileType markdown set tw=80 -augroup END " }}} - -augroup typescript " {{{ - au! - autocmd FileType typescript let b:vimpipe_command='tsc' - autocmd FileType typescript let b:vimpipe_filetype='javascript' - autocmd FileType typescript TSSstarthere - autocmd FileType typescript nnoremap gd :TSSdef -augroup END " }}} - -augroup jsx " {{{ - au! - " autocmd FileType jsx set syntax=javascript - autocmd FileType javascript set filetype=javascript.jsx -augroup END " }}} - -augroup nicefoldmethod " {{{ - au! - " Don't screw up folds when inserting text that might affect them, until - " leaving insert mode. Foldmethod is local to the window. Protect against - " screwing up folding when switching between windows. - autocmd InsertEnter * - \ if !exists('w:last_fdm') | - \ let w:last_fdm=&foldmethod | - \ setlocal foldmethod=manual | - \ endif - autocmd InsertLeave,WinLeave * - \ if exists('w:last_fdm') | - \ let &l:foldmethod=w:last_fdm | - \ unlet w:last_fdm | - \ endif -augroup END " }}} - -augroup visualbell " {{{ - au! - autocmd GUIEnter * set visualbell t_vb= -augroup END -" }}} - -augroup quickfix " {{{ - au! - autocmd QuickFixCmdPost grep cwindow -augroup END " }}} - -augroup php " {{{ - au! -augroup END "}}} - -augroup rubylang " {{{ - au! - autocmd FileType ruby compiler rake -augroup END " }}} - -augroup javascript "{{{ - au! - autocmd FileType javascript let &errorformat = - \ '%E%.%#%n) %s:,' . - \ '%C%.%#Error: %m,' . - \ '%C%.%#at %s (%f:%l:%c),' . - \ '%Z%.%#at %s (%f:%l:%c),' . - \ '%-G%.%#,' -augroup END " }}} - -augroup git " {{{ - autocmd! - autocmd FileType gitcommit set textwidth=72 -augroup END -" }}} -" }}} - -" Leader commands {{{ - -" Edit specific files {{{ -nnoremap ev :split $MYVIMRC -nnoremap eb :split ~/.vim_bundles -nnoremap es :UltiSnipsEdit -nnoremap ea :split ~/.vim/after/plugin/abolish.vim - -nnoremap sv :so $MYVIMRC -nnoremap sb :so ~/.vim_bundles -nnoremap sa :so ~/.vim/after/plugin/abolish.vim - -nnoremap el :EditSqlTempFile -" }}} - -" Toggle navigation panels {{{ -nnoremap l :TagbarToggle -nnoremap mb :MBEToggle -nnoremap u :GundoToggle - -nnoremap t :CtrlP -nnoremap z :FZF -nnoremap b :CtrlPBuffer -nnoremap a :CtrlPTag -nnoremap r :CtrlPGitBranch -" }}} - -" CtrlP {{{ -let g:ctrlp_custom_ignore = { - \ 'dir': 'node_modules', - \ } -" }}} - -" Git leader commands {{{ -noremap g :Git -noremap gu :Gpull -noremap gp :Gpush -noremap s :Gstatus -noremap cv :Gcommit --verbose -noremap ca :Gcommit --verbose --amend - -nnoremap dl :diffg LOCAL -nnoremap dr :diffg REMOTE -nnoremap db :diffg BASE -nnoremap du :diffu -nnoremap dg :diffg - -nnoremap d2 :diffg //2:diffu -nnoremap d3 :diffg //3:diffu - -nnoremap yt :SignifyToggle -" }}} - -" Breakpoint Leader Commands {{{ -nnoremap x :Breakpoint -nnoremap dx :BreakpointRemove * -" }}} - -" Tabularize {{{ - " Leader Commands {{{ - nnoremap t= :Tabularize /= - vmap t= :Tabularize /= - - nnoremap t> :Tabularize /=> - vmap t> :Tabularize /=> - " }}} - - " => Aligning {{{ - function! s:rocketalign() - let l:p = '^.*=>\s.*$' - echo l:p - if exists(':Tabularize') && getline('.') =~# '^.*=' && - \ (getline(line('.')-1) =~# l:p || getline(line('.')+1) =~# l:p) - let column = strlen(substitute(getline('.')[0:col('.')],'[^=>]','','g')) - let position = strlen(matchstr(getline('.')[0:col('.')],'.*=>\s*\zs.*')) - Tabularize/=>/l1 - normal! $ - call search(repeat('[^=>]*=>',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) - endif - endfunction - "inoremap => =>:call rocketalign()a - " }}} - - " = Aligning {{{ - function! s:eqalign() - let l:p = '^.*=\s.*$' - if exists(':Tabularize') && getline('.') =~# '^.*=' && - \ (getline(line('.')-1) =~# l:p || getline(line('.')+1) =~# l:p) - let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g')) - let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*')) - Tabularize/=/l1 - normal! $ - call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) - endif - endfunction - "inoremap = =:call eqalign()a - " }}} - - " : Aligning {{{ - function! s:colonalign() - let l:p : '^.*:\s.*$' - if exists(':Tabularize') && getline('.') :~# '^.*:' && - \ (getline(line('.')-1) :~# l:p || getline(line('.')+1) :~# l:p) - let column : strlen(substitute(getline('.')[0:col('.')],'[^:]','','g')) - let position : strlen(matchstr(getline('.')[0:col('.')],'.*:\s*\zs.*')) - Tabularize/:/l1 - normal! $ - call search(repeat('[^:]*:',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) - endif - endfunction - "inoremap : ::call colonalign()a - " }}} -" }}} - -" }}} - -" Mappings {{{ -" 'delete current' -nnoremap dc 0d$ -nnoremap com :silent !tmux set status -nnoremap :Make -nnoremap g :Dispatch -nnoremap g\ :Start -inoremap :Makei - -" Navigate buffers {{{ -nnoremap gb :bn -nnoremap gB :bp -" }}} - -" Window Navigation {{{ -nnoremap w -nnoremap h h -nnoremap j j -nnoremap k k -nnoremap l l -nnoremap z z -" }}} - - -" Sort with motion {{{ -if !exists("g:sort_motion_flags") - let g:sort_motion_flags = "" -endif -function! s:sort_motion(mode) abort - if a:mode == 'line' - execute "'[,']sort " . g:sort_motion_flags - elseif a:mode == 'char' - execute "normal! `[v`]y" - let sorted = join(sort(split(@@, ', ')), ', ') - execute "normal! v`]c" . sorted - elseif a:mode == 'V' || a:mode == '' - execute "'<,'>sort " . g:sort_motion_flags - endif -endfunction - -function! s:sort_lines() - let beginning = line('.') - let end = v:count + beginning - 1 - execute beginning . ',' . end . 'sort' -endfunction - -xnoremap SortMotionVisual :call sort_motion(visualmode()) -nnoremap SortMotion :set opfunc=sort_motiong@ -nnoremap SortLines :call sort_lines() - -map go SortMotion -vmap go SortMotionVisual -map goo SortLines -" }}} -" }}} - -let g:hare_executable = 'cabal exec -- ghc-hare' -- cgit 1.4.1