Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
feat: blazingly fast motions with hop
Browse files Browse the repository at this point in the history
  • Loading branch information
nexxeln committed Oct 9, 2022
1 parent 5b89332 commit 0fc49a9
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 8 deletions.
33 changes: 33 additions & 0 deletions after/plugin/hop.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
local present, hop = pcall(require, "hop")

if not present then
return
end

local directions = require("hop.hint").HintDirection

hop.setup({
keys = "etovxqpdygfblzhckisuran",
})

local map = vim.keymap.set

map("n", "<leader>w", function()
hop.hint_words()
end)

map("n", "<M-f>", function()
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true })
end)

map("n", "<M-F>", function()
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true })
end)

map("n", "<M-t>", function()
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })
end)

map("n", "<M-T>", function()
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 })
end)
6 changes: 6 additions & 0 deletions lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ return require("packer").startup({
-- telescope file browser
use("nvim-telescope/telescope-file-browser.nvim")

-- quick motions
use({
"phaazon/hop.nvim",
branch = "v2",
})

-- status line
use({
"nvim-lualine/lualine.nvim",
Expand Down
21 changes: 13 additions & 8 deletions plugin/packer_compiled.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ _G.packer_plugins = {
path = "/home/nxl/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
url = "https://github.com/lewis6991/gitsigns.nvim"
},
["hop.nvim"] = {
loaded = true,
path = "/home/nxl/.local/share/nvim/site/pack/packer/start/hop.nvim",
url = "https://github.com/phaazon/hop.nvim"
},
["indent-blankline.nvim"] = {
loaded = true,
path = "/home/nxl/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim",
Expand Down Expand Up @@ -247,22 +252,22 @@ _G.packer_plugins = {
}

time([[Defining packer_plugins]], false)
-- Config for: Comment.nvim
time([[Config for Comment.nvim]], true)
try_loadstring("\27LJ\2\n \1\0\0\6\0\a\0\r6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\5\0006\3\0\0'\5\3\0B\3\2\0029\3\4\3B\3\1\2=\3\6\2B\0\2\1K\0\1\0\rpre_hook\1\0\0\20create_pre_hook7ts_context_commentstring.integrations.comment_nvim\nsetup\fComment\frequire\0", "config", "Comment.nvim")
time([[Config for Comment.nvim]], false)
-- Config for: gitsigns.nvim
time([[Config for gitsigns.nvim]], true)
try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim")
time([[Config for gitsigns.nvim]], false)
-- Config for: nvim-autopairs
time([[Config for nvim-autopairs]], true)
try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs")
time([[Config for nvim-autopairs]], false)
-- Config for: nvim-ts-autotag
time([[Config for nvim-ts-autotag]], true)
try_loadstring("\27LJ\2\nA\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\20nvim-ts-autotag\frequire\0", "config", "nvim-ts-autotag")
time([[Config for nvim-ts-autotag]], false)
-- Config for: nvim-autopairs
time([[Config for nvim-autopairs]], true)
try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs")
time([[Config for nvim-autopairs]], false)
-- Config for: Comment.nvim
time([[Config for Comment.nvim]], true)
try_loadstring("\27LJ\2\n \1\0\0\6\0\a\0\r6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\5\0006\3\0\0'\5\3\0B\3\2\0029\3\4\3B\3\1\2=\3\6\2B\0\2\1K\0\1\0\rpre_hook\1\0\0\20create_pre_hook7ts_context_commentstring.integrations.comment_nvim\nsetup\fComment\frequire\0", "config", "Comment.nvim")
time([[Config for Comment.nvim]], false)

_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
Expand Down

0 comments on commit 0fc49a9

Please sign in to comment.