elixir-tools / elixir-tools.nvim

Neovim plugin for Elixir
MIT License
403 stars 30 forks source link

Example keybinds override common Vim bindings #51

Closed mikl closed 1 year ago

mikl commented 1 year ago

Hi there,

I was very confused as to why my some of my Vim deletion commands didn’t work, like dtX (delete until the next X character), until I noticed this, which I copied from this repo’s README:

    -- standard lsp keybinds
    vim.keymap.set("n", "df", "<cmd>lua vim.lsp.buf.formatting_seq_sync()<cr>", map_opts)
    vim.keymap.set("n", "gd", "<cmd>lua vim.diagnostic.open_float()<cr>", map_opts)
    vim.keymap.set("n", "dt", "<cmd>lua vim.lsp.buf.definition()<cr>", map_opts)
    vim.keymap.set("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", map_opts)
    vim.keymap.set("n", "gD","<cmd>lua vim.lsp.buf.implementation()<cr>", map_opts)
    vim.keymap.set("n", "1gD","<cmd>lua vim.lsp.buf.type_definition()<cr>", map_opts)
    -- keybinds for fzf-lsp.nvim: https://github.com/gfanto/fzf-lsp.nvim
    -- you could also use telescope.nvim: https://github.com/nvim-telescope/telescope.nvim
    -- there are also core vim.lsp functions that put the same data in the loclist
    vim.keymap.set("n", "gr", ":References<cr>", map_opts)
    vim.keymap.set("n", "g0", ":DocumentSymbols<cr>", map_opts)
    vim.keymap.set("n", "gW", ":WorkspaceSymbols<cr>", map_opts)
    vim.keymap.set("n", "<leader>d", ":Diagnostics<cr>", map_opts)

Not sure what makes these “standard”, but it might be a bit more beginner-friendly having the example code use bindings that do not conflict with core Vim bindings, using <leader>, or at least clearly state that this is what’s going on.

mhanberg commented 1 year ago

PR is welcome!

I just copied these out of my dotfiles and it seems I just never the t motion so I never noticed it.

mikl commented 1 year ago

Done, see #52 :)