question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I do not understand how to call defaultAction or add input

See original GitHub issue

Warning: I will close the issue without the minimal init.vim and the reproduction instructions.

Problems summary

Hi. I am migrating from Denite and I get the general flow of how this new plugin works, but I cannot figure out how to accomplish two things.

  1. How to define and call actions in the init.vim file? Currently I can pull up the ddu buffer, but then I have no way to open files.
  2. How to refine input with the fuzzy finder? for instance if ‘file_rec’ pulls up too many files, how can I refine my search after the buffer comes up?

Expected

I have looked through the documentation, but I do not see any examples of how to do this.

Environment Information

  • ddu.vim version (SHA1): 649e50b2db53a63c7be5de942e356ac4e914b5d6

  • denops.vim version (SHA1): d01a89773b158255073cefa88f6527fb9f522e59

  • deno version(deno -V output): deno 1.20.6

  • OS: Ubuntu 20.04

  • neovim/Vim :version output: NVIM v0.7.0-dev+1254-g6dc2c8293

  • :checkhealth or :CheckHealth result(neovim only):

  2 denops: health#denops#check                                                                                                                                                   
  3 ========================================================================                                                                                                      
  4   - info: supported deno version: `1.17.1`                                                                                                                                    
  5   - info: detected deno version: `1.20.6`                                                                                                                                     
  6   - ok: deno version check: passed                                                                                                                                            
  7   - info: supported neovim version: `0.6.0`                                                                                                                                   
  8   - info: detected neovim version: `0.7.0`                                                                                                                                    
  9   - ok: neovim version check: passed                                                                                                                                          
 10   - info: denops status: `running`                                                                                                                                            
 11   - ok: denops status check: passed                                                                                                                                           
 12                                                                                                                                                                               
 13 nvim: health#nvim#check                                                                                                                                                       
 14 ========================================================================                                                                                                      
 15 ## configuration                                                                                                                                                              
 16   - ok: no issues found                                                                                                                                                       
 17                                                                                                                                                                               
 18 ## performance                                                                                                                                                                
 19   - ok: build type: relwithdebinfo                                                                                                                                            
 20                                                                                                                                                                               
 21 ## remote plugins                                                                                                                                                             
 22   - ok: up to date                                                                                                                                                            
 23                                                                                                                                                                               
 24 ## terminal                                                                                                                                                                   
 25   - info: key_backspace (kbs) terminfo entry: key_backspace=\177                                                                                                              
 26   - info: key_dc (kdch1) terminfo entry: key_dc=\e[3~                                                                                                                         
 27   - info: $ssh_tty='/dev/pts/3'                                                                                                                                               
 28                                                                                                                                                                               
 29 ## tmux                                                                                                                                                                       
 30   - ok: escape-time: 10                                                                                                                                                       
 31   - info: checking stuff                                                                                                                                                      
 32   - ok: focus-events: on                                                                                                                                                      
 33   - info: $term: screen-256color                                                                                                                                              
 34                                                                                                                                                                               
 35 provider: health#provider#check                                                                                                                                               
 36 ========================================================================                                                                                                      
 37 ## clipboard (optional)                                                                                                                                                       
 38   - ok: clipboard tool found: tmux                                                                                                                                            
 39                                                                                                                                                                               
 40 ## python 3 provider (optional)                                                                                                                                               
 41   - info: pyenv: path: /st1/jeff/.pyenv/libexec/pyenv                                                                                                                         
 42   - info: pyenv: root: /st1/jeff/.pyenv                                                                                                                                       
 43   - info: using: g:python3_host_prog = "/st1/jeff/.venv/nvim/bin/python"                                                                                                      
 44   - info: executable: /st1/jeff/.venv/nvim/bin/python                                                                                                                         
 45   - info: python version: 3.8.13                                                                                                                                              
 46   - info: pynvim version: 0.4.3                                                                                                                                               
 47   - ok: latest pynvim is installed.                                                                                                                                           
 48                                                                                                                                                                               
 49 ## python virtualenv                                                                                                                                                          
 50   - info: $virtual_env is set to: /st1/jeff/.venv/env                                                                                                                         
 51   - info: python version: 3.8.13                                                                                                                                              
 52   - ok: $virtual_env provides :!python.                                                                                                                                       
 53                                                                                                                                                                               
 54 ## ruby provider (optional)                                                                                                                                                   
 55   - warning: `ruby` and `gem` must be in $path.                                                                                                                               
 56     - advice:                                                                                                                                                                 
 57       - install ruby and verify that `ruby` and `gem` commands work.                                                                                                          
 58                                                                                                                                                                               
 59 ## node.js provider (optional)                                                                                                                                                
 60   - warning: `node` and `npm` (or `yarn`) must be in $path.                                                                                                                   
 61     - advice:                                                                                                                                                                 
 62       - install node.js and verify that `node` and `npm` (or `yarn`) commands work.                                                                                           
 63                                                                                                                                                                               
 64 ## perl provider (optional)                                                                                                                                                   
 65   - error: perl provider error:                                                                                                                                               
 66     - advice:                                                                                                                                                                 
 67       - "neovim::ext" cpan module is not installed                                                                                                                            
 68                                                                                                                                                                               
 69 vim.lsp: require("vim.lsp.health").check()                                                                                                                                    
 70 ========================================================================                                                                                                      
 71   - info: lsp log level : warn                                                                                                                                                
 72   - info: log path: /st1/jeff/.cache/nvim/lsp.log                                                                                                                             
 73   - info: log size: 2 kb                                                                                                                                                      
 74                                                                                                                                                                               
 75 vim.treesitter: require("vim.treesitter.health").check()                                                                                                                      
 76 ========================================================================                                                                                                      
 77   - info: runtime abi version : 14                                                                                                                                            
 78   - ok: loaded parser for c: abi version 13 

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

 call plug#begin('~/.config/nvim/plugged')
                  
Plug 'vim-denops/denops.vim'                                                                 
                                                                               
Plug 'Shougo/ddu.vim'                        
Plug 'shun/ddu-source-buffer'                        
Plug 'Shougo/ddu-ui-ff'                                          
Plug 'shun/ddu-source-rg'              
Plug 'Shougo/ddu-source-file_rec'                                                     

call ddu#custom#patch_global({         
    \ 'ui': 'ff',                                                          
    \ })                                                              
                                                                                                      
call ddu#custom#patch_global({                                              
    \   'kindOptions': {                                                 
    \     'file': {                                               
    \       'defaultAction': 'open',                      
    \     },                              
    \   }                                                                     
    \ })            
                                                                          
call ddu#custom#patch_global({                            
    \   'sourceOptions': {    
    \     '_': {                                           
    \       'matchers': ['matcher_substring'],                                 
    \     },                                                                    
    \     'file_rec': {'path': expand("~")},               
    \   }                                                              
    \ })                                                                  
                                                                               
call ddu#custom#patch_global({
    \   'sourceParams' : {                                                
    \     'rg' : {     
    \       'args': ['--column', '--no-heading', '--color', 'never'],
    \     },                            
    \   },                                                                                    
    \ })                                                                        
                                           
                                        
function! s:ddu_rg_live() abort                   
  call ddu#start({                            
        \   'volatile': v:true,        
        \   'sources': [{            
        \     'name': 'rg',                           
        \     'options': {'matchers': []},
        \   }],                      
        \   'uiParams': {'ff': { 
        \     'ignoreEmpty': v:false,                           
        \     'autoResize': v:false,
        \   }},                        
        \ })                                                                    
endfunction                                                                                                             
                                      
" open list of buffers, open directory for seatch, search for test in files (rg)                            
nnoremap <leader><leader> <Cmd>call ddu#start({'sources': [{'name': 'buffer'}]})<CR>
nnoremap <leader><Space> <Cmd>call ddu#start({'sources': [{'name': 'file_rec'}]})<CR>
nnoremap <leader><Space><Space> <Cmd>call <SID>ddu_rg_live()<CR>
nnoremap <CR> <Cmd>ddu#ui_action('default')<CR>  

How to reproduce the problem from neovim/Vim startup (Required!)

  1. foo
  2. bar
  3. baz

Screenshot (if possible)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jeffwillettecommented, Apr 20, 2022

I see now that the ‘kind’ is actually another module which needs to be installed to implement file operations. I did not know everything would be so modular down to this micro level. Sorry for the noise, I hope this thread helps someone in the future.

This is what I needed to install https://github.com/Shougo/ddu-kind-file

0reactions
Shougocommented, Apr 20, 2022

You need to read sources documentation. For example, in ddu-source-file:

## Required

### denops.vim

https://github.com/vim-denops/denops.vim

### ddu.vim

https://github.com/Shougo/ddu.vim

### ddu-kind-file

https://github.com/Shougo/ddu-kind-file

The dependency is already documented.

Read more comments on GitHub >

github_iconTop Results From Across the Web

jsf - Default action to execute when pressing enter in a form
Hi Jörn, I'd disable autosubmit for forms with just one input field. I guess you don't want the form to be submitted by...
Read more >
Browser default actions - The Modern JavaScript Tutorial
If we omit return false , then after our code executes the browser will do its “default action” – navigating to the URL...
Read more >
Event.preventDefault() - Web APIs | MDN
The preventDefault() method of the Event interface tells the user agent that if the event does not get explicitly handled, its default ......
Read more >
Prevent Default and Form Events - Beginner JavaScript
To do that you would do the following: Grab the name input from the form. Within the listen, add the following log to...
Read more >
preventDefault() Event Method - W3Schools
The preventDefault() method cancels the event if it is cancelable, meaning that the default action that belongs to the event will not occur....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found