1
Fork 0

feat: fixed leader not working

This commit is contained in:
Matei Adriel 2022-04-04 10:01:13 +03:00
parent 0c1f2b4297
commit 6fe5826a29
6 changed files with 79 additions and 30 deletions
dotfiles/neovim/lua/my/plugins

View file

@ -4,13 +4,19 @@ local arpeggio = vim.fn["arpeggio#map"]
local M = {}
function M.chord(mode, lhs, rhs, opts)
local options = helpers.mergeTables(opts, {noremap = true})
if string.len(mode) > 1 then
for i = 1, #mode do
local c = mode:sub(i, i)
M.chord(c, lhs, rhs, opts)
end
else
local options = helpers.mergeTables(opts, {noremap = true})
local settings = ""
local settings = ""
if options.silent then settings = settings .. "s" end
if options.silent then settings = settings .. "s" end
arpeggio(mode, settings, options.noremap, lhs, rhs)
arpeggio(mode, settings, options.noremap, lhs, rhs)
end
end
function M.chordSilent(mode, lhs, rhs, opts)

View file

@ -1,8 +1,14 @@
local A = require("my.helpers.augroup")
local map = require("my.keymaps").mapSilent
local arpeggio = require("my.plugins.arpeggio")
local M = {}
local extraBrackets = {lean = {{"", ""}}}
local extraBrackets = {
lean = {{"", ""}}, -- lean
all = {
{"(", ")"}, {"[", "]"}, {"'", "'"}, {'"', '"'}, {"{", "}"}, {"`", "`"}
} -- more general stuff
}
function M.createBracketCommand(lhs, rhs, isGlobal, opts)
local suffix = ""
@ -17,19 +23,29 @@ function M.createBracket(lhs, rhs, isGlobal, opts)
end
function M.setup()
if arpeggio == nil then return end
vim.g.marker_define_jump_mappings = 0 -- disable automatic binding of marker jumping (conflicts with tmux-vim-navigator)
map("inv", "sf", '<Plug>MarkersJumpF')
map("inv", "fs", '<Plug>MarkersJumpB')
map("inv", "mi", '<Plug>MarkersMark')
map("inv", "ml", '<Plug>MarkersCloseAllAndJumpToLast')
map("inv", "mo", '<Plug>MarkersJumpOutside')
arpeggio.chord("inv", "sj", '<Plug>MarkersJumpF')
arpeggio.chord("inv", "sk", '<Plug>MarkersJumpB')
arpeggio.chord("inv", "mi", '<Plug>MarkersMark')
arpeggio.chord("inv", "ml", '<Plug>MarkersCloseAllAndJumpToLast')
arpeggio.chord("inv", "mo", '<Plug>MarkersJumpOutside')
for key, brackets in pairs(extraBrackets) do
for _, v in ipairs(brackets) do
A.augroup('custom-brackets' .. key, function()
local action = M.createBracketCommand(v[1], v[2], 0, v[3] or "")
A.autocmd('BufEnter', '*.' .. key, action)
local glob = '*.' .. key
if key == "all" then
-- The all key just matches everything
glob = "*"
end
A.autocmd('BufEnter', glob, action)
end)
end
end

View file

@ -12,21 +12,21 @@ local bindings = {
live_grep = "<c-F>",
-- See diagnostics with space + d
lsp_document_diagnostics = "<space>d",
lsp_workspace_diagnostics = "<space>wd",
lsp_code_actions = "<space>ca",
lsp_document_diagnostics = "<Leader>d",
lsp_workspace_diagnostics = "<Leader>wd",
lsp_code_actions = "<Leader>ca",
-- Open a list with all the pickers
builtin = "<space>t",
builtin = "<Leader>t",
-- List function, var names etc
treesitter = "<space>s",
treesitter = "<Leader>s",
-- Git stuff
git_commits = "<space>gj",
git_branches = "<space>gk"
git_commits = "<Leader>gj",
git_branches = "<Leader>gk"
},
["extensions.file_browser.file_browser"] = "<space>p",
["extensions.file_browser.file_browser"] = "<Leader>p",
extensions = {
unicode = {picker = {mode = "i", kind = "dropdown", key = "uu"}}
}