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:
Kien N 2012-02-02 03:18:04 +07:00
parent afa9158132
commit ece04926b0
4 changed files with 18 additions and 42 deletions

View File

@ -1110,11 +1110,7 @@ endf
fu! ctrlp#setdir(path, ...)
let cmd = exists('a:1') ? a:1 : 'lc!'
try
exe cmd.' '.ctrlp#fnesc(a:path)
cat
cal ctrlp#msg("Can't change working directory.")
endt
sil! exe cmd.' '.ctrlp#fnesc(a:path)
endf
" Highlighting {{{2
fu! s:syntax()
@ -1345,25 +1341,17 @@ fu! s:migemo(str)
retu str
endf
fu! ctrlp#msg(msg)
redr | echoh Identifier | echon "CtrlP: ".a:msg | echoh None
endf
fu! s:openfile(cmd, filpath, ...)
let cmd = a:cmd =~ '^[eb]$' && &modified ? 'hid '.a:cmd : a:cmd
let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd
let tail = a:0 ? a:1 : s:tail()
try
exe cmd.tail.' '.ctrlp#fnesc(a:filpath)
cat
fina
if !empty(tail)
sil! norm! zvzz
en
if exists('*haslocaldir')
cal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!')
en
endt
sil! exe cmd.tail.' '.ctrlp#fnesc(a:filpath)
if !empty(tail)
sil! norm! zvzz
en
if exists('*haslocaldir')
cal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!')
en
endf
fu! s:writecache(read_cache, cache_file)

View File

@ -165,9 +165,6 @@ fu! s:esctagscmd(bin, args, ...)
let last = s:enc != &enc ? s:enc : !empty($LANG) ? $LANG : &enc
let cmd = iconv(cmd, &enc, last)
en
if empty(cmd)
cal ctrlp#msg("Encoding conversion failed!")
en
retu cmd
endf

View File

@ -43,13 +43,8 @@ fu! ctrlp#quickfix#accept(mode, str)
let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
\ : ctrlp#normcmd('e')
let cmd = cmd == 'e' && &modified ? 'hid e' : cmd
try
exe cmd.' '.ctrlp#fnesc(filpath)
cat
cal ctrlp#msg("Invalid command or argument.")
fina
cal cursor(items[2], items[3]) | sil! norm! zvzz
endt
sil! exe cmd.' '.ctrlp#fnesc(filpath)
cal cursor(items[2], items[3]) | sil! norm! zvzz
endf
fu! ctrlp#quickfix#id()

View File

@ -90,19 +90,15 @@ fu! ctrlp#tag#accept(mode, str)
\ }
let cmd = fnd[0] == 1 ? cmds[md][0] : cmds[md][1]
let cmd = cmd == 'tj' && &modified ? 'hid '.cmd : cmd
try
let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd
if fnd[0] == 1
if cmd != ''
exe cmd
en
exe fnd[1].'ta' tg
el
exe cmd.' '.tg
let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd
if fnd[0] == 1
if cmd != ''
sil! exe cmd
en
cat
cal ctrlp#msg("Tag not found.")
endt
sil! exe fnd[1].'ta' tg
el
sil! exe cmd.' '.tg
en
endf
fu! ctrlp#tag#id()