if has('python3') silent! python3 1 endif " Vimscript basic setup " ------------------------------------------------------- {{{ """"""""""""""""""Some very basic setup""""""""""""""""""""""""""""""""""""""""" set nocompatible " be improved set noswapfile " Tyler says: "don't create annoying swap files" set nobackup " Tyler says: "they did this in the 70's" set history=1000 set undolevels=1000 set wildmenu " Tyler says: "make command-line completion better" set wildmode=list:longest " Tyler says: "list all matches" set mousemodel=popup let mapleader = "," set shell=bash set tabstop=2 set autoindent set expandtab set shiftwidth=2 set softtabstop=2 " 2017-02-16 jes - Added rnu/insert options set relativenumber set number augroup auNumbering autocmd! auNumbering autocmd InsertEnter * :set number norelativenumber autocmd InsertLeave * :set relativenumber augroup end set showmatch set hls set ic set ruler set laststatus=2 set incsearch set hlsearch set ignorecase set smartcase syntax enable " Added 2019-10-18 to resolve filetype failures? " https://superuser.com/questions/68226/filetype-detection-not-working filetype off filetype plugin indent on filetype plugin on " Change how new split windows are opened set splitright set splitbelow " }}} set linebreak set lazyredraw " Local/project abbreviations inoremap ,dc DuplicateContacts inoremap .dc DuplicateContacts " Scroll viewport up/down (forward/back) as for and nnoremap b nnoremap f nnoremap 0 nnoremap $ inoremap 0i inoremap A inoremap inoremap """ Allow quick move to beginning of command line cnoremap noremap ,,ev :tabnew:e $MYVIMRC noremap ,,sv :source $MYVIMRC inoremap ,jj nnoremap ,jj " These for errors while still in input mode inoremap jjj inoremap kkk inoremap hhh inoremap lll " May get rid of this one? 2018-11-15 inoremap nnoremap ,ntt :NERDTreeToggle inoremap ,ntt :NERDTreeToggle " Brew vim now compiled without conceal!!! " Causes ^G in front of all nerdtree lines " let g:NERDTreeNodeDelimiter = "\u00a0" " Quick search for conflict markers nnoremap ,< /<<<<< nnoremap ,cs /<<<<< nnoremap ,cf />>>>> nnoremap ,cmid /===== " TODO: Need an 'undo' for this function! WordProcessorMode() " Setup for writers setlocal formatoptions=1 setlocal noexpandtab map j gj map k gk setlocal spell spelllang=en_us " set thesaurus+=/Users/jseidel/.dotfiles/.vim/thesaurus/mthesaur.txt set complete+=s set formatprg=par setlocal wrap setlocal linebreak endfunction com! WP call WordProcessorMode() function! WordProcessorModeOff() unmap j unmap k set formatprg= set complete-=s set thesaurus= setlocal nospell endfunction command! NOWP call WordProcessorModeOff() " dynamic current window sizing from TBot Art of Vim set winheight=9 set winminheight=3 let &winheight = &lines - 9 set winwidth=41 silent! set winminwidth=40 let &winwidth = &columns - 40 " switch between dynamic and equal sizing nnoremap ,we :let &winwidth = &columns / 2 nnoremap ,wd :let &winwidth = &columns - 40 " Widen/narrow windows quickly nnoremap ,ww 65> nnoremap ,wn 65< nnoremap ,whh 25+ nnoremap ,whn 25- set virtualedit=block " Experimental """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """BEGIN""""""""""" VimPlug setup """"""""""""""""""""""""""""""""""""""""""""" if empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif call plug#begin('~/.vim/bundle') " my bundles here: " original repos on github " Cannot reliably use a file repo with changes; get git errors such as: " Plug 'benmills/vimux' " Plug 'lervag/vimtex' " LaTex plugin" " Plug 'http://www.vim.org/scripts/script.php?script_id=491' " Plug 'kaichen/vim-snipmate-ruby-snippets.git' " Plug 'msanders/snipmate.vim' " Plug 'https://github.com/ervandew/supertab' " Plug 'https://github.com/Shougo/neocomplete.vim' " -- Plug 'ashisha/image.vim' ASCII display only; use for photos only " -- Plug 'Chiel92/vim-autoformat' !!! Do not reinstate - Blows indent command " How to include a local plugin " Plug 'file://'.expand('~/dev/ale') "--BEGIN---------- Experimental Plugs ------------------ "---Yet to be tried... " Plug 'reedes/vim-pencil' " Plug 'ervandew/supertab' " Plug 'AndrewRadev/linediff.vim' " Plug 'posva/vim-vue' " Plug 'jceb/vim-orgmode' " Plug 'tpope/vim-speeddating' " Plug 'dbatten5/vim-macroscope' "--END------------ Experimental Plugs ----------------- " Plug 'airblade/vim-gitgutter' " Plug 'christoomey/vim-conflicted' " Plug 'christoomey/vim-sort-motion' " Plug 'christoomey/vim-system-copy' " Plug 'christoomey/vim-titlecase' " Plug 'christoomey/vim-tmux-navigator' " Plug 'christoomey/vim-tmux-runner' " Plug 'Clavelito/indent-sh.vim' " Plug 'ctrlpvim/ctrlp.vim' " Plug 'file:///$HOME/dev/snipmate.vim' " Plug 'file:///$HOME/dev/vim-snipmate-ruby-snippets' " -- Plug 'fatih/vim-go' " Plug 'ericpruitt/tmux.vim' " Plug 'flazz/vim-colorschemes' " Plug 'garbas/vim-snipmate' " Use latest version of snipmate " let g:snipMate = { 'snippet_version' : 1 } " Plug 'godlygeek/tabular' " Plug 'ervandew/snipmate.vim' " Plug 'honza/vim-snippets' " Plug 'jesii/vim-potion' " Plug '/usr/local/opt/fzf' " Javascript plugins " Plug 'pangloss/vim-javascript' " 2019-04-11 - attempted to fix mxs/vim-jsx " Plug '~/dev/vim-jsx' " Plug 'jesii/vim-jsx' " 2019-04-xx - amadeus picked up but won't take issues " Plug 'amadeus/vim-jsx' " Plug 'amadeus/vim-xml' " Plug 'jelera/vim-javascript-syntax' " Plug 'MaxMEllon/vim-jsx-pretty' " 2019-04-12 - switched to this one; seems OK so far " Plug 'neoclide/vim-jsx-improve' " Plug 'kchmck/vim-coffee-script' " Plug 'vim-scripts/JavaScript-Indent.git' " Plug 'junegunn/fzf.vim' " Plug 'junegunn/vim-easy-align' " Plug 'kana/vim-fakeclip' " Plug 'kana/vim-smartinput' " Plug 'kana/vim-textobj-entire' " Plug 'kana/vim-textobj-indent' " Plug 'kana/vim-textobj-line' " Plug 'kana/vim-textobj-user' " Plug 'jakar/vim-json' " Plug 'ludovicchabant/vim-gutentags' " Plug 'mogelbrod/vim-jsonpath' " Plug 'majutsushi/tagbar' " Plug 'MarcWeber/vim-addon-mw-utils' " Plug 'markonm/traces.vim' " Plug 'mileszs/ack.vim' " Plug 'othree/xml.vim' " Plug 'nelstrom/vim-textobj-rubyblock' " Plug 'paulkass/jira-vim' "Probably requires additional permissions to use?" " Plug 'prettier/vim-prettier', { " \ 'do': 'yarn install', " \ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html'] } " Plug 'rking/ag.vim' " -- Plug 'rosenfeld/conque-term' " Plug 'Rykka/lastbuf.vim' Plug 'preservim/nerdtree' "Plug 'SirVer/ultisnips' " Plug 'tomtom/tcomment_vim' " Plug 'tomtom/tlib_vim' " Plug 'tmux-plugins/vim-tmux-focus-events' " Plug 'tpope/vim-characterize' " Plug 'tpope/vim-commentary' " Plug 'tpope/vim-cucumber' " Plug 'jesii/vim-cucumber' " Plug 'tpope/vim-dadbod' " Plug 'tpope/vim-fugitive' " Plug 'tpope/vim-haml' " Plug 'tpope/vim-jdaddy' " Plug 'tpope/vim-markdown' " Plug 'tpope/vim-obsession' " Plug 'tpope/vim-projectionist' " Plug 'tpope/vim-rails' " Plug 'tpope/vim-repeat' " Plug 'tpope/vim-rvm' " Plug 'tpope/vim-scriptease' " Plug 'tpope/vim-surround' " Plug 'tpope/vim-unimpaired' " Plug 'vim-ruby/vim-ruby' " Plug 'vim-scripts/Align' " Plug 'vim-scripts/CSyntaxAfter' " Plug 'vim-scripts/Decho' " Plug 'vim-scripts/SQLUtilities' " Plug 'vim-scripts/ZoomWin' " Plug 'vimoutliner/vimoutliner' " Plug 'vim-scripts/taglist.vim' " -- Plug 'wlangstroth/vim-racket' " Racket language highlighting" " Plug 'dense-analysis/ale' " Auto Formatting -- to go along with ALE " Plug 'Chiel92/vim-autoformat' " Plug 'xojs/vim-xo' " " Plug 'xolox/vim-misc' " Plug 'xolox/vim-session' " Doesn't clear flags for new branch! Plug 'Xuyuanp/nerdtree-git-plugin' " Additional plugins that help with ctags integration (courtesy of T'Bot Vim/Drew Neil) "Plug 'tpope/vim-rake.git' "Plug 'tpope/vim-bundler.git' "Plug 'majutsushi/tagbar' "Plug 'altercation/vim-colors-solarized' " Github repos of the user 'vim-scripts' " => can omit the username part "Plug 'L9' "Plug 'FuzzyFinder' " non github repos "Plug 'git://git.wincent.com/command-t.git' " ... " All of your Plugs must be added before the following line call plug#end() " " Brief help " :PlugList - list configured plugins " :PlugInstall(!) - install (update) plugins " :PlugSearch(!) foo - search (or refresh cache first) for foo " :PlugClean(!) - confirm (or auto-approve) removal of unused plugins """""""""""""""""""" Some plugin overrides """"""""""""""""""""""" " vim-titlecase overrides " Override TitleCase default mappings so that normal tab switching works let g:titlecase_map_keys = 0 nmap gt Titlecase vmap gt Titlecase nmap gT TitlecaseLine " " vim-session overrides let g:session_autosave = 'no' set sessionoptions-=tabpages set sessionoptions-=help """ UltiSnips Settings """" " " let g:UltiSnipsSnippetDirectories=["~/.vim/UltiSnips/", "UltiSnips"] " " let g:UltisnipsSnippetDirectories=["UltiSnips"] " let g:UltiSnipsSnippetsDir="~/.vim/UltiSnips" set runtimepath+=~/.dotfiles/.vim nnoremap ,ulr :call UltiSnips#RefreshSnippets() """ Conflicted overrides """" let g:diffget_upstream_map = 'gu' let g:diffget_local_map = 'gl' """END"""""""""""" VimPlug setup """""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""" Failed Experiments """""""""""""""""""""""" " The "+y """ and these aren't working either " noremap c "+y " inoremap c "+y """ DO NOT WORK " map <2-LeftMouse> d " map d """""" Experimental -- well, not really: filetype information """"" " Note sure this will work for me? " window rebalancing from CT augroup auVimResize autocmd! auVimResize autocmd vimresized :window = augroup end nnoremap ,- :wincmd_:wincmd \| nnoremap ,= :wincmd = " au BufNewFile,BufRead *[sS]pec.js set filetype=javascript " Had to change this to get markdown textwidth=100 to (mostly) work augroup auMiscFileTypes autocmd! autocmd BufNewFile,BufRead *gohtml set filetype=html autocmd BufNewFile,BufRead *json_schema set syntax=javascript " Automatically handled by vim now " autocmd BufNewFile,BufRead *json set filetype=json " Automatically handled by vim now " autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css " tpope's vim-markdown should handle this but didn't: removed 2019-02-19 " autocmd BufRead,BufNewFile *.md set filetype=markdown | setlocal textwidth=100 autocmd BufNewFile,BufREad .env* set filetype=conf augroup end augroup auFileTypes autocmd Filetype markdown setlocal textwidth=100 " Set tags file location autocmd FileType ruby set tags=rubytags;/ autocmd FileType java set tags=javatags;/ autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx autocmd BufNewFile,BufRead *.js set filetype=javascript.jsx " autocmd FileType javascript set tags=tags;/ autocmd FileType javascript.jsx set tags=tags;/ augroup end " markdown setlocal not working all the time; setup a shortcut nnoremap ,sltw :set textwidth=100 "Automatically re-source .vimrc if changed augroup auVimrc autocmd! auVimrc autocmd! BufWritePost $MYVIMRC source $MYVIMRC augroup end noremap ,smv :source $MYVIMRC """ END Experimental (sortof) stuff - filetype options"""" """"""""""""""""""""""""""" Basic options """"""""""""""""""""""""" set mouse+=a set ttymouse=xterm2 """ persistent undo """ set undofile " Maintain undo history between sessions set undodir=~/.vim/undodir autocmd! FileType c,cpp,java,php call CSyntaxAfter() nnoremap :w " nnoremap :w inoremap :w """ BEGIN maintain file creation times in vim/OS X """" autocmd BufReadPre * call SaveFileCreateTime() autocmd BufWritePost * call RestoreFileCreateTime() function! SaveFileCreateTime() let l:path = expand('%:p') if l:path != '' let b:created = system("GetFileInfo -d " . shellescape(bufname("%"))) endif endfunction function! RestoreFileCreateTime() if exists('b:created') execute system( \ 'SetFile -d ' . \ shellescape(b:created) . \ ' ' . \ shellescape(bufname("%"))) endif endfunction " """ END maintain file creation times in vim/OS X """" " Printer setup stuff {{{ let s:duplex = 'long' let s:paper = 'letter' execute 'set printoptions=paper:' . s:paper . ',duplex:' . s:duplex . ',number:y' " set printoptions=paper:letter,duplex:long """ HPOJ7747 in EDP Office let ECL_pdev='HP_OfficeJet_Pro_7740_series' " let ECL_pdev='_10_12_12_8_2' """ Cannon MF4100 in family room let ECannon_pdev='Canon_MF4100_Series' let EBWc_pdev ='Canon_MF4100_Series' """ Brother xxx in EDP Office """" let EBrother_pdev = '_10_12_12_9' let EBW_pdev = '_10_12_12_9' " let EBW_pdev = 'Downstairs_Brother_HL_L2370DW_series__3c2af4c9462e_' " let EBW_pdev = 'Downstairs_Brother_HL_L2370DW_series__3c2af4c9462e_' """ Brother xxx in Carol's Office """" let CBrother_pdev = 'Brother_HL_L2370DW_series' let CBW_pdev = 'Brother_HL_L2370DW_series' function! SetPdev(pval) let s:pvalue ='g:'.a:pval.'_pdev' execute 'set pdev='.{s:pvalue} " echom 'Printer set to: '.&pdev endfunction if &pdev == "" if hostname() =~ 'EDP32' call SetPdev('EBW') else call SetPdev('EBWc_pdef') endif endif let &printexpr="(v:cmdarg=='' ? ". \"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice)". \". ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error". \" : system('mv '.v:fname_in.' '.v:cmdarg) + v:shell_error)" " }}} noremap ,sjs :set filetype=json :syntax enable :set fdm=syntaxzA " Setting for fzf " + see below for Plug settings set rtp+=/usr/local/opt/fzf """ ^[ mapping """ " Hoses ^] ??? " nnoremap CTRL-[ CTRL-SHIFT-T """BEGIN"""Javascript-specific stuff""""""""""""""""""""""""""""""""""""""""""" " JavaScript shortcuts """ Shortcuts for fixing JS linting errors ``"""" " ,,fcs => Fix (missing) Curly Bracket Spaces " ,,fcds => Fix (missing) Double Curly Bracket Spaces " ,,abs => Add (missing) Curly Bracket Spaces (legacy) " ,,dbs => Delete (extra) Curly Bracket Spaces (legacy) " ,,anc -> Add eNd-of-line Comma " ,,ano => Add eNd-of-line coloN + new line " ,,ann => Add eNd-of-line semi-coloN " ,,and => Delete end-of-line character " ,,ap => Add Parentheses around arrow function argument having a body with curly braces " ,,cc => Change word to Const " ,,fcn => Fix Curly Newlines " ,,fsn => Fix Square Newlines " ,,frn => Fix React component Newlines " ,,fbq => Fix Backquote to single Quote " ,,fqb => Fix single Quote to Backquote " ,,fcw => Fix (delete) Comma-separated Word at end of list " ,,dlcw => Delete Last Comma-separated Word in list " ,,ic => Insert Carriage return (replacing space) " ,,id => Insert Dollar sign " ,,iip => Insert left paren " ,,iic => Insert left curly brace " ,,iiq => Insert single quote " ,,iid => Insert double quote " ,,iis => Insert left square bracket " ,,fne => Go to end of function / Enzyme " ,,fnn => Go to next function / Enzume **disabled** " ,,fnc => /* eslint-disable-line no-console */ " ,,8v => Create {i18n.xxx} " ,,8q => Create {i18n['xxx']} " These two need to be fixed; don't work " ,,ftc => Align colons in a block " ,,fcl => Fix Colon aLignment " ,,edl => Add /* eslint-disable-line */ """ More JS shortcuts """" " ,,clw => CLI Word wrap ${} " ,,clcw => Copy & CLI Word wrap -${} " ,,mtb => Add {target= "_blank"} " CreateRedux shortcuts " ,,crjc => Commentify a JSX line " ,,crjuc => Uncommentify a JSX line " ,,craa => ... Action Alias " ,,crad => ... Action Define " ,,crcp => ... Component Parameter " ,,crfb => ... Function Binding " ,,crms => ... Map State " ,,crmd => ... Map Dispatch " ,,crpt => ... Prop Types " Enzyme shortcuts " ,,ewd => console.log(wrapper.debug()) nnoremap ,ewd Oconsole.log(wrapper.debug()); nnoremap ,uns O'use strict'; nnoremap ,dns o'use strict'; nnoremap ,mec 0cf,module.exports = nnoremap ,sph :sp client/mcom/src/templates/helpers/ nnoremap ,vus ovar _ = require('underscore'); nnoremap ,vnd Gxgg=G nnoremap ,fne $% nnoremap ,mcf :s/const /s/ = //s/ =>//noh nnoremap ,mfc :s/function/const/:s/(/ = (/:s/)/) =>/:noh " nnoremap ,fnn $%/{ nnoremap ,ndx :!node % augroup folding autocmd! folding autocmd BufWinLeave *.* mkview autocmd BufWinEnter *.* silent! loadview augroup END augroup aufiletypeVim autocmd! aufiletypeVim autocmd Filetype vim setlocal foldmethod=marker augroup END nnoremap ,zff $zf% augroup auautoRead autocmd! auautoRead " Triger `autoread` when files changes on disk " https://unix.stackexchange.com/questions/149209/refresh-changed-content-of-file-opened-in-vim/383044#383044 " https://vi.stackexchange.com/questions/13692/prevent-focusgained-autocmd-running-in-command-line-editing-mode autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' | checktime | endif " Notification after file change " https://vi.stackexchange.com/questions/13091/autocmd-event-for-autoread autocmd FileChangedShellPost * \ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None augroup END " =============== Jiravim =============== " let g:jiraVimDomainName = "https://jira.businesswire.com" " let g:jiraVimEmail = "jon.seidel@businesswire.com" " let g:jiraVimToken = "Car5595/9999" nnoremap ,npmt :! npm test nnoremap ,ytf :!yarn testone % " A space is required after '{' AND A space is required before '}' function! s:FixCurlySpaces() :s/{/{ /g :s/}/ }/g :nohlsearch endfunction " command! -range FCS ,call s:FixCurlySpaces() command! FCS call s:FixCurlySpaces() nnoremap ,fcs :FCS inoremap ,fcs :FCS function! s:FixCurlyDoubleSpaces() :s/{{/{{ / :s/}}/ }}/ :nohlsearch endfunction command! FCDS call s:FixCurlyDoubleSpaces() noremap ,fcds :FCDS " fixCurlyDoubleSpaces " inoremap ,fcds :FCDS " Add Bracket Spaces; Delete Bracket Spaces (legacy code - use Fix Bracket Spaces) nnoremap ,abs :s/{/{ /g:s/}/ }/g nnoremap ,dbs :s/{ /{/g:s/ }/}/g " Missing comma nnoremap ,anc A, inoremap ,anc A, " Missing semicolon nnoremap ,ann A; nnoremap ,ano A; inoremap ,ann A; " Remove trailing character (usually command or semi-colon) nnoremap ,and $x inoremap ,and $x " Expected parentheses around arrow function argument having a body with curly braces nnoremap ,ap :execute "normal ysiw)" inoremap ,ap :execute "normal \ysiw)" " 'XXX' is never reassigned. Use 'const' instead nnoremap ,cc ciwconst inoremap ,cc ciwconst " Fix curly newlines function! s:FixCurlyNewlines() execute "normal! 0" :s/{ /{ / execute "normal! ==" :s/ }/, }/ execute "normal! ==" execute "normal! \" :s/, /, /g endfunction command! FCN call s:FixCurlyNewlines() nnoremap ,fcn :FCN " fixCurly[Add]NewLines " inoremap ,fcn :FCN " Fix Square newlines " STRANGE vim 'optional' regEx!!! function! s:FixSquareNewlines() execute "normal! 0" :s/\[ \{-}/[ / execute "normal! ==" :s/ \{-}]/, ]/ execute "normal! ==" execute "normal! \" :s/, /, /g endfunction command! FSN call s:FixSquareNewlines() nnoremap ,fsn :FSN " fixSquareNewLines " inoremap ,fsn :FSN " Fix React component newlines " STRANGE vim 'optional' regEx!!! " NOTE: Not perfect; relies on {...} parameters so misses: " 1) hover " 2) property='testing' function! s:FixReactComponentNewlines() execute "normal! 0" :s/<\(\w*\) /<\1 / execute "normal! ==" :s/ \/>/ \/>/ execute "normal! ==" execute "normal! \" :s/} /} /g " TODO: Start V, then search backwards for ,frn :FRN " fixReactComponentNewLines " inoremap ,frn :FRN nnoremap ,edl A /* eslint-disable-line */ inoremap ,edl A /* eslint-disable-line */ " TODO: These do not work!!! ranges are crazy " Align colons inside a block " nnoremap ,ftc :Tab/: " Fix Colon aLignment " THESE DO NOT WORK!!! function! FixColonAlignment() range execute (a:firstline + 1) . "," . a:lastline .:TAB/:\ endfunction command! -range FCL call , s:FixColonAlignment() nnoremap ,fcl :FCL " :cab ttt TAB/: " Fix eslint no-console warnings nnoremap ,fnc $a /* eslint-disable-line no-console */ " Fix back quotes => single quotes nnoremap ,fbq :s/`/'/g " fix backQuotes to quotes" " And vice-versa nnoremap ,fqb :s/'/`/g " fix quotes to backQuotes " Fix (delete) commaword from word nnoremap ,fcw diwxx " Fix (delete) last Comma-separated word" nnoremap ,dlcw diwxx " Delete Last Comma-separated Word" " Replace space with carriage return nnoremap ,ic s " Replace space with carriage return" inoremap ,ic s " Replace space with carriage return" "////////// i18n stuff ////////// " Create i18n entry from single quoted string nnoremap ,8n :s/'/"/gA,yypJ " Search for possible missing i18n strings nnoremap ,88q /["'].\{-}['"] nnoremap ,88a /alt="/ " Insert i18n with quotes nnoremap ,8i a{i18n['']} "Insert i18n with variable nnoremap ,8v i{i18n.} " Wrap word in i18n... function s:map8ww() exe "normal! ii18n.\" endfunction command! MAP8WW call s:map8ww() nnoremap ,8ww :MAP8WW " Wrap double-quoted string in i18n... function! s:wrap8DoubleQuote() execute "normal cs\"'" execute "normal ysf']ysf]}" execute "normal! ai18n\" endfunction command! WRAP8DQ call s:wrap8DoubleQuote() nnoremap ,8wq :WRAP8DQ " Wrap single-quoted string in i18n... function! s:wrap8SingleQuote() execute "normal cs\''" execute "normal ysf']ysf]}" execute "normal! ai18n\" endfunction command! WRAP8SQ call s:wrap8SingleQuote() nnoremap ,8ws :WRAP8SQ " Wrap un-quoted string in i18n... function! s:wrap8UnQuote() execute "normal yst<''" execute "normal yst<)yst<}" execute "normal! ai18n\" endfunction command! WRAP8UQ call s:wrap8UnQuote() nnoremap ,8wu :WRAP8UQ " Wrap to < string in i18n... function! s:wrap8ToCaret() execute "normal yst<'" execute "normal yst<]yst<}" execute "normal! ai18n\" endfunction command! WRAP8TC call s:wrap8ToCaret() nnoremap ,8wc :WRAP8TC " Create the i18n basics for starters... " function! s:createI18nBaseline() " execute "normal iimport { setI18n, i18nifySimpleStrings } from '../../utils/useI18n';"\ " const [i18n, setI18n] = setState(null); " const i18nStrings = [ " ]; " const useI18nStrings = { " strings: { " \.\.\.i18nifySimpleStrings\(i18nStrings\) " } " } " useI18n(setI18n, useI18nStrings);\ " endfunction " command! CREATEI18N call s:createI18nBaseline() " nnoremap ,8cc :CREATEI18N function s:map8q() exe "normal ysf']" exe "normal! ii18n\" endfunction command! MAP8Q call s:map8q() nnoremap ,8q :MAP8Q " i18n template with nnoremap ,8si i{i18n['']}i inoremap ,8si i{i18n['']}i nnoremap ,8sa a{i18n['']}a inoremap ,8sa a{i18n['']}a " inoremap ,i8 {i18n['']} " Create i18n line, using copied 'xxx' value nnoremap ,8p opA : [],== " Wrap {...} with ... nnoremap ,wuc if}a " Insert left paren, curly brace, square bracket (to avoid automatic right-version) nnoremap ,iip i r( nnoremap ,iic i r{ nnoremap ,iis i r[ nnoremap ,iid i r" nnoremap ,iiq i r' " Insert $ (dollar sign) nnoremap ,id i$ "Insert dollar sign" " Insert carriage return and go back to original position function! s:AddCarriageReturn() execute "normal! mzA;\'z" endfunction command! ACR call s:AddCarriageReturn() nnoremap ,acr :ACR " addCarriageReturn + go back to original position " " Insert startd of console.log( function inoremap ,clg console.log( nnoremap ,clg iconsole.log( " Wrap word with ${xxx} function! s:CliWordWrap() execute "normal ysiw}" execute "normal! i$\" endfunction command! CLW call s:CliWordWrap() nnoremap ,cww :CWW " Wrap word with ${...}" inoremap ,cww :CWW " Wrap word with ${...}" " Copy & wrap word => xxx-${xxx} function! s:CliCopyWordWrap() execute "normal! yiwea: \p" " :CLW call s:CliWordWrap() endfunction command! CLCW call s:CliCopyWordWrap() nnoremap ,ccww :CCWW " Copy and wrap word with ${...}" inoremap ,ccww :CWWW " Copy and wrap word with ${...}" " Append {target="_blank"} for menu updates nnoremap ,mtb A{target="_blank"} inoremap ,mtb A{target="_blank"} " Generate console.log('word', word) from word function! s:CliLogWordWrap() execute "normal! yiwea, \p^\" execute "normal ysiw'" execute "normal ys$)" execute "normal! iconsole.log" execute "normal! A;\" endfunction command! CLWW call s:CliLogWordWrap() nnoremap ,clww :CLWW " Copy and wrap word into console.log('...', ...) " Wrap word with ${xxx} - template literal expressions " nnoremap ,jtx execute "normal ysiw}a$\" " inoremap ,jtx execute "normal \ysiw}a$\" " Wrap word with ${JSON.Stringify(xxx)} function! s:JSONStringify() exe "normal ysiw)" exe "normal ysf)}" exe "normal! i$\\aJSON.stringify\" endfunction command! JSN call s:JSONStringify() nnoremap ,jsn :JSN " This variation assumes one left curly brace to be JSONified function! s:JSONStringifyS() exe "normal \yst})" exe "normal! iJSON.stringify\" endfunction command! JSNS call s:JSONStringifyS() nnoremap ,jssn :JSNS nnoremap ,cli oconsole.log(``); inoremap ,cli console.log(``); function! s:UtilInspect() exe "normal ysw)" exe "normal ysf)}" exe "normal! i$\\autil.inspect\" endfunction command! UTI call s:UtilInspect() nnoremap ,uti :UTI function! s:SurroundCurlyBraces() exe "normal ysiw}" exe "normal \ysw " endfunction command! SCB call s:SurroundCurlyBraces() noremap ,scb :SCB " Commentify a JSX line function! s:TransmogrifyCreateJSXComment() execute "normal! 0wD" execute "normal! i{/* */}\" execute "normal! \\\pa \" endfunction command! CRJC call s:TransmogrifyCreateJSXComment() noremap ,crjc :CRJC "Uncommentify a JSX line function! s:TransmogrifyCreateJSXUnComment() execute "normal! 0w" execute "normal! 4x$xxxx" endfunction command! CRJUC call s:TransmogrifyCreateJSXUnComment() noremap ,crjuc :CRJUC " Transmogrify word into redux action alias " => export const = ''; ===OLD=== " => : 'A = '\pA';\==" execute "normal! " . "0eyiw0wi \A : '\pA',\==" endfunction command! CRAA call s:TransmogrifyCreateReduxActionAlias() noremap ,craa :CRAA nnoremap ,crjic o{/* */}i inoremap ,crjic {/* */} """ TODO: This one works whether indented or at start of line """" """ 0eyiw """" " Transmogrify word into component parameter " => ={} function! s:TransmogrifyCreateReduxComponentParameter() execute "normal! " . "yiwea={}\\p==" endfunction command! CRCP call s:TransmogrifyCreateReduxComponentParameter() noremap ,crcp :CRCP function! s:TransmogrifyCreateReduxFunctionBind() execute "normal! " . "0eyiwithis.\A = this.\pA.bind(this);\==" endfunction command! CRFB call s:TransmogrifyCreateReduxFunctionBind() noremap ,crfb :CRFB function! s:TransmogrifyCreateReduxActionDefine() " Uppercases the word before yanking " execute "normal! " . "0eyiwiexport const \A = '\pA';\" execute "normal! " . "viwUywiexport const \A = '\pA';\" " execute "normal! " . "0wywiexport const \A = '\pA';\==" endfunction command! CRAD call s:TransmogrifyCreateReduxActionDefine() noremap ,crad :CRAD inoremap ,crad :CRADo function! s:TransmogrifyCreateReduxMapState() execute "normal! 0eyiwA: state.\pAReducer,\==" endfunction command! CRMS call s:TransmogrifyCreateReduxMapState() noremap ,crms :CRMS function! s:TransmogrifyCreateReduxMapDispatch() execute "normal! 0eyiwA: \pA => dispatch(set \p" execute "normal! b\x~A(\\"0pA))," endfunction command! CRMD call s:TransmogrifyCreateReduxMapDispatch() noremap ,crmd :CRMD function! s:TransmogrifyCreateReduxPropTypes() execute "normal! 0eyiwA: PropTypes.func.isRequired,\==" endfunction command! CRPT call s:TransmogrifyCreateReduxPropTypes() noremap ,crpt :CRPT """END"""""JavaScript-specific stuff""""""""""""""""""""""""""""""""""""""""""" " single camelCase to snake_case function! s:TransmogrifyNextCamelToSnakeCase() :normal /[A-Z] ] execute "normal! " . "i_\" execute "normal! " . "\vgu" endfunction command! TUS call s:TransmogrifyNextCamelToSnakeCase() noremap ,us :TUS " Java-specific definitions source ~/.dotfiles/.vimrc_java " Macys-specific definitions source ~/.dotfiles/.vimrc_macys """""""""""""""" Newly-hatched stuff """""""""""""""""""""""" """ Insert above/below line w/o entering insert mode"""" nnoremap o nnoremap ,O O nnoremap O nnoremap ,o o " Configure persistent undo/redo " REMOVED - creates many files with % which cannot be rm'd with git " set undofile " set undodir=~/.vim/undodir """ BEGIN Insert spaces from cursor to given column """" function! s:TransmogrifySpacingByColumn(column) if a:column == "" let g:TransmogrifySpacingByColumn = arguments[0] else let g:TransmogrifySpacingByColumn = a:column endif let current_column = col(".") let spaces = g:TransmogrifySpacingByColumn - current_column + 1 execute "normal " . spaces . "i " endfunction command! -nargs=1 TSBC call s:TransmogrifySpacingByColumn() nnoremap ,tsbc :TSBC """ END """" " " refresh syntax highlighting when lost (see TODO notes) noremap ,ftd :filetype detect function! s:ShowMaps() let old_reg = getreg("a") " save the current content of register a let old_reg_type = getregtype("a") " save the type of the register as well try redir @a " redirect output to register a " Get the list of all key mappings silently, satisfy "Press ENTER to continue" silent map | call feedkeys("\") redir END " end output redirection vnew " new buffer in vertical window put a " put content of register " Sort on 4th character column which is the key(s) %!sort --key=1,14 finally " Execute even if exception is raised call setreg("a", old_reg, old_reg_type) " restore register a endtry endfunction command! ShowMaps call s:ShowMaps() " Enable :ShowMaps to call the function nnoremap ,mm :ShowMaps " Map keys to call the function let g:jsx_ext_required = 0 inoremap inoremap inoremap inoremap noremap ,; @: noremap ,rp :redraw! """""""""""""""""""""" BASH shortcuts """"""""""""""""""""""" inoremap ,bsb #!/usr/bin/env bash let g:bst_file = "~/bash_template" inoremap ,bst :execute "0read " . fnameescape(g:bst_file) nnoremap ,bst :execute ":read " . fnameescape(g:bst_file) """""""""""""""""" END BASH shortcuts """"""""""""""""""""""" """""""""""""""" END Newly-hatched stuff """""""""""""""""""" """"""""""""""""""" Options for editing OPDB files """"""""""""""" nnoremap ,,guid :read !ruby -e "require 'uuid'; puts UUID.generate"J " Following inserts the mapped string, not the results? " inoremap ,,guid :execute read !ruby -e "require 'uuid'; puts UUID.generate" inoremap ,,guid :call AddGuidLine() function! AddGuidLine() let cmd = 'ruby -e "require \'uuid\'; puts UUID.generate"' let result = system(cmd) call setline(line('.'), getline('.') . ' guid: ' . result) endfunction nnoremap ,,guil Iguid: """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""" Ack Cmds """""""""""""""""""""""""""""""""""""""" " Replace grep with ack " >>> Had to move ack to /usr/local/bin since not being found in ~/bin set grepprg=ack\ -ik " Get a list of all buffers to pass to Ack for buffer-relative searching function! s:GetAllBufferPaths() echo map(filter(range(0,bufnr('$')), 'buflisted(v:val)'), 'fnamemodify(bufname(v:val), ":p")') endfunction command! GABP call s:GetAllBufferPaths() noremap a :tabnew Ack noremap za Ack xxx s:GetAllBufferPaths() """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""" Experimental #1 Options"""""""""""""""""""""""""""""""""""""""""" nnoremap ,nerd :NERDTree nnoremap ,er :e + nnoremap ,brcvi :OpenSession brcvi " Copy/paste/delete mappings {{{ ""BEGIN""""""""""""""""""" copy/paste/delete mappings """""""""""""""""" " Doesn't work on new machine?!? vnoremap  "+ vnoremap "+y vnoremap ,,ys "+y " Not perfect; loses leading chars on first line??? vnoremap ,,yv 0"+y noremap ,,yy 0v$"+y inoremap ,,yy 0v$"+y noremap ,,ye v$"+y inoremap ,,yw viw"+y nnoremap ,,yw viw"+y inoremap ,,ya ggVG"+y nnoremap ,,ya ggVG"+y inoremap ,,da ggVGx nnoremap ,,da ggVGx nnoremap ,,ca :execute "normal ggVGgcc" " Still need to paste the clipboard entry; how to do that? nnoremap ,,pa ggVGxi noremap ,,yv v$"+y " noremap ,,y "+y noremap ,,y$ v$"+y ""END""""""""""""""""""""" copy/paste mappings """""""""""""""""" " }}} inoremap ,,d O inoremap ,,fc :wq nnoremap ,,fc :wq " Sometimes these fail and I have to do " So adding extra in definition to see if that helps " 2019-02-08 inoremap ,,fk :w nnoremap ,,fk :w inoremap ,,ff :q nnoremap ,,ff :q inoremap ,,dfc :%d:wq nnoremap ,,dfc :%d:wq inoremap ,,d noremap ,diffme :w !diff % - nnoremap ,ndf :windo :diffoff command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis function! StartUp() if 0 == argc() NERDTree elseif argv(0) == "^^^" :silent! argdelete * :silent! argdo! update :colo BlackSea " :Conflicted end endfunction augroup auVimEnter autocmd! auVimEnter autocmd VimEnter * call StartUp() augroup end set diffopt=vertical,context:4,iwhite,filler " =====Cucumber / Rspec abbreviations / mappings {{{ iab crp @current_page iab cru @current_user iab xxjmt @jes-manually-tested iab xxjps @jes-passing iab xxjts @jes-testing " Numbering for manual cucumber steps noremap n1 caw1. j0w noremap n2 caw2. j0w noremap n3 caw3. j0w noremap n4 caw4. j0w noremap n5 caw5. j0w noremap n6 caw6. j0w noremap n7 caw7. j0w noremap n8 caw8. j0w noremap n9 caw9. j0w noremap n0 caw10. j0w " Numbering for simple text lines noremap ,n1 0i1. noremap ,n2 0i2. noremap ,n3 0i3. noremap ,n4 0i4. noremap ,n5 0i5. noremap ,n6 0i6. noremap ,n7 0i7. noremap ,n8 0i8. noremap ,n9 0i9. noremap ,n0 0i10. """"""""""""""""" Test code / Rspec, etc. """""""""""""""""""""""""""""""""""""" " nnoremap ,bre obeginrescue => ebinding.pryend """""""""""""""""""""" BEGIN Ruby/Cucumber shortcuts """"""""""""""""""""""" " OLD stuff " Following maps are for QAA/Ruby/Cucumber work... commenting out for now 2018-10-09 "" modify steps in steps copied from feature " This works to do both ends of updates "nnoremap ,ccss : s/^\s*\w* I/Then(\/^I/$a$/) dobinding.pryend "" Following work to do beginning or end "nnoremap ,ccsb : s/^\s*\w* I/Then(\/^I/ "nnoremap ,ccse $a$/) doend """ """""""""""""""""""""" END Ruby/Cucumber shortcuts """"""""""""""""""""""" nnoremap ,rspec :!rspec % nnoremap ,rra :!rspec spec nnoremap ,rrs :!rspec ./%:h/%:t nnoremap ks :execute ":!runany " . line('.') " syntax-check / dry-run cucumber feature file nnoremap ,scf :!bundle exec cucumber --dry-run URL=http://mm2registrybrowse.herokuapp.com --profile mobile_website_default SITE=MCOM % nnoremap ,rcuke :!rake cucumber nnoremap ,rs oelseraise StandardError, "[]" nnoremap ,lp oLog.instance.info "" nnoremap ,flp cwLog.instance.info " run specific cucumber FFile scenario -- NOT YET " nnoremap ,runfl :execute ... " SAMPLE? " nnoremap ks :execute ":!runany " . line('.') "}}} " =====Java Language abbreviations {{{ nnoremap ,itt ithrows Throwable " TODO: Get these abbreviations to work with trailing '(' iabbrev ysop System.out.println inoremap ,sop System.out.println( iabbrev yloi logger.info( inoremap ,loi logger.info( " }}} "=====Abbreviatons for commun misspellings iabbrev curent current iabbrev resonse response " BEGIN vimScript debugging tools fu! s:ShowSynStack() for id in synstack(line("."), col(".")) echo synIDattr(id, "name") endfor endfu command! SSS call s:ShowSynStack() nnoremap ,sss :SSS " END vimScript debugging tools " Experimental - matchit plugin runtime macros/matchit.vim runtime macros/Redir.vim " Map key to list/select a buffer nnoremap :buffers:buffer " Map keys for use with grep/ack (when it's working) nnoremap :cn nnoremap :cp "Experimental - underline active window's current line " Minor problem; no underline until leave 1st window! augroup auBgHighlight autocmd! auBgHighlight autocmd WinEnter * set cul autocmd WinLeave * set nocul augroup END set so=7 " keep selected line off bottom or top """""""""""""""" XML Pretty-Printer """"""""""""""""""""""""""""""""""""""""""""" " Source: http://vim.wikia.com/wiki/Pretty-formatting_XML function! DoPrettyXML() " save the filetype so we can restore it later let l:origft = &ft set ft= " delete the xml header if it exists. This will " permit us to surround the document with fake tags " without creating invalid xml. 1s///e " insert fake tags around the entire document. " This will permit us to pretty-format excerpts of " XML that may contain multiple top-level elements. 0put ='' $put ='' silent %!xmllint --format - " xmllint will insert an header. it's easy enough to delete " if you don't want it. " delete the fake tags 2d $d " restore the 'normal' indentation, which is one extra level " too deep due to the extra tags we wrapped around the document. silent %< " back to home 1 " restore the filetype exe "set ft=" . l:origft endfunction command! PrettyXML call DoPrettyXML() command! PrettyHTML :%!tidy -q -i --show-errors 0 command! PrettyJSON :%!ruby -rjson -e 'puts JSON.pretty_generate(JSON.load($<))' """""""""""""""" Tried and True Options """"""""""""""""""""""""""""""""""""""""" """"""""""""""" BEGIN Generic Options / Shortcuts """""""""""""""""""""""""""" nnoremap ,mdn ^a DONE nnoremap ,vsb V$% nnoremap ,spo :setlocal spell nnoremap ,spf :setlocal nospell " Generic shortcuts nnoremap ,cup viwU nnoremap ,clo viwu nnoremap ,cdn viwu inoremap ,cup viwUea inoremap ,clo viwuea inoremap ,cdn viwuea nnoremap ,csw :execute "normal ysiw'" " TODO: fails " inoremap ,csw :execute "normal \ysiw'f'ea" " inoremap ,csw ysiw'f'a nnoremap ,cpw :execute "normal ysiw)" " Single/Double underlines function! UnderlineLine (char) let myline = getline(line('.')) let @z = repeat(a:char, strlen(myline)) call append(line('.'), @z) exec "normal jo" exec "startinsert" endfunction function! UnderlineSingle() call UnderlineLine('-') endfunction function! UnderlineDouble() call UnderlineLine('=') endfunction nnoremap ,uls :call UnderlineSingle() nnoremap ,uld :call UnderlineDouble() " These don't work? inoremap ,uls :call UnderlineSingle() inoremap ,uld :call UnderlineDouble() """"""""""""""" END Generic Options / Shortcuts """""""""""""""""""""""""""" " Experimental - count string occurrences " Doesn't work! " function! CountOccurrences(string) " let execvar = "normal :% s/" + a:string + "//gn" " exec execvar " endfunction " nnoremap xc :call CountOccurrences("") " But this simple approach DOES work! nnoremap ,cc :% s///gn nnoremap ,cso :% s///gn " Basic Window movement mappings nnoremap h h nnoremap j j nnoremap k k nnoremap l l " use ,,rp to redraw screen if needed for viewport size changes nnoremap ,ro :redo " C-R already taken for :redo " "Zoom" a split window into a tab and/or close it nmap ,zo :tabnew % nmap ,zc :tabclose " Miscellaneous shortcuts nnoremap ,nh :nohls inoremap ,nh :nohls nnoremap ,ps :set paste nnoremap ,nps :set nopaste:set autoindent nnoremap ,nl i " insert new line & exit insert mode " function! SetFastPaste() endfunction """ BEGIN pry/debugger mappings """" nnoremap ,z :tabnew % function! SetPry() if &ft == 'cucumber' let pry_command = 'And I pry' elseif &ft == 'ruby' let pry_command = 'binding.pry' elseif &ft == 'javascript' let pry_command = 'debugger;' elseif &ft == 'javascript.jsx' let pry_command = 'debugger;' elseif &ft == 'typescript' let pry_command = 'debugger;' elseif &ft == 'typescript.tsx' let pry_command = 'debugger;' else echo "Pry command unknown for this filetype: " &ft return end return pry_command endfunction nnoremap ,upry :execute "normal " . "O" . SetPry() inoremap ,upry :execute "normal " . "\O" . SetPry() nnoremap ,dpry :execute "normal " . "o" . SetPry() inoremap ,dpry :execute "normal " . "\o" . SetPry() """ END pry/debugger mappings """" inoremap O nnoremap O " Running ruby, etc.. " & syntax-check current ruby file " Updated for leading 'rr': 2019-10-18 nnoremap ,rruby :!ruby % nnoremap ,rrb :!ruby % nnoremap ,rrcr :!ruby -c % nnoremap ,rrsc :!ruby -c % nnoremap ,rrbc :!ruby -c % """"" Put path/file info into clipboard """ function! CopyPath() let pathVal = expand('%:p') let @+ = pathVal echo 'The path name is: ' . pathVal endfunction nnoremap ,,path :call CopyPath() function! CopyRoot() let rootVal = expand('%:r') let rootExt = expand('%.e') let rootFile = rootVal . '.' . rootExt let @* = rootFile echo 'The root name is: ' . rootFile endfunction nnoremap ,,root :call CopyRoot() function! CopyFile() let fileVal = expand('%:t') let @+ = fileVal echo 'The file name is: ' . fileVal endfunction nnoremap ,,file :call CopyFile() """"" Search for UTF-8 quotes (bad in text files/FF,SD) nnoremap ,fq /“\\|” nnoremap ,ffq :% s/“\\|”/"/g """"""""""""""""""""""""""""" Order is important here """"""""""""""""""""""""""""" """ Moved colorscheme stuff to bottom! """ was previous-C " Experimental - Highlight cursor row and column " Not sure if this is worth it; very busy; not right colors yet hi CursorLine cterm=NONE ctermbg=darkblue ctermfg=white guibg=darkred guifg=white hi CursorColumn cterm=NONE ctermbg=darkblue ctermfg=white guibg=darkred guifg=white nnoremap ,scc :set cursorline! cursorcolumn! nnoremap ,scl :set cursorline! nnoremap ,ncl :set nocursorline! nnoremap ,ncc :set nocursorline! nocursorcolumn! " Exprimental (2014-06-14) - highlight current window status line " NEEDS WORK! hi StatusLine ctermfg=15 guifg=#ffffff ctermbg=239 guibg=#4e4e4e cterm=bold gui=bold hi StatusLineNC ctermfg=249 guifg=#b2b2b2 ctermbg=237 guibg=#3a3a3a cterm=none gui=none """ Was previous-F """""""END""""""""""""""""""" Order is important here """"""""""""""""""""""""""""" " Experimental status line """ Clobbers 'last' file separator in gvim "set statusline= "set statusline +=%1*\ %n\ %* "buffer number "set statusline +=%5*%{&ff}%* "file format "set statusline +=%3*%y%* "file type "set statusline +=%4*\ %<%F%* "full path "set statusline +=%2*%m%* "modified flag "set statusline +=%1*%=%5l%* "current line "set statusline +=%2*/%L%* "total lines "set statusline +=%1*%4v\ %* "virtual column number "set statusline +=%2*0x%04B\ %* "character under cursor "hi User1 guifg=#eea040 guibg=#222222 "hi User2 guifg=#dd3333 guibg=#222222 "hi User3 guifg=#ff66ff guibg=#222222 "hi User4 guifg=#a0ee40 guibg=#222222 "hi User5 guifg=#eeee40 guibg=#222222 " Another attempt "hi statusline guibg=DarkGrey ctermfg=8 guifg=White ctermbg=15 """ This works! previous do not " Display byte count and byte value, modified flag in red. :set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b'\ ]%{winnr()}[\ set stl+=%{ConflictedVersion()} " Show conflicted version on status line :hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red " From http://stackoverflow.com/questions/356126/how-can-you-automatically-remove-trailing-whitespace-in-vim " Highlight extra whitespace highlight ExtraWhitespace ctermbg=red guibg=red match ExtraWhitespace /\s\+$/ augroup auExtraWhiteSpace autocmd! auExtraWhiteSpace autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@,twp :TrimWhiteSpace """"""""""""""""""""""""""""""" ColorScheme Stuff """""""""""""""""""""""""" " Challenges with colo stuff; put it all here for test/debug :=( """"" NOTE - color scheme & highlighting are very sensitive to order """"" We are changing the background at the end of this file, so beware """"""""""" " " Experimental - new background colors " 17 => dark blue; 238 => dark greay " NOTE: Doesn't work from .vimrc; must manually enter " turn it on """ start previous-C " All comments; all removed """ end previous-C """start previous-F """ If colorscheme BlackSea goes here, then many things change!!! if(has('gui')) colorscheme BlackSea " colorscheme elflord " Change color scheme (hard to see red on black) else colo default end """ And these have to go after the colorscheme BlackSea as well?! " Fix the difficult-to-read default setting for diff text highlighting. The " " bang (!) is required since we are overwriting the DiffText setting. The highlighting " " for "Todo" also looks nice (yellow) if you don't like the "MatchParen" colors. highlight! link DiffText Evening " MatchParen " Todo " Evening " MatchParen """end previous-F " For now, don't actually call any of these, just define them function! SetBGNormalColor() :highlight Normal ctermbg=17 endfunction command! SetBGNormalColor :call SetBGNormalColor() nmap ,sbc :SetBGNormalColor " :call SetBGNormalColor() " or turn it off function! ResetBGNormalColor() :highlight Normal ctermbg=0 endfunction command! ResetBGNormalColor :call ResetBGNormalColor() nmap ,rbc :ResetBGNormalColor " TODO: Highlighting and background really need some undertanding and work " Fix poor search highlighting function! SetNewHighlight() :highlight Search ctermfg=black ctermbg=light :highlight LineNr ctermfg=yellow endfunction command! SetNewHighlight :call SetNewHighlight() nmap ,shi :SetNewHighlight " :call SetNewHighlight() " Make the rnu number also stand out hi! link CursorLineNr LineNr " Make 'SpellBad' group readable -- for ALE mostly " NOTE: the ctermbg=1 makes no sense to me -- it comes out Red, not Blue hi SpellBad term=bold ctermfg=0 ctermbg=1 guifg=Black guibg=Red """"""""""""""""""""""""""""""" END ColorScheme Stuff """""""""""""""""""""" " " Special processing if invoked by fcvim " if v:progname == 'fcvim' " set lines=8 " set columns=80 " end syntax sync minlines=50 noremap ,sync :syntax sync minlines=50 noremap ,synn :syntax sync fromstart ""BEGIN"""""""""""""""""""""""" Embedded syntax highlighting """"""""""""""""""""""""""""""" {{{ function! TextEnableCodeSnip(filetype,start,end,textSnipHl) abort let ft=toupper(a:filetype) let group='textGroup'.ft if exists('b:current_syntax') let s:current_syntax=b:current_syntax " Remove current syntax definition, as some syntax files (e.g. cpp.vim) " do nothing if b:current_syntax is defined. unlet b:current_syntax endif execute 'syntax include @'.group.' syntax/'.a:filetype.'.vim' try execute 'syntax include @'.group.' after/syntax/'.a:filetype.'.vim' catch endtry if exists('s:current_syntax') let b:current_syntax=s:current_syntax else unlet b:current_syntax endif execute 'syntax region textSnip'.ft.' \ matchgroup='.a:textSnipHl.' \ start="'.a:start.'" end="'.a:end.'" \ contains=@'.group endfunction call TextEnableCodeSnip( 'java', '@begin=java@', '@end=java@', 'SpecialComment') call TextEnableCodeSnip( 'ruby', '@begin=ruby@', '@end=ruby@', 'SpecialComment') " call TextEnableCodeSnip( 'bash', '@begin=bash@', '@end=bash@', 'SpecialComment') ""END"""""""""""""""""""""""""" Embedded syntax highlighting """"""""""""""""""""""""""""""" }}}