mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-14 16:55:57 +01:00
729276c4c5
new file: modules/utility/binds/cheatsheet/cheatsheet.nix new file: modules/utility/binds/cheatsheet/config.nix modified: modules/utility/binds/cheatsheet/default.nix modified: modules/utility/binds/default.nix new file: modules/utility/binds/which-key/config.nix modified: modules/utility/binds/which-key/default.nix new file: modules/utility/binds/which-key/which-key.nix renamed: modules/utility/colorizer.nix -> modules/utility/colorizer/colorizer.nix new file: modules/utility/colorizer/config.nix new file: modules/utility/colorizer/default.nix modified: modules/utility/default.nix modified: modules/utility/gestures/default.nix renamed: modules/utility/gestures/gesture-nvim.nix -> modules/utility/gestures/gesture-nvim/config.nix new file: modules/utility/gestures/gesture-nvim/default.nix new file: modules/utility/gestures/gesture-nvim/gesture-nvim.nix renamed: modules/utility/icon-picker.nix -> modules/utility/icon-picker/config.nix new file: modules/utility/icon-picker/default.nix new file: modules/utility/icon-picker/icon-picker.nix new file: modules/utility/telescope/config.nix modified: modules/utility/telescope/default.nix new file: modules/utility/telescope/telescope.nix renamed: modules/utility/venn.nix -> modules/utility/venn/config.nix new file: modules/utility/venn/default.nix new file: modules/utility/venn/venn.nix
43 lines
1.5 KiB
Nix
43 lines
1.5 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
with lib;
|
|
with builtins; let
|
|
cfg = config.vim.utility.venn-nvim;
|
|
in {
|
|
config = mkIf (cfg.enable) {
|
|
vim.startPlugins = [
|
|
"venn-nvim"
|
|
];
|
|
|
|
# TODO: https://github.com/jbyuki/venn.nvim#using-toggle-command
|
|
# add keybindings for drawing diagrams
|
|
vim.luaConfigRC.venn-nvim = nvim.dag.entryAnywhere ''
|
|
local venn = require('venn')
|
|
-- venn.nvim: enable or disable keymappings
|
|
function _G.Toggle_venn()
|
|
local venn_enabled = vim.inspect(vim.b.venn_enabled)
|
|
if venn_enabled == "nil" then
|
|
vim.b.venn_enabled = true
|
|
vim.cmd[[setlocal ve=all]]
|
|
-- draw a line on HJKL keystokes
|
|
vim.api.nvim_buf_set_keymap(0, "n", "J", "<C-v>j:VBox<CR>", {noremap = true})
|
|
vim.api.nvim_buf_set_keymap(0, "n", "K", "<C-v>k:VBox<CR>", {noremap = true})
|
|
vim.api.nvim_buf_set_keymap(0, "n", "L", "<C-v>l:VBox<CR>", {noremap = true})
|
|
vim.api.nvim_buf_set_keymap(0, "n", "H", "<C-v>h:VBox<CR>", {noremap = true})
|
|
-- draw a box by pressing "f" with visual selection
|
|
vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox<CR>", {noremap = true})
|
|
else
|
|
vim.cmd[[setlocal ve=]]
|
|
vim.cmd[[mapclear <buffer>]]
|
|
vim.b.venn_enabled = nil
|
|
end
|
|
end
|
|
-- toggle keymappings for venn using <leader>v
|
|
vim.api.nvim_set_keymap('n', '<leader>v', ":lua Toggle_venn()<CR>", { noremap = true})
|
|
'';
|
|
};
|
|
}
|