Skip to content

Commit

Permalink
- Improved match line.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Nov 3, 2010
1 parent a22c198 commit 4a6eddc
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
7 changes: 6 additions & 1 deletion autoload/unite.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: unite.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 02 Nov 2010
" Last Modified: 03 Nov 2010
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -107,6 +107,11 @@ function! unite#undef_kind(name)"{{{
call remove(s:custom_kind, a:name)
endif
endfunction"}}}

function! unite#do_action(action)
return printf("%s:\<C-u>call unite#mappings#do_action(%s)\<CR>",
\ (mode() ==# 'i' ? "\<ESC>" : ''), string(a:action))
endfunction
"}}}

" Constants"{{{
Expand Down
20 changes: 11 additions & 9 deletions autoload/unite/mappings.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: mappings.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 02 Nov 2010
" Last Modified: 03 Nov 2010
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
Expand All @@ -28,11 +28,6 @@
function! unite#mappings#define_default_mappings()"{{{
" Plugin keymappings"{{{
nnoremap <silent><buffer> <Plug>(unite_exit) :<C-u>call <SID>exit()<CR>
nnoremap <silent><buffer> <Plug>(unite_do_default_action) :<C-u>call unite#mappings#do_action(b:unite.context.default_action)<CR>
nnoremap <silent><buffer> <Plug>(unite_do_delete_action) :<C-u>call unite#mappings#do_action('delete')<CR>
nnoremap <silent><buffer> <Plug>(unite_do_bookmark_action) :<C-u>call unite#mappings#do_action('bookmark')<CR>
nnoremap <silent><buffer> <Plug>(unite_do_preview_action) :<C-u>call unite#mappings#do_action('preview')<CR>
nnoremap <silent><buffer> <Plug>(unite_do_narrow_action) :<C-u>call unite#mappings#do_action('narrow')<CR>
nnoremap <silent><buffer> <Plug>(unite_choose_action) :<C-u>call <SID>choose_action()<CR>
nnoremap <silent><buffer> <Plug>(unite_insert_enter) :<C-u>call <SID>insert_enter()<CR>
nnoremap <silent><buffer> <Plug>(unite_insert_head) :<C-u>call <SID>insert_head()<CR>
Expand All @@ -48,6 +43,12 @@ function! unite#mappings#define_default_mappings()"{{{
nnoremap <buffer><expr> <Plug>(unite_loop_cursor_up) (line('.') <= b:unite.prompt_linenr)? 'G' : 'k'
nnoremap <silent><buffer> <Plug>(unite_quick_match_default_action) :<C-u>call <SID>quick_match()<CR>
nnoremap <silent><buffer><expr> <Plug>(unite_do_default_action) unite#do_action(b:unite.context.default_action)
nnoremap <silent><buffer><expr> <Plug>(unite_do_delete_action) unite#do_action('delete')
nnoremap <silent><buffer><expr> <Plug>(unite_do_narrow_action) unite#do_action('narrow')
nnoremap <silent><buffer><expr> <Plug>(unite_do_bookmark_action) unite#do_action('bookmark')
nnoremap <silent><buffer><expr> <Plug>(unite_do_preview_action) unite#do_action('preview')
vnoremap <buffer><silent> <Plug>(unite_toggle_mark_selected_candidates) :<C-u>call <SID>toggle_mark_candidates(getpos("'<")[1], getpos("'>")[1])<CR>
inoremap <silent><buffer> <Plug>(unite_exit) <ESC>:<C-u>call <SID>exit()<CR>
Expand All @@ -62,13 +63,14 @@ function! unite#mappings#define_default_mappings()"{{{
\ : line('.') == (b:unite.prompt_linenr+2) ? "\<End>\<Up>\<Up>" : "\<Home>\<Up>"
inoremap <expr><buffer> <Plug>(unite_select_next_page) pumvisible() ? "\<PageDown>" : repeat("\<Down>", winheight(0))
inoremap <expr><buffer> <Plug>(unite_select_previous_page) pumvisible() ? "\<PageUp>" : repeat("\<Up>", winheight(0))
inoremap <silent><buffer> <Plug>(unite_do_default_action) <C-o>:call unite#mappings#do_action(b:unite.context.default_action)<CR>
inoremap <silent><buffer> <Plug>(unite_do_delete_action) <C-o>:call unite#mappings#do_action('delete')<CR>
inoremap <silent><buffer> <Plug>(unite_do_narrow_action) <C-o>:call unite#mappings#do_action('narrow')<CR>
inoremap <silent><buffer> <Plug>(unite_toggle_mark_current_candidate) <C-o>:<C-u>call <SID>toggle_mark()<CR>
inoremap <silent><buffer> <Plug>(unite_choose_action) <C-o>:<C-u>call <SID>choose_action()<CR>
inoremap <silent><buffer> <Plug>(unite_move_head) <C-o>:<C-u>call <SID>insert_head()<CR>
inoremap <silent><buffer> <Plug>(unite_quick_match_default_action) <C-o>:<C-u>call <SID>quick_match()<CR>
inoremap <silent><buffer><expr> <Plug>(unite_do_default_action) unite#do_action(b:unite.context.default_action)
inoremap <silent><buffer><expr> <Plug>(unite_do_delete_action) unite#do_action('delete')
inoremap <silent><buffer><expr> <Plug>(unite_do_narrow_action) unite#do_action('narrow')
"}}}

if exists('g:unite_no_default_keymappings') && g:unite_no_default_keymappings
Expand Down
4 changes: 2 additions & 2 deletions autoload/unite/sources/file_mru.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: file_mru.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 31 Oct 2010
" Last Modified: 03 Nov 2010
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -95,7 +95,7 @@ let s:action_table.delete = {
\ }
function! s:action_table.delete.func(candidates)"{{{
for l:candidate in a:candidates
call filter(s:mru_files, 'v:val.action__path !=# a:candidate.action__path')
call filter(s:mru_files, 'v:val.action__path !=# l:candidate.action__path')
endfor

call s:save()
Expand Down
7 changes: 3 additions & 4 deletions doc/unite.jax
Expand Up @@ -552,7 +552,7 @@ unite#get_context() *unite#get_context()*
|unite#custom_action()|などで、|unite#start()|を内部で呼び出す
際に使用する。

unite#mappings#do_action({action-name} [, {candidate-num}]) *unite#mappings#do_action()*
unite#do_action({action-name}) *unite#do_action()*
マークしている候補に対して{action-name}アクションを実行す
る。この関数はuniteが起動している時にのみ動作する。{action-name}が存
在しない、もしくは不正な実行だった場合はエラーとなる。
Expand All @@ -561,8 +561,7 @@ unite#mappings#do_action({action-name} [, {candidate-num}]) *unite#mappings#do_a
{action-name}に"default"を指定すると、デフォルトのアクションが
実行される。
候補がマークされていない場合は、現在の行もしくは、一番上の候補
に対してアクションを実行する。ただし{candidate-num}が指定されて
いる時は、そちらを優先する。
に対してアクションを実行する。

unite#mappings#smart_map({narrow-map}, {select-map}) *unite#mappings#smart_map()*
絞り込み時と選択時のマッピングを設定し、文脈によって切り換える。
Expand Down Expand Up @@ -1047,7 +1046,7 @@ parents リスト (任意)
" Overwrite settings.
imap <buffer> jj <Plug>(unite_insert_leave)
nnoremap <silent><buffer> <C-k> :<C-u>call unite#mappings#do_action('preview')<CR>
nnoremap <silent><buffer><expr> <C-k> unite#do_action('preview')
"imap <buffer> <C-w> <Plug>(unite_delete_backward_path)
" Start insert.
Expand Down
5 changes: 5 additions & 0 deletions doc/unite.txt
Expand Up @@ -292,6 +292,11 @@ BUGS *unite-bugs*
==============================================================================
CHANGELOG *unite-changelog*

2010-11-03
- Added unite#do_action().
- Improved mappings.
- Fixed file_mru error.

2010-11-02
- Improved <Plug>(unite_select_next_line) and <Plug>(unite_select_previous_line).
- Improved prompt check.
Expand Down

0 comments on commit 4a6eddc

Please sign in to comment.