Remove redundant fnamemodify() calls

This commit is contained in:
Kien N 2012-07-12 15:10:52 +07:00
parent 455cadb0a0
commit bf3f6cb2b1
3 changed files with 8 additions and 9 deletions

View File

@ -217,9 +217,10 @@ endf
fu! ctrlp#buffertag#accept(mode, str) fu! ctrlp#buffertag#accept(mode, str)
let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|') let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|')
if vals == [] | retu | en let bufnr = str2nr(get(vals, 1))
let [bufnm, linenr] = [fnamemodify(bufname(str2nr(vals[1])), ':p'), vals[2]] if bufnr
cal ctrlp#acceptfile(a:mode, bufnm, linenr) cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(vals, 2))
en
endf endf
fu! ctrlp#buffertag#cmd(mode, ...) fu! ctrlp#buffertag#cmd(mode, ...)

View File

@ -71,10 +71,9 @@ endf
fu! ctrlp#changes#accept(mode, str) fu! ctrlp#changes#accept(mode, str)
let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$') let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$')
if info == [] | retu | en
let bufnr = str2nr(get(info, 1)) let bufnr = str2nr(get(info, 1))
if bufnr if bufnr
cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p')) cal ctrlp#acceptfile(a:mode, bufname(bufnr))
cal cursor(get(info, 2), get(info, 3)) cal cursor(get(info, 2), get(info, 3))
sil! norm! zvzz sil! norm! zvzz
en en

View File

@ -48,10 +48,9 @@ endf
fu! ctrlp#line#accept(mode, str) fu! ctrlp#line#accept(mode, str)
let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$') let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
if info == [] | retu | en let bufnr = str2nr(get(info, 1))
let [bufnr, linenr] = [str2nr(get(info, 1)), get(info, 2)] if bufnr
if bufnr > 0 cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(info, 2))
cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p'), linenr)
en en
endf endf