From bf3f6cb2b1a3bf4b082199d190e3dd86ff2b3e3e Mon Sep 17 00:00:00 2001 From: Kien N Date: Thu, 12 Jul 2012 15:10:52 +0700 Subject: [PATCH] Remove redundant fnamemodify() calls --- autoload/ctrlp/buffertag.vim | 7 ++++--- autoload/ctrlp/changes.vim | 3 +-- autoload/ctrlp/line.vim | 7 +++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/autoload/ctrlp/buffertag.vim b/autoload/ctrlp/buffertag.vim index 73c5d9b..09e18be 100644 --- a/autoload/ctrlp/buffertag.vim +++ b/autoload/ctrlp/buffertag.vim @@ -217,9 +217,10 @@ endf fu! ctrlp#buffertag#accept(mode, str) let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|') - if vals == [] | retu | en - let [bufnm, linenr] = [fnamemodify(bufname(str2nr(vals[1])), ':p'), vals[2]] - cal ctrlp#acceptfile(a:mode, bufnm, linenr) + let bufnr = str2nr(get(vals, 1)) + if bufnr + cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(vals, 2)) + en endf fu! ctrlp#buffertag#cmd(mode, ...) diff --git a/autoload/ctrlp/changes.vim b/autoload/ctrlp/changes.vim index a658a80..c391aad 100644 --- a/autoload/ctrlp/changes.vim +++ b/autoload/ctrlp/changes.vim @@ -71,10 +71,9 @@ endf fu! ctrlp#changes#accept(mode, str) let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$') - if info == [] | retu | en let bufnr = str2nr(get(info, 1)) 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)) sil! norm! zvzz en diff --git a/autoload/ctrlp/line.vim b/autoload/ctrlp/line.vim index 10a45fa..a2e0dde 100644 --- a/autoload/ctrlp/line.vim +++ b/autoload/ctrlp/line.vim @@ -48,10 +48,9 @@ endf fu! ctrlp#line#accept(mode, str) let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$') - if info == [] | retu | en - let [bufnr, linenr] = [str2nr(get(info, 1)), get(info, 2)] - if bufnr > 0 - cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p'), linenr) + let bufnr = str2nr(get(info, 1)) + if bufnr + cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(info, 2)) en endf