From 68f0530548087a542539e10b77c7041d260006ac Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sun, 8 Dec 2024 18:10:07 -0800 Subject: [PATCH] feat: neotab.nvim --- flake.lock | 17 ++++++++++++ flake.nix | 9 +++---- nix/neovim-overlay.nix | 14 +++++----- nvim/lua/plugins/coding/init.lua | 1 + nvim/lua/plugins/coding/neotab-nvim.lua | 36 +++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 13 deletions(-) create mode 100644 nvim/lua/plugins/coding/neotab-nvim.lua diff --git a/flake.lock b/flake.lock index 09c39b5..9c6679a 100644 --- a/flake.lock +++ b/flake.lock @@ -280,6 +280,22 @@ "type": "github" } }, + "neotab-nvim": { + "flake": false, + "locked": { + "lastModified": 1733176083, + "narHash": "sha256-5IJQwZxDGDMM6KBWKU/EZwa5wciHeTXOZgHPCRmlxJk=", + "owner": "kawre", + "repo": "neotab.nvim", + "rev": "f6ed1ef49f32586f5db95edae5d6f264c8180d85", + "type": "github" + }, + "original": { + "owner": "kawre", + "repo": "neotab.nvim", + "type": "github" + } + }, "neovim-nightly": { "inputs": { "flake-compat": "flake-compat_2", @@ -385,6 +401,7 @@ "inputs": { "flake-utils": "flake-utils", "gen-luarc": "gen-luarc", + "neotab-nvim": "neotab-nvim", "neovim-nightly": "neovim-nightly", "nixpkgs": "nixpkgs_2" } diff --git a/flake.nix b/flake.nix index c9d5e14..7e68f0f 100644 --- a/flake.nix +++ b/flake.nix @@ -11,11 +11,10 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - # Add bleeding-edge plugins here. - # wf-nvim = { - # url = "github:Cassin01/wf.nvim"; - # flake = false; - # }; + neotab-nvim = { + url = "github:kawre/neotab.nvim"; + flake = false; + }; }; outputs = inputs @ { diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index daebe47..c463117 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -4,11 +4,11 @@ with final.pkgs.lib; let pkgs = final; # Use this to create a plugin from a flake input - # mkNvimPlugin = src: pname: - # pkgs.vimUtils.buildVimPlugin { - # inherit pname src; - # version = src.lastModifiedDate; - # }; + mkNvimPlugin = src: pname: + pkgs.vimUtils.buildVimPlugin { + inherit pname src; + version = src.lastModifiedDate; + }; # Make sure we use the pinned nixpkgs instance for wrapNeovimUnstable, # otherwise it could have an incompatible signature when applying this overlay. @@ -26,9 +26,6 @@ with final.pkgs.lib; let # ... # } all-plugins = with pkgs.vimPlugins; [ - # bleeding-edge plugins from flake inputs - # (mkNvimPlugin inputs.wf-nvim "wf.nvim") # (example) keymap hints - # Base lz-n snacks-nvim @@ -58,6 +55,7 @@ with final.pkgs.lib; let # Coding lexima-vim + (mkNvimPlugin inputs.neotab-nvim "neotab.nvim") # Treesitter nvim-treesitter-textobjects diff --git a/nvim/lua/plugins/coding/init.lua b/nvim/lua/plugins/coding/init.lua index a30b06b..bba945b 100644 --- a/nvim/lua/plugins/coding/init.lua +++ b/nvim/lua/plugins/coding/init.lua @@ -2,4 +2,5 @@ local req = MarleyVim.local_require('plugins.coding') return { req('lexima-vim'), + req('neotab-nvim'), } diff --git a/nvim/lua/plugins/coding/neotab-nvim.lua b/nvim/lua/plugins/coding/neotab-nvim.lua new file mode 100644 index 0000000..36ae6fa --- /dev/null +++ b/nvim/lua/plugins/coding/neotab-nvim.lua @@ -0,0 +1,36 @@ +return { + 'neotab.nvim', + event = 'InsertEnter', + after = function() + require('neotab').setup({ + behavior = 'closing', + smart_punctuators = { + enabled = true, + semicolon = { + enabled = true, + ft = { 'javascript', 'typescript', 'php', 'nix' }, + }, + escape = { + enabled = true, + triggers = { + [','] = { + pairs = { + { open = "'", close = "'" }, + { open = '"', close = '"' }, + }, + format = '%s ', -- ", " + }, + ['='] = { + pairs = { + { open = '(', close = ')' }, + }, + ft = { 'javascript', 'typescript' }, + format = ' %s> ', -- ` => ` + cond = '^$', -- match only pairs with empty content + }, + }, + }, + }, + }) + end, +}