GithubHelp home page GithubHelp logo

nvim-better-n's People

Contributors

jonatan-branting avatar weofiw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

weofiw greg17477

nvim-better-n's Issues

better usage explanation and ideas

As I understand it, this makes me loose the functionality to continue the previous stored search result.
For example, if I have searched for all exact occurrences with * for word /\<example\>, n will not continue searching for /\<example\> after I have registered another action under n.

is this correct?

Ideas:

  1. Do you have a plan or idea how to enable the user to save and restore this search info?
  2. This looks related to a modal configuration, which means to have a different set of static or dynamic configurations under keypress (by entering a mode): https://github.com/Iron-E/nvim-libmodal
  • Do you have an idea how to simplify the approach? libmodal is rather cumbersome to get a fast setup like emacs
  1. Do you have any idea how to solve https://github.com/linty-org/key-menu.nvim/issues/10, which would be useful for this plugin as (optional) user-info for the current binding?

Overrides which-key descriptions

Hi, thanks for putting your plugin online, I really like the idea.

One problem I'm having is that any keybindings registered with better_n lose their which-key description.

So for example I have many mappings that start with [ or ] (I'm using largely the AstroNvim default).

But if I register any with better_n, they get the default label "better_n_remap".

Here is the which-key menu that appears after typing "[", before enabling better_n.

image

And here is the same menu when better_n has been installed and some of the "[" keybindings have been registered with it:

image

Here is the "next git hunk" mapping in the default AstroNvim config:

maps.n["]g"] = { function() require("gitsigns").next_hunk() end, desc = "Next Git hunk" }

Is there any way to pass through the "desc" field when using better_n, in order for which-key to still be useful?

Thanks

Plugin disables f-movement in macros

When I use default settings, they are re-mapping [FfTf] keys to better-n functions.

However, in case of recording macros, recorded 'f' were not reproduced when macro is called.

Here is a workaround to disable keys in config:

          ["f"] = {cmdline = true},
          ["t"] = {cmdline = true},
          ["F"] = {cmdline = true},
          ["T"] = {cmdline = true},

p.s. Maybe it's worth to find another option to make clear how to disable better-n calls and propagating original nvim calls. I've only managed to figure this out after digging into code.

Thanks

Need help to modify my config

Here's my original config:

  require("better-n").setup {
    callbacks = {
      mapping_executed = function(_mode, _key)
        -- Clear highlighting, indicating that `n` will not goto the next
        -- highlighted search-term
        vim.cmd [[ nohl ]]
      end
    },
    mappings = {
      -- I want `n` to always go forward, and `<s-n>` to always go backwards
      ["#"] = {previous = "n", next ="<s-n>"},
      ["F"] = {previous = ";", next = ","},
      ["T"] = {previous = ";", next = ","},

      -- Setting `cmdline = true` ensures that `n` will only be 
      -- overwritten if the search command is succesfully executed
      ["?"] = {previous = "n", next ="<s-n>", cmdline = true},

      -- I have <leader>hn/hp bound to git-hunk-next/prev
      ["]]"] = {previous = "[[", next = "]]"},
      ["[["] = {previous = "[[", next = "]]"},
      ["]m"] = {previous = "[m", next = "]m"},
      ["[m"] = {previous = "[m", next = "]m"},
    }
  }

I don't understand how to write new version config.

I can't even use default mapping with n during search or press * on a word, no matter disable_default_mappings is set to true or false.

Breaking change: `opts.mappings` and `opts.callbacks` no longer supported

Due to fundamental changes done in #10, the options opts.mappings and opts.callbacks are no longer supported.

Instead, you should create repeatable mappings manually like this:

local hunk_navigation = require("better-n").create(
  {
    next =  require("gitsigns").next_hunk,
    previous = require("gitsigns").prev_hunk
  }
)

vim.keymap.set({ "n", "x"}, "]h", hunk_navigation.next)
vim.keymap.set({ "n", "x"}, "[h", hunk_navigation.previous)

insert `1<Plug>(better-n)f` accidentally.

Currently, I'm mapping fl to f and fh to F. Therefore, I setup config as below.

image

It turs out to work expected except when I push somethings like fa, fs, fi which insert a string 1<Plug>(better-n)f.

image

Thank you. I really like this plugin so far.

f & F are not working during visual mode

For example, when the cursor is at the begin of the following line:
import sys

and I press v, f, s
it only executes s during visual mode, f doesn't work.

Here's my config:

  require("better-n").setup {
    callbacks = {
      mapping_executed = function(_mode, _key)
        -- Clear highlighting, indicating that `n` will not goto the next
        -- highlighted search-term
        vim.cmd [[ nohl ]]
      end
    },
    mappings = {
      -- I want `n` to always go forward, and `<s-n>` to always go backwards
      ["#"] = {previous = "n", next ="<s-n>"},
      ["F"] = {previous = ";", next = ","},
      ["T"] = {previous = ";", next = ","},

      -- Setting `cmdline = true` ensures that `n` will only be 
      -- overwritten if the search command is succesfully executed
      ["?"] = {previous = "n", next ="<s-n>", cmdline = true},

      -- I have <leader>hn/hp bound to git-hunk-next/prev
      ["]]"] = {previous = "[[", next = "]]"},
      ["[["] = {previous = "[[", next = "]]"},
      ["]m"] = {previous = "[m", next = "]m"},
      ["[m"] = {previous = "[m", next = "]m"},
    }
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.