Skip to content

Commit

Permalink
Add key binding to close denite in filter buffer (wsdjeg#3206)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsdjeg authored Nov 2, 2019
1 parent fcfcfbf commit 40a43de
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
11 changes: 11 additions & 0 deletions config/plugins/denite.vim
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,12 @@ function! s:denite_my_settings() abort
endfunction

function! s:denite_filter_my_settings() abort
call s:clear_imap('<C-g>g')
call s:clear_imap('<C-g>S')
call s:clear_imap('<C-g>s')
call s:clear_imap('<C-g>%')
imap <silent><buffer> <Esc> <Plug>(denite_filter_quit)
imap <silent><buffer> <C-g> <Plug>(denite_filter_quit):q<Cr>
inoremap <silent><buffer> <Tab>
\ <Esc><C-w>p:call cursor(line('.')+1,0)<CR><C-w>pA
inoremap <silent><buffer> <S-Tab>
Expand All @@ -187,4 +192,10 @@ function! s:denite_filter_my_settings() abort
endfunction


function! s:clear_imap(map) abort
if maparg(a:map, 'i')
exe 'iunmap <buffer> ' . a:map
endif
endfunction

" vim:set et sw=2 cc=80:
47 changes: 19 additions & 28 deletions docs/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,8 @@ endfunction

### Fuzzy finder

SpaceVim provides five fuzzy find tools, each of them is configured in a layer(`unite`, `denite`, `leaderf`, `ctrlp` and `fzf` layer).
SpaceVim provides five fuzzy find tools, each of them is configured in a layer
(`unite`, `denite`, `leaderf`, `ctrlp` and `fzf` layer).
These layers have the same key bindings and features. But they need different dependencies.

Users only need to load one of these layers, they will be able to get these features.
Expand All @@ -791,8 +792,25 @@ for example, load the denite layer:
| `<Leader> f q` | Fuzzy find quick fix |
| `<Leader> f r` | Resumes Unite window |

**Key bindings within fuzzy finder buffer**

| Key Bindings | Descriptions |
| ------------------------ | ------------------------------- |
| `<Tab>` / `Ctrl-j` | Select next line |
| `Shift-<Tab>` / `Ctrl-k` | Select previous line |
| `<Esc>` | Leave Insert mode |
| `Ctrl-w` | Delete backward path |
| `Ctrl-u` | Delete whole line before cursor |
| `<Enter>` | Run default action |
| `Ctrl-s` | Open in a split |
| `Ctrl-v` | Open in a vertical split |
| `Ctrl-t` | Open in a new tab |
| `Ctrl-g` | Close fuzzy finder |

**Differences between these layers**

The above key bindings are only part of fuzzy finder layers, please read the layers's documentations.

| Feature | denite | unite | leaderf | ctrlp | fzf |
| ------------------ | :----: | :---: | :-----: | :---: | --- |
| CustomKeyMaps menu | yes | yes | no | no | no |
Expand All @@ -807,33 +825,6 @@ for example, load the denite layer:
| quickfix list | yes | yes | no | yes | yes |
| resume windows | yes | yes | no | no | no |

**Key bindings within fuzzy finder buffer**

| Key Bindings | Descriptions |
| ------------------------ | ----------------------------------------- |
| `<Tab>` / `Ctrl-j` | Select next line |
| `Shift-<Tab>` / `Ctrl-k` | Select previous line |
| `j k` | Leave Insert mode (Only for denite/unite) |
| `Ctrl-w` | Delete backward path |
| `<Enter>` | Run default action |
| `Ctrl-s` | Open in a split |
| `Ctrl-v` | Open in a vertical split |
| `Ctrl-t` | Open in a new tab |
| `Ctrl-g` | Exit unite |

**Denite/Unite normal mode key bindings**

| Key Bindings | Mode | Descriptions |
| -------------- | ------------- | ------------------------------------ |
| `Ctrl-h/k/l/r` | Normal | Un-map |
| `Ctrl-l` | Normal | Redraw |
| `<Tab>` | Normal | Select actions |
| `<Space>` | Normal | Toggle mark current candidate, up |
| `r` | Normal | Replace ('search' profile) or rename |
| `Ctrl-z` | Normal/insert | Toggle transpose window |

The above key bindings are only part of fuzzy finder layers, please read the layers's documentations.

### Discovering

#### Mappings
Expand Down

0 comments on commit 40a43de

Please sign in to comment.