alexghergh / nvim-tmux-navigation

Easy Neovim-Tmux navigation, completely written in Lua
MIT License
312 stars 22 forks source link

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

Open stepanzak opened 5 months ago

stepanzak commented 5 months ago

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

stepanzak commented 5 months ago

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

alexghergh commented 5 months ago

Hey,

Thanks for opening a pull request!

Couple of things:

Have a good one!

stepanzak commented 5 months ago

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.