More silent executions
* Silently continue execution of commands regardless of errors which are prone to happen with Vim's customizability. * Remove ctrlp#msg() as it's no longer needed. Fix #95 and prevent similar issues.
This commit is contained in:
parent
afa9158132
commit
ece04926b0
@ -1110,11 +1110,7 @@ endf
|
|||||||
|
|
||||||
fu! ctrlp#setdir(path, ...)
|
fu! ctrlp#setdir(path, ...)
|
||||||
let cmd = exists('a:1') ? a:1 : 'lc!'
|
let cmd = exists('a:1') ? a:1 : 'lc!'
|
||||||
try
|
sil! exe cmd.' '.ctrlp#fnesc(a:path)
|
||||||
exe cmd.' '.ctrlp#fnesc(a:path)
|
|
||||||
cat
|
|
||||||
cal ctrlp#msg("Can't change working directory.")
|
|
||||||
endt
|
|
||||||
endf
|
endf
|
||||||
" Highlighting {{{2
|
" Highlighting {{{2
|
||||||
fu! s:syntax()
|
fu! s:syntax()
|
||||||
@ -1345,25 +1341,17 @@ fu! s:migemo(str)
|
|||||||
retu str
|
retu str
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! ctrlp#msg(msg)
|
|
||||||
redr | echoh Identifier | echon "CtrlP: ".a:msg | echoh None
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:openfile(cmd, filpath, ...)
|
fu! s:openfile(cmd, filpath, ...)
|
||||||
let cmd = a:cmd =~ '^[eb]$' && &modified ? 'hid '.a:cmd : a:cmd
|
let cmd = a:cmd =~ '^[eb]$' && &modified ? 'hid '.a:cmd : a:cmd
|
||||||
let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd
|
let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd
|
||||||
let tail = a:0 ? a:1 : s:tail()
|
let tail = a:0 ? a:1 : s:tail()
|
||||||
try
|
sil! exe cmd.tail.' '.ctrlp#fnesc(a:filpath)
|
||||||
exe cmd.tail.' '.ctrlp#fnesc(a:filpath)
|
if !empty(tail)
|
||||||
cat
|
sil! norm! zvzz
|
||||||
fina
|
en
|
||||||
if !empty(tail)
|
if exists('*haslocaldir')
|
||||||
sil! norm! zvzz
|
cal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!')
|
||||||
en
|
en
|
||||||
if exists('*haslocaldir')
|
|
||||||
cal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!')
|
|
||||||
en
|
|
||||||
endt
|
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:writecache(read_cache, cache_file)
|
fu! s:writecache(read_cache, cache_file)
|
||||||
|
@ -165,9 +165,6 @@ fu! s:esctagscmd(bin, args, ...)
|
|||||||
let last = s:enc != &enc ? s:enc : !empty($LANG) ? $LANG : &enc
|
let last = s:enc != &enc ? s:enc : !empty($LANG) ? $LANG : &enc
|
||||||
let cmd = iconv(cmd, &enc, last)
|
let cmd = iconv(cmd, &enc, last)
|
||||||
en
|
en
|
||||||
if empty(cmd)
|
|
||||||
cal ctrlp#msg("Encoding conversion failed!")
|
|
||||||
en
|
|
||||||
retu cmd
|
retu cmd
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
@ -43,13 +43,8 @@ fu! ctrlp#quickfix#accept(mode, str)
|
|||||||
let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
|
let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
|
||||||
\ : ctrlp#normcmd('e')
|
\ : ctrlp#normcmd('e')
|
||||||
let cmd = cmd == 'e' && &modified ? 'hid e' : cmd
|
let cmd = cmd == 'e' && &modified ? 'hid e' : cmd
|
||||||
try
|
sil! exe cmd.' '.ctrlp#fnesc(filpath)
|
||||||
exe cmd.' '.ctrlp#fnesc(filpath)
|
cal cursor(items[2], items[3]) | sil! norm! zvzz
|
||||||
cat
|
|
||||||
cal ctrlp#msg("Invalid command or argument.")
|
|
||||||
fina
|
|
||||||
cal cursor(items[2], items[3]) | sil! norm! zvzz
|
|
||||||
endt
|
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! ctrlp#quickfix#id()
|
fu! ctrlp#quickfix#id()
|
||||||
|
@ -90,19 +90,15 @@ fu! ctrlp#tag#accept(mode, str)
|
|||||||
\ }
|
\ }
|
||||||
let cmd = fnd[0] == 1 ? cmds[md][0] : cmds[md][1]
|
let cmd = fnd[0] == 1 ? cmds[md][0] : cmds[md][1]
|
||||||
let cmd = cmd == 'tj' && &modified ? 'hid '.cmd : cmd
|
let cmd = cmd == 'tj' && &modified ? 'hid '.cmd : cmd
|
||||||
try
|
let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd
|
||||||
let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd
|
if fnd[0] == 1
|
||||||
if fnd[0] == 1
|
if cmd != ''
|
||||||
if cmd != ''
|
sil! exe cmd
|
||||||
exe cmd
|
|
||||||
en
|
|
||||||
exe fnd[1].'ta' tg
|
|
||||||
el
|
|
||||||
exe cmd.' '.tg
|
|
||||||
en
|
en
|
||||||
cat
|
sil! exe fnd[1].'ta' tg
|
||||||
cal ctrlp#msg("Tag not found.")
|
el
|
||||||
endt
|
sil! exe cmd.' '.tg
|
||||||
|
en
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! ctrlp#tag#id()
|
fu! ctrlp#tag#id()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user