Skip to content

Commit

Permalink
More readable keybinding from lua example. hadronized#285
Browse files Browse the repository at this point in the history
  • Loading branch information
ehllie committed Jul 17, 2022
1 parent 6bcaeb7 commit ef02973
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,20 @@ If you want to create a key binding from within Lua:

```lua
-- place this in one of your configuration file(s)
vim.api.nvim_set_keymap('', 'f', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })<cr>", {})
vim.api.nvim_set_keymap('', 'F', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })<cr>", {})
vim.api.nvim_set_keymap('', 't', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })<cr>", {})
vim.api.nvim_set_keymap('', 'T', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 })<cr>", {})
local hop = require("hop")
local directions = require("hop.hint").HintDirection
vim.api.nvim_set_keymap("", "f", function()
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true })
end, {})
vim.api.nvim_set_keymap("", "F", function()
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true })
end, {})
vim.api.nvim_set_keymap("", "t", function()
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })
end, {})
vim.api.nvim_set_keymap("", "T", function()
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 })
end, {})
```

# Chat
Expand Down

0 comments on commit ef02973

Please sign in to comment.