From 3c1c43a64d67c92507ada37ab1df41901e838109 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Mon, 30 May 2016 09:02:23 +0200 Subject: [PATCH 1/5] update vimrc --- vimrc | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 137 insertions(+), 14 deletions(-) diff --git a/vimrc b/vimrc index 5cf5209..7929f1d 100644 --- a/vimrc +++ b/vimrc @@ -30,6 +30,7 @@ Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' Plug 'scrooloose/syntastic' +Plug 'pmsorhaindo/syntastic-local-eslint.vim' Plug 'tpope/vim-fugitive' Plug 'airblade/vim-gitgutter' @@ -48,7 +49,7 @@ Plug 'Raimondi/delimitMate' Plug 'pangloss/vim-javascript' Plug 'marijnh/tern_for_vim', { 'do': 'npm install', 'for': 'javascript'} Plug 'mustache/vim-mustache-handlebars' -Plug 'mxw/vim-jsx' +"Plug 'mxw/vim-jsx' Plug 'shime/vim-livedown' Plug 'xuhdev/vim-latex-live-preview' @@ -262,22 +263,141 @@ nnoremap sc :CloseSession "" syntastic let g:syntastic_javascript_checkers = ['eslint'] + +let g:syntastic_always_populate_loc_list = 1 +let g:syntastic_auto_loc_list = 0 let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_wq = 0 "" lightline let g:lightline = { -\ 'colorscheme': 'solarized', -\ 'active': { -\ 'left': [ [ 'mode', 'paste' ], -\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ] -\ }, -\ 'component': { -\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}' -\ }, -\ 'component_visible_condition': { -\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())' -\ } -\} + \ 'colorscheme': 'solarized', + \ 'active': { + \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark'] ], + \ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ] + \ }, + \ 'component_function': { + \ 'fugitive': 'LightLineFugitive', + \ 'filename': 'LightLineFilename', + \ 'fileformat': 'LightLineFileformat', + \ 'filetype': 'LightLineFiletype', + \ 'fileencoding': 'LightLineFileencoding', + \ 'mode': 'LightLineMode', + \ 'ctrlpmark': 'CtrlPMark', + \ }, + \ 'component_expand': { + \ 'syntastic': 'SyntasticStatuslineFlag', + \ }, + \ 'component_type': { + \ 'syntastic': 'error', + \ }, + \ 'subseparator': { 'left': '|', 'right': '|' } + \ } + +function! LightLineModified() + return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-' +endfunction + +function! LightLineReadonly() + return &ft !~? 'help' && &readonly ? 'RO' : '' +endfunction + +function! LightLineFilename() + let fname = expand('%:t') + return fname == 'ControlP' ? g:lightline.ctrlp_item : + \ fname == '__Tagbar__' ? g:lightline.fname : + \ fname =~ '__Gundo\|NERD_tree' ? '' : + \ &ft == 'vimfiler' ? vimfiler#get_status_string() : + \ &ft == 'unite' ? unite#get_status_string() : + \ &ft == 'vimshell' ? vimshell#get_status_string() : + \ ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') . + \ ('' != fname ? fname : '[No Name]') . + \ ('' != LightLineModified() ? ' ' . LightLineModified() : '') +endfunction + +function! LightLineFugitive() + try + if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head') + let mark = '' " edit here for cool mark + let _ = fugitive#head() + return strlen(_) ? mark._ : '' + endif + catch + endtry + return '' +endfunction + +function! LightLineFileformat() + return winwidth(0) > 70 ? &fileformat : '' +endfunction + +function! LightLineFiletype() + return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : '' +endfunction + +function! LightLineFileencoding() + return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : '' +endfunction + +function! LightLineMode() + let fname = expand('%:t') + return fname == '__Tagbar__' ? 'Tagbar' : + \ fname == 'ControlP' ? 'CtrlP' : + \ fname == '__Gundo__' ? 'Gundo' : + \ fname == '__Gundo_Preview__' ? 'Gundo Preview' : + \ fname =~ 'NERD_tree' ? 'NERDTree' : + \ &ft == 'unite' ? 'Unite' : + \ &ft == 'vimfiler' ? 'VimFiler' : + \ &ft == 'vimshell' ? 'VimShell' : + \ winwidth(0) > 60 ? lightline#mode() : '' +endfunction + +function! CtrlPMark() + if expand('%:t') =~ 'ControlP' + call lightline#link('iR'[g:lightline.ctrlp_regex]) + return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item + \ , g:lightline.ctrlp_next], 0) + else + return '' + endif +endfunction + +let g:ctrlp_status_func = { + \ 'main': 'CtrlPStatusFunc_1', + \ 'prog': 'CtrlPStatusFunc_2', + \ } + +function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked) + let g:lightline.ctrlp_regex = a:regex + let g:lightline.ctrlp_prev = a:prev + let g:lightline.ctrlp_item = a:item + let g:lightline.ctrlp_next = a:next + return lightline#statusline(0) +endfunction + +function! CtrlPStatusFunc_2(str) + return lightline#statusline(0) +endfunction + +let g:tagbar_status_func = 'TagbarStatusFunc' + +function! TagbarStatusFunc(current, sort, fname, ...) abort + let g:lightline.fname = a:fname + return lightline#statusline(0) +endfunction + +augroup AutoSyntastic + autocmd! + autocmd BufWritePost *.c,*.cpp call s:syntastic() +augroup END +function! s:syntastic() + SyntasticCheck + call lightline#update() +endfunction + +let g:unite_force_overwrite_statusline = 0 +let g:vimfiler_force_overwrite_statusline = 0 +let g:vimshell_force_overwrite_statusline = 0 "" NERDTree configuration nmap n :NERDTreeToggle @@ -315,7 +435,7 @@ let g:tex_flavor = "latex" let g:livepreview_previewer = 'zathura' " JSX -let g:jsx_ext_required = 0 " Allow JSX in normal JS files +" let g:jsx_ext_required = 0 " Allow JSX in normal JS files " " Autocmd Rules @@ -337,6 +457,9 @@ au FileType markdown set wrap wm=2 textwidth=78 nocindent spell "" Python au FileType python set noexpandtab +"" JavaScript +au FileType javascript map r :TernRename + "" Json au BufRead,BufNewFile *.json set ft=json From b8acd6350f9ec2ca92ddb6e82a2b80aae160640b Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Mon, 30 May 2016 09:02:48 +0200 Subject: [PATCH 2/5] add EDITOR to env --- zprofile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zprofile b/zprofile index f0e04a6..69dbbda 100644 --- a/zprofile +++ b/zprofile @@ -1,6 +1,8 @@ # extend path export PATH="$HOME/local/bin:$PATH" +export EDITOR=$(which vim) + # nvm export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" From 1873d9bbc508c15797f3155cabb729c9fd7a371e Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Mon, 30 May 2016 09:03:18 +0200 Subject: [PATCH 3/5] detect el caplitain --- zprofile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zprofile b/zprofile index 69dbbda..0c576d7 100644 --- a/zprofile +++ b/zprofile @@ -11,7 +11,7 @@ export NVM_DIR="$HOME/.nvm" # Dist related settings ######################## case $OSTYPE in - "darwin14.0" ) + "darwin14.0"|"darwin15.0" ) export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH" export MANPATH="$(brew --prefix coreutils)/libexec/gnuman:$MANPATH" #eval $(ssh-agent -s) From eebb909b09214362ef840259b1ed8c2d28ba4296 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Mon, 30 May 2016 09:03:33 +0200 Subject: [PATCH 4/5] add uttr aliases --- zshrc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zshrc b/zshrc index d94a282..e74b1f5 100644 --- a/zshrc +++ b/zshrc @@ -40,6 +40,14 @@ alias ts='tmux new-session -s' alias tl='tmux list-sessions' rl () { $(npm bin)/$* } +# utt time tracking +alias uh='uttr --add hello' +alias ust='uttr --add standup' +alias ul='uttr --add "lunch**"' +alias ue='uttr --edit' +alias urw='uttr --report=week' +alias urm='uttr --report=month' + # colors autoload -U colors && colors alias ls='ls --color=tty' From 05d2a2c32ac44015480a6347cf1d1886a600663e Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Mon, 30 May 2016 09:04:43 +0200 Subject: [PATCH 5/5] add own js snippets --- vim/UltiSnips/javascript-jasmine.snippets | 218 ++++++++++++++++++++++ vim/UltiSnips/javascript-node.snippets | 65 +++++++ vim/UltiSnips/javascript.snippets | 51 +++++ 3 files changed, 334 insertions(+) create mode 100644 vim/UltiSnips/javascript-jasmine.snippets create mode 100644 vim/UltiSnips/javascript-node.snippets create mode 100644 vim/UltiSnips/javascript.snippets diff --git a/vim/UltiSnips/javascript-jasmine.snippets b/vim/UltiSnips/javascript-jasmine.snippets new file mode 100644 index 0000000..77aec77 --- /dev/null +++ b/vim/UltiSnips/javascript-jasmine.snippets @@ -0,0 +1,218 @@ +priority -50 + +# JavaScript versions -- from the TextMate bundle + some additions +# for jasmine-jquery matchers +# + +snippet des "Describe (js)" b +describe('${1:description}', function() { + $0 +}); +endsnippet + +snippet it "it (js)" b +it('${1:description}', function() { + $0 +}); +endsnippet + +snippet bef "before each (js)" b +beforeEach(function() { + $0 +}); +endsnippet + +snippet aft "after each (js)" b +afterEach(function() { + $0 +}); +endsnippet + +snippet befa "before all (js)" b +beforeAll(function() { + $0 +}); +endsnippet + +snippet afta "after all (js)" b +afterAll(function() { + $0 +}); +endsnippet + +snippet any "any (js)" b +jasmine.any($1) +endsnippet + +snippet anyt "anything (js)" b +jasmine.anything() +endsnippet + +snippet objc "object containing (js)" b +jasmine.objectContaining({ + ${VISUAL}$0 +}); +endsnippet + +snippet arrc "array containing (js)" b +jasmine.arrayContaining([${1:value1}]); +endsnippet + +snippet strm "string matching (js)" b +jasmine.stringMatching("${1:matcher}") +endsnippet + +snippet ru "runs (js)" b +runs(function() { + $0 +}); +endsnippet + +snippet wa "waits (js)" b +waits($1); +endsnippet + +snippet ex "expect (js)" b +expect(${1:target})$0; +endsnippet + +snippet ee "expect to equal (js)" b +expect(${1:target}).toEqual(${2:value}); +endsnippet + +snippet el "expect to be less than (js)" b +expect(${1:target}).toBeLessThan(${2:value}); +endsnippet + +snippet eg "expect to be greater than (js)" b +expect(${1:target}).toBeGreaterThan(${2:value}); +endsnippet + +snippet eb "expect to be (js)" b +expect(${1:target}).toBe(${2:value}); +endsnippet + +snippet em "expect to match (js)" b +expect(${1:target}).toMatch(${2:pattern}); +endsnippet + +snippet eha "expect to have attribute (js)" b +expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'}); +endsnippet + +snippet et "expect to be truthy (js)" b +expect(${1:target}).toBeTruthy(); +endsnippet + +snippet ef "expect to be falsy (js)" b +expect(${1:target}).toBeFalsy(); +endsnippet + +snippet ed "expect to be defined (js)" b +expect(${1:target}).toBeDefined(); +endsnippet + +snippet eud "expect to be defined (js)" b +expect(${1:target}).toBeUndefined(); +endsnippet + +snippet en "expect to be null (js)" b +expect(${1:target}).toBeNull(); +endsnippet + +snippet ec "expect to contain (js)" b +expect(${1:target}).toContain(${2:value}); +endsnippet + +snippet ev "expect to be visible (js)" b +expect(${1:target}).toBeVisible(); +endsnippet + +snippet eh "expect to be hidden (js)" b +expect(${1:target}).toBeHidden(); +endsnippet + +snippet notx "expect not (js)" b +expect(${1:target}).not$0; +endsnippet + +snippet note "expect not to equal (js)" b +expect(${1:target}).not.toEqual(${2:value}); +endsnippet + +snippet notl "expect to not be less than (js)" b +expect(${1:target}).not.toBeLessThan(${2:value}); +endsnippet + +snippet notg "expect to not be greater than (js)" b +expect(${1:target})..not.toBeGreaterThan(${2:value}); +endsnippet + +snippet notm "expect not to match (js)" b +expect(${1:target}).not.toMatch(${2:pattern}); +endsnippet + +snippet notha "expect to not have attribute (js)" b +expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'}); +endsnippet + +snippet nott "expect not to be truthy (js)" b +expect(${1:target}).not.toBeTruthy(); +endsnippet + +snippet notf "expect not to be falsy (js)" b +expect(${1:target}).not.toBeFalsy(); +endsnippet + +snippet notd "expect not to be defined (js)" b +expect(${1:target}).not.toBeDefined(); +endsnippet + +snippet notn "expect not to be null (js)" b +expect(${1:target}).not.toBeNull(); +endsnippet + +snippet notc "expect not to contain (js)" b +expect(${1:target}).not.toContain(${2:value}); +endsnippet + +snippet notv "expect not to be visible (js)" b +expect(${1:target}).not.toBeVisible(); +endsnippet + +snippet noth "expect not to be hidden (js)" b +expect(${1:target}).not.toBeHidden(); +endsnippet + +snippet s "spy on (js)" b +spyOn(${1:object}, '${2:method}')$0; +endsnippet + +snippet sr "spy on and return (js)" b +spyOn(${1:object}, '${2:method}').and.returnValue(${3:arguments}); +endsnippet + +snippet st "spy on and throw (js)" b +spyOn(${1:object}, '${2:method}').and.throwError(${3:exception}); +endsnippet + +snippet sct "spy on and call through (js)" b +spyOn(${1:object}, '${2:method}').and.callThrough(); +endsnippet + +snippet scf "spy on and call fake (js)" b +spyOn(${1:object}, '${2:method}').and.callFake(${3:function}); +endsnippet + +snippet ethbc "expect to have been called (js)" b +expect(${1:target}).toHaveBeenCalled(); +endsnippet + +snippet nthbc "expect not to have been called (js)" b +expect(${1:target}).not.toHaveBeenCalled(); +endsnippet + +snippet ethbcw "expect to have been called with (js)" b +expect(${1:target}).toHaveBeenCalledWith(${2:arguments}); +endsnippet + diff --git a/vim/UltiSnips/javascript-node.snippets b/vim/UltiSnips/javascript-node.snippets new file mode 100644 index 0000000..7a14dee --- /dev/null +++ b/vim/UltiSnips/javascript-node.snippets @@ -0,0 +1,65 @@ +priority -50 + +snippet #! "shebang" +#!/usr/bin/env node +endsnippet + +snippet vreq "assign a CommonJS-style module to a var" +var ${0:${1/(.+\/)*(\w+)(-|\b|$)(\..+$)?/\u$2/g}} = require('${1}'); +endsnippet + +snippet ex "module.exports" +module.exports = ${1}; +endsnippet + +snippet hcs "http.createServer" +http.createServer(${1}).listen(${2}); +endsnippet + +snippet ncs "net.createServer" +net.createServer(function(${1:socket}){ + ${1}.on('data', function(${3:data}){ + ${4} + }); + ${1}.on('end', function(){ + ${5} + }); +}).listen(${6:8124}); +endsnippet + +snippet pipe "pipe" +pipe(${1:stream})${2} +endsnippet + +# Express snippets + +snippet eget "express GET" +${1:app}.get('${2}', ${3}); +endsnippet + +snippet epost "express POST" +${1:app}.post('${2}', ${3}); +endsnippet + +snippet eput "express PUT" +${1:app}.put('${2}', ${3}); +endsnippet + +snippet edelete "express DELETE" +${1:app}.delete('${2}', ${3}); +endsnippet + +# process snippets + +snippet stdout "stdout" +process.stdout +endsnippet + +snippet stdin "stdin" +process.stdin +endsnippet + +snippet stderr "stderr" +process.stderr +endsnippet + diff --git a/vim/UltiSnips/javascript.snippets b/vim/UltiSnips/javascript.snippets new file mode 100644 index 0000000..c60cf6b --- /dev/null +++ b/vim/UltiSnips/javascript.snippets @@ -0,0 +1,51 @@ +priority -30 + +# AMD (Asynchronous Module Definition) snippets + +snippet def "define an AMD module" +define([ + '${1:backbone}' +], function( + ${2:Name}) +) { + $0 +} +endsnippet + +# Jasmine +snippet des "Describe (js)" b +describe('${1:description}', function() { + $0 +}); +endsnippet + +snippet it "it (js)" b +it('${1:description}', function() { + $0 +}); +endsnippet + +snippet bef "before each (js)" b +beforeEach(function() { + $0 +}); +endsnippet + +snippet aft "after each (js)" b +afterEach(function() { + $0 +}); +endsnippet + +snippet befa "before all (js)" b +beforeAll(function() { + $0 +}); +endsnippet + +snippet afta "after all (js)" b +afterAll(function() { + $0 +}); +endsnippet +# vim:ft=snippets: