Created
February 7, 2018 20:50
-
-
Save cesardeazevedo/b36bc8fd92c6259724857a0967dec3d1 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
" Notes { | |
" Ben Hayden, Scott Blevins, Matt Thompson, et al. Public Domain. | |
" https://github.com/IntuitiveWebSolutions/VimConf | |
"} | |
" Basics { | |
set nocompatible " explicitly get out of vi-compatible mode | |
syntax on | |
if has('vim_starting') | |
set runtimepath+=~/.vim/bundle/neobundle.vim/ | |
endif | |
" Declare all NeoBundles | |
call neobundle#begin(expand('~/.vim/bundle/')) | |
NeoBundleFetch 'Shougo/neobundle.vim' | |
" Shougo stuff | |
NeoBundle 'Shougo/unite.vim' | |
" A really cool shell in vim! | |
NeoBundle 'Shougo/vimshell.vim' | |
NeoBundle 'othree/html5.vim' | |
NeoBundle 'junegunn/vim-emoji' | |
NeoBundle 'reasonml-editor/vim-reason' | |
NeoBundle 'elixir-editors/vim-elixir' | |
NeoBundle 'jparise/vim-graphql' | |
NeoBundle 'altercation/vim-colors-solarized' | |
NeoBundle 'lukaszb/vim-web-indent' | |
"React | |
NeoBundle 'mxw/vim-jsx' | |
"Vim syntax highlighting for Slim templates. | |
NeoBundle 'slim-template/vim-slim' | |
NeoBundle 'Shutnik/jshint2.vim' | |
NeoBundle 'chriskempson/vim-tomorrow-theme' | |
NeoBundle 'dhruvasagar/vim-table-mode' | |
NeoBundle 'vim-scripts/c.vim' | |
NeoBundle 'vim-scripts/a.vim' | |
NeoBundle 'lambdatoast/elm.vim' | |
NeoBundle 'guns/vim-clojure-static' | |
NeoBundle 'AndrewRadev/splitjoin.vim' | |
" Control Space | |
NeoBundle 'szw/vim-ctrlspace' | |
" todo.txt plugin. | |
NeoBundle 'freitass/todo.txt-vim' | |
" Git Integration | |
NeoBundle 'airblade/vim-gitgutter' | |
NeoBundle 'tpope/vim-fugitive' | |
" Nicer start screen | |
NeoBundle 'mhinz/vim-startify' | |
" <Tab> all the things! | |
NeoBundle 'ervandew/supertab' | |
" A pretty statusline, bufferline integration | |
NeoBundle 'bling/vim-airline', { 'rev': '401ce611c6f9b9e8be0857cf6094604033e1b717' } | |
NeoBundle 'keith/swift.vim' | |
" Better Python code completion. | |
NeoBundleLazy 'davidhalter/jedi-vim', { 'filetypes' : ['python'] } | |
" Use Python mode for all the awesome PEP-8 stuff but not for completion. | |
NeoBundleLazy 'klen/python-mode', { 'filetypes' : ['python'] } | |
" Tagbar for browsing source code trees. | |
NeoBundle 'majutsushi/tagbar' | |
" Show indent level with ,ig | |
NeoBundle 'nathanaelkane/vim-indent-guides' | |
" Quick commenting using ,, | |
NeoBundle 'scrooloose/nerdcommenter' | |
" Haskell development | |
NeoBundle 'dag/vim2hs' | |
NeoBundle 'leafgarland/typescript-vim' | |
NeoBundle 'dracula/vim' | |
NeoBundle 'rakr/vim-one' | |
NeoBundle 'lifepillar/vim-wwdc16-theme' | |
NeoBundle 'easysid/mod8.vim' | |
NeoBundle 'joshdick/onedark.vim' | |
NeoBundle 'sirver/ultisnips' | |
NeoBundle 'honza/vim-snippets' | |
NeoBundle 'tpope/vim-haml' | |
" Tim Pope has some awesome plugins for working with text. | |
NeoBundle 'tpope/vim-abolish' | |
NeoBundle 'tpope/vim-surround' | |
NeoBundle 'tpope/vim-endwise' | |
NeoBundle 'scrooloose/nerdtree' | |
NeoBundle 'tpope/vim-unimpaired' | |
NeoBundle 'tpope/vim-vinegar' | |
" Repeat plugin actions | |
NeoBundle 'tpope/vim-repeat' | |
NeoBundle 'flowtype/vim-flow' | |
NeoBundle 'w0rp/ale' | |
" Sparkup for HTML voodoo | |
" CTRL-y, to convert | |
NeoBundleLazy 'mattn/emmet-vim', { 'filetypes' : ['javascript', 'html', 'php'] } | |
" Syntax, tabs, indenting, etc. for PHP, JS, Puppet, Go, Coffee | |
NeoBundleLazy 'pangloss/vim-javascript', { 'filetypes' : ['javascript', 'html'], 'rev': '997c2b12f5fffedd3a787b8840dfe710b2e6d3f9' } | |
NeoBundleLazy 'maksimr/vim-jsbeautify', { 'filetypes' : ['javascript', 'html', 'php', 'jinja', 'css'] } | |
NeoBundleLazy 'einars/js-beautify', { 'filetypes' : ['javascript', 'html', 'php', 'jinja', 'css'] } | |
NeoBundleLazy 'fatih/vim-go', { 'filetypes' : ['go'] } | |
NeoBundleLazy 'plasticboy/vim-markdown', { 'filetypes' : ['mkd'] } | |
NeoBundleLazy 'elzr/vim-json', { 'filetypes' : ['json', 'jinja'] } | |
NeoBundleLazy 'sophacles/vim-bundle-mako', { 'filetypes' : ['html', 'jinja'] } | |
" NOT WORKING WITH HOMEBREW VIM. :( Keeping to try out later. | |
" YouCompleteMe uses jedi to complete for Python and works for many other | |
" languages. This replaces python-mode. | |
" NeoBundle 'Valloric/YouCompleteMe.git' | |
" vimproc needs a special build | |
NeoBundle 'Shougo/vimproc', { | |
\ 'build' : { | |
\ 'windows' : 'make -f make_mingw32.mak', | |
\ 'cygwin' : 'make -f make_cygwin.mak', | |
\ 'mac' : 'make -f make_mac.mak', | |
\ 'unix' : 'make -f make_unix.mak', | |
\ }, | |
\ } | |
NeoBundleLazy 'flowtype/vim-flow', { | |
\ 'autoload': { | |
\ 'filetypes': 'javascript' | |
\ }} | |
call neobundle#end() | |
" the plugin indent needs to be on before neobundle runs... | |
filetype plugin indent on " load filetype plugins/indent settings | |
" Update and turn on all NeoBundles | |
NeoBundleCheck | |
colorscheme fx " set our customized colorscheme | |
set background=dark | |
set guifont=Monaco\ for\ Powerline:h18 | |
" } | |
" General { | |
set backspace=indent,eol,start " make backspace a more flexible | |
"set backup " make backup files | |
set history=200 " remember more commands and search history | |
set undolevels=200 " use many big heap levels of undo | |
"set backupdir=~/.vim/backup " where to put backup files | |
"set directory=~/.vim/tmp " directory to place swap files in | |
set noswapfile | |
" set autochdir | |
set fileformats=unix,mac,dos " support all three, in this order | |
set hidden " you can change buffers without saving | |
if has("mouse") | |
set mouse=a " use mouse everywhere | |
endif | |
set noerrorbells " don't make noise when something errors | |
if has("persistent_undo") | |
set undofile " enable file undoing | |
set undodir=~/.vim/undo " where to put undo files | |
endif | |
set whichwrap=b,s,h,l,<,>,~,[,] " everything wraps | |
" | | | | | | | | | | |
" | | | | | | | | +-- "]" Insert and Replace | |
" | | | | | | | +-- "[" Insert and Replace | |
" | | | | | | +-- "~" Normal | |
" | | | | | +-- <Right> Normal and Visual | |
" | | | | +-- <Left> Normal and Visual | |
" | | | +-- "l" Normal and Visual (not recommended) | |
" | | +-- "h" Normal and Visual (not recommended) | |
" | +-- <Space> Normal and Visual | |
" +-- <BS> Normal and Visual | |
set wildmenu " turn on command line completion wild style | |
" ignore these list file extensions | |
set wildignore=*.dll,*.o,*.obj,*.bak,*.exe,*.pyc, | |
\*.jpg,*.gif,*.png | |
set wildmode=list:longest " turn on wild mode huge list | |
" Set buffer to infinity | |
set viminfo='100,h | |
" Enable omnicompletion | |
" NOTE: This is turned off right now because of jedi-vim | |
" set omnifunc=syntaxcomplete#Complete | |
au FileType python set omnifunc=jedi#completions | |
au BufNewFile,BufRead *.ejs set filetype=html | |
set omnifunc=syntaxcomplete#Complete | |
" } | |
" Vim UI { | |
set t_Co=256 | |
set cursorline " highlight current line | |
set hlsearch " highlight searched for phrases | |
set incsearch " highlight as you type you | |
" search phrase | |
set laststatus=2 " always show the status line | |
set lazyredraw " do not redraw while running macros | |
set linespace=0 " don't insert any extra pixel lines | |
" betweens rows | |
set list " we do what to show tabs, to ensure we get them | |
" out of my files | |
scriptencoding utf-8 | |
set encoding=utf-8 | |
" set listchars=tab:››,trail:∙ " show tabs and trailing | |
set listchars=tab:>-,trail:- " show tabs and trailing | |
set matchtime=5 " how many tenths of a second to blink | |
" matching brackets for | |
" set nostartofline " leave my cursor where it was | |
set number " turn on line numbers | |
set numberwidth=5 " We are good up to 99999 lines | |
set report=0 " tell us when anything is changed via :... | |
set ruler " Always show current positions along the bottom | |
set scrolloff=3 " Keep 10 lines (top/bottom) for scope | |
set shortmess=aOstT " shortens messages to avoid | |
" 'press a key' prompt | |
set showcmd " show the command being typed | |
set showmatch " show matching brackets | |
set sidescrolloff=10 " Keep 5 lines at the size | |
set statusline= " clear the statusline for when vimrc is reloaded | |
set statusline+=%-3.3n\ " buffer number | |
set statusline+=%<%.99f\ " file name up to 99 chars | |
set statusline+=%h%m%r%w " flags | |
set statusline+=%{fugitive#statusline()} " Git fugitive status line | |
set statusline+=[%{strlen(&ft)?&ft:'none'}, " filetype | |
set statusline+=%{strlen(&fenc)?&fenc:&enc}, " encoding | |
set statusline+=%{&fileformat}] " file format | |
set statusline+=%= " right align | |
set statusline+=%b,0x%-8B\ " current char | |
set statusline+=%-14.(%l,%c%V%)\ %<%P " offset | |
set statusline+=%{ALEGetStatusLine()} | |
set statusline+=%#warningmsg# | |
" set statusline+=%#syntodo#%{SyntasticStatuslineFlag()} " Add syntastic status line | |
set statusline+=%* | |
" } | |
" Text Formatting/Layout { | |
set expandtab " no real tabs please! | |
set formatoptions=rq " Automatically insert comment leader on return, | |
" and let gq format comments | |
set ignorecase " case insensitive by default | |
set infercase " case inferred by default | |
set nowrap " do not wrap line | |
set shiftround " when at 3 spaces, and I hit > ... go to 4, not 5 | |
set smartcase " if there are caps, go case-sensitive | |
set nosmartindent " turn off smart indent so comments work in Python | |
set shiftwidth=2 " auto-indent amount when using cindent, | |
" >>, << and stuff like that | |
set softtabstop=2 " when hitting tab or backspace, how many spaces | |
"should a tab be (see expandtab) | |
set tabstop=2 " We don't care about real tabs... | |
" } | |
" Mappings { | |
let mapleader = "," | |
" Mapping Unite commands | |
nnoremap <Leader>/ :Unite grep:.<cr> | |
nnoremap <Leader>y :Unite -buffer-name=yank history/yank<cr> | |
nnoremap <Leader>l :Unite -buffer-name=buffers -quick-match buffer<cr> | |
nnoremap <C-p> :Unite -start-insert file<cr> | |
" Mapping tab commands | |
nnoremap <Leader>tc :tabc<return> | |
nnoremap <Leader>tn :tabn<return> | |
nnoremap <Leader>tp :tabp<return> | |
nnoremap <Leader>te :tabe<space> | |
" Swich tabs like chrome | |
nnoremap <C-tab> :tabn<return> | |
nnoremap <C-S-tab> :tabp<return> | |
" Remap ,0 to first non-blank character | |
nnoremap <Leader>0 ^ | |
" Netrw vertical left split | |
command! NetrwVSP 30vsp . | set winfixwidth | |
nnoremap <Leader>nt :NetrwVSP<return> | |
" Add Tagbar Toggle | |
nnoremap <Leader>tb :TagbarToggle<return> | |
" Error list, next & previous commands for Syntastic | |
nnoremap <Leader>e :Errors<return> | |
nnoremap <Leader>en :lnext<return> | |
nnoremap <Leader>ep :lprev<return> | |
" Adding Toggle Comment | |
nnoremap <Leader><Leader> :call NERDComment("n", "Toggle")<return> | |
vnoremap <Leader><Leader> :call NERDComment("v", "Toggle")<return> | |
" Toggle NERDTree | |
nnoremap <C-e> :NERDTreeToggle <CR> | |
" Generate CPP Header File | |
nnoremap <Leader>hpp :call H2cppx(substitute(expand('%:t'), "\\.h", "\\.cpp", ""))<return> | |
" Add 'Sign' shortcut | |
nnoremap <Leader>si :exec "normal A".system("echo -n ' -- '$(git config --global --get user.name) $(date +\%D)")<return> | |
" Map Paste / No Number for copy, paste, etc. in Vim without X. | |
nnoremap <Leader>p :set paste!<return> | |
nnoremap <Leader>ln :set number!<return> | |
" X System Clipboard copy, cut, & paste shortcuts. | |
noremap <Leader>xp "+gP<return> | |
noremap <Leader>xy "+y<return> | |
noremap <Leader>xx "+x<return> | |
" Format JSON automagically | |
nmap <Leader>json :%!python -m json.tool<CR> | |
" Compile and run | |
nmap <F9> :SCCompile<cr> | |
nmap <F10> :SCCompileRun<cr> | |
" Compile (make) less to new CSS file | |
nnoremap <Leader>ml :w <BAR> !lessc % > %:t:r.css<CR><space> | |
" Spell Checking | |
nnoremap <Leader>sp :setlocal spell spelllang=en_us<return> | |
nnoremap <Leader>nsp :setlocal spell spelllang=<return> | |
" Edit & Source $MYVIMRC | |
nnoremap <Leader>ev :vsplit $MYVIMRC<CR> | |
nnoremap <Leader>sv :source $MYVIMRC<CR> | |
" Start vertical split command with space character. | |
nnoremap <Leader>vs :vsp<space> | |
" Start horizontal split command with space character. | |
nnoremap <Leader>hs :sp<space> | |
" Close window | |
nnoremap <Leader>cw :close<return> | |
" Close all but the current window. | |
nnoremap <Leader>w :only<return> | |
" Close buffer | |
nnoremap <Leader>bd :bd<return> | |
" Clear highlighting | |
nnoremap <Leader>ch :noh<return> | |
" Insert a line above or below cursor without insert mode. | |
nnoremap <Leader>O O<Esc> | |
nnoremap <Leader>o o<Esc> | |
" Make arrow keys jump by 10 lines | |
nnoremap <S-Down> 10j | |
nnoremap <S-Up> 10k | |
inoremap <S-Down> <Esc>10ji | |
inoremap <S-Up> <Esc>10ki | |
vnoremap <S-Down> 10j | |
vnoremap <S-Up> 10k | |
" Send the selected hunk to IWS's hastebin | |
vnoremap <Leader>hb <esc>:'<,'>:w !HASTE_SERVER=http://hastebin.britecorepro.com haste<CR> | |
" Jump easily between open windows | |
" Deprecated in favor of DWM | |
" nnoremap <C-h> <C-w>h | |
" nnoremap <C-j> <C-w>j | |
" nnoremap <C-k> <C-w>k | |
" nnoremap <C-l> <C-w>l | |
" " Howdoi mapping | |
map <Leader>hdi <Plug>Howdoi | |
" Refresh syntax highlighting | |
nnoremap <Leader>rf :syntax off<return>:syntax on<return> | |
" Fix all the whitespace in a file. Re-tabs and removes trailing whitespace. | |
" Usage: ,ws | |
nnoremap <Leader>ws :TrimWS<return> | |
nnoremap <Leader>rt gg=G | |
nnoremap <Leader>rw :TrimWS<return>gg=G | |
nnoremap <Leader>lw :set wrap!<return>:set linebreak!<return>:set list!<return> | |
" GitGutter Next/Prev Shortcuts | |
nmap ]h <Plug>GitGutterNextHunk | |
nmap [h <Plug>GitGutterPrevHunk | |
" Split Join map | |
nmap sj :SplitjoinJoin<cr> | |
nmap sk :SplitjoinSplit<cr> | |
" Insert a single character of your choosing and return to the right spot. | |
" Usage: ,[spacebar][character] | |
nnoremap <Leader><space> :exec "normal i".nr2char(getchar())."\e"<return> | |
nnoremap <Leader>a :exec "normal a".nr2char(getchar())."\e"<return> | |
" Write as super user | |
command! W w !sudo tee % > /dev/null | |
" Trim trailing whitespace | |
command! TrimWS %s/\s*$//g | noh | |
" Visual Selection Search using * and # | |
function! s:VSetSearch() | |
let temp = @@ | |
norm! gvy | |
let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') | |
let @@ = temp | |
endfunction | |
vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR> | |
vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR> | |
" 'Parameters' Operator mapping | |
" Usage: dp - Delete between () | |
onoremap p i( | |
" } | |
" Plugin settings { | |
let coffee_compile_vert=1 " When compiling CoffeeScript, throw output into vertical split | |
let coffee_make_options='--bare' | |
" ALE Config | |
" let g:ale_set_signs = 0 | |
let g:ale_lint_on_save = 1 | |
let g:ale_sign_column_always = 0 | |
let g:ale_statusline_format = ['⨉ %d', '⚠ %d', '⬥ ok'] | |
let g:ale_echo_msg_error_str = 'E' | |
let g:ale_echo_msg_warning_str = 'W' | |
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' | |
let g:ale_linters = { | |
\ 'javascript': ['eslint'], | |
\ 'javascript.jsx': ['eslint'], | |
\ 'go': ['gofmt -e', 'go vet', 'golint'], | |
\} | |
" Validator Config | |
" let g:validator_filetype_map = {"javascript.jsx": "javascript"} | |
" let g:validator_javascript_checkers = ['eslint'] | |
" Disables man | |
map <S-k> <Nop> | |
let g:ftplugin_sql_omni_key='<C-S>' " reset sql omni key | |
let NERDSpaceDelims=1 " Add space delimiters | |
let g:gitgutter_eager=0 " Only run gitgutter on read/write of files | |
let g:gitgutter_max_signs=5000 | |
let g:gitgutter_override_sign_column_highlight = 0 | |
" airline settings | |
let g:airline#extensions#tabline#enabled = 1 " Adding pretty tabline | |
let g:airline_powerline_fonts = 1 | |
" remove errors | |
let g:airline_section_warning=' ' | |
if !exists('g:airline_symbols') | |
let g:airline_symbols = {} | |
endif | |
let g:airline_symbols.space = "\ua0" | |
" let g:airline#extensions#tabline#show_buffers = 1 " Make 0 for not showing closed buffers | |
" let g:vim_json_syntax_conceal = 0 " Don't hide quotes on JSON | |
" Disable GitGutter in vimdiff | |
if &diff | |
let g:gitgutter_enabled=0 | |
endif | |
" Solarized variables | |
let g:solarized_termtrans=1 | |
let g:solarized_contrast="high" | |
" Molokai settings | |
let g:rehash256 = 1 | |
let g:molokai_original = 1 | |
" Python syntax highlighting settings | |
let python_highlight_all = 1 | |
let python_version_2 = 1 | |
"NERDTree | |
let NERDTreeIgnore = ['\.meta$', '\.pyc$', '\.ibc'] | |
" Set flow | |
let g:flow#enable = 0 | |
let g:flow#autoclose = 0 | |
let g:flow#timeout = 4 | |
let g:javascript_plugin_flow = 0 | |
nnoremap <C-w>F :FlowMake<CR> | |
" Indent guide settings | |
let g:indent_guides_start_level = 2 | |
let g:indent_guides_guide_size = 1 | |
let g:indent_guides_auto_colors = 0 | |
hi IndentGuidesOdd ctermbg=234 | |
hi IndentGuidesEven ctermbg=234 | |
" Jedi settings | |
let g:jedi#popup_on_dot = 1 | |
let g:jedi#popup_select_first = 1 | |
" Disabling parameter autocomplete to speed up completion for now. | |
" Will enable after it is fixed in Jedi. | |
let g:jedi#show_call_signatures = "0" | |
" No rope for autocomplete! | |
let g:pymode_rope = 0 | |
let g:pymode_folding = 0 | |
let g:pymode_lint=0 " Turn off python-mode lint since we use Syntastic | |
let g:pymode_trim_whitespaces=0 " don't molest whitespace | |
let g:pymode_syntax_all = 1 | |
let g:pymode_syntax_print_as_function = 1 | |
let g:pymode_syntax = 1 | |
let g:ycm_add_preview_to_completeopt = 0 | |
" Snippet settings | |
let g:UltiSnipsExpandTrigger="<c-k>" | |
let g:UltiSnipsListSnippets="<c-l>" | |
let g:UltiSnipsJumpForwardTrigger="<c-b>" | |
let g:UltiSnipsJumpBackwardTrigger="<c-z>" | |
" markdown settings | |
let g:vim_markdown_folding_disabled=1 | |
" golang settings | |
" let g:go_fmt_command = "goimports" | |
" Unite settings | |
let g:unite_enabled_start_insert=1 | |
let g:unite_source_history_yank_enable=1 | |
let g:unite_winheight = 10 | |
let g:splitjoin_split_mapping = '' | |
let g:splitjoin_join_mapping = '' | |
" JSX to .js files | |
let g:jsx_ext_required = 0 | |
" Startify settings | |
let g:startify_session_persistence = 1 | |
let g:startify_custom_header = [ | |
\ '', | |
\ '', | |
\ ' _______ _______ __ _______ _____ __', | |
\ ' |_ _\ \ / / ____| \ \ / /_ _| / ____| / _|', | |
\ ' | | \ \ /\ / / (___ \ \ / / | | _ __ ___ | | ___ _ __ | |_', | |
\ ' | | \ \/ \/ / \___ \ \ \/ / | | | `_ ` _ \| | / _ \| `_ \| _|', | |
\ ' _| |_ \ /\ / ____) | \ / _| |_| | | | | | |___| (_) | | | | |', | |
\ ' |_____| \/ \/ |_____/ \/ |_____|_| |_| |_|\_____\___/|_| |_|_|', | |
\ '', | |
\ '', | |
\ ] | |
" } | |
" TableMode | |
" | |
let g:table_mode_corner_corner="|" | |
" inoreabbrev <expr> <bar><bar> | |
" \ s:isAtStartOfLine('\|\|') ? | |
" \ '<c-o>:TableModeEnable<cr><bar><space><bar><left><left>' : '<bar><bar>' | |
" inoreabbrev <expr> __ | |
" \ s:isAtStartOfLine('__') ? | |
" \ '<c-o>:silent! TableModeDisable<cr>' : '__' | |
" fun! s:isAtStartOfLine(mapping) | |
" let text_before_cursor = getline('.')[0 : col('.')-1] | |
" let mapping_pattern = '\V' . escape(a:mapping, '\') | |
" let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\') | |
" return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$') | |
" endf | |
" Global Abbreviations { | |
iabbrev rn return | |
" } | |
" Global Functions { | |
function! InsertDebugLine(str, lnum) | |
let line = getline(a:lnum) | |
if strridx(line, a:str) != -1 | |
normal dd | |
else | |
let plnum = prevnonblank(a:lnum) | |
call append(line('.')-1, repeat(' ', indent(plnum)).a:str) | |
normal k | |
endif | |
" Save file without any events | |
if &modifiable && &modified | noautocmd write | endif | |
endfunction | |
" } | |
" Autocmds { | |
autocmd BufNewFile,BufRead *.fs,*.fsi,*.fsx set filetype=fsharp | |
autocmd FileType javascript noremap <buffer> <Leader>js :call JsBeautify()<cr> | |
autocmd FileType html noremap <buffer> <Leader>js :call HtmlBeautify()<cr> | |
autocmd FileType css noremap <buffer> <Leader>js :call CSSBeautify()<cr> | |
autocmd FileType javascript vnoremap <buffer> <c-f> :call RangeJsBeautify()<cr> | |
autocmd FileType html vnoremap <buffer> <c-f> :call RangeHtmlBeautify()<cr> | |
autocmd FileType css vnoremap <buffer> <c-f> :call RangeCSSBeautify()<cr> | |
autocmd vimenter * NERDTree | |
autocmd FileType javascript.jsx set tabstop=2 | |
autocmd FileType javascript.jsx set softtabstop=2 | |
autocmd FileType javascript.jsx set shiftwidth=2 | |
" autocmd BufEnter *.jsx set filetype=javascript | |
autocmd FileType javascript set tabstop=2 | |
autocmd FileType javascript set softtabstop=2 | |
autocmd FileType javascript set shiftwidth=2 | |
au BufNewFile,BufRead *.wsgi set filetype=python | |
augroup golang_au | |
autocmd! | |
" Display real tabs like 4 spaces, don't list trailing characters | |
au BufNewFile,BufReadPost *.go setl noexpandtab tabstop=4 nolist | |
augroup END | |
augroup javascript_au | |
autocmd! | |
" Add debugger key command for JS | |
au BufNewFile,BufReadPost *.js nnoremap <Leader>b :call InsertDebugLine("debugger;", line('.'))<return> | |
augroup END | |
augroup less_au | |
autocmd! | |
" Function to compile Less to CSS | |
function! LessToCss() | |
let current_file = shellescape(expand('%:p')) | |
let filename = shellescape(expand('%:r')) | |
let command = "silent !lessc " . current_file . " " . filename . ".css" | |
execute command | |
endfunction | |
" Auto-compile less files on save. | |
autocmd BufWritePost,FileWritePost *.less call LessToCss() | |
augroup END | |
augroup python_au | |
autocmd! | |
" Add remote debugger key command for Python | |
au BufNewFile,BufReadPost *.py nnoremap <Leader>rb :call InsertDebugLine("import rpdb; rpdb.set_trace() # XXX BREAKPOINT", line('.'))<return> | |
au BufNewFile,BufReadPost *.py nnoremap <Leader>bb :call InsertDebugLine("import pudb; pudb.set_trace() # XXX BREAKPOINT", line('.'))<return> | |
augroup END | |
augroup reopen_au | |
autocmd! | |
" Re-open VIM to the last spot you had open. | |
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | |
\| exe "normal! g'\"" | endif | |
" Jump to the top of git COMMIT_EDITMSG files. | |
au BufReadPost COMMIT_EDITMSG | |
\ exe "normal! gg" | |
augroup END | |
augroup unite_au | |
autocmd! | |
function! s:unite_settings() | |
" Put settings that execute inside the unite buffer here | |
endfunction | |
autocmd FileType unite call s:unite_settings() | |
augroup END | |
autocmd Filetype jade setlocal ts=2 sts=2 sw=2 | |
autocmd Filetype styl setlocal ts=2 sts=2 sw=2 | |
autocmd Filetype sass setlocal ts=2 sts=2 sw=2 | |
autocmd Filetype html setlocal ts=2 sts=2 sw=2 | |
autocmd Filetype js setlocal ts=2 sts=2 sw=2 | |
autocmd Filetype rb setlocal ts=2 sts=2 sw=2 | |
" } | |
" Include custom configurations via the .vimrc_custom file | |
" which is included here: | |
if filereadable($HOME."/.vimrc_custom") | |
source $HOME/.vimrc_custom | |
endif | |
" AirlineTheme fx | |
set background=dark | |
colorscheme fx | |
" set background=light | |
" colorscheme solarized | |
if(has("gui_runing")) | |
set transp=6 | |
endif | |
nmap ]h <Plug>GitGutterNextHunk | |
nmap [h <Plug>GitGutterPrevHunk | |
" set shell=zsh\ -l |
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
" ~/.vim/bundle/vim-javascript/syntax/javascript.vim | |
" Vim syntax file | |
" Language: JavaScript | |
" Maintainer: vim-javascript community | |
" URL: https://github.com/pangloss/vim-javascript | |
if !exists("main_syntax") | |
if version < 600 | |
syntax clear | |
elseif exists("b:current_syntax") | |
finish | |
endif | |
let main_syntax = 'javascript' | |
endif | |
" Dollar sign is permitted anywhere in an identifier | |
if v:version > 704 || v:version == 704 && has('patch1142') | |
syntax iskeyword @,48-57,_,192-255,$ | |
else | |
setlocal iskeyword+=$ | |
endif | |
syntax sync fromstart | |
" TODO: Figure out what type of casing I need | |
" syntax case ignore | |
syntax case match | |
syntax match jsNoise /[:,\;\.]\{1}/ | |
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/ | |
syntax match jsParensError /[)}\]]/ | |
" Program Keywords | |
syntax keyword jsStorageClass const var let skipwhite skipempty nextgroup=jsDestructuringBlock,jsDestructuringArray,jsVariableDef | |
syntax match jsVariableDef contained /\k\+/ nextgroup=jsFlowDefinition | |
syntax keyword jsOperator delete instanceof typeof void new in of | |
syntax match jsOperator /[\!\|\&\+\-\<\>\=\%\/\*\~\^]\{1}/ | |
syntax keyword jsBooleanTrue true | |
syntax keyword jsBooleanFalse false | |
" Modules | |
syntax keyword jsModuleKeywords contained import | |
syntax keyword jsModuleKeywords contained export skipwhite skipempty nextgroup=jsExportBlock,jsModuleDefault | |
syntax keyword jsModuleOperators contained from | |
syntax keyword jsModuleOperators contained as | |
syntax region jsModuleGroup contained matchgroup=jsModuleBraces start=/{/ end=/}/ contains=jsModuleOperators,jsNoise,jsComment | |
syntax match jsModuleAsterisk contained /*/ | |
syntax keyword jsModuleDefault contained default skipwhite skipempty nextgroup=@jsExpression | |
syntax region jsImportContainer start=/\<import\> / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsComment,jsString,jsTemplateString,jsNoise,jsModuleGroup,jsModuleAsterisk | |
syntax region jsExportContainer start=/\<export\> / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsStorageClass,jsModuleDefault,@jsExpression | |
syntax region jsExportBlock contained matchgroup=jsExportBraces start=/{/ end=/}/ contains=jsModuleOperators,jsNoise,jsComment | |
" Strings, Templates, Numbers | |
syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend | |
syntax region jsString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend | |
syntax region jsTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=jsTemplateVar,jsSpecial extend | |
syntax match jsTaggedTemplate /\k\+\%(`\)\@=/ nextgroup=jsTemplateString | |
syntax match jsNumber /\<\d\+\%([eE][+-]\=\d\+\)\=\>\|\<0[bB][01]\+\>\|\<0[oO]\o\+\>\|\<0[xX]\x\+\>/ | |
syntax keyword jsNumber Infinity | |
syntax match jsFloat /\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/ | |
" Regular Expressions | |
syntax match jsSpecial contained "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)" | |
syntax region jsTemplateVar contained matchgroup=jsTemplateBraces start=+${+ end=+}+ contains=@jsExpression | |
syntax region jsRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+ | |
syntax match jsRegexpBoundary contained "\v%(\<@![\^$]|\\[bB])" | |
syntax match jsRegexpBackRef contained "\v\\[1-9][0-9]*" | |
syntax match jsRegexpQuantifier contained "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??" | |
syntax match jsRegexpOr contained "\v\<@!\|" | |
syntax match jsRegexpMod contained "\v\(@<=\?[:=!>]" | |
syntax region jsRegexpGroup contained start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contains=jsRegexpCharClass,@jsRegexpSpecial keepend | |
if v:version > 703 || v:version == 603 && has("patch1088") | |
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@50<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@50<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend | |
else | |
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend | |
endif | |
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod | |
" Objects | |
syntax match jsObjectKey contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue | |
syntax match jsObjectColon contained /:/ skipwhite skipempty | |
syntax region jsObjectKeyString contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue | |
syntax region jsObjectKeyString contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue | |
syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend | |
syntax match jsObjectSeparator contained /,/ | |
syntax region jsObjectValue contained start=/:/ end=/\%(,\|}\)\@=/ contains=jsObjectColon,@jsExpression extend | |
syntax match jsObjectFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>[\r\n\t ]*(\@=/ skipwhite skipempty nextgroup=jsFuncArgs | |
syntax match jsFunctionKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/ | |
syntax match jsObjectMethodType contained /\%(get\|set\|static\|async\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsObjectFuncName | |
syntax region jsObjectStringKey contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue | |
syntax region jsObjectStringKey contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue | |
exe 'syntax keyword jsNull null '.(exists('g:javascript_conceal_null') ? 'conceal cchar='.g:javascript_conceal_null : '') | |
exe 'syntax keyword jsReturn return contained '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '') | |
exe 'syntax keyword jsUndefined undefined '.(exists('g:javascript_conceal_undefined') ? 'conceal cchar='.g:javascript_conceal_undefined : '') | |
exe 'syntax keyword jsNan NaN '.(exists('g:javascript_conceal_NaN') ? 'conceal cchar='.g:javascript_conceal_NaN : '') | |
exe 'syntax keyword jsPrototype prototype '.(exists('g:javascript_conceal_prototype') ? 'conceal cchar='.g:javascript_conceal_prototype : '') | |
exe 'syntax keyword jsThis this '.(exists('g:javascript_conceal_this') ? 'conceal cchar='.g:javascript_conceal_this : '') | |
exe 'syntax keyword jsSuper super contained '.(exists('g:javascript_conceal_super') ? 'conceal cchar='.g:javascript_conceal_super : '') | |
" Statement Keywords | |
syntax keyword jsStatement contained break continue with yield debugger | |
syntax keyword jsConditional if skipwhite skipempty nextgroup=jsParenIfElse | |
syntax keyword jsConditional else skipwhite skipempty nextgroup=jsCommentMisc,jsIfElseBlock | |
syntax keyword jsConditional switch skipwhite skipempty nextgroup=jsParenSwitch | |
syntax keyword jsRepeat while for skipwhite skipempty nextgroup=jsParenRepeat,jsForAwait | |
syntax keyword jsDo do skipwhite skipempty nextgroup=jsRepeatBlock | |
syntax keyword jsLabel contained case default | |
syntax keyword jsTry try skipwhite skipempty nextgroup=jsTryCatchBlock | |
syntax keyword jsFinally contained finally skipwhite skipempty nextgroup=jsFinallyBlock | |
syntax keyword jsCatch contained catch skipwhite skipempty nextgroup=jsParenCatch | |
syntax keyword jsException throw | |
syntax keyword jsAsyncKeyword async await | |
syntax match jsSwitchColon contained /:/ skipwhite skipempty nextgroup=jsSwitchBlock | |
" Keywords | |
syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set RegExp String Proxy Promise Buffer ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray JSON Math console document window Intl Collator DateTimeFormat NumberFormat | |
syntax keyword jsGlobalNodeObjects module exports global process | |
" syntax match jsGlobalNodeObjects /require/ containedin=jsFuncCall | |
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError | |
syntax keyword jsBuiltins decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt uneval | |
" DISCUSS: How imporant is this, really? Perhaps it should be linked to an error because I assume the keywords are reserved? | |
syntax keyword jsFutureKeys abstract enum int short boolean interface byte long char final native synchronized float package throws goto private transient implements protected volatile double public | |
" DISCUSS: Should we really be matching stuff like this? | |
" DOM2 Objects | |
syntax keyword jsGlobalObjects DOMImplementation DocumentFragment Document Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction | |
syntax keyword jsExceptions DOMException | |
" DISCUSS: Should we really be matching stuff like this? | |
" DOM2 CONSTANT | |
syntax keyword jsDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR | |
syntax keyword jsDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE | |
" DISCUSS: Should we really be special matching on these props? | |
" HTML events and internal variables | |
syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize | |
" Code blocks | |
syntax region jsBracket matchgroup=jsBrackets start=/\[/ end=/\]/ contains=@jsExpression extend fold | |
syntax region jsParen matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll extend fold | |
syntax region jsParenDecorator contained matchgroup=jsParensDecorator start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc extend fold | |
syntax region jsParenIfElse contained matchgroup=jsParensIfElse start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc,jsIfElseBlock extend fold | |
syntax region jsParenRepeat contained matchgroup=jsParensRepeat start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc,jsRepeatBlock extend fold | |
syntax region jsParenSwitch contained matchgroup=jsParensSwitch start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsSwitchBlock extend fold | |
syntax region jsParenCatch contained matchgroup=jsParensCatch start=/(/ end=/)/ skipwhite skipempty nextgroup=jsTryCatchBlock extend fold | |
syntax region jsFuncArgs contained matchgroup=jsFuncParens start=/(/ end=/)/ contains=jsFuncArgCommas,jsComment,jsFuncArgExpression,jsDestructuringBlock,jsRestExpression,jsFlowArgumentDef skipwhite skipempty nextgroup=jsCommentFunction,jsFuncBlock,jsFlowReturn extend fold | |
syntax region jsClassBlock contained matchgroup=jsClassBraces start=/{/ end=/}/ contains=jsClassFuncName,jsClassMethodType,jsArrowFunction,jsArrowFuncArgs,jsComment,jsGenerator,jsDecorator,jsClassProperty,jsClassPropertyComputed,jsClassStringKey,jsNoise extend fold | |
syntax region jsFuncBlock contained matchgroup=jsFuncBraces start=/{/ end=/}/ contains=@jsAll extend fold | |
syntax region jsIfElseBlock contained matchgroup=jsIfElseBraces start=/{/ end=/}/ contains=@jsAll extend fold | |
syntax region jsBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll extend fold | |
syntax region jsTryCatchBlock contained matchgroup=jsTryCatchBraces start=/{/ end=/}/ contains=@jsAll skipwhite skipempty nextgroup=jsCatch,jsFinally extend fold | |
syntax region jsFinallyBlock contained matchgroup=jsFinallyBraces start=/{/ end=/}/ contains=@jsAll extend fold | |
syntax region jsSwitchBlock contained matchgroup=jsSwitchBraces start=/{/ end=/}/ contains=@jsAll,jsLabel,jsSwitchColon extend fold | |
syntax region jsRepeatBlock contained matchgroup=jsRepeatBraces start=/{/ end=/}/ contains=@jsAll extend fold | |
syntax region jsDestructuringBlock contained matchgroup=jsDestructuringBraces start=/{/ end=/}/ contains=jsDestructuringProperty,jsDestructuringAssignment,jsDestructuringNoise,jsDestructuringPropertyComputed,jsSpreadExpression extend fold | |
syntax region jsDestructuringArray contained matchgroup=jsDestructuringBraces start=/\[/ end=/\]/ contains=jsDestructuringPropertyValue,jsNoise,jsDestructuringProperty,jsSpreadExpression extend fold | |
syntax region jsObject matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsDecorator extend fold | |
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression | |
syntax region jsSpreadExpression contained matchgroup=jsSpreadOperator start=/\.\.\./ end=/[,}\]]\@=/ contains=@jsExpression | |
syntax region jsRestExpression contained matchgroup=jsRestOperator start=/\.\.\./ end=/[,)]\@=/ | |
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression | |
syntax match jsGenerator contained /\*/ skipwhite skipempty nextgroup=jsFuncName,jsFuncArgs | |
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowFunctionGroup | |
syntax region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend | |
syntax match jsFuncArgCommas contained ',' | |
syntax keyword jsArguments contained arguments | |
syntax keyword jsForAwait contained await skipwhite skipempty nextgroup=jsParenRepeat | |
" Matches a single keyword argument with no parens | |
syntax match jsArrowFuncArgs /\k\+\s*\%(=>\)\@=/ skipwhite contains=jsFuncArgs skipwhite skipempty nextgroup=jsArrowFunction extend | |
" Matches a series of arguments surrounded in parens | |
syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ contains=jsFuncArgs skipempty skipwhite nextgroup=jsArrowFunction extend | |
exe 'syntax match jsFunction /\<function\>/ skipwhite skipempty nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '') | |
exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFuncBlock,jsCommentFunction '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '') | |
" Classes | |
syntax keyword jsClassKeywords contained extends class | |
syntax match jsClassNoise contained /\./ | |
syntax match jsClassMethodType contained /\%(get\|set\|static\|async\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsFuncName,jsClassProperty | |
syntax match jsClassDefinition /\<class\>\%( [a-zA-Z_$][0-9a-zA-Z_$ \n.]*\)*/ contains=jsClassKeywords,jsClassNoise skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup | |
syntax match jsClassProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsClassValue | |
syntax region jsClassValue contained start=/=/ end=/\%(;\|}\|\n\)\@=/ contains=@jsExpression | |
syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend | |
syntax match jsClassFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\%(\s*(\)\@=/ skipwhite skipempty nextgroup=jsFuncArgs | |
syntax region jsClassStringKey contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs | |
syntax region jsClassStringKey contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs | |
" Destructuring | |
syntax match jsDestructuringPropertyValue contained /\<[0-9a-zA-Z_$]*\>/ | |
syntax match jsDestructuringProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValue | |
syntax match jsDestructuringAssignment contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValueAssignment | |
syntax region jsDestructuringValue contained start=/=/ end=/[,}\]]\@=/ contains=@jsExpression extend | |
syntax region jsDestructuringValueAssignment contained start=/:/ end=/[,}=]\@=/ contains=jsDestructuringPropertyValue,jsDestructuringBlock,jsNoise,jsDestructuringNoise skipwhite skipempty nextgroup=jsDestructuringValue extend | |
syntax match jsDestructuringNoise contained /[,\[\]]/ | |
syntax region jsDestructuringPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringNoise extend fold | |
" Comments | |
syntax keyword jsCommentTodo contained TODO FIXME XXX TBD | |
syntax region jsComment start=/\/\// end=/$/ contains=jsCommentTodo,@Spell extend keepend | |
syntax region jsComment start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell fold extend keepend | |
syntax region jsEnvComment start=/\%^#!/ end=/$/ display | |
" Specialized Comments - These are special comment regexes that are used in | |
" odd places that maintain the proper nextgroup functionality. It sucks we | |
" can't make jsComment a skippable type of group for nextgroup | |
syntax region jsCommentFunction contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn extend keepend | |
syntax region jsCommentFunction contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn fold extend keepend | |
syntax region jsCommentClass contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup extend keepend | |
syntax region jsCommentClass contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup fold extend keepend | |
syntax region jsCommentMisc contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsBlock extend keepend | |
syntax region jsCommentMisc contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsBlock fold extend keepend | |
" Decorators | |
syntax match jsDecorator /^\s*@/ nextgroup=jsDecoratorFunction | |
syntax match jsDecoratorFunction contained /[a-zA-Z_][a-zA-Z0-9_.]*/ nextgroup=jsParenDecorator | |
if exists("javascript_plugin_jsdoc") | |
runtime extras/jsdoc.vim | |
" NGDoc requires JSDoc | |
if exists("javascript_plugin_ngdoc") | |
runtime extras/ngdoc.vim | |
endif | |
endif | |
if exists("javascript_plugin_flow") | |
runtime extras/flow.vim | |
endif | |
syntax cluster jsExpression contains=jsBracket,jsParen,jsObject,jsBlock,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsFuncCall,jsUndefined,jsNan,jsPrototype,jsBuiltins,jsNoise,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs,jsParensError,jsComment,jsArguments,jsThis,jsSuper,jsDo | |
syntax cluster jsAll contains=@jsExpression,jsExportContainer,jsImportContainer,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsStatement,jsException,jsTry,jsAsyncKeyword | |
" Define the default highlighting. | |
" For version 5.7 and earlier: only when not done already | |
" For version 5.8 and later: only when an item doesn't have highlighting yet | |
if version >= 508 || !exists("did_javascript_syn_inits") | |
if version < 508 | |
let did_javascript_syn_inits = 1 | |
command -nargs=+ HiLink hi link <args> | |
else | |
command -nargs=+ HiLink hi def link <args> | |
endif | |
HiLink jsComment Comment | |
HiLink jsEnvComment PreProc | |
HiLink jsParensIfElse jsParens | |
HiLink jsParensRepeat jsParens | |
HiLink jsParensSwitch jsParens | |
HiLink jsParensCatch jsParens | |
HiLink jsCommentTodo Todo | |
HiLink jsString String | |
HiLink jsObjectKeyString String | |
HiLink jsTemplateString String | |
HiLink jsObjectStringKey String | |
HiLink jsClassStringKey String | |
HiLink jsTaggedTemplate StorageClass | |
HiLink jsTernaryIfOperator Conditional | |
HiLink jsRegexpString String | |
HiLink jsRegexpBoundary SpecialChar | |
HiLink jsRegexpQuantifier SpecialChar | |
HiLink jsRegexpOr Conditional | |
HiLink jsRegexpMod SpecialChar | |
HiLink jsRegexpBackRef SpecialChar | |
HiLink jsRegexpGroup jsRegexpString | |
HiLink jsRegexpCharClass Character | |
HiLink jsCharacter Character | |
HiLink jsPrototype Special | |
HiLink jsConditional Conditional | |
HiLink jsBranch Conditional | |
HiLink jsLabel Label | |
HiLink jsReturn Statement | |
HiLink jsRepeat Repeat | |
HiLink jsDo Repeat | |
HiLink jsStatement Statement | |
HiLink jsException Exception | |
HiLink jsTry Exception | |
HiLink jsFinally Exception | |
HiLink jsCatch Exception | |
HiLink jsAsyncKeyword Keyword | |
HiLink jsForAwait Keyword | |
HiLink jsArrowFunction Type | |
HiLink jsFunction Type | |
HiLink jsGenerator jsFunction | |
HiLink jsArrowFuncArgs jsFuncArgs | |
HiLink jsFuncName Function | |
" HiLink jsClassFuncName jsFuncName | |
HiLink jsClassFuncName Normal | |
HiLink jsObjectFuncName Function | |
HiLink jsArguments Special | |
HiLink jsError Error | |
HiLink jsParensError Error | |
HiLink jsOperator Operator | |
HiLink jsOf Operator | |
HiLink jsStorageClass StorageClass | |
HiLink jsClassKeywords Keyword | |
HiLink jsThis Special | |
HiLink jsSuper Constant | |
HiLink jsNan Number | |
HiLink jsNull Type | |
HiLink jsUndefined Type | |
HiLink jsNumber Number | |
HiLink jsFloat Float | |
HiLink jsBooleanTrue Boolean | |
HiLink jsBooleanFalse Boolean | |
HiLink jsObjectColon jsNoise | |
HiLink jsNoise Noise | |
HiLink jsBrackets Noise | |
HiLink jsParens Noise | |
HiLink jsBraces Noise | |
HiLink jsFuncBraces Noise | |
HiLink jsFuncParens Noise | |
HiLink jsClassBraces Noise | |
HiLink jsClassNoise Noise | |
HiLink jsIfElseBraces jsBraces | |
HiLink jsTryCatchBraces jsBraces | |
HiLink jsModuleBraces jsBraces | |
HiLink jsObjectBraces Noise | |
HiLink jsObjectSeparator Noise | |
HiLink jsFinallyBraces jsBraces | |
HiLink jsRepeatBraces jsBraces | |
HiLink jsSwitchBraces jsBraces | |
HiLink jsExportBraces jsBraces | |
HiLink jsSpecial Special | |
HiLink jsTemplateVar Special | |
HiLink jsTemplateBraces jsBraces | |
" HiLink jsGlobalObjects Constant | |
HiLink jsGlobalObjects Special | |
" HiLink jsGlobalNodeObjects Constant | |
HiLink jsGlobalNodeObjects Special | |
HiLink jsExceptions Constant | |
HiLink jsBuiltins Constant | |
HiLink jsModuleKeywords Include | |
HiLink jsModuleOperators Include | |
" HiLink jsModuleDefault Include | |
HiLink jsModuleDefault Keyword | |
" HiLink jsDecorator Special | |
HiLink jsDecorator Normal | |
" HiLink jsDecoratorFunction Function | |
HiLink jsDecoratorFunction Normal | |
HiLink jsParensDecorator jsParens | |
HiLink jsFuncArgOperator jsFuncArgs | |
HiLink jsModuleAsterisk Noise | |
HiLink jsClassProperty jsObjectKey | |
HiLink jsSpreadOperator Operator | |
HiLink jsRestOperator Operator | |
HiLink jsRestExpression jsFuncArgs | |
HiLink jsSwitchColon Noise | |
HiLink jsClassMethodType Type | |
HiLink jsObjectMethodType Type | |
HiLink jsClassDefinition jsFuncName | |
HiLink jsDestructuringBraces Noise | |
HiLink jsDestructuringProperty jsFuncArgs | |
HiLink jsDestructuringAssignment jsObjectKey | |
HiLink jsDestructuringNoise Noise | |
HiLink jsCommentFunction jsComment | |
HiLink jsCommentClass jsComment | |
HiLink jsCommentMisc jsComment | |
HiLink jsDomErrNo Constant | |
HiLink jsDomNodeConsts Constant | |
HiLink jsDomElemAttrs Label | |
HiLink jsDomElemFuncs PreProc | |
HiLink jsHtmlEvents Special | |
HiLink jsHtmlElemAttrs Label | |
HiLink jsHtmlElemFuncs PreProc | |
HiLink jsCssStyles Label | |
delcommand HiLink | |
endif | |
" Define the htmlJavaScript for HTML syntax html.vim | |
syntax cluster htmlJavaScript contains=@jsAll | |
syntax cluster javaScriptExpression contains=@jsAll | |
" Vim's default html.vim highlights all javascript as 'Special' | |
hi! def link javaScript NONE | |
let b:current_syntax = "javascript" | |
if main_syntax == 'javascript' | |
unlet main_syntax | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment