Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added lazy.nvim config that uses keymap based lazy-loading to README.md #24

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

stepanzak
Copy link

It's a native way of Lazy.nvim to add keymaps and it has multiple advantages.

  • faster load times:
    if you have many plugins in neovim, lazy-loading can save you significant amount of time at startup.
  • integration:
    Lazy's keymaps integrate to tools like Which Key, which shows their descriptions

@stepanzak
Copy link
Author

PS: My english is not very great, please feel free to reword the sentences I used in the README.

@alexghergh
Copy link
Owner

Hey,

Thanks for opening a pull request!

Couple of things:

  • instead of:
    {
      "<C-h>",
      function()
        require("nvim-tmux-navigation").NvimTmuxNavigateLeft()
      end,
      desc = "Move one nvim/tmux pane to the left",
    },

you can probably directly specify:

    {
      "<C-h>",
      require("nvim-tmux-navigation").NvimTmuxNavigateLeft
      desc = "Move one nvim/tmux pane to the left",
    },

though I haven't tried it.

  • this is not true:
  -- You don't have to include the "config" function if it's empty.
  -- config = function()
  --   require("nvim-tmux-navigation").setup()
  -- end,

as per the README, you do have to call the setup() method at least once, even if empty (see the Note right at the end of this section.

Have a good one!

@stepanzak
Copy link
Author

I looked at some other examples and I think the best way is to use cmd and then <cmd>NvimTmuxNavigateSomewhere<cr>. I did it like that in the new commit, and it's almost the same way as https://github.com/christoomey/vim-tmux-navigator does it. One thing I'm not sure about is that christoomey/vim-tmux-navigator uses <C-U> in the bindings for some reason:

{
  "christoomey/vim-tmux-navigator",
  cmd = {
    "TmuxNavigateLeft",
    "TmuxNavigateDown",
    "TmuxNavigateUp",
    "TmuxNavigateRight",
    "TmuxNavigatePrevious",
  },
  keys = {
    { "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" },
    { "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" },
    { "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" },
    { "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" },
    { "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" },
  },
}

I don't know why should <C-U> be there and my neovim tells me that I don't have any binding for <C-U> when I try to use it.

The config I used in the first commit worked without the config function, but this one doesn't, so I removed that comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants