19 Commits

Author SHA1 Message Date
Tim Pope
16c2b7abb9 Support worktrees
Closes https://github.com/tpope/vim-fugitive/issues/655
2016-02-24 16:20:52 -05:00
Tim Pope
1e3f1103d9 DRY up refs/ paths 2016-02-24 15:53:51 -05:00
Tim Pope
9835920a3c Use includeexpr on default <cfile>
Closes https://github.com/tpope/vim-fugitive/issues/744
2016-01-22 20:03:58 -05:00
Tim Pope
fd36aa9c61 Fix issue extracting remote 2016-01-08 17:05:54 -05:00
Tim Pope
4dd41688cf Entertain P as a p alternative in :Gstatus
This could potentially free up `p` as "open in new tab", which would
correspond nicely with `vim -p`.
2016-01-01 16:55:17 -05:00
Tim Pope
18d6d1ab82 Overhaul :Gbrowse remote handling 2015-12-26 19:53:07 -05:00
Tim Pope
9ce67cdc93 Always pass commit SHA to :Gbrowse handlers 2015-12-26 15:09:08 -05:00
Tim Pope
bf04261080 Revert "Remove guard against index stage in :Gbrowse handler"
This reverts commit 14daf094d9.  My
assertion was wrong; commit will no longer be an index stage but it
still might be an empty string.
2015-12-26 14:54:35 -05:00
Tim Pope
52d180af0a Include trailing / in tree paths for :Gbrowse handlers 2015-12-26 14:37:45 -05:00
Tim Pope
14daf094d9 Remove guard against index stage in :Gbrowse handler
This parameter can now always be directly used within a URL, without any
sanity checking
2015-12-26 14:36:39 -05:00
Tim Pope
ac904e806d Don't pass stage number as commit to :Gbrowse handler 2015-12-26 14:18:00 -05:00
Tim Pope
9f768cd3bc Minimum viable URL escaping in :Gbrowse
Closes https://github.com/tpope/vim-fugitive/issues/703.
2015-12-26 14:11:54 -05:00
Tim Pope
09cdce7add Fix jump to file for tree at root of commit
Closes https://github.com/tpope/vim-fugitive/issues/735
2015-12-23 21:27:43 -05:00
Tim Pope
8851b8fe64 Fix jump from diff to file
This code hasn't been touched in 4 years; how did it break?!
2015-12-15 21:19:33 -05:00
Tim Pope
cfa485ede7 Better support for binary file grep results 2015-12-15 19:01:40 -05:00
Tim Pope
207c643ea4 Bring GitHub handler in line with rhubarb.vim
Closes https://github.com/tpope/vim-fugitive/issues/730
2015-12-11 16:38:05 -05:00
Tim Pope
cac2c8ef8e Fix instaweb current buffer assumption 2015-12-01 18:41:29 -05:00
Tim Pope
a9a22e0e4e Never :Gedit with a trailing slash 2015-12-01 18:35:25 -05:00
Tim Pope
c3e918072f Accommodate @ as alias for HEAD 2015-12-01 18:06:38 -05:00
2 changed files with 124 additions and 72 deletions

View File

@@ -221,10 +221,9 @@ that are part of Git repositories).
*fugitive-:Gbrowse* *fugitive-:Gbrowse*
:Gbrowse Open the current file, blob, tree, commit, or tag :Gbrowse Open the current file, blob, tree, commit, or tag
in your browser at the upstream hosting provider in your browser at the upstream hosting provider.
indicated by the "origin" remote. If a range is If a range is given, it is appropriately appended to
given, it is appropriately appended to the URL as an the URL as an anchor.
anchor.
Upstream providers can be added by installing an Upstream providers can be added by installing an
appropriate Vim plugin. For example, GitHub can be appropriate Vim plugin. For example, GitHub can be
@@ -233,8 +232,11 @@ that are part of Git repositories).
support for GitHub is currently included, but that is support for GitHub is currently included, but that is
slated to be removed.) slated to be removed.)
If no upstream support is available, a local instance The hosting provider is determined by looking at the
of git-instaweb will be started and used instead. remote for the current or specified branch and falls
back to "origin". In the special case of a "."
remote, a local instance of git-instaweb will be
started and used.
:Gbrowse {revision} Like :Gbrowse, but for a given |fugitive-revision|. A :Gbrowse {revision} Like :Gbrowse, but for a given |fugitive-revision|. A
useful value here is -, which ties the URL to the useful value here is -, which ties the URL to the

