Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
editors/neovim: post-refactor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf committed Feb 26, 2024
1 parent 770bad6 commit 2f10454
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 30 deletions.
6 changes: 6 additions & 0 deletions homes/notashelf/programs/terminal/editors/neovim/.stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
column_width = 100
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 4
quote_style = "AutoPreferSingle"
call_parentheses = "Always"
34 changes: 9 additions & 25 deletions homes/notashelf/programs/terminal/editors/neovim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ in {
# neovim-flake home-manager module
[nvf.homeManagerModules.default]

# constructed modules
(mkModule {path = ./plugins;})
(mkModule {path = ./mappings;})
# construct this entire directory as a module
# which means all default.nix files will be imported automatically
(mkModule {path = ./.;})
];

config = {
Expand Down Expand Up @@ -79,36 +79,20 @@ in {
};

luaConfigRC = {
# autocommands
"autocommands" = builtins.readFile ./lua/autocommands.lua;

# additional LSP handler configurations via vim.lsp.handlers
"lsp-handler" = builtins.readFile ./lua/handlers.lua;

# configurations that don't belong anywhere else
"misc" = builtins.readFile ./lua/misc.lua;

# additional neovide configuration
"neovide" = builtins.readFile ./lua/neovide.lua;
};
};
};
};

xdg.desktopEntries."neovim" = lib.mkForce {
name = "Neovim";
type = "Application";
mimeType = ["text/plain"];

icon = builtins.fetchurl {
url = "https://raw.githubusercontent.com/NotAShelf/neovim-flake/main/assets/neovim-flake-logo-work.svg";
sha256 = "19n7n9xafyak35pkn4cww0s5db2cr97yz78w5ppbcp9jvxw6yyz3";
};

exec = let
wezterm = lib.getExe config.programs.wezterm.package;
direnv = lib.getExe pkgs.direnv;
in "${pkgs.writeShellScript "wezterm-neovim" ''
filename = "$(readlink -f "$1")" # define target filename
dirname = "$(dirname "$filename")" # get the directory target file is in
# launch a wezterm instance with direnv and nvim
${wezterm} start --cwd "$dirname" -- ${lib.getExe pkgs.zsh} -c "${direnv} exec . nvim '$filename'"
''} %f";
};
};
}
2 changes: 2 additions & 0 deletions homes/notashelf/programs/terminal/editors/neovim/lua/misc.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vim.cmd.aunmenu [[PopUp.How-to\ disable\ mouse]]
vim.cmd.aunmenu [[PopUp.-1-]]
32 changes: 32 additions & 0 deletions homes/notashelf/programs/terminal/editors/neovim/plugins/extra.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,38 @@ in {
setup = "require('smart-splits').setup {}";
};

neotab-nvim = {
package = pluginSources.neotab-nvim;
setup = ''
require('neotab').setup {
tabkey = "<Tab>",
act_as_tab = true,
behavior = "nested", ---@type ntab.behavior
pairs = { ---@type ntab.pair[]
{ open = "(", close = ")" },
{ open = "[", close = "]" },
{ open = "{", close = "}" },
{ open = "'", close = "'" },
{ open = '"', close = '"' },
{ open = "`", close = "`" },
{ open = "<", close = ">" },
},
exclude = {},
smart_punctuators = {
enabled = false,
semicolon = {
enabled = false,
ft = { "cs", "c", "cpp", "java" },
},
escape = {
enabled = false,
triggers = {}, ---@type table<string, ntab.trigger>
},
},
}
'';
};

specs-nvim = {
package = pluginSources.specs-nvim;
setup = ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
...
}: let
inherit (self) pins;
inherit (pkgs) fetchFromGitHub;
inherit (pkgs.vimUtils) buildVimPlugin;

sources = {
Expand All @@ -24,7 +25,7 @@

regexplainer = buildVimPlugin {
name = "nvim-regexplainer";
src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "bennypowers";
repo = "nvim-regexplainer";
rev = "4250c8f3c1307876384e70eeedde5149249e154f";
Expand All @@ -34,7 +35,7 @@

specs-nvim = buildVimPlugin {
name = "specs.nvim";
src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "edluffy";
repo = "specs.nvim";
rev = "2743e412bbe21c9d73954c403d01e8de7377890d";
Expand All @@ -44,7 +45,7 @@

deferred-clipboard = buildVimPlugin {
name = "deferred-clipboard";
src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "EtiamNullam";
repo = "deferred-clipboard.nvim";
rev = "810a29d166eaa41afc220cc7cd85eeaa3c43b37f";
Expand All @@ -54,7 +55,7 @@

data-viewer-nvim = buildVimPlugin {
name = "data-viewer.nvim";
src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "VidocqH";
repo = "data-viewer.nvim";
rev = "40ddf37bb7ab6c04ff9e820812d1539afe691668";
Expand All @@ -64,13 +65,23 @@

vim-nftables = buildVimPlugin {
name = "vim-nftables";
src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "awisse";
repo = "vim-nftables";
rev = "bc29309080b4c7e1888ffb1a830846be16e5b8e7";
hash = "sha256-L1x3Hv95t/DBBrLtPBKrqaTbIPor/NhVuEHVIYo/OaA=";
};
};

neotab-nvim = buildVimPlugin {
name = "neotab.nvim";
src = fetchFromGitHub {
owner = "kawre";
repo = "neotab.nvim";
rev = "6c6107dddaa051504e433608f59eca606138269b";
hash = "sha256-bSFKbjj8fJHdfBzYoQ9l3NU0GAYfdfCbESKbwdbLNSw=";
};
};
};
in
sources
31 changes: 31 additions & 0 deletions homes/notashelf/programs/terminal/editors/neovim/wrapper.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
config,
pkgs,
lib,
...
}: {
xdg.desktopEntries."Neovim" = lib.mkForce {
name = "Neovim";
type = "Application";
mimeType = ["text/plain"];

icon = builtins.fetchurl {
url = "https://raw.githubusercontent.com/NotAShelf/neovim-flake/main/assets/neovim-flake-logo-work.svg";
sha256 = "19n7n9xafyak35pkn4cww0s5db2cr97yz78w5ppbcp9jvxw6yyz3";
};

exec = let
wezterm = lib.getExe config.programs.wezterm.package;
direnv = lib.getExe pkgs.direnv;
in "${pkgs.writeShellScript "wezterm-neovim" ''
# define target filename
filename="$(readlink -f "$1")"
# get the directory target file is in
dirname="$(dirname "$filename")"
# launch a wezterm instance with direnv and nvim
${wezterm} -e --cwd "$dirname" -- ${lib.getExe pkgs.zsh} -c "${direnv} exec . nvim '$filename'"
''} %f";
};
}

0 comments on commit 2f10454

Please sign in to comment.