Last active
October 4, 2016 04:59
-
-
Save bounceme/a2cb5c341af1b33c48689f64c678235f to your computer and use it in GitHub Desktop.
on-the-fly ide
This file contains 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
augroup async | |
au! | |
augroup END | |
function! MYIDE() | |
au! async | |
if !empty(neomake#GetJobs()) || &buftype ==? 'nofile' | |
return | |
endif | |
if filereadable('s:neomaketemp') | |
call delete(s:neomaketemp) | |
endif | |
let s:neomaketemp = fnamemodify(fnamemodify(tempname(),':h'),':p') . 'neomaketemp.' . expand('%:e') | |
silent! call writefile(getline(1, '$'), s:neomaketemp) | |
let maker = deepcopy(neomake#GetMaker(neomake#makers#ft#{&ft}#EnabledMakers()[0],&ft),1) | |
let maker['append_file'] = 0 | |
if !exists('maker["args"]') | |
let maker['args'] = [] | |
endif | |
let maker['args'] += [s:neomaketemp] | |
let maker['mapexpr'] = 'substitute(v:val, escape('''.s:neomaketemp.''',".\\"), expand("%"), "")' | |
let keyName = maker['name'] | |
if exists('g:neomake_'.&ft.'_' . keyName . '_maker') | |
let last = g:neomake_{&ft}_{keyName}_maker | |
endif | |
let g:neomake_{&ft}_{keyName}_maker = maker | |
exe ':Neomake ' . keyName | |
if exists('last') | |
let g:neomake_{&ft}_{keyName}_maker = last | |
else | |
unlet g:neomake_{&ft}_{keyName}_maker | |
endif | |
endfunction | |
au bufreadpost * Neomake | |
au User NeomakeFinished au! async textchanged * call MYIDE() | |
au quitpre * if filereadable('s:neomaketemp') | call delete(s:neomaketemp) | endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
found out how to use escape()