View File

@@ -123,7 +123,9 @@ let s:abstract_prototype = {}
function! fugitive#is_git_dir(path) abort function! fugitive#is_git_dir(path) abort
let path = s:sub(a:path, '[\/]$', '') . '/' let path = s:sub(a:path, '[\/]$', '') . '/'
return isdirectory(path.'objects') && isdirectory(path.'refs') && getfsize(path.'HEAD') > 10 return getfsize(path.'HEAD') > 10 && (
\ isdirectory(path.'objects') && isdirectory(path.'refs') ||
\ getftype(path.'commondir') ==# 'file')
endfunction endfunction
function! fugitive#extract_git_dir(path) abort function! fugitive#extract_git_dir(path) abort
@@ -265,9 +267,14 @@ function! s:configured_tree(git_dir) abort
let config = readfile(config_file,'',10) let config = readfile(config_file,'',10)
call filter(config,'v:val =~# "^\\s*worktree *="') call filter(config,'v:val =~# "^\\s*worktree *="')
if len(config) == 1 if len(config) == 1
let s:worktree_for_dir[a:git_dir] = matchstr(config[0], '= *\zs.*') let worktree = matchstr(config[0], '= *\zs.*')
let s:dir_for_worktree[s:worktree_for_dir[a:git_dir]] = a:git_dir
endif endif
elseif filereadable(a:git_dir . '/gitdir')
let worktree = fnamemodify(readfile(a:git_dir . '/gitdir')[0], ':h')
endif
if exists('worktree')
let s:worktree_for_dir[a:git_dir] = worktree
let s:dir_for_worktree[s:worktree_for_dir[a:git_dir]] = a:git_dir
endif endif
endif endif
if s:worktree_for_dir[a:git_dir] =~# '^\.' if s:worktree_for_dir[a:git_dir] =~# '^\.'
@@ -299,6 +306,10 @@ function! s:repo_bare() dict abort
endfunction endfunction
function! s:repo_translate(spec) dict abort function! s:repo_translate(spec) dict abort
let refs = self.dir('refs/')
if filereadable(self.dir('commondir'))
let refs = simplify(self.dir(get(readfile(self.dir('commondir'), 1), 0, ''))) . '/refs/'
endif
if a:spec ==# '.' || a:spec ==# '/.' if a:spec ==# '.' || a:spec ==# '/.'
return self.bare() ? self.dir() : self.tree() return self.bare() ? self.dir() : self.tree()
elseif a:spec =~# '^/\=\.git$' && self.bare() elseif a:spec =~# '^/\=\.git$' && self.bare()
@@ -320,18 +331,20 @@ function! s:repo_translate(spec) dict abort
return 'fugitive://'.self.dir().'//'.ref return 'fugitive://'.self.dir().'//'.ref
elseif a:spec =~# '^:' elseif a:spec =~# '^:'
return 'fugitive://'.self.dir().'//0/'.a:spec[1:-1] return 'fugitive://'.self.dir().'//0/'.a:spec[1:-1]
elseif a:spec =~# 'HEAD\|^refs/' && a:spec !~ ':' && filereadable(self.dir(a:spec)) elseif a:spec ==# '@'
return self.dir(a:spec) return self.dir('HEAD')
elseif filereadable(self.dir('refs/'.a:spec)) elseif a:spec =~# 'HEAD\|^refs/' && a:spec !~ ':' && filereadable(refs . '../' . a:spec)
return self.dir('refs/'.a:spec) return simplify(refs . '../' . a:spec)
elseif filereadable(self.dir('refs/tags/'.a:spec)) elseif filereadable(refs.a:spec)
return self.dir('refs/tags/'.a:spec) return refs.a:spec
elseif filereadable(self.dir('refs/heads/'.a:spec)) elseif filereadable(refs.'tags/'.a:spec)
return self.dir('refs/heads/'.a:spec) return refs.'tags/'.a:spec
elseif filereadable(self.dir('refs/remotes/'.a:spec)) elseif filereadable(refs.'heads/'.a:spec)
return self.dir('refs/remotes/'.a:spec) return refs.'heads/'.a:spec
elseif filereadable(self.dir('refs/remotes/'.a:spec.'/HEAD')) elseif filereadable(refs.'remotes/'.a:spec)
return self.dir('refs/remotes/'.a:spec,'/HEAD') return refs.'remotes/'.a:spec
elseif filereadable(refs.'remotes/'.a:spec.'/HEAD')
return refs.'remotes/'.a:spec,'/HEAD'
else else
try try
let ref = self.rev_parse(matchstr(a:spec,'[^:]*')) let ref = self.rev_parse(matchstr(a:spec,'[^:]*'))
@@ -1258,7 +1271,7 @@ function! s:Grep(cmd,bang,arg) abort
try try
execute cd.'`=s:repo().tree()`' execute cd.'`=s:repo().tree()`'
let &grepprg = s:repo().git_command('--no-pager', 'grep', '-n', '--no-color') let &grepprg = s:repo().git_command('--no-pager', 'grep', '-n', '--no-color')
let &grepformat = '%f:%l:%m,%f' let &grepformat = '%f:%l:%m,%m %f match%ts,%f'
exe a:cmd.'! '.escape(matchstr(a:arg,'\v\C.{-}%($|[''" ]\@=\|)@='),'|') exe a:cmd.'! '.escape(matchstr(a:arg,'\v\C.{-}%($|[''" ]\@=\|)@='),'|')
let list = a:cmd =~# '^l' ? getloclist(0) : getqflist() let list = a:cmd =~# '^l' ? getloclist(0) : getqflist()
for entry in list for entry in list
@@ -1406,6 +1419,9 @@ function! s:Edit(cmd,bang,...) abort
catch /^fugitive:/ catch /^fugitive:/
return 'echoerr v:errmsg' return 'echoerr v:errmsg'
endtry endtry
if file !~# '^fugitive:'
let file = s:sub(file, '/$', '')
endif
if a:cmd ==# 'read' if a:cmd ==# 'read'
return 'silent %delete_|read '.s:fnameescape(file).'|silent 1delete_|diffupdate|'.line('.') return 'silent %delete_|read '.s:fnameescape(file).'|silent 1delete_|diffupdate|'.line('.')
else else
@@ -2171,11 +2187,18 @@ endfunction
" Section: Gbrowse " Section: Gbrowse
call s:command("-bar -bang -range -nargs=* -complete=customlist,s:EditComplete Gbrowse :execute s:Browse(<bang>0,<line1>,<count>,<f-args>)") call s:command("-bar -bang -range=0 -nargs=* -complete=customlist,s:EditComplete Gbrowse :execute s:Browse(<bang>0,<line1>,<count>,<f-args>)")
function! s:Browse(bang,line1,count,...) abort function! s:Browse(bang,line1,count,...) abort
try try
let rev = a:0 ? substitute(join(a:000, ' '),'@[[:alnum:]_-]*\%(://.\{-\}\)\=$','','') : '' let validremote = '\.\|\.\=/.*\|[[:alnum:]_-]\+\%(://.\{-\}\)\='
if a:0
let remote = matchstr(join(a:000, ' '),'@\zs\%('.validremote.'\)$')
let rev = substitute(join(a:000, ' '),'@\%('.validremote.'\)$','','')
else
let remote = ''
let rev = ''
endif
if rev ==# '' if rev ==# ''
let expanded = s:buffer().rev() let expanded = s:buffer().rev()
elseif rev ==# ':' elseif rev ==# ':'
@@ -2186,10 +2209,11 @@ function! s:Browse(bang,line1,count,...) abort
let full = s:repo().translate(expanded) let full = s:repo().translate(expanded)
let commit = '' let commit = ''
if full =~# '^fugitive://' if full =~# '^fugitive://'
let commit = matchstr(full,'://.*//\zs\w\+') let commit = matchstr(full,'://.*//\zs\w\w\+')
let path = matchstr(full,'://.*//\w\+\zs/.*') let path = matchstr(full,'://.*//\w\+\zs/.*')
if commit =~ '..' if commit =~ '..'
let type = s:repo().git_chomp('cat-file','-t',commit.s:sub(path,'^/',':')) let type = s:repo().git_chomp('cat-file','-t',commit.s:sub(path,'^/',':'))
let branch = matchstr(expanded, '^[^:]*')
else else
let type = 'blob' let type = 'blob'
endif endif
@@ -2207,6 +2231,9 @@ function! s:Browse(bang,line1,count,...) abort
let type = 'blob' let type = 'blob'
endif endif
endif endif
if type ==# 'tree' && !empty(path)
let path = s:sub(path, '/\=$', '/')
endif
if path =~# '^\.git/.*HEAD' && filereadable(s:repo().dir(path[5:-1])) if path =~# '^\.git/.*HEAD' && filereadable(s:repo().dir(path[5:-1]))
let body = readfile(s:repo().dir(path[5:-1]))[0] let body = readfile(s:repo().dir(path[5:-1]))[0]
if body =~# '^\x\{40\}$' if body =~# '^\x\{40\}$'
@@ -2218,35 +2245,54 @@ function! s:Browse(bang,line1,count,...) abort
endif endif
endif endif
if a:0 && join(a:000, ' ') =~# '@[[:alnum:]_-]*\%(://.\{-\}\)\=$' let merge = ''
let remote = matchstr(join(a:000, ' '),'@\zs[[:alnum:]_-]\+\%(://.\{-\}\)\=$') if path =~# '^\.git/refs/remotes/.'
elseif path =~# '^\.git/refs/remotes/.' if empty(remote)
let remote = matchstr(path,'^\.git/refs/remotes/\zs[^/]\+') let remote = matchstr(path, '^\.git/refs/remotes/\zs[^/]\+')
else
let remote = 'origin'
let branch = matchstr(rev,'^[[:alnum:]/._-]\+\ze[:^~@]')
if branch ==# '' && path =~# '^\.git/refs/\w\+/'
let branch = s:sub(path,'^\.git/refs/\w+/','')
endif endif
if filereadable(s:repo().dir('refs/remotes/'.branch)) let merge = matchstr(path, '^\.git/refs/remotes/[^/]\+/\zs.\+')
let remote = matchstr(branch,'[^/]\+') let branch = ''
let rev = rev[strlen(remote)+1:-1] let path = '.git/refs/heads/'.merge
else elseif path =~# '^\.git/refs/heads/.'
if branch ==# '' let branch = path[16:-1]
let branch = matchstr(s:repo().head_ref(),'\<refs/heads/\zs.*') elseif !exists('branch')
let branch = s:repo().head()
endif
if !empty(branch)
let r = s:repo().git_chomp('config','branch.'.branch.'.remote')
let m = s:repo().git_chomp('config','branch.'.branch.'.merge')[11:-1]
if r ==# '.' && !empty(m)
let r2 = s:repo().git_chomp('config','branch.'.m.'.remote')
if r2 !~# '^\.\=$'
let r = r2
let m = s:repo().git_chomp('config','branch.'.m.'.merge')[11:-1]
endif endif
if branch != '' endif
let remote = s:repo().git_chomp('config','branch.'.branch.'.remote') if empty(remote)
if remote =~# '^\.\=$' let remote = r
let remote = 'origin' endif
elseif rev[0:strlen(branch)-1] ==# branch && rev[strlen(branch)] =~# '[:^~@]' if r ==# '.' || r ==# remote
let rev = s:repo().git_chomp('config','branch.'.branch.'.merge')[11:-1] . rev[strlen(branch):-1] let merge = m
endif if path =~# '^\.git/refs/heads/.'
let path = '.git/refs/heads/'.merge
endif endif
endif endif
endif endif
let raw = s:repo().git_chomp('config','remote.'.remote.'.url') if empty(commit) && path !~# '^\.git/'
if a:line1 && !a:count && !empty(merge)
let commit = merge
else
let commit = s:repo().rev_parse('HEAD')
endif
endif
if empty(remote)
let remote = '.'
let raw = s:repo().git_chomp('config','remote.origin.url')
else
let raw = s:repo().git_chomp('config','remote.'.remote.'.url')
endif
if raw ==# '' if raw ==# ''
let raw = remote let raw = remote
endif endif
@@ -2255,7 +2301,7 @@ function! s:Browse(bang,line1,count,...) abort
let url = call(Handler, [{ let url = call(Handler, [{
\ 'repo': s:repo(), \ 'repo': s:repo(),
\ 'remote': raw, \ 'remote': raw,
\ 'revision': rev, \ 'revision': 'No longer provided',
\ 'commit': commit, \ 'commit': commit,
\ 'path': path, \ 'path': path,
\ 'type': type, \ 'type': type,
@@ -2266,10 +2312,13 @@ function! s:Browse(bang,line1,count,...) abort
endif endif
endfor endfor
if empty(url) if empty(url) && raw ==# '.'
call s:throw("Instaweb failed to start and '".remote."' is not a supported remote") call s:throw("Instaweb failed to start")
elseif empty(url)
call s:throw('"'.remote."' is not a supported remote")
endif endif
let url = s:gsub(url, '[ <>]', '\="%".printf("%02X",char2nr(submatch(0)))')
if a:bang if a:bang
if has('clipboard') if has('clipboard')
let @* = url let @* = url
@@ -2305,7 +2354,7 @@ function! s:github_url(opts, ...) abort
if repo ==# '' if repo ==# ''
return '' return ''
endif endif
let path = a:opts.path let path = substitute(a:opts.path, '^/', '', '')
if index(domains, 'http://' . matchstr(repo, '^[^:/]*')) >= 0 if index(domains, 'http://' . matchstr(repo, '^[^:/]*')) >= 0
let root = 'http://' . s:sub(repo,':','/') let root = 'http://' . s:sub(repo,':','/')
else else
@@ -2319,28 +2368,22 @@ function! s:github_url(opts, ...) abort
return root . '/commits/' . branch return root . '/commits/' . branch
endif endif
elseif path =~# '^\.git/refs/tags/' elseif path =~# '^\.git/refs/tags/'
return root . '/releases/tag/' . matchstr(path,'[^/]\+$') return root . '/releases/tag/' . path[15:-1]
elseif path =~# '^\.git/refs/.' elseif path =~# '^\.git/refs/remotes/[^/]\+/.'
return root . '/commits/' . matchstr(path,'[^/]\+$') return root . '/commits/' . matchstr(path,'remotes/[^/]\+/\zs.*')
elseif path =~# '.git/\%(config$\|hooks\>\)' elseif path =~# '.git/\%(config$\|hooks\>\)'
return root . '/admin' return root . '/admin'
elseif path =~# '^\.git\>' elseif path =~# '^\.git\>'
return root return root
endif endif
if a:opts.revision =~# '^[[:alnum:]._-]\+:' if a:opts.commit =~# '^\d\=$'
let commit = matchstr(a:opts.revision,'^[^:]*') let commit = a:opts.repo.rev_parse('HEAD')
elseif a:opts.commit =~# '^\d\=$'
let local = matchstr(a:opts.repo.head_ref(),'\<refs/heads/\zs.*')
let commit = a:opts.repo.git_chomp('config','branch.'.local.'.merge')[11:-1]
if commit ==# ''
let commit = local
endif
else else
let commit = a:opts.commit let commit = a:opts.commit
endif endif
if a:opts.type == 'tree' if get(a:opts, 'type', '') ==# 'tree' || a:opts.path =~# '/$'
let url = s:sub(root . '/tree/' . commit . '/' . path,'/$','') let url = substitute(root . '/tree/' . commit . '/' . path, '/$', '', 'g')
elseif a:opts.type == 'blob' elseif get(a:opts, 'type', '') ==# 'blob' || a:opts.path =~# '[^/]$'
let url = root . '/blob/' . commit . '/' . path let url = root . '/blob/' . commit . '/' . path
if get(a:opts, 'line2') && a:opts.line1 == a:opts.line2 if get(a:opts, 'line2') && a:opts.line1 == a:opts.line2
let url .= '#L' . a:opts.line1 let url .= '#L' . a:opts.line1
@@ -2354,6 +2397,9 @@ function! s:github_url(opts, ...) abort
endfunction endfunction
function! s:instaweb_url(opts) abort function! s:instaweb_url(opts) abort
if a:opts.remote !=# '.'
return ''
endif
let output = a:opts.repo.git_chomp('instaweb','-b','unknown') let output = a:opts.repo.git_chomp('instaweb','-b','unknown')
if output =~# 'http://' if output =~# 'http://'
let root = matchstr(output,'http://.*').'/?p='.fnamemodify(a:opts.repo.dir(),':t') let root = matchstr(output,'http://.*').'/?p='.fnamemodify(a:opts.repo.dir(),':t')
@@ -2372,10 +2418,8 @@ function! s:instaweb_url(opts) abort
endif endif
let url .= ';h=' . a:opts.repo.rev_parse(a:opts.commit . (a:opts.path == '' ? '' : ':' . a:opts.path)) let url .= ';h=' . a:opts.repo.rev_parse(a:opts.commit . (a:opts.path == '' ? '' : ':' . a:opts.path))
else else
if a:opts.type ==# 'blob' if a:opts.type ==# 'blob' && empty(a:opts.commit)
let tmp = tempname() let url .= ';h='.a:opts.repo.git_chomp('hash-object', '-w', a:opts.path)
silent execute 'write !'.a:opts.repo.git_command('hash-object','-w','--stdin').' > '.tmp
let url .= ';h=' . readfile(tmp)[0]
else else
try try
let url .= ';h=' . a:opts.repo.rev_parse((a:opts.commit == '' ? 'HEAD' : ':' . a:opts.commit) . ':' . a:opts.path) let url .= ';h=' . a:opts.repo.rev_parse((a:opts.commit == '' ? 'HEAD' : ':' . a:opts.commit) . ':' . a:opts.path)
@@ -2514,6 +2558,8 @@ function! s:BufReadIndex() abort
nnoremap <buffer> <silent> dv :<C-U>execute <SID>StageDiff('Gvdiff')<CR> nnoremap <buffer> <silent> dv :<C-U>execute <SID>StageDiff('Gvdiff')<CR>
nnoremap <buffer> <silent> p :<C-U>execute <SID>StagePatch(line('.'),line('.')+v:count1-1)<CR> nnoremap <buffer> <silent> p :<C-U>execute <SID>StagePatch(line('.'),line('.')+v:count1-1)<CR>
xnoremap <buffer> <silent> p :<C-U>execute <SID>StagePatch(line("'<"),line("'>"))<CR> xnoremap <buffer> <silent> p :<C-U>execute <SID>StagePatch(line("'<"),line("'>"))<CR>
nnoremap <buffer> <silent> P :<C-U>execute <SID>StagePatch(line('.'),line('.')+v:count1-1)<CR>
xnoremap <buffer> <silent> P :<C-U>execute <SID>StagePatch(line("'<"),line("'>"))<CR>
nnoremap <buffer> <silent> q :<C-U>if bufnr('$') == 1<Bar>quit<Bar>else<Bar>bdelete<Bar>endif<CR> nnoremap <buffer> <silent> q :<C-U>if bufnr('$') == 1<Bar>quit<Bar>else<Bar>bdelete<Bar>endif<CR>
nnoremap <buffer> <silent> r :<C-U>edit<CR> nnoremap <buffer> <silent> r :<C-U>edit<CR>
nnoremap <buffer> <silent> R :<C-U>edit<CR> nnoremap <buffer> <silent> R :<C-U>edit<CR>
@@ -2855,7 +2901,7 @@ function! s:cfile() abort
elseif getline('.') =~# '^[+-]' && search('^@@ -\d\+,\d\+ +\d\+,','bnW') elseif getline('.') =~# '^[+-]' && search('^@@ -\d\+,\d\+ +\d\+,','bnW')
let type = getline('.')[0] let type = getline('.')[0]
let lnum = line('.') - 1 let lnum = line('.') - 1
let offset = -1 let offset = 0
while getline(lnum) !~# '^@@ -\d\+,\d\+ +\d\+,' while getline(lnum) !~# '^@@ -\d\+,\d\+ +\d\+,'
if getline(lnum) =~# '^[ '.type.']' if getline(lnum) =~# '^[ '.type.']'
let offset += 1 let offset += 1
@@ -2947,7 +2993,11 @@ function! fugitive#cfile() abort
let pre = '' let pre = ''
let results = s:cfile() let results = s:cfile()
if empty(results) if empty(results)
return expand('<cfile>') let cfile = expand('<cfile>')
if &includeexpr =~# '\<v:fname\>'
sandbox let cfile = eval(substitute(&includeexpr, '\C\<v:fname\>', '\=string(cfile)', 'g'))
endif
return cfile
elseif len(results) > 1 elseif len(results) > 1
let pre = '+' . join(map(results[1:-1], 'escape(v:val, " ")'), '\|') . ' ' let pre = '+' . join(map(results[1:-1], 'escape(v:val, " ")'), '\|') . ' '
endif endif