Skip to content
Browse files

[vim] unite.vim update

  • Loading branch information...
1 parent d96786e commit b22e8b9f24380b5b6324b03a7e57369983d32322 @guns committed Sep 13, 2013
Showing with 1,050 additions and 534 deletions.
  1. +4 −1 etc/vim/bundle/unite.vim/autoload/unite.vim
  2. +8 −4 etc/vim/bundle/unite.vim/autoload/unite/action.vim
  3. +2 −4 etc/vim/bundle/unite.vim/autoload/unite/candidates.vim
  4. +4 −1 etc/vim/bundle/unite.vim/autoload/unite/filters/converter_relative_abbr.vim
  5. +51 −0 etc/vim/bundle/unite.vim/autoload/unite/filters/converter_smart_path.vim
  6. +2 −3 etc/vim/bundle/unite.vim/autoload/unite/filters/matcher_hide_hidden_files.vim
  7. +50 −0 etc/vim/bundle/unite.vim/autoload/unite/filters/sorter_ftime.vim
  8. +16 −7 etc/vim/bundle/unite.vim/autoload/unite/filters/sorter_rank.vim
  9. +36 −25 etc/vim/bundle/unite.vim/autoload/unite/handlers.vim
  10. +19 −5 etc/vim/bundle/unite.vim/autoload/unite/init.vim
  11. +85 −1 etc/vim/bundle/unite.vim/autoload/unite/kinds/cdable.vim
  12. +2 −2 etc/vim/bundle/unite.vim/autoload/unite/kinds/completion.vim
  13. +13 −2 etc/vim/bundle/unite.vim/autoload/unite/kinds/file.vim
  14. +2 −2 etc/vim/bundle/unite.vim/autoload/unite/kinds/uri.vim
  15. +30 −13 etc/vim/bundle/unite.vim/autoload/unite/mappings.vim
  16. +13 −4 etc/vim/bundle/unite.vim/autoload/unite/sources/bookmark.vim
  17. +5 −13 etc/vim/bundle/unite.vim/autoload/unite/sources/buffer.vim
  18. +48 −0 etc/vim/bundle/unite.vim/autoload/unite/sources/buffer/variables.vim
  19. +1 −5 etc/vim/bundle/unite.vim/autoload/unite/sources/directory.vim
  20. +24 −19 etc/vim/bundle/unite.vim/autoload/unite/sources/file.vim
  21. +14 −1 etc/vim/bundle/unite.vim/autoload/unite/sources/function.vim
  22. +20 −11 etc/vim/bundle/unite.vim/autoload/unite/sources/grep.vim
  23. +20 −83 etc/vim/bundle/unite.vim/autoload/unite/sources/mru.vim
  24. +113 −0 etc/vim/bundle/unite.vim/autoload/unite/sources/mru/variables.vim
  25. +9 −82 etc/vim/bundle/unite.vim/autoload/unite/sources/rec.vim
  26. +5 −4 etc/vim/bundle/unite.vim/autoload/unite/sources/undo.vim
  27. +19 −3 etc/vim/bundle/unite.vim/autoload/unite/sources/vimgrep.vim
  28. +19 −4 etc/vim/bundle/unite.vim/autoload/unite/start.vim
  29. +45 −26 etc/vim/bundle/unite.vim/autoload/unite/util.vim
  30. +11 −10 etc/vim/bundle/unite.vim/autoload/unite/view.vim
  31. +12 −1 etc/vim/bundle/unite.vim/autoload/vital/{_cef2359.vim → _b268d8d.vim}
  32. +55 −6 etc/vim/bundle/unite.vim/autoload/vital/{_cef2359 → _b268d8d}/Data/List.vim
  33. +25 −54 etc/vim/bundle/unite.vim/autoload/vital/{_cef2359 → _b268d8d}/Data/String.vim
  34. +96 −28 etc/vim/bundle/unite.vim/autoload/vital/{_cef2359 → _b268d8d}/Prelude.vim
  35. 0 etc/vim/bundle/unite.vim/autoload/vital/{_cef2359 → _b268d8d}/System/Cache.vim
  36. +27 −32 etc/vim/bundle/unite.vim/autoload/vital/{_cef2359 → _b268d8d}/System/File.vim
  37. +1 −1 etc/vim/bundle/unite.vim/autoload/vital/unite.vim.vital
  38. +140 −73 etc/vim/bundle/unite.vim/doc/unite.txt
  39. +2 −2 etc/vim/bundle/unite.vim/plugin/unite.vim
  40. +1 −1 etc/vim/bundle/unite.vim/plugin/unite/buffer.vim
  41. +1 −1 etc/vim/bundle/unite.vim/plugin/unite/mru.vim
View
5 etc/vim/bundle/unite.vim/autoload/unite.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: unite.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 17 Jun 2013.
+" Last Modified: 26 Aug 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -289,6 +289,9 @@ endfunction"}}}
function! unite#args_complete(sources, arglead, cmdline, cursorpos) "{{{
return unite#complete#args(a:sources, a:arglead, a:cmdline, a:cursorpos)
endfunction"}}}
+function! unite#dummy_completefunc(findstart, base) "{{{
+ return a:findstart ? -1 : []
+endfunction"}}}
function! unite#all_quit_session(...) "{{{
call unite#view#_quit(get(a:000, 0, 1), 1)
View
12 etc/vim/bundle/unite.vim/autoload/unite/action.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: action.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 20 Jul 2013.
+" Last Modified: 02 Sep 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -68,6 +68,10 @@ function! s:get_action_table(source_name, kind_name, self_func, is_parents_actio
call unite#print_error('[unite.vim] source "' . a:source_name . '" is not found.')
return {}
endif
+ if empty(kind)
+ call unite#print_error('[unite.vim] kind "' . a:kind_name . '" is not found.')
+ return {}
+ endif
let action_table = {}
@@ -373,12 +377,12 @@ function! unite#action#do(action_name, ...) "{{{
catch /^Vim\%((\a\+)\)\=:E325/
" Ignore catch.
call unite#print_error(v:exception)
- call unite#print_error('Attenssion: Swap file is found in executing action!')
+ call unite#print_error('Warning: Swap file was found while executing action!')
call unite#print_error('Action name is ' . table.action.name)
catch
call unite#print_error(v:throwpoint)
call unite#print_error(v:exception)
- call unite#print_error('Error occured in executing action!')
+ call unite#print_error('Error occured while executing action!')
call unite#print_error('Action name is ' . table.action.name)
endtry
@@ -397,7 +401,7 @@ function! unite#action#do(action_name, ...) "{{{
endif
endfor
- if !is_quit && unite.context.keep_focus
+ if (!is_quit || unite.context.no_quit) && unite.context.keep_focus
let winnr = bufwinnr(unite.bufnr)
if winnr > 0
View
6 etc/vim/bundle/unite.vim/autoload/unite/candidates.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: candidates.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 23 Jul 2013.
+" Last Modified: 02 Sep 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -107,9 +107,7 @@ function! unite#candidates#gather(...) "{{{
if is_gather_all
let unite.candidates_pos = len(unite.candidates)
elseif unite.context.is_redraw || unite.candidates_pos == 0
- let height = unite.context.no_split ?
- \ winheight(0) : unite.context.winheight
- let unite.candidates_pos = height
+ let unite.candidates_pos = line('.') + winheight(0)
endif
let candidates = unite#init#_candidates(
View
5 etc/vim/bundle/unite.vim/autoload/unite/filters/converter_relative_abbr.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: converter_relative_abbr.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 22 Jul 2013.
+" Last Modified: 30 Jul 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -58,6 +58,9 @@ function! s:converter.filter(candidates, context) "{{{
let candidate.abbr = get(candidate, 'action__path',
\ candidate.word)
endif
+ if isdirectory(candidate.abbr)
+ let candidate.abbr .= '/'
+ endif
endfor
finally
if has_key(a:context, 'source__directory')
View
51 etc/vim/bundle/unite.vim/autoload/unite/filters/converter_smart_path.vim
@@ -0,0 +1,51 @@
+"=============================================================================
+" FILE: converter_smart_path.vim
+" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
+" Last Modified: 04 Aug 2013.
+" License: MIT license {{{
+" Permission is hereby granted, free of charge, to any person obtaining
+" a copy of this software and associated documentation files (the
+" "Software"), to deal in the Software without restriction, including
+" without limitation the rights to use, copy, modify, merge, publish,
+" distribute, sublicense, and/or sell copies of the Software, and to
+" permit persons to whom the Software is furnished to do so, subject to
+" the following conditions:
+"
+" The above copyright notice and this permission notice shall be included
+" in all copies or substantial portions of the Software.
+"
+" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+" }}}
+"=============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+function! unite#filters#converter_smart_path#define() "{{{
+ return s:converter
+endfunction"}}}
+
+let s:converter = {
+ \ 'name' : 'converter_smart_path',
+ \ 'description' : 'converts word to smart path of filename',
+ \}
+
+function! s:converter.filter(candidates, context) "{{{
+ if a:context.input =~ '^\%(\a\+:/\|/\)'
+ return unite#filters#converter_full_path#define().filter(
+ \ a:candidates, a:context)
+ endif
+
+ return a:candidates
+endfunction"}}}
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: foldmethod=marker
View
5 etc/vim/bundle/unite.vim/autoload/unite/filters/matcher_hide_hidden_files.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: matcher_hide_hidden_files.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 23 Jul 2013.
+" Last Modified: 04 Aug 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -38,12 +38,11 @@ let s:matcher = {
function! s:matcher.filter(candidates, context) "{{{
if stridx(a:context.input, '.') >= 0
- \ || get(a:context, 'source__directory', '') =~ '/\.\|^\.'
return unite#filters#filter_matcher(
\ a:candidates, '', a:context)
endif
- return filter(a:candidates, "v:val.action__path !~ '/\\.\\|^\\.'")
+ return filter(a:candidates, "v:val.action__path !~ '/\\.[^/]*$\\|^\\.[^/]*$'")
endfunction"}}}
let &cpo = s:save_cpo
View
50 etc/vim/bundle/unite.vim/autoload/unite/filters/sorter_ftime.vim
@@ -0,0 +1,50 @@
+"=============================================================================
+" FILE: sorter_ftime.vim
+" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
+" Last Modified: 06 Aug 2013.
+" License: MIT license {{{
+" Permission is hereby granted, free of charge, to any person obtaining
+" a copy of this software and associated documentation files (the
+" "Software"), to deal in the Software without restriction, including
+" without limitation the rights to use, copy, modify, merge, publish,
+" distribute, sublicense, and/or sell copies of the Software, and to
+" permit persons to whom the Software is furnished to do so, subject to
+" the following conditions:
+"
+" The above copyright notice and this permission notice shall be included
+" in all copies or substantial portions of the Software.
+"
+" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+" }}}
+"=============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+function! unite#filters#sorter_ftime#define() "{{{
+ return s:sorter
+endfunction"}}}
+
+let s:sorter = {
+ \ 'name' : 'sorter_ftime',
+ \ 'description' : 'sort by getftime() order',
+ \}
+
+function! s:sorter.filter(candidates, context) "{{{
+ return unite#util#sort_by(a:candidates, '
+ \ has_key(v:val, "action__path") ? getftime(v:val.action__path)
+ \ : has_key(v:val, "action__directory") ? getftime(v:val.action__directory)
+ \ : 0
+ \ ')
+endfunction"}}}
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: foldmethod=marker
View
23 etc/vim/bundle/unite.vim/autoload/unite/filters/sorter_rank.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: sorter_rank.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 05 Jul 2013.
+" Last Modified: 08 Aug 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -37,7 +37,7 @@ let s:sorter = {
\}
function! s:sorter.filter(candidates, context) "{{{
- if a:context.input == '' || !has('float')
+ if a:context.input == '' || !has('float') || empty(a:candidates)
return a:candidates
endif
@@ -46,12 +46,22 @@ function! s:sorter.filter(candidates, context) "{{{
let candidate.filter__rank = 0
endfor
+ " let is_path = has_key(a:candidates[0], 'action__path')
+
for input in split(a:context.input, '\\\@<! ')
let input = substitute(substitute(input, '\\ ', ' ', 'g'),
\ '\*', '', 'g')
" Calc rank.
let l1 = len(input)
+
+ " for candidate in a:candidates
+ " let word = is_path ? fnamemodify(candidate.word, ':t') : candidate.word
+ " let index = stridx(word, input[0])
+ " let candidate.filter__rank +=
+ " \ len(word) + (index > 0 ? index * 2 : len(word))
+ " endfor
+
if unite#util#has_lua()
for candidate in a:candidates
let candidate.filter__rank +=
@@ -71,6 +81,8 @@ function! s:sorter.filter(candidates, context) "{{{
endfunction"}}}
function! s:calc_word_distance(str1, str2, l1) "{{{
+ return
+
let l2 = len(a:str2)
let p1 = range(l2+1)
let p2 = []
@@ -113,16 +125,12 @@ function! s:calc_word_distance_lua(str1, str2, l1) "{{{
for j = 0, l2 do
p2[j+1] = math.min(p1[j+1] + 1, p2[j]+1)
end
-
- -- Swap.
- local tmp = p1
- p1 = p2
- p2 = tmp
end
vim.command('let distance = ' .. p1[l2])
EOF
+ " echomsg string([a:str1, a:str2, distance])
return distance
endfunction"}}}
@@ -142,6 +150,7 @@ do
end
end
EOF
+ " echomsg string(map(copy(a:candidates), '[v:val.word, v:val.filter__rank]'))
return a:candidates
endfunction"}}}
View
61 etc/vim/bundle/unite.vim/autoload/unite/handlers.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: handlers.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 06 Jul 2013.
+" Last Modified: 05 Sep 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -31,11 +31,6 @@ function! unite#handlers#_on_insert_enter() "{{{
let unite = unite#get_current_unite()
let unite.is_insert = 1
- if exists(':NeoComplCacheLock')
- " Lock neocomplcache.
- NeoComplCacheLock
- endif
-
if &filetype ==# 'unite'
setlocal modifiable
endif
@@ -44,7 +39,7 @@ function! unite#handlers#_on_insert_leave() "{{{
let unite = unite#get_current_unite()
if line('.') != unite.prompt_linenr
- keepjumps normal! 0
+ normal! 0
endif
let unite.is_insert = 0
@@ -56,6 +51,8 @@ endfunction"}}}
function! unite#handlers#_on_cursor_hold_i() "{{{
let unite = unite#get_current_unite()
+ call s:change_highlight()
+
if unite.max_source_candidates > unite.redraw_hold_candidates
call s:check_redraw()
endif
@@ -152,10 +149,13 @@ function! unite#handlers#_on_cursor_moved() "{{{
let prompt_linenr = unite.prompt_linenr
let context = unite.context
- setlocal nocursorline
+ if line('.') == prompt_linenr && !&l:modifiable
+ setlocal modifiable
+ endif
+ if line('.') != prompt_linenr && &l:modifiable
+ setlocal nomodifiable
+ endif
- execute 'setlocal' line('.') == prompt_linenr ?
- \ 'modifiable' : 'nomodifiable'
if line('.') <= prompt_linenr
nnoremap <silent><buffer> <Plug>(unite_loop_cursor_up)
\ :call unite#mappings#loop_cursor_up_call(
@@ -185,11 +185,13 @@ function! unite#handlers#_on_cursor_moved() "{{{
endif
if exists('b:current_syntax') && !context.no_cursor_line
- silent! execute 'match' (line('.') <= prompt_linenr ?
- \ line('$') <= prompt_linenr ?
- \ 'uniteError /\%'.prompt_linenr.'l/' :
- \ context.cursor_line_highlight.' /\%'.(prompt_linenr+1).'l/' :
- \ context.cursor_line_highlight.' /\%'.line('.').'l/')
+ match
+
+ if line('.') <= prompt_linenr+1 || mode('.') == 'i' ||
+ \ split(reltimestr(reltime(unite.cursor_line_time)))[0] > '0.10'
+ call s:set_cursor_line()
+ endif
+ let unite.cursor_line_time = reltime()
endif
if context.auto_preview
@@ -202,8 +204,8 @@ function! unite#handlers#_on_cursor_moved() "{{{
call s:restore_statusline()
" Check lines. "{{{
- if winheight(0) < line('$') &&
- \ line('.') + winheight(0) / 2 < line('$')
+ if !context.auto_resize &&
+ \ winheight(0) < line('$') && line('.') + winheight(0) / 2 < line('$')
return
endif
@@ -212,7 +214,7 @@ function! unite#handlers#_on_cursor_moved() "{{{
\ || unite.context.winheight == 0) ?
\ winheight(0) : unite.context.winheight
let candidates = unite#candidates#_gather_pos(height)
- if empty(candidates)
+ if !context.auto_resize && empty(candidates)
" Nothing.
return
endif
@@ -288,22 +290,19 @@ function! s:change_highlight() "{{{
let context = unite#get_context()
let prompt_linenr = unite.prompt_linenr
if !context.no_cursor_line
- execute 'match' (line('.') <= prompt_linenr ?
- \ line('$') <= prompt_linenr ?
- \ 'uniteError /\%'.prompt_linenr.'l/' :
- \ context.cursor_line_highlight.' /\%'.(prompt_linenr+1).'l/' :
- \ context.cursor_line_highlight.' /\%'.line('.').'l/')
+ call s:set_cursor_line()
endif
silent! syntax clear uniteCandidateInputKeyword
- if unite#helper#get_input() == ''
+ if !context.is_changed || unite#helper#get_input() == ''
return
endif
syntax case ignore
- for input in unite#helper#get_substitute_input(unite#helper#get_input())
+ for input in unite#helper#get_substitute_input(
+ \ unite#helper#get_input())
for pattern in map(split(input, '\\\@<! '),
\ "substitute(escape(unite#util#escape_match(v:val), '/'),
\ '\\\\\\@<!|', '\\\\|', 'g')")
@@ -359,6 +358,18 @@ function! s:check_redraw() "{{{
call s:change_highlight()
endif
endfunction"}}}
+function! s:set_cursor_line()
+ let unite = unite#get_current_unite()
+ let prompt_linenr = unite.prompt_linenr
+ let context = unite.context
+
+ execute 'match' (line('.') <= prompt_linenr ?
+ \ line('$') <= prompt_linenr ?
+ \ 'uniteError /\%'.prompt_linenr.'l/' :
+ \ context.cursor_line_highlight.' /\%'.(prompt_linenr+1).'l/' :
+ \ context.cursor_line_highlight.' /\%'.line('.').'l/')
+ let unite.cursor_line_time = reltime()
+endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
View
24 etc/vim/bundle/unite.vim/autoload/unite/init.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: init.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 24 Jul 2013.
+" Last Modified: 08 Sep 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -27,6 +27,11 @@
let s:save_cpo = &cpo
set cpo&vim
+" Global options definition. "{{{
+let g:unite_ignore_source_files =
+ \ get(g:, 'unite_ignore_source_files', [])
+"}}}
+
function! unite#init#_context(context, ...) "{{{
let source_names = get(a:000, 0, [])
@@ -115,14 +120,15 @@ function! unite#init#_unite_buffer() "{{{
setlocal nolist
setlocal nobuflisted
setlocal noswapfile
+ setlocal nospell
setlocal noreadonly
setlocal nofoldenable
setlocal nomodeline
setlocal nonumber
setlocal foldcolumn=0
setlocal iskeyword+=-,+,\\,!,~
setlocal matchpairs-=<:>
- setlocal completefunc=
+ setlocal completefunc=unite#dummy_completefunc
setlocal omnifunc=
match
if has('conceal')
@@ -135,6 +141,9 @@ function! unite#init#_unite_buffer() "{{{
if exists('+colorcolumn')
setlocal colorcolumn=0
endif
+ if exists('+relativenumber')
+ setlocal norelativenumber
+ endif
" Autocommands.
augroup plugin-unite
@@ -211,8 +220,7 @@ function! unite#init#_current_unite(sources, context) "{{{
endif
" The current buffer is initialized.
- let buffer_name = unite#util#is_windows() ?
- \ '[unite] - ' : '*unite* - '
+ let buffer_name = '[unite] - '
let buffer_name .= context.buffer_name
let winnr = winnr()
@@ -270,8 +278,9 @@ function! unite#init#_current_unite(sources, context) "{{{
let unite.args = unite#helper#get_source_args(a:sources)
let unite.msgs = []
let unite.err_msgs = []
- let unite.redraw_hold_candidates = (unite#util#has_lua() ? 10000 : 4000)
+ let unite.redraw_hold_candidates = (unite#util#has_lua() ? 20000 : 10000)
let unite.disabled_max_candidates = 0
+ let unite.cursor_line_time = reltime()
if context.here
let context.winheight = winheight(0) - winline() +
@@ -469,6 +478,11 @@ function! unite#init#_default_scripts(kind, names) "{{{
\ 'autoload/unite/'.a:kind.'/'.prefix.'*.vim', 1), '\n')
endfor
+ if a:kind == 'sources'
+ call filter(files, "index(g:unite_ignore_source_files,
+ \ fnamemodify(v:val, ':t')) < 0")
+ endif
+
for define in map(files,
\ "unite#{a:kind}#{fnamemodify(v:val, ':t:r')}#define()")
for dict in filter(unite#util#convert2list(define),
View
86 etc/vim/bundle/unite.vim/autoload/unite/kinds/cdable.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: cdable.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 19 Jul 2013.
+" Last Modified: 11 Aug 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -205,6 +205,90 @@ function! s:kind.action_table.tabvimfiler.func(candidate) "{{{
endif
endfunction"}}}
+" For rec. "{{{
+let s:cdable_action_rec = {
+ \ 'description' : 'open this directory by file_rec source',
+ \ 'is_start' : 1,
+ \}
+
+function! s:cdable_action_rec.func(candidate)
+ call unite#start_script([['file_rec', a:candidate.action__directory]])
+endfunction
+
+let s:cdable_action_rec_parent = {
+ \ 'description' : 'open parent directory by file_rec source',
+ \ 'is_start' : 1,
+ \}
+
+function! s:cdable_action_rec_parent.func(candidate)
+ call unite#start_script([['file_rec', unite#util#substitute_path_separator(
+ \ fnamemodify(a:candidate.action__directory, ':h'))
+ \ ]])
+endfunction
+
+let s:cdable_action_rec_project = {
+ \ 'description' : 'open project directory by file_rec source',
+ \ 'is_start' : 1,
+ \}
+
+function! s:cdable_action_rec_project.func(candidate)
+ call unite#start_script([['file_rec', unite#util#substitute_path_separator(
+ \ unite#util#path2project_directory(a:candidate.action__directory))
+ \ ]])
+endfunction
+
+let s:cdable_action_rec_async = {
+ \ 'description' : 'open this directory by file_rec/async source',
+ \ 'is_start' : 1,
+ \}
+
+function! s:cdable_action_rec_async.func(candidate)
+ call unite#start_script([['file_rec/async', a:candidate.action__directory]])
+endfunction
+
+let s:cdable_action_rec_parent_async = {
+ \ 'description' : 'open parent directory by file_rec/async source',
+ \ 'is_start' : 1,
+ \}
+
+function! s:cdable_action_rec_parent_async.func(candidate)
+ call unite#start_script([['file_rec/async', unite#util#substitute_path_separator(
+ \ fnamemodify(a:candidate.action__directory, ':h'))
+ \ ]])
+endfunction
+
+let s:cdable_action_rec_project_async = {
+ \ 'description' : 'open project directory by file_rec/async source',
+ \ 'is_start' : 1,
+ \}
+
+function! s:cdable_action_rec_project_async.func(candidate)
+ call unite#start_script([['file_rec/async', unite#util#substitute_path_separator(
+ \ unite#util#path2project_directory(a:candidate.action__directory))
+ \ ]])
+endfunction
+
+let s:kind.action_table['rec'] =
+ \ s:cdable_action_rec
+let s:kind.action_table['rec_parent'] =
+ \ s:cdable_action_rec_parent
+let s:kind.action_table['rec_project'] =
+ \ s:cdable_action_rec_project
+let s:kind.action_table['rec/async'] =
+ \ s:cdable_action_rec_async
+let s:kind.action_table['rec_parent/async'] =
+ \ s:cdable_action_rec_parent_async
+let s:kind.action_table['rec_project/async'] =
+ \ s:cdable_action_rec_project_async
+unlet! s:cdable_action_rec
+unlet! s:cdable_action_rec_async
+unlet! s:cdable_action_rec_project
+unlet! s:cdable_action_rec_project_async
+unlet! s:cdable_action_rec_parent
+unlet! s:cdable_action_rec_parent_async
+"}}}
+
+
function! s:external_cd(candidate) "{{{
if &filetype ==# 'vimfiler'
call vimfiler#mappings#cd(a:candidate.action__directory)
View
4 etc/vim/bundle/unite.vim/autoload/unite/kinds/completion.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: completion.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 24 Jan 2013.
+" Last Modified: 29 Jul 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -61,7 +61,7 @@ function! s:kind.action_table.preview.func(candidate) "{{{
\ a:candidate.action__complete_info_lazy() :
\ ''
if complete_info != ''
- let S = vital#of('unite.vim').import('Data.String')
+ let S = unite#util#get_vital().import('Data.String')
echo join(S.wrap(complete_info)[: &cmdheight-1], "\n")
endif
endfunction"}}}
View
15 etc/vim/bundle/unite.vim/autoload/unite/kinds/file.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: file.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 02 Jul 2013.
+" Last Modified: 10 Sep 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -60,7 +60,7 @@ function! unite#kinds#file#define() "{{{
return s:kind
endfunction"}}}
-let s:System = vital#of('unite.vim').import('System.File')
+let s:System = unite#util#get_vital().import('System.File')
let s:kind = {
\ 'name' : 'file',
@@ -201,6 +201,13 @@ function! s:kind.action_table.diff.func(candidates)
if len(a:candidates) == 1
" :vimdiff with current buffer.
+ if &filetype ==# 'vimfiler'
+ " Move to other window.
+ wincmd w
+ endif
+
+ tabnew %
+ let t:title = 'vimdiff'
call s:execute_command('vert diffsplit', a:candidates[0])
elseif len(a:candidates) == 2
" :vimdiff the other candidate.
@@ -804,6 +811,7 @@ function! unite#kinds#file#do_rename(old_filename, new_filename) "{{{
let current_dir_save = getcwd()
lcd `=directory`
+ let hidden_save = &l:hidden
try
let old_filename = unite#util#substitute_path_separator(
\ fnamemodify(a:old_filename, ':.'))
@@ -812,6 +820,8 @@ function! unite#kinds#file#do_rename(old_filename, new_filename) "{{{
let bufnr = bufnr(unite#util#escape_file_searching(old_filename))
if bufnr > 0
+ setlocal hidden
+
" Buffer rename.
let bufnr_save = bufnr('%')
execute 'buffer' bufnr
@@ -827,6 +837,7 @@ function! unite#kinds#file#do_rename(old_filename, new_filename) "{{{
finally
" Restore path.
lcd `=current_dir_save`
+ let &l:hidden = hidden_save
endtry
endfunction"}}}
function! s:filename2candidate(filename) "{{{
View
4 etc/vim/bundle/unite.vim/autoload/unite/kinds/uri.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: uri.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 07 Feb 2013.
+" Last Modified: 29 Jul 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -31,7 +31,7 @@ function! unite#kinds#uri#define() "{{{
return s:kind
endfunction"}}}
-let s:System = vital#of('unite.vim').import('System.File')
+let s:System = unite#util#get_vital().import('System.File')
let s:kind = {
\ 'name' : 'uri',
View
43 etc/vim/bundle/unite.vim/autoload/unite/mappings.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: mappings.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 06 Jul 2013.
+" Last Modified: 01 Sep 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -46,7 +46,9 @@ function! unite#mappings#define_default_mappings() "{{{
nnoremap <expr><buffer> <Plug>(unite_append_end)
\ <SID>insert_enter('A')
nnoremap <silent><buffer> <Plug>(unite_toggle_mark_current_candidate)
- \ :<C-u>call <SID>toggle_mark()<CR>
+ \ :<C-u>call <SID>toggle_mark('j')<CR>
+ nnoremap <silent><buffer> <Plug>(unite_toggle_mark_current_candidate_up)
+ \ :<C-u>call <SID>toggle_mark('k')<CR>
nnoremap <silent><buffer> <Plug>(unite_redraw)
\ :<C-u>call <SID>redraw()<CR>
nnoremap <silent><buffer> <Plug>(unite_rotate_next_source)
@@ -133,7 +135,9 @@ function! unite#mappings#define_default_mappings() "{{{
inoremap <expr><buffer> <Plug>(unite_select_previous_page)
\ pumvisible() ? "\<PageUp>" : repeat("\<Up>", winheight(0))
inoremap <silent><buffer> <Plug>(unite_toggle_mark_current_candidate)
- \ <C-o>:<C-u>call <SID>toggle_mark()<CR>
+ \ <C-o>:<C-u>call <SID>toggle_mark('j')<CR>
+ inoremap <silent><buffer> <Plug>(unite_toggle_mark_current_candidate_up)
+ \ <C-o>:<C-u>call <SID>toggle_mark('k')<CR>
inoremap <silent><buffer> <Plug>(unite_choose_action)
\ <C-o>:<C-u>call <SID>choose_action()<CR>
inoremap <expr><buffer> <Plug>(unite_move_head)
@@ -181,6 +185,7 @@ function! unite#mappings#define_default_mappings() "{{{
nmap <buffer> Q <Plug>(unite_all_exit)
nmap <buffer> <CR> <Plug>(unite_do_default_action)
nmap <buffer> <Space> <Plug>(unite_toggle_mark_current_candidate)
+ nmap <buffer> <S-Space> <Plug>(unite_toggle_mark_current_candidate_up)
nmap <buffer> <Tab> <Plug>(unite_choose_action)
nmap <buffer> <C-n> <Plug>(unite_rotate_next_source)
nmap <buffer> <C-p> <Plug>(unite_rotate_previous_source)
@@ -247,6 +252,8 @@ function! unite#mappings#define_default_mappings() "{{{
imap <silent><buffer><expr> <Space>
\ unite#smart_map(' ', "\<Plug>(unite_toggle_mark_current_candidate)")
+ imap <silent><buffer><expr> <S-Space>
+ \ unite#smart_map(' ', "\<Plug>(unite_toggle_mark_current_candidate_up)")
inoremap <silent><buffer><expr> <C-d>
\ unite#do_action('delete')
@@ -270,7 +277,7 @@ function! unite#mappings#narrowing(word) "{{{
startinsert!
else
call cursor(prompt_linenr+1, 0)
- keepjumps normal! 0z.
+ normal! 0z.
endif
endfunction"}}}
@@ -361,7 +368,7 @@ function! s:normal_delete_backward_path() "{{{
call unite#redraw()
let &l:modifiable = modifiable_save
endfunction"}}}
-function! s:toggle_mark() "{{{
+function! s:toggle_mark(...) "{{{
let candidate = unite#helper#get_current_candidate()
if empty(candidate) || get(candidate, 'is_dummy', 0)
return
@@ -371,19 +378,29 @@ function! s:toggle_mark() "{{{
let candidate.unite__marked_time = localtime()
let prompt_linenr = unite#get_current_unite().prompt_linenr
- if line('.') <= prompt_linenr
- call cursor(prompt_linenr+1, 0)
+
+ call unite#view#_redraw_line()
+
+ let map = get(a:000, 0, '')
+ if map == ''
+ return
endif
while 1
- call unite#view#_redraw_line()
-
- if line('.') != line('$')
- normal! j
+ if map ==# 'j'
+ if line('.') != line('$')
+ normal! j
+ endif
+ elseif map ==# 'k'
+ if line('.') > prompt_linenr
+ normal! k
+ endif
endif
let candidate = unite#helper#get_current_candidate()
- if line('.') == line('$') || !get(candidate, 'is_dummy', 0)
+ if (map ==# 'j' && line('.') <= prompt_linenr ||
+ \ map ==# 'k' && line('.') == line('$')) ||
+ \ !get(candidate, 'is_dummy', 0)
break
endif
endwhile
@@ -681,7 +698,7 @@ function! s:toggle_auto_preview() "{{{
if !context.auto_preview
\ && !unite#get_current_unite().has_preview_window
" Close preview window.
- pclose!
+ noautocmd pclose!
endif
endfunction"}}}
function! s:toggle_auto_highlight() "{{{
View
17 etc/vim/bundle/unite.vim/autoload/unite/sources/bookmark.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: bookmark.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 29 Mar 2013.
+" Last Modified: 03 Sep 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -33,7 +33,8 @@ let s:VERSION = '0.1.0'
let s:bookmarks = {}
-call unite#util#set_default('g:unite_source_bookmark_directory', g:unite_data_directory . '/bookmark')
+call unite#util#set_default('g:unite_source_bookmark_directory',
+ \ g:unite_data_directory . '/bookmark')
"}}}
function! unite#sources#bookmark#define() "{{{
@@ -88,7 +89,9 @@ endfunction"}}}
let s:source = {
\ 'name' : 'bookmark',
\ 'description' : 'candidates from bookmark list',
+ \ 'syntax' : 'uniteSource__Bookmark',
\ 'action_table' : {},
+ \ 'hooks' : {},
\}
function! s:source.gather_candidates(args, context) "{{{
@@ -100,11 +103,12 @@ function! s:source.gather_candidates(args, context) "{{{
if stridx(bookmark_name, '*') != -1
let bookmarks = map(filter(
- \ unite#util#glob(g:unite_source_bookmark_directory . '/' . bookmark_name),
+ \ unite#util#glob(
+ \ g:unite_source_bookmark_directory . '/' . bookmark_name),
\ 'filereadable(v:val)'),
\ 'fnamemodify(v:val, ":t:r")'
\)
- else
+ else
let bookmarks = [bookmark_name]
endif
@@ -127,6 +131,11 @@ function! s:source.gather_candidates(args, context) "{{{
endfor
return candidates
endfunction"}}}
+function! s:source.hooks.on_syntax(args, context) "{{{
+ syntax match uniteSource__Bookmark_Name /\[.\{-}\] /
+ \ contained containedin=uniteSource__Bookmark
+ highlight default link uniteSource__Bookmark_Name Statement
+endfunction"}}}
function! s:source.complete(args, context, arglead, cmdline, cursorpos) "{{{
return ['_', '*', 'default'] + map(split(glob(
\ g:unite_source_bookmark_directory . '/' . a:arglead . '*'), '\n'),
View
18 etc/vim/bundle/unite.vim/autoload/unite/sources/buffer.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: buffer.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 30 Jun 2013.
+" Last Modified: 03 Sep 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -28,8 +28,6 @@ let s:save_cpo = &cpo
set cpo&vim
" Variables "{{{
-let s:buffer_list = {}
-
call unite#util#set_default(
\ 'g:unite_source_buffer_time_format',
\ '(%Y/%m/%d %H:%M:%S) ')
@@ -38,14 +36,6 @@ call unite#util#set_default(
function! unite#sources#buffer#define() "{{{
return [s:source_buffer_all, s:source_buffer_tab]
endfunction"}}}
-function! unite#sources#buffer#_append() "{{{
- " Append the current buffer.
- let bufnr = bufnr('%')
- let s:buffer_list[bufnr] = {
- \ 'action__buffer_nr' : bufnr,
- \ 'source__time' : localtime(),
- \ }
-endfunction"}}}
let s:source_buffer_all = {
\ 'name' : 'buffer',
@@ -222,10 +212,11 @@ function! s:get_buffer_list(is_bang, is_question) "{{{
" Make buffer list.
let list = []
let bufnr = 1
+ let buffer_list = unite#sources#buffer#variables#get_buffer_list()
while bufnr <= bufnr('$')
if s:is_listed(a:is_bang, a:is_question, bufnr)
\ && bufnr != bufnr('%')
- let dict = get(s:buffer_list, bufnr, {
+ let dict = get(buffer_list, bufnr, {
\ 'action__buffer_nr' : bufnr,
\ 'source__time' : 0,
\ })
@@ -240,7 +231,8 @@ function! s:get_buffer_list(is_bang, is_question) "{{{
if s:is_listed(a:is_bang, a:is_question, bufnr('%'))
" Add current buffer.
- let dict = get(s:buffer_list, bufnr('%'), {
+ let dict = get(unite#sources#buffer#variables#get_buffer_list(),
+ \ bufnr('%'), {
\ 'action__buffer_nr' : bufnr('%'),
\ 'source__time' : 0,
\ })
View
48 etc/vim/bundle/unite.vim/autoload/unite/sources/buffer/variables.vim
@@ -0,0 +1,48 @@
+"=============================================================================
+" FILE: variables.vim
+" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
+" Last Modified: 30 Apr 2013
+" License: MIT license {{{
+" Permission is hereby granted, free of charge, to any person obtaining
+" a copy of this software and associated documentation files (the
+" "Software"), to deal in the Software without restriction, including
+" without limitation the rights to use, copy, modify, merge, publish,
+" distribute, sublicense, and/or sell copies of the Software, and to
+" permit persons to whom the Software is furnished to do so, subject to
+" the following conditions:
+"
+" The above copyright notice and this permission notice shall be included
+" in all copies or substantial portions of the Software.
+"
+" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+" }}}
+"=============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+let s:buffer_list = {}
+
+function! unite#sources#buffer#variables#append() "{{{
+ " Append the current buffer.
+ let bufnr = bufnr('%')
+ let s:buffer_list[bufnr] = {
+ \ 'action__buffer_nr' : bufnr,
+ \ 'source__time' : localtime(),
+ \ }
+endfunction"}}}
+
+function! unite#sources#buffer#variables#get_buffer_list() "{{{
+ return s:buffer_list
+endfunction"}}}
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: foldmethod=marker
View
6 etc/vim/bundle/unite.vim/autoload/unite/sources/directory.vim
@@ -127,14 +127,10 @@ function! s:source_directory_new.change_candidates(args, context) "{{{
let input = resolve(input)
endif
- " Glob by directory name.
- let input = substitute(input, '[^/.]*$', '', '')
- let glob = input . (input =~ '\*$' ? '' : '*')
-
let is_relative_path = path !~ '^\%(/\|\a\+:/\)'
let newfile = unite#util#expand(
- \ escape(substitute(a:context.input, '[*\\]', '', 'g'), ''))
+ \ escape(substitute(input, '[*\\]', '', 'g'), ''))
if filereadable(newfile) || isdirectory(newfile)
return []
endif
View
43 etc/vim/bundle/unite.vim/autoload/unite/sources/file.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: file.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 25 Jul 2013.
+" Last Modified: 12 Aug 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -44,7 +44,6 @@ let s:source_file = {
\ 'ignore_pattern' : g:unite_source_file_ignore_pattern,
\ 'default_kind' : 'file',
\ 'matchers' : [ 'matcher_default', 'matcher_hide_hidden_files' ],
- \ 'converters' : [ 'converter_relative_abbr', ],
\}
function! s:source_file.change_candidates(args, context) "{{{
@@ -93,8 +92,9 @@ function! s:source_file.change_candidates(args, context) "{{{
let files = unite#util#glob(glob, !is_vimfiler)
if !is_vimfiler
- let files = sort(filter(copy(files), 'isdirectory(v:val)'), 1) +
- \ sort(filter(copy(files), '!isdirectory(v:val)'), 1)
+ let files = sort(filter(copy(files),
+ \ "v:val != '.' && isdirectory(v:val)"), 1) +
+ \ sort(filter(copy(files), "!isdirectory(v:val)"), 1)
endif
let a:context.source__cache[glob] = map(files,
@@ -217,22 +217,29 @@ let s:source_file_new = {
\ 'name' : 'file/new',
\ 'description' : 'file candidates from input',
\ 'default_kind' : 'file',
- \ 'converters' : 'converter_relative_abbr',
+ \ 'hooks' : {},
\ }
+function! s:source_file_new.hooks.on_init(args, context) "{{{
+ let path = unite#util#substitute_path_separator(
+ \ expand(join(a:args, ':')))
+ let path = unite#util#substitute_path_separator(
+ \ fnamemodify(path, ':p'))
+ if path !=# '/' && path =~ '[\\/]$'
+ " Chomp.
+ let path = path[: -2]
+ endif
+ let a:context.source__path = path
+endfunction"}}}
+
function! s:source_file_new.change_candidates(args, context) "{{{
let input = substitute(substitute(
- \ a:context.path, '\\ ', ' ', 'g'), '^\a\+:\zs\*/', '/', '')
+ \ a:context.input, '\\ ', ' ', 'g'), '^\a\+:\zs\*/', '/', '')
if input == ''
return []
endif
- let path = join(a:args, ':')
- if path !=# '/' && path =~ '[\\/]$'
- " Chomp.
- let path = path[: -2]
- endif
-
+ let path = a:context.source__path
if input !~ '^\%(/\|\a\+:/\)' && path != '' && path != '/'
let input = path . '/' . input
endif
@@ -245,14 +252,10 @@ function! s:source_file_new.change_candidates(args, context) "{{{
let input = resolve(input)
endif
- " Glob by directory name.
- let input = substitute(input, '[^/.]*$', '', '')
- let glob = input . (input =~ '\*$' ? '' : '*')
-
let is_relative_path = path !~ '^\%(/\|\a\+:/\)'
let newfile = unite#util#expand(
- \ escape(substitute(a:context.path, '[*\\]', '', 'g'), ''))
+ \ escape(substitute(input, '[*\\]', '', 'g'), ''))
if filereadable(newfile) || isdirectory(newfile)
return []
endif
@@ -302,14 +305,16 @@ function! unite#sources#file#create_file_dict(file, is_relative_path, ...) "{{{
let dict.kind = 'directory'
elseif is_newfile
+ let dict.abbr = unite#util#substitute_path_separator(
+ \ fnamemodify(a:file, ':~:.'))
if is_newfile == 1
" New file.
- let dict.abbr = '[new file] ' . a:file
+ let dict.abbr = '[new file] ' . dict.abbr
let dict.kind = 'file'
elseif is_newfile == 2
" New directory.
let dict.action__directory = a:file
- let dict.abbr = '[new directory] ' . a:file
+ let dict.abbr = '[new directory] ' . dict.abbr
let dict.kind = 'directory'
endif
else
View
15 etc/vim/bundle/unite.vim/autoload/unite/sources/function.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: function.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 31 Dec 2012.
+" Last Modified: 13 Aug 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -151,6 +151,19 @@ function! s:source.action_table.call.func(candidate) "{{{
endfunction"}}}
"}}}
+let s:source.action_table.edit = {
+ \ 'description' : 'edit the function from the source',
+ \ }
+function! s:source.action_table.edit.func(candidates) "{{{
+ redir => func
+ silent execute 'verbose function '.a:candidates.action__function
+ redir END
+ let path = matchstr(split(func,'\n')[1], 'Last set from \zs.*$')
+ execute 'edit' fnameescape(path)
+ execute search('^[ \t]*fu\%(nction\)\?[ !]*'.
+ \ a:candidates.action__function)
+endfunction"}}}
+
let &cpo = s:save_cpo
unlet s:save_cpo
View
31 etc/vim/bundle/unite.vim/autoload/unite/sources/grep.vim
@@ -2,7 +2,7 @@
" FILE: grep.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
" Tomohiro Nishimura <tomohiro68 at gmail.com>
-" Last Modified: 16 Jul 2013.
+" Last Modified: 08 Sep 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -146,15 +146,29 @@ function! s:source.hooks.on_syntax(args, context) "{{{
endif
syntax case ignore
- execute 'syntax match uniteSource__GrepPattern /:.*\zs'
+ syntax region uniteSource__GrepLine
+ \ start=' ' end='$'
+ \ containedin=uniteSource__Grep
+ syntax match uniteSource__GrepFile /^[^:]*/ contained
+ \ containedin=uniteSource__GrepLine
+ \ nextgroup=uniteSource__GrepSeparator
+ syntax match uniteSource__GrepSeparator /:/ contained
+ \ containedin=uniteSource__GrepLine
+ \ nextgroup=uniteSource__GrepLineNr
+ syntax match uniteSource__GrepLineNr /\d\+\ze:/ contained
+ \ containedin=uniteSource__GrepLine
+ \ nextgroup=uniteSource__GrepPattern
+ execute 'syntax match uniteSource__GrepPattern /'
\ . substitute(a:context.source__input, '\([/\\]\)', '\\\1', 'g')
- \ . '/ contained containedin=uniteSource__Grep'
+ \ . '/ contained containedin=uniteSource__GrepLine'
+ highlight default link uniteSource__GrepFile Directory
+ highlight default link uniteSource__GrepLineNr LineNR
execute 'highlight default link uniteSource__GrepPattern'
\ unite#get_source_variables(a:context).search_word_highlight
endfunction"}}}
function! s:source.hooks.on_close(args, context) "{{{
if has_key(a:context, 'source__proc')
- call a:context.source__proc.waitpid()
+ call a:context.source__proc.kill()
endif
endfunction "}}}
function! s:source.hooks.on_post_filter(args, context) "{{{
@@ -253,6 +267,8 @@ function! s:source.async_gather_candidates(args, context) "{{{
" Disable async.
let a:context.is_async = 0
call unite#print_source_message('Completed.', s:source.name)
+
+ call a:context.source__proc.waitpid()
endif
let candidates = map(stdout.read_lines(-1, 100),
@@ -268,11 +284,6 @@ function! s:source.async_gather_candidates(args, context) "{{{
\ '[v:val, split(v:val[2:], ":", 1)]')
endif
- let cwd = getcwd()
- if isdirectory(a:context.source__directory)
- lcd `=a:context.source__directory`
- endif
-
if a:context.source__ssh_path != ''
" Use ssh command.
let [hostname, port, path] = unite#sources#ssh#parse_path(
@@ -317,8 +328,6 @@ function! s:source.async_gather_candidates(args, context) "{{{
call add(_, dict)
endfor
- lcd `=cwd`
-
return _
endfunction "}}}
View
103 etc/vim/bundle/unite.vim/autoload/unite/sources/mru.vim
@@ -30,7 +30,7 @@ set cpo&vim
" Variables "{{{
-let s:V = vital#of('unite.vim')
+let s:V = unite#util#get_vital()
let s:L = s:V.import("Data.List")
" The version of MRU file format.
@@ -120,9 +120,6 @@ let s:mru = {
function! s:mru.is_a(type) "{{{
return self.type == a:type
endfunction "}}}
-function! s:mru.path()
- throw 'unite(mru) umimplemented method: path()!'
-endfunction
function! s:mru.save(...)
throw 'unite(mru) umimplemented method: save()!'
endfunction
@@ -133,33 +130,21 @@ function! s:mru.validate()
throw 'unite(mru) umimplemented method: validate()!'
endfunction
-function! s:mru.append() "{{{
- let path = self.path()
-
- if empty(path)
- return
- endif
-
+function! s:mru.gather_candidates(args, context) "{{{
if empty(self.candidates)
call self.load()
endif
- let save_ignorecase = &ignorecase
- let &ignorecase = unite#util#is_windows()
-
- let time = localtime()
- call insert(self.candidates, s:convert2dictionary([path, time]))
-
- let &ignorecase = save_ignorecase
-
- if (time - self.mtime) > self.update_interval
- call self.save()
- endif
-endfunction"}}}
+ let self.candidates = unite#sources#mru#variables#get_mrus(self.type)
+ \ + self.candidates
+ call unite#sources#mru#variables#clear(self.type)
-function! s:mru.gather_candidates(args, context) "{{{
- if empty(self.candidates)
- call self.load()
+ if a:context.is_redraw
+ call filter(self.candidates,
+ \ ((self.type == 'file') ?
+ \ "v:val.action__path !~ '^\\a\\w\\+:'
+ \ && getftype(v:val.action__path) ==# 'file'" :
+ \ "isdirectory(v:val.action__path)"))
endif
if get(a:args, 0, '') =~# '\%(long\|all\|\*\|_\)'
@@ -184,6 +169,10 @@ function! s:mru.has_external_update() "{{{
endfunction"}}}
function! s:mru.save(...) "{{{
+ let self.candidates = unite#sources#mru#variables#get_mrus(self.type)
+ \ + self.candidates
+ call unite#sources#mru#variables#clear(self.type)
+
if empty(self.candidates)
" nothing to save, mru is not loaded
return
@@ -195,16 +184,14 @@ function! s:mru.save(...) "{{{
endif
" should load all candidates
- if self.is_loaded < 2
- call self.load()
- endif
+ call self.load()
if self.has_external_update() && filereadable(self.mru_file.short)
" only need to get the short list which contains the latest MRUs
let [ver; items] = readfile(self.mru_file.short)
if self.version_check(ver)
call extend(self.candidates, s:convert2candidates(items))
- let self.candidates = s:uniq_sort(self.candidates)
+ let self.candidates = s:L.uniq(items, 'v:val.action__path')
endif
endif
@@ -292,21 +279,6 @@ let s:file_mru = extend(deepcopy(s:mru), {
\ },
\ }
\)
-function! s:file_mru.path() "{{{
- let path = unite#util#substitute_path_separator(expand('%:p'))
- if path !~ '\a\+:'
- let path = unite#util#substitute_path_separator(
- \ simplify(resolve(path)))
- endif
-
- " Append the current buffer to the mru list.
- if !s:is_file_exist(path) || &l:buftype =~# 'help\|nofile'
- return ''
- endif
-
- return path
-endfunction "}}}
-
function! s:file_mru.validate() "{{{
if self.do_validate
call filter(self.candidates,
@@ -328,30 +300,6 @@ let s:directory_mru = extend(deepcopy(s:mru), {
\ }
\)
-function! s:directory_mru.path() "{{{
- let filetype = getbufvar(bufnr('%'), '&filetype')
- if filetype ==# 'vimfiler' &&
- \ type(getbufvar(bufnr('%'), 'vimfiler')) == type({})
- let path = getbufvar(bufnr('%'), 'vimfiler').current_dir
- elseif filetype ==# 'vimshell' &&
- \ type(getbufvar(bufnr('%'), 'vimshell')) == type({})
- let path = getbufvar(bufnr('%'), 'vimshell').current_dir
- else
- let path = getcwd()
- endif
-
- let path = unite#util#substitute_path_separator(
- \ simplify(resolve(path)))
- " Chomp last /.
- let path = substitute(path, '/$', '', '')
-
- " Append the current buffer to the mru list.
- if !isdirectory(path) || &buftype =~ 'help'
- return ''
- endif
- return path
-endfunction "}}}
-
function! s:directory_mru.validate() "{{{
if self.do_validate
call filter(self.candidates,
@@ -364,12 +312,6 @@ endfunction"}}}
let s:MRUs.file = s:file_mru
let s:MRUs.directory = s:directory_mru
-function! unite#sources#mru#_append() "{{{
- for m in values(s:MRUs)
- call m.append()
- endfor
-endfunction"}}}
-
function! unite#sources#mru#_save(...) "{{{
let opts = {}
if a:0 >= 1 && s:V.is_dict(a:1)
@@ -396,6 +338,7 @@ let s:file_mru_source = {
\ 'syntax' : 'uniteSource__FileMru',
\ 'default_kind' : 'file',
\ 'ignore_pattern' : g:unite_source_file_mru_ignore_pattern,
+ \ 'max_candidates' : 200,
\}
let s:dir_mru_source = {
@@ -408,6 +351,7 @@ let s:dir_mru_source = {
\ 'ignore_pattern' :
\ g:unite_source_directory_mru_ignore_pattern,
\ 'alias_table' : { 'unite__new_candidate' : 'vimfiler__mkdir' },
+ \ 'max_candidates' : 200,
\}
function! s:file_mru_source.hooks.on_syntax(args, context) "{{{
@@ -480,14 +424,7 @@ let s:dir_mru_source.converters = [ s:dir_mru_source.source__converter ]
" Misc "{{{
function! s:is_file_exist(path) "{{{
- return a:path !~ '^\a\w\+:' && getftype(a:path) ==# 'file'
-endfunction"}}}
-function! s:uniq_sort(items) "{{{
- function! s:compare(i1, i2) "{{{
- return a:i2.source__time - a:i1.source__time
- endfunction"}}}
- call sort(a:items, function('s:compare'))
- return s:L.uniq(a:items, 'v:val.action__path')
+ return
endfunction"}}}
function! s:convert2candidates(items) "{{{
try
View
113 etc/vim/bundle/unite.vim/autoload/unite/sources/mru/variables.vim
@@ -0,0 +1,113 @@
+"=============================================================================
+" FILE: variables.vim
+" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
+" Last Modified: 30 Apr 2013
+" License: MIT license {{{
+" Permission is hereby granted, free of charge, to any person obtaining
+" a copy of this software and associated documentation files (the
+" "Software"), to deal in the Software without restriction, including
+" without limitation the rights to use, copy, modify, merge, publish,
+" distribute, sublicense, and/or sell copies of the Software, and to
+" permit persons to whom the Software is furnished to do so, subject to
+" the following conditions:
+"
+" The above copyright notice and this permission notice shall be included
+" in all copies or substantial portions of the Software.
+"
+" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+" }}}
+"=============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+let s:is_windows = has('win16') || has('win32') || has('win64')
+
+let s:mru_files = []
+let s:mru_directories = []
+
+function! unite#sources#mru#variables#append() "{{{
+ if &l:buftype =~ 'help\|nofile'
+ return
+ endif
+
+ let path = s:substitute_path_separator(expand('%:p'))
+ if path !~ '\a\+:'
+ let path = s:substitute_path_separator(
+ \ simplify(resolve(path)))
+ endif
+
+ " Append the current buffer to the mru list.
+ if s:is_file_exist(path)
+ call insert(s:mru_files, s:convert2dictionary([path, localtime()]))
+ endif
+
+ let filetype = getbufvar(bufnr('%'), '&filetype')
+ if filetype ==# 'vimfiler' &&
+ \ type(getbufvar(bufnr('%'), 'vimfiler')) == type({})
+ let path = getbufvar(bufnr('%'), 'vimfiler').current_dir
+ elseif filetype ==# 'vimshell' &&
+ \ type(getbufvar(bufnr('%'), 'vimshell')) == type({})
+ let path = getbufvar(bufnr('%'), 'vimshell').current_dir
+ else
+ let path = getcwd()
+ endif
+
+ let path = s:substitute_path_separator(simplify(resolve(path)))
+ " Chomp last /.
+ let path = substitute(path, '/$', '', '')
+
+ " Append the current buffer to the mru list.
+ if isdirectory(path)
+ call insert(s:mru_directories, s:convert2dictionary([path, localtime()]))
+ endif
+endfunction"}}}
+
+function! unite#sources#mru#variables#get_mrus(type) "{{{
+ return a:type ==# 'file' ? s:mru_files : s:mru_directories
+endfunction"}}}
+
+function! unite#sources#mru#variables#clear(type) "{{{
+ if a:type ==# 'file'
+ let s:mru_files = []
+ else
+ let s:mru_directories = []
+ endif
+endfunction"}}}
+
+function! s:convert2candidates(items) "{{{
+ try
+ return map(a:items, 's:convert2dictionary(split(v:val, "\t"))')
+ catch
+ call unite#util#print_error('Sorry, MRU file is invalid.')
+ return []
+ endtry
+endfunction"}}}
+
+function! s:convert2dictionary(list) "{{{
+ return { 'word' : a:list[0], 'source__time' : str2nr(a:list[1]),
+ \ 'action__path' : a:list[0], }
+endfunction"}}}
+
+function! s:convert2list(dict) "{{{
+ return [ a:dict.action__path, a:dict.source__time ]
+endfunction"}}}
+
+function! s:is_file_exist(path) "{{{
+ return a:path !~ '^\a\w\+:' && getftype(a:path) ==# 'file'
+endfunction"}}}
+
+function! s:substitute_path_separator(path)
+ return s:is_windows ? substitute(a:path, '\\', '/', 'g') : a:path
+endfunction
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: foldmethod=marker
View
91 etc/vim/bundle/unite.vim/autoload/unite/sources/rec.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: rec.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 22 Jul 2013.
+" Last Modified: 12 Sep 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -41,12 +41,14 @@ call unite#util#set_default(
\ 'g:unite_source_file_rec_max_cache_files')
call unite#util#set_default(
\ 'g:unite_source_rec_async_command',
- \ (executable('ag') ? 'ag --nocolor --nogroup --hidden -g ""' :
- \ !unite#util#is_windows() && executable('find') ? 'find' : ''),
+ \ (executable('ag') ?
+ \ 'ag --nocolor --nogroup --skip-vcs-ignores --ignore ' .
+ \ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'' --hidden -g ""' :
+ \ !unite#util#is_windows() && executable('find') ? 'find' : ''),
\ 'g:unite_source_file_rec_async_command')
"}}}
-let s:Cache = vital#of('unite.vim').import('System.Cache')
+let s:Cache = unite#util#get_vital().import('System.Cache')
let s:continuation = { 'directory' : {}, 'file' : {} }
@@ -341,6 +343,8 @@ function! s:source_file_async.async_gather_candidates(args, context) "{{{
endif
let a:context.is_async = 0
let continuation.end = 1
+
+ call a:context.source__proc.waitpid()
endif
let candidates = []
@@ -372,7 +376,7 @@ function! s:source_file_async.hooks.on_init(args, context) "{{{
endfunction"}}}
function! s:source_file_async.hooks.on_close(args, context) "{{{
if has_key(a:context, 'source__proc')
- call a:context.source__proc.waitpid()
+ call a:context.source__proc.kill()
endif
endfunction "}}}
@@ -400,83 +404,6 @@ function! s:source_directory_async.hooks.on_init(args, context) "{{{
call s:on_init(a:args, a:context)
endfunction"}}}
-" Add custom action table. "{{{
-let s:cdable_action_rec = {
- \ 'description' : 'open this directory by file_rec source',
- \ 'is_start' : 1,
- \}
-
-function! s:cdable_action_rec.func(candidate)
- call unite#start_script([['file_rec', a:candidate.action__directory]])
-endfunction
-
-let s:cdable_action_rec_parent = {
- \ 'description' : 'open parent directory by file_rec source',
- \ 'is_start' : 1,
- \}
-
-function! s:cdable_action_rec_parent.func(candidate)
- call unite#start_script([['file_rec', unite#util#substitute_path_separator(
- \ fnamemodify(a:candidate.action__directory, ':h'))
- \ ]])
-endfunction
-
-let s:cdable_action_rec_project = {
- \ 'description' : 'open project directory by file_rec source',
- \ 'is_start' : 1,
- \}
-
-function! s:cdable_action_rec_project.func(candidate)
- call unite#start_script([['file_rec', unite#util#substitute_path_separator(
- \ unite#util#path2project_directory(a:candidate.action__directory))
- \ ]])
-endfunction
-
-let s:cdable_action_rec_async = {
- \ 'description' : 'open this directory by file_rec/async source',
- \ 'is_start' : 1,
- \}
-
-function! s:cdable_action_rec_async.func(candidate)
- call unite#start_script([['file_rec/async', a:candidate.action__directory]])
-endfunction
-
-let s:cdable_action_rec_parent_async = {
- \ 'description' : 'open parent directory by file_rec/async source',
- \ 'is_start' : 1,
- \}
-
-function! s:cdable_action_rec_parent_async.func(candidate)
- call unite#start_script([['file_rec/async', unite#util#substitute_path_separator(
- \ fnamemodify(a:candidate.action__directory, ':h'))
- \ ]])
-endfunction
-
-let s:cdable_action_rec_project_async = {
- \ 'description' : 'open project directory by file_rec/async source',
- \ 'is_start' : 1,
- \}
-
-function! s:cdable_action_rec_project_async.func(candidate)
- call unite#start_script([['file_rec/async', unite#util#substitute_path_separator(
- \ unite#util#path2project_directory(a:candidate.action__directory))
- \ ]])
-endfunction
-
-call unite#custom_action('cdable', 'rec', s:cdable_action_rec)
-call unite#custom_action('cdable', 'rec_parent', s:cdable_action_rec_parent)
-call unite#custom_action('cdable', 'rec_project', s:cdable_action_rec_project)
-call unite#custom_action('cdable', 'rec/async', s:cdable_action_rec_async)
-call unite#custom_action('cdable', 'rec_parent/async', s:cdable_action_rec_parent_async)
-call unite#custom_action('cdable', 'rec_project/async', s:cdable_action_rec_project_async)
-unlet! s:cdable_action_rec
-unlet! s:cdable_action_rec_async
-unlet! s:cdable_action_rec_project
-unlet! s:cdable_action_rec_project_async
-unlet! s:cdable_action_rec_parent
-unlet! s:cdable_action_rec_parent_async
-"}}}
-
" Misc.
function! s:get_path(args, context) "{{{
let directory = get(
View
9 etc/vim/bundle/unite.vim/autoload/unite/sources/undo.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: undo.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
-" Last Modified: 07 Jun 2013.
+" Last Modified: 21 Aug 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -62,11 +62,11 @@ function! s:make_candidates(tree, current) "{{{
\ 'text' : text,
\ }
if has_key(item, 'alt')
- call extend(dict, s:make_candidate(item.alt, a:current))
+ call extend(dict, s:make_candidates(item.alt, a:current))
endif
endfor
- return sort(values(dict), 's:compare')
+ return dict
endfunction"}}}
function! s:compare(a, b)
@@ -104,7 +104,8 @@ function! s:source.gather_candidates(args, context) "{{{
return []
endif
- let candidates = s:make_candidates(tree.entries, tree.seq_cur)
+ let dict = s:make_candidates(tree.entries, tree.seq_cur)
+ let candidates = sort(values(dict), 's:compare')
return map(candidates, "{
\ 'word' : printf('%s : [%s]%s',
View
22 etc/vim/bundle/unite.vim/autoload/unite/sources/vimgrep.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: vimgrep.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
-" Last Modified: 31 May 2013.
+" Last Modified: 10 Sep 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -115,9 +115,23 @@ function! s:source.hooks.on_init(args, context) "{{{
endfunction"}}}
function! s:source.hooks.on_syntax(args, context) "{{{
syntax case ignore
- execute 'syntax match uniteSource__VimgrepPattern /:.*\zs'
+ syntax region uniteSource__VimgrepLine
+ \ start=' ' end='$'
+ \ containedin=uniteSource__Vimgrep
+ syntax match uniteSource__VimgrepFile /^[^:]*/ contained
+ \ containedin=uniteSource__VimgrepLine
+ \ nextgroup=uniteSource__VimgrepSeparator
+ syntax match uniteSource__VimgrepSeparator /:/ contained
+ \ containedin=uniteSource__VimgrepLine
+ \ nextgroup=uniteSource__VimgrepLineNr
+ syntax match uniteSource__VimgrepLineNr /\d\+\ze:/ contained
+ \ containedin=uniteSource__VimgrepLine
+ \ nextgroup=uniteSource__VimgrepPattern
+ execute 'syntax match uniteSource__VimgrepPattern /'
\ . substitute(a:context.source__input, '\([/\\]\)', '\\\1', 'g')
- \ . '/ contained containedin=uniteSource__Vimgrep'
+ \ . '/ contained containedin=uniteSource__VimgrepLine'
+ highlight default link uniteSource__VimgrepFile Directory
+ highlight default link uniteSource__VimgrepLineNr LineNR
execute 'highlight default link uniteSource__VimgrepPattern'
\ g:unite_source_vimgrep_search_word_highlight
endfunction"}}}
@@ -193,6 +207,8 @@ function! s:source.gather_candidates(args, context) "{{{
" Clear qflist.
call setqflist([])
+
+ cclose
endtry
return _
View
23 etc/vim/bundle/unite.vim/autoload/unite/start.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: start.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 23 Jul 2013.
+" Last Modified: 08 Sep 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -120,7 +120,7 @@ function! unite#start#script(sources, ...) "{{{
let context.script = 1
- return get(unite#get_context(), 'temporary', 0) ?
+ return &filetype == 'unite' ?
\ unite#start#temporary(a:sources, context) :
\ unite#start#standard(a:sources, context)
endfunction"}}}
@@ -267,6 +267,22 @@ function! unite#start#get_vimfiler_candidates(sources, ...) "{{{
let context.unite__is_interactive = 0
let candidates = s:get_candidates(a:sources, context)
+
+ " Converts utf-8-mac to utf-8.
+ if unite#util#is_mac() && has('iconv')
+ for item in candidates
+ let item.action__path = unite#util#iconv(
+ \ item.action__path, 'utf-8-mac', &encoding)
+ let item.action__directory = unite#util#iconv(
+ \ item.action__directory, 'utf-8-mac', &encoding)
+ let item.word = unite#util#iconv(item.word, 'utf-8-mac', &encoding)
+ let item.abbr = unite#util#iconv(item.abbr, 'utf-8-mac', &encoding)
+ let item.vimfiler__filename = unite#util#iconv(
+ \ item.vimfiler__filename, 'utf-8-mac', &encoding)
+ let item.vimfiler__abbr = unite#util#iconv(
+ \ item.vimfiler__abbr, 'utf-8-mac', &encoding)
+ endfor
+ endif
finally
call unite#set_current_unite(unite_save)
endtry
@@ -404,8 +420,7 @@ function! s:get_resume_buffer(buffer_name) "{{{
let buffer_name = a:buffer_name
if buffer_name !~ '@\d\+$'
" Add postfix.
- let prefix = unite#util#is_windows() ?
- \ '[unite] - ' : '*unite* - '
+ let prefix = '[unite] - '
let prefix .= buffer_name
let buffer_name .= unite#helper#get_postfix(prefix, 0)
endif
View
71 etc/vim/bundle/unite.vim/autoload/unite/util.vim
@@ -1,53 +1,72 @@
let s:save_cpo = &cpo
set cpo&vim
-let s:V = vital#of('unite.vim')
-let s:List = vital#of('unite.vim').import('Data.List')
-let s:String = vital#of('unite.vim').import('Data.String')
+function! unite#util#get_vital() "{{{
+ if !exists('s:V')
+ let s:V = vital#of('unite.vim')
+ endif
+ return s:V
+endfunction"}}}
+
+function! s:get_list() "{{{
+ if !exists('s:List')
+ let s:List = unite#util#get_vital().import('Data.List')
+ endif
+ return s:List
+endfunction"}}}
+
+function! s:get_string() "{{{
+ if !exists('s:String')
+ let s:String = unite#util#get_vital().import('Data.String')
+ endif
+ return s:String
+endfunction"}}}
+" TODO use vital's
let s:is_windows = has('win16') || has('win32') || has('win64')
function! unite#util#truncate_smart(...)
- return call(s:V.truncate_smart, a:000)
+ return call(unite#util#get_vital().truncate_smart, a:000)
endfunction
function! unite#util#truncate(...)
- return call(s:V.truncate, a:000)
+ return call(unite#util#get_vital().truncate, a:000)
endfunction
function! unite#util#strchars(...)
- return call(s:String.strchars, a:000)
+ return call(s:get_string().strchars, a:000)
endfunction
function! unite#util#strwidthpart(...)
- return call(s:V.strwidthpart, a:000)
+ return call(unite#util#get_vital().strwidthpart, a:000)
endfunction
function! unite#util#strwidthpart_reverse(...)
- return call(s:V.strwidthpart_reverse, a:000)
+ return call(unite#util#get_vital().strwidthpart_reverse, a:000)
endfunction
function! unite#util#wcswidth(...)
- return call(s:V.wcswidth, a:000)
+ return call(unite#util#get_vital().wcswidth, a:000)
endfunction
function! unite#util#wcswidth(...)
- return call(s:V.wcswidth, a:000)
+ return call(unite#util#get_vital().wcswidth, a:000)
endfunction
function! unite#util#is_win(...)
+ echoerr 'unite#util#is_win() is deprecated. use unite#util#is_windows() instead.'
return s:is_windows
endfunction
function! unite#util#is_windows(...)
return s:is_windows
endfunction
function! unite#util#is_mac(...)
- return call(s:V.is_mac, a:000)
+ return call(unite#util#get_vital().is_mac, a:000)
endfunction
function! unite#util#print_error(...)
- return call(s:V.print_error, a:000)
+ return call(unite#util#get_vital().print_error, a:000)
endfunction
function! unite#util#smart_execute_command(action, word)
- execute 'keepjumps' a:action . ' ' . (a:word == '' ? '' : '`=a:word`')
+ execute a:action . ' ' . (a:word == '' ? '' : '`=a:word`')
endfunction
function! unite#util#escape_file_searching(...)
- return call(s:V.escape_file_searching, a:000)
+ return call(unite#util#get_vital().escape_file_searching, a:000)
endfunction
function! unite#util#escape_pattern(...)
- return call(s:V.escape_pattern, a:000)
+ return call(unite#util#get_vital()