From 062d618a21f8324a3cae7c3b5ba69ab8fe561522 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Wed, 3 Jan 2024 01:24:21 +0100 Subject: [PATCH] add neogit and venn diagram config --- lua/plugins/init.lua | 20 +++++++++++++++----- lua/plugins/neogit.lua | 5 +++++ lua/plugins/venn.lua | 21 +++++++++++++++++++++ 3 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 lua/plugins/neogit.lua create mode 100644 lua/plugins/venn.lua diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 99ca0c6..f9816a1 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -8,7 +8,10 @@ require('packer').startup(function() -- Fuzzy finder use { 'nvim-telescope/telescope.nvim', - requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}} + requires = { + {'nvim-lua/popup.nvim'}, + {'nvim-lua/plenary.nvim'}, + } } -- Autocomplete and snippets @@ -42,19 +45,26 @@ require('packer').startup(function() use { 'tjdevries/nlua.nvim' } -- Git - use { 'NeogitOrg/neogit' } + use { + 'NeogitOrg/neogit', + requires = { + { "nvim-lua/plenary.nvim" }, + { "sindrets/diffview.nvim" }, + }, + } -- Filesystem in a nvim buffer use { 'stevearc/oil.nvim' } -- Misc - use { 'RRethy/vim-illuminate' } -- highlight all words same as the one under cursor - use { 'vim-scripts/DrawIt' } -- ascii diagrams + use { 'jbyuki/venn.nvim' } -- ascii diagrams use { 'nathom/filetype.nvim' } end) require('plugins.cmp') +require('plugins.neogit') +require('plugins.oil') require('plugins.treesitter') require('plugins.telescope') -require('plugins.oil') +require('plugins.venn') diff --git a/lua/plugins/neogit.lua b/lua/plugins/neogit.lua new file mode 100644 index 0000000..b08d583 --- /dev/null +++ b/lua/plugins/neogit.lua @@ -0,0 +1,5 @@ +local neogit = require('neogit') + +neogit.setup { } + +vim.keymap.set('n', '', neogit.open, {}) diff --git a/lua/plugins/venn.lua b/lua/plugins/venn.lua new file mode 100644 index 0000000..1a808b9 --- /dev/null +++ b/lua/plugins/venn.lua @@ -0,0 +1,21 @@ +-- 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", "j:VBox", {noremap = true}) + vim.api.nvim_buf_set_keymap(0, "n", "K", "k:VBox", {noremap = true}) + vim.api.nvim_buf_set_keymap(0, "n", "L", "l:VBox", {noremap = true}) + vim.api.nvim_buf_set_keymap(0, "n", "H", "h:VBox", {noremap = true}) + -- draw a box by pressing "f" with visual selection + vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox", {noremap = true}) + else + vim.cmd[[setlocal ve=]] + vim.cmd[[mapclear ]] + vim.b.venn_enabled = nil + end +end +-- toggle keymappings for venn using v +vim.api.nvim_set_keymap('n', 'v', ":lua Toggle_venn()", { noremap = true})