Created
December 15, 2021 20:38
-
-
Save benlieb/c6f8d7b69d601fba3c47643e1ae0a9bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'ap/vim-css-color' | |
Plugin 'tpope/vim-commentary' | |
" requires eslint and ./.eslintrc.json | |
" yarn add --dev babel-eslint | |
" yarn add --dev eslint | |
" yarn add --dev eslint-plugin-react | |
" yarn add --dev eslint | |
" ./node_modules/.bin/eslint --init | |
" then check ./eslintrc.js for settings and compare to other functioning projects if necessary | |
Plugin 'dense-analysis/ale' | |
Plugin 'jeetsukumaran/vim-indentwise' | |
Plugin 'mattn/emmet-vim' | |
Plugin 'arthurxavierx/vim-caser' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'SirVer/ultisnips' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'Galooshi/vim-import-js' | |
Plugin 'michaeljsmith/vim-indent-object' | |
Plugin 'henrik/vim-indexed-search' | |
Plugin 'yuezk/vim-js' | |
Plugin 'maxmellon/vim-jsx-pretty' | |
Plugin 'adelarsq/vim-matchit' | |
Plugin 'tpope/vim-rails' | |
Plugin 'tpope/vim-repeat' | |
Plugin 'thoughtbot/vim-rspec' | |
Plugin 'honza/vim-snippets' | |
Plugin 'tpope/vim-surround' | |
Plugin 'rhysd/vim-textobj-ruby' | |
Plugin 'kana/vim-textobj-user' | |
Plugin 'bronson/vim-visual-star-search' | |
Plugin 'dyng/ctrlsf.vim' | |
Plugin 'junegunn/fzf' | |
Plugin 'junegunn/fzf.vim' | |
Plugin 'airblade/vim-rooter' | |
Plugin 'itchyny/lightline.vim' | |
Plugin 'itchyny/vim-gitbranch' | |
Plugin 'maximbaz/lightline-ale' | |
Plugin 'flazz/vim-colorschemes' | |
Plugin 'felixhummel/setcolors.vim' | |
Plugin 'Yggdroot/indentLine' | |
Plugin 'junegunn/vim-easy-align' | |
Plugin 'Xuyuanp/nerdtree-git-plugin' | |
"open, delete, move, or copy multiple Visually-selected files at once. | |
Plugin 'PhilRunninger/nerdtree-visual-selection' | |
"disabling because super slow | |
"Plugin 'tiagofumo/vim-nerdtree-syntax-highlight' | |
"Plugin 'dhruvasagar/vim-zoom' | |
" Plugin 'ycm-core/YouCompleteMe' | |
if exists('g:using_neovim') | |
Plugin 'glacambre/firenvim' | |
endif | |
"Plugin 'thaerkh/vim-indentguides' | |
"Plugin 'nathanaelkane/vim-indent-guides' | |
"Best to keep last, as it needs to load after | |
"need to install the nerd font associated with guifont | |
"brew tap homebrew/cask-fonts | |
"brew cask install font-bitstream-vera-sans-mono-nerd-font (where name matches https://github.com/Homebrew/homebrew-cask-fonts/tree/master/Casks) | |
Plugin 'ryanoasis/vim-devicons' | |
" All Plugins must be added before the following line | |
call vundle#end() | |
filetype plugin indent on " required | |
let g:lightline = { | |
\ 'colorscheme': 'wombat', | |
\ 'active': { | |
\ 'left': [ | |
\ [ 'mode', 'paste' ], [ 'gitbranch', 'readonly', 'filename', 'modified' ] | |
\ ], | |
\ 'right': [ | |
\ [ 'lineinfo' ], | |
\ [ 'percent' ], | |
\ [ 'fileformat', 'fileencoding', 'filetype', 'charvaluehex' ], | |
\ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ], | |
\ ] | |
\ }, | |
\ 'component_function': { | |
\ 'gitbranch': 'gitbranch#name', | |
\ 'filetype': 'LightlineFiletype', | |
\ 'fileformat': 'LightlineFileformat', | |
\ 'filename': 'LightlineFilename', | |
\ }, | |
\ 'component_expand': { | |
\ 'linter_checking': 'lightline#ale#checking', | |
\ 'linter_infos': 'lightline#ale#infos', | |
\ 'linter_warnings': 'lightline#ale#warnings', | |
\ 'linter_errors': 'lightline#ale#errors', | |
\ 'linter_ok': 'lightline#ale#ok', | |
\ }, | |
\ 'component_type': { | |
\ 'linter_checking': 'right', | |
\ 'linter_infos': 'right', | |
\ 'linter_warnings': 'warning', | |
\ 'linter_errors': 'error', | |
\ 'linter_ok': 'right', | |
\ } | |
\ } | |
"ALE | |
let g:ale_linter_aliases = {'jsx': ['css', 'javascript']} | |
let g:ale_linters = { | |
\ 'jsx': ['stylelint', 'eslint'], | |
\ 'javascript': ['eslint'], | |
\} | |
let g:rspec_runner = "os_x_iterm2" | |
let g:rspec_command = "srspec {spec}" | |
let g:indentLine_char = '¦' | |
let g:inflector_mapping = 'gi' | |
let g:indentLine_bgcolor_term="NONE" | |
let g:indentLine_bgcolor_gui="NONE" | |
let g:NERDTreeWinSize = 45 | |
let g:NERDTreeExactMatchHighlightFullName = 1 | |
let g:NERDTreePatternMatchHighlightFullName = 1 | |
let g:NERDTreeFileExtensionHighlightFullName = 1 | |
let g:UltiSnipsExpandTrigger="<tab>" | |
let g:UltiSnipsJumpForwardTrigger="<c-b>" | |
let g:UltiSnipsJumpBackwardTrigger="<c-z>" | |
xmap ga <Plug>(EasyAlign) | |
nmap ga <Plug>(EasyAlign) | |
function! LightlineFilename() | |
return expand('%:p') | |
endfunction | |
function! LightlineFiletype() | |
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : '' | |
endfunction | |
function! LightlineFileformat() | |
return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : '' | |
endfunction | |
let mapleader = ',' | |
syntax enable | |
set path+=** | |
set wildmenu | |
set encoding=UTF-8 | |
set number | |
set nosmartindent | |
set autoindent | |
set ruler | |
set showmode | |
set showcmd | |
set nocompatible | |
set bs=2 " lets you backspace over things | |
"set digraph " lets you put in foreign chars. type :digraphs to see the default digraphs. use: {char1} <BS> {char2} | |
set shiftwidth=2 | |
set tabstop=2 | |
set expandtab "uses spaces for tab (ctrl-v tab for real tab) | |
set wrap | |
set ignorecase | |
set smartcase " used for searching. If ignorecase is on, any search using capital letters is case sensitive | |
set infercase " used for word completion | |
set cmdheight=2 | |
set incsearch | |
set hlsearch | |
set listchars=tab:TT,eol:$,trail:-,extends:>,precedes:< | |
set viminfo='20,<50,s10,h,f1 | |
set tildeop " allows motion to be added to ~ commands | |
set splitbelow "make window splits open below current window | |
set splitright "make window splits open to the right of current | |
set tabpagemax=16 | |
set spelllang=en_us | |
set nospell | |
set dictionary=/usr/share/dict/words | |
set whichwrap=b,s,h,<,>,[,] | |
set noswapfile | |
set scrolloff=20 | |
set cursorline "highlight line the cursor is on | |
"set cursorcolumn "highlight the column | |
set shell=zsh | |
set isf+=@-@ "add @ to filenames so gemset paths work: /Users/benlieb/.rvm/gems/ruby-1.8.7-p334@idance/gems/activesupport-3.0.7/lib/active_support/whiny_nil.rb:48:in `method_missing' | |
set laststatus=2 "always show status line | |
set statusline=%{expand('%:p')}%m%r%h%w\ %=\ [POS=%l,%v]\ [%p%%]\ [FORMAT=%{&ff}]\ [LEN=%L]\ [TYPE=%y] | |
set synmaxcol=190 "stops long lines from slowing down movement http://superuser.com/questions/302186/vim-scrolls-very-slow-when-a-line-is-to-long | |
set foldmethod=indent | |
set iskeyword+=- "treat words with dashes as word objects | |
set foldcolumn=0 | |
set guioptions+=k "keep window size the same when font changes size, or scrollbar appears etc | |
if exists('g:using_neovim') | |
" apparently nvim doesn't have rand() | |
colorscheme znake | |
else | |
"'torte', | |
let my_colorschemes = ['Dark2' , 'ubloh', 'znake', 'blackboard', 'colorful256', 'landscape', 'neverland2-darker', 'murphy'] | |
execute 'colorscheme' my_colorschemes[rand() % (len(my_colorschemes) - 1 ) ] | |
endif | |
"-------------------------------------------------------------------- | |
" For setting and zooming font size | |
"-------------------------------------------------------------------- | |
let g:fnt_sizes = [ 13, 7] | |
let g:fnt = 'BitstreamVeraSansMono\ Nerd\ Font\ Mono:h' | |
let g:fnt_index = 0 | |
let g:fnt_size = g:fnt_sizes[g:fnt_index] | |
function! CycleFontSize() | |
let g:fnt_index = (g:fnt_index + 1) % len(g:fnt_sizes) | |
let g:fnt_size = g:fnt_sizes[g:fnt_index] | |
call SetFont() | |
endfunction | |
function! SetFont() | |
if has('gui_running') | |
exe ':set guifont=' . g:fnt . string(g:fnt_size) | |
endif | |
endfunction | |
nnoremap <leader>= :call CycleFontSize()<cr> | |
"-------------------------------------------------------------------- | |
" SET THE FUNCS FOR OMNI COMPLETION PER FILETYPE | |
"-------------------------------------------------------------------- | |
autocmd FileType php set omnifunc=phpcomplete#CompletePHP | |
autocmd FileType python set omnifunc=pythoncomplete#Complete | |
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType css set omnifunc=csscomplete#CompleteCSS | |
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags | |
autocmd FileType php set omnifunc=phpcomplete#CompletePHP | |
autocmd FileType c set omnifunc=ccomplete#Complete | |
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete | |
" don't search included files for completion | |
" https://vi.stackexchange.com/questions/11349/ctrl-n-completion-takes-a-long-time-for-scanning-included-file | |
setglobal complete-=i | |
cab te tabe | |
cab Te tabe | |
cab tn tabnew | |
cab dd ~/Desktop/ | |
"-------------------------------------------------------------------- | |
" ABBREVIATIONS | |
"-------------------------------------------------------------------- | |
iab pry binding.pry | |
iab cl console.log( | |
cab _vrc :tabe ~/.vimrc | |
cab _sv :source ~/.vimrc | |
cab _dt vert diffsplit ~/.vim/download_tmp_file.php | |
cab _cd cd %:p:h | |
cab _bda 0,2000bd | |
"ex: /Users/benlieb/my_life/sites/2007/idance/idance_16/app/models/purchase.rb | |
cab _file :put =expand('%:p') | |
"ex: /Users/benlieb/.vimrc:103 | |
cab _file_n :put =expand('%:p') . ':' . expand(line('.')) | |
"ex: purchase.rb | |
cab _filename :put =expand('%:t:h') | |
" relative to current dir: app/models/purchase | |
"cab: _app_path :put =expand('%:r') | |
"rails helpers | |
cab _dc app/controllers/ | |
cab _dv app/views/ | |
cab _dm app/models/ | |
cab _ds app/assets/stylesheets/ | |
cab _dj app/javascripts/ | |
cab _di app/assets/images/ | |
cab _c tabe app/controllers/ | |
cab _v tabe app/views/ | |
cab _m tabe app/models/ | |
cab _s tabe app/assets/stylesheets/ | |
cab _j tabe app/javascripts/ | |
cab _i tabe app/assets/images/ | |
:map <C-S> V:!file_contents_search<CR><CR> | |
:imap <C-S> <ESC>V:!file_contents_search<CR><CR> | |
:map <C-F> V:!file_search<CR><CR> | |
:imap <C-F> <ESC>V:!file_search<CR><CR> | |
:map ,cs i class=''<ESC> | |
:map ,cn i className=''<ESC> | |
:map ,st i style=''<ESC> | |
:map ,id i id=''<ESC> | |
:map ,ti i title=''<ESC> | |
:map ,wi i width=''<ESC> | |
:nmap ,ntc :NERDTreeCWD<CR> | |
:nmap ,ntf :NERDTreeFind<CR> | |
:nmap ,ntt :NERDTreeToggle<CR> | |
:nmap ,ntm :NERDTreeMirror<CR> | |
:vmap ,tid :!tidy -config ~/vim_filter.tidy<CR> | |
:vmap ,ct :!csstidy - --silent=true <CR> | |
"remove spaces | |
:map ,rs :s/ //g<CR> | |
"line above | |
:map ,la O<ESC>j | |
"line below | |
:map ,lb o<ESC>k | |
"break | |
:map ,br A<br><ESC> | |
"starts a new line at cursor | |
:map ,, i<CR><ESC> | |
" Remove tags | |
:map ,rt :s/<.\{-}>//g<CR>:noh<CR> "the \{-} means non greedy, but as many as possible w/o being greedy | |
"select all | |
:map ,va ggVG | |
"delete all | |
:map ,da ggVGd | |
"move current tab to front position | |
:map ,tf :tabm 0<CR> | |
"get out of diffmode | |
:map ,do :diffo<CR> | |
"fold maps----------------------------------------------- | |
"fold syntax | |
:map ,fs :set foldmethod=syntax<CR> | |
"fold indent | |
:map ,fi :set foldmethod=indent<CR> | |
"fold function | |
"insert mode maps----------------------------------------------- | |
"move to end of line | |
:imap <C-A> <ESC>A | |
"option-delete (bs) to delete previous word | |
:imap <M-BS> <ESC>dbxa | |
"MOVEMENT MAPS | |
:map <C-j> 3j | |
:map <C-k> 3k | |
:map <D-j> 5j | |
:map <D-k> 5k | |
"remaps of page up and down | |
:map <C-U> 20k | |
:map <C-D> 20j | |
"remap: this one is built-in to do a man lookup but wastes a lot of time when accidentally triggered | |
:map <S-k> k | |
:map <up> kzz | |
:map <down> jzz | |
" | |
"this one usually does a man lookup but wastes a lot of time when accidentally triggered | |
:map <C-k> 3k | |
"move through tabs | |
:map <C-Tab> gt | |
:map <S-C-Tab> gT | |
"RSPEC VIM MAPS | |
map ,sp :call RunCurrentSpecFile()<CR> | |
map ,sn :call RunNearestSpec()<CR> | |
"map ,l :call RunLastSpec()<CR> | |
"map ,a :call RunAllSpecs()<CR> | |
"User functions | |
"----------------------------------------------------------------- | |
noremap <silent> <Leader>w :call ToggleWrap()<CR> | |
function ToggleWrap() | |
if &wrap | |
echo "Wrap OFF" | |
setlocal nowrap | |
silent! iunmap <buffer> k | |
silent! iunmap <buffer> j | |
silent! iunmap <buffer> ^ | |
silent! iunmap <buffer> $ | |
silent! nunmap <buffer> <Up> | |
silent! nunmap <buffer> <Down> | |
silent! nunmap <buffer> <Home> | |
silent! nunmap <buffer> <End> | |
silent! iunmap <buffer> <Up> | |
silent! iunmap <buffer> <Down> | |
silent! iunmap <buffer> <Home> | |
silent! iunmap <buffer> <End> | |
else | |
echo "Wrap ON" | |
setlocal wrap linebreak nolist | |
setlocal display+=lastline | |
noremap <buffer> <silent> k gk | |
noremap <buffer> <silent> j gj | |
noremap <buffer> <silent> ^ g^ | |
noremap <buffer> <silent> $ g$ | |
noremap <buffer> <silent> <Up> gk | |
noremap <buffer> <silent> <Down> gj | |
noremap <buffer> <silent> <Home> g<Home> | |
noremap <buffer> <silent> <End> g<End> | |
inoremap <buffer> <silent> <Up> <C-o>gk | |
inoremap <buffer> <silent> <Down> <C-o>gj | |
inoremap <buffer> <silent> <Home> <C-o>g<Home> | |
inoremap <buffer> <silent> <End> <C-o>g<End> | |
endif | |
endfunction | |
"make * count occurances | |
"<C-O> goes back | |
" %s///gn counts last surch | |
" fixes movement | |
" Don't forget to call SetColor all first | |
noremap <silent> <Leader>nc :call NextColor(0)<CR> | |
"gray folds | |
"this fixes some bug in macvims color system | |
noremap <silent> <Leader>gf :call GrayFolds()<CR> | |
function GrayFolds() | |
"make sure folds are obscure: | |
highlight Folded guifg=#333333 guibg=NONE | |
highlight Folded ctermfg=DarkGray ctermbg=NONE | |
endfunction | |
"changes comments to black | |
cab _ch :call CommentsHide()<CR> | |
function CommentsHide() | |
highlight Comment guifg=#222222 | |
endfunction | |
"changes comments to visible color | |
cab _cs :call CommentsShow()<CR> | |
function CommentsShow() | |
highlight Comment guifg=DarkCyan | |
highlight Comment guifg=#444444 | |
endfunction | |
"-------------------------------------------------------------------- | |
"USER DEFINED COMMANDS | |
"-------------------------------------------------------------------- | |
"this adds :Tabe as a user command and allows multiple arguments, unlike :tabe | |
com! -bang -nargs=+ -complete=file Tabe args<bang> <args>|tab all|argd * | |
"this puts the Cream Capitalization command in gC | |
vmap <silent> gC :<C-u>call Cream_case_title("v")<CR> | |
"other capitalization commands (native): gu -> all lower, gU -> all caps, ~ -> reverse | |
"-------------------------------------------------------------------- | |
"LINUX-SPECIFIC | |
"-------------------------------------------------------------------- | |
set fileformat=unix | |
"-------------------------------------------------------------------- | |
"MAC-SPECIFIC | |
"-------------------------------------------------------------------- | |
set guitablabel=%m%t "see statusline for format | |
set guitabtooltip=%F "see statusline for format | |
" set guifont=FuraCode\ Nerd\ Font\ Mono:h13 | |
" set guifont=BitstreamVeraSansMono\ Nerd\ Font\ Mono:h13 | |
" exe ':set guifont=BitstreamVeraSansMono\ Nerd\ Font\ Mono:h' . string(g:fnt_size) | |
call SetFont() | |
"hi TabLineFill ctermfg=LightGreen ctermbg=DarkGreen | |
hi TabLineFill ctermfg=Black ctermbg=Black | |
hi TabLine ctermfg=Gray ctermbg=Black | |
hi TabLineSel ctermfg=Black ctermbg=Yellow | |
hi CursorLine cterm=NONE ctermbg=darkgray guibg=#222222 | |
hi foldcolumn guibg=#222222 | |
hi VertSplit guibg=#222222 guifg=#222222 | |
" the ~ | |
hi EndOfBuffer guifg=#555555 | |
"let g:csv_highlight_column = 'y' "sets auto yellow colum | |
call GrayFolds() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment