Skip to content

In mini.files how to add a new mapping for synchronizing? #1532

Closed Answered by echasnovski
eric-hansen asked this question in Q&A
Discussion options

You must be logged in to vote

Sure, that should be possible by going the same route as this example for making buffer-local mappings. So something like this:

vim.api.nvim_create_autocmd('User', {
  pattern = 'MiniFilesBufferCreate',
  callback = function(args)
    vim.keymap.set('i', '<C-s>', function() MiniFiles.synchronize() end, { buffer = args.data.buf_id })
  end,
})

So although this works, it would not be very useful to always stay in Insert mode, as synchronization might rearrange lines according to sorting and put cursor at the file/directory name start.

My suggestion would be try and get used to a generally assumed way of making edits in Neovim/Vim: the non-typing activity is usually better to do from Normal …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@eric-hansen
Comment options

@echasnovski
Comment options

@eric-hansen
Comment options

Answer selected by echasnovski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested mini.files
2 participants