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

View file

@ -5,14 +5,40 @@
Table of my own keybinds. Here as documentation for myself. I am yet to include any of the keybinds for the lspconfig, telescope or cmp here. Table of my own keybinds. Here as documentation for myself. I am yet to include any of the keybinds for the lspconfig, telescope or cmp here.
> Things written using italics are chords > Things written using italics are chords
> (aka all the keys need to be pressed at the same time)
| Keybind | Description | Plugins | | Keybind | Description | Plugins |
| ---------------- | -------------------------------- | --------------- | | ---------------- | ------------------------------------------- | ------------------ |
| vv | Create vertical split | | | vv | Create vertical split | |
| \<Space>\<Space> | Save | | | \<Space>\<Space> | Save | |
| jj | Exit insert mode | | | jj | Exit insert mode | |
| _vp_ | Run command in another tmux pane | vimux, arpeggio |
| C-n | Open tree | nvim-tree | | C-n | Open tree | nvim-tree |
| _vp_ | Run command in another tmux pane | vimux, arpeggio |
| _<leader>k_ | Insert digraph | |
| _<leader>a_ | Swap last 2 used buffers | |
| _sk_ | Move to previous lh-bracket marker | lh-brackets |
| _sj_ | Move to next lh-bracket marker | lh-brackets |
| _mo_ | Move outside the current brackets | lh-brackets |
| _ml_ | Remove all markers and move to the last one | lh-brackets |
| C-hjkl | Navigation between vim & tmux panes | vim-tmux-navigator |
### Idris
> The idris and arpeggio plugins are implicit here
| Keybind | Description |
| ------- | ------------------- |
| _sc_ | Case split |
| _mc_ | Make case |
| _ml_ | Make lemma |
| _es_ | Expression search |
| _gd_ | Generate definition |
| _rh_ | Refine hole |
| _ac_ | Add clause |
### Lean
- Extra brackets: ⟨⟩
## Some cool vim keybinds I sometimes forget about ## Some cool vim keybinds I sometimes forget about
@ -21,6 +47,5 @@ Documentation for myself
| Keybind | Description | Plugins | | Keybind | Description | Plugins |
| ------- | ----------------------- | ------------ | | ------- | ----------------------- | ------------ |
| zz | Center the current line | | | zz | Center the current line | |
| C-w C-r | Swap 2 splits | |
| gcc | Comment line | nvim-comment | | gcc | Comment line | nvim-comment |
| gc | Comment selection | nvim-comment | | gc | Comment selection | nvim-comment |

View file

@ -27,8 +27,10 @@ function M.setup()
if arpeggio ~= nil then if arpeggio ~= nil then
-- Create chords -- Create chords
arpeggio.chord("i", "<Leader>k", "C-k") -- Rebind digraph insertion to leader+k arpeggio.chord("i", "<Leader>k", "<C-k><cr>") -- Rebind digraph insertion to leader+k
arpeggio.chord("inv", "<Leader>a", "<C-6><cr>") -- Rebind switching to the last pane using leader+a
end end
end end
return M return M

View file

@ -30,7 +30,7 @@ function M.setup()
opt.completeopt = {"menu", "menuone", "noselect"} opt.completeopt = {"menu", "menuone", "noselect"}
-- Set leader -- Set leader
helpers.global("mapleader", "<Space>") helpers.global("mapleader", " ")
-- Import other options -- Import other options
require("my.options.folding").setup() require("my.options.folding").setup()

View file

@ -4,13 +4,19 @@ local arpeggio = vim.fn["arpeggio#map"]
local M = {} local M = {}
function M.chord(mode, lhs, rhs, opts) function M.chord(mode, lhs, rhs, opts)
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 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 end
function M.chordSilent(mode, lhs, rhs, opts) function M.chordSilent(mode, lhs, rhs, opts)

View file

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

View file

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