Compare commits
10 commits
744b1ad145
...
2765de277a
Author | SHA1 | Date | |
---|---|---|---|
2765de277a | |||
9bd532e06b | |||
a12fc1d1c9 | |||
0b9f37df6c | |||
4dc7cf3e67 | |||
a43c5c1776 | |||
f11fdc928c | |||
c9aff6788d | |||
da79eabf09 | |||
b70909f429 |
8 changed files with 382 additions and 17 deletions
41
flake.nix
41
flake.nix
|
@ -90,7 +90,7 @@
|
|||
name,
|
||||
mkNvimPlugin,
|
||||
...
|
||||
} @ packageDef: {
|
||||
}: {
|
||||
# to define and use a new category, simply add a new list to a set here,
|
||||
# and later, you will include categoryname = true; in the set you
|
||||
# provide when you build the package using this builder function.
|
||||
|
@ -112,13 +112,15 @@
|
|||
nil
|
||||
stylua
|
||||
alejandra
|
||||
biome
|
||||
];
|
||||
};
|
||||
|
||||
# NOTE: lazy doesnt care if these are in startupPlugins or optionalPlugins
|
||||
# also you dont have to download everything via nix if you dont want.
|
||||
# but you have the option, and that is demonstrated here.
|
||||
startupPlugins = with pkgs.vimPlugins; with pkgs.neovimPlugins; {
|
||||
startupPlugins = with pkgs.vimPlugins;
|
||||
with pkgs.neovimPlugins; {
|
||||
general = [
|
||||
# LazyVim
|
||||
lazy-nvim
|
||||
|
@ -192,6 +194,35 @@
|
|||
name = "LuaSnip";
|
||||
}
|
||||
|
||||
# Mini-comment
|
||||
{
|
||||
plugin = mini-comment;
|
||||
name = "mini.comment";
|
||||
}
|
||||
nvim-ts-context-commentstring
|
||||
|
||||
# Mini-surround
|
||||
{
|
||||
plugin = mini-surround;
|
||||
name = "mini.surround";
|
||||
}
|
||||
|
||||
# yanky.nvim
|
||||
yanky-nvim
|
||||
|
||||
# Editor
|
||||
# Aerial
|
||||
aerial-nvim
|
||||
|
||||
# Navic
|
||||
nvim-navic
|
||||
|
||||
# Neo-tree
|
||||
neo-tree-nvim
|
||||
|
||||
# Refactoring
|
||||
refactoring-nvim
|
||||
|
||||
# Custom
|
||||
rose-pine
|
||||
diffview-nvim
|
||||
|
@ -211,9 +242,9 @@
|
|||
# shared libraries to be added to LD_LIBRARY_PATH
|
||||
# variable available to nvim runtime
|
||||
sharedLibraries = {
|
||||
general = with pkgs; [
|
||||
# libgit2
|
||||
];
|
||||
# general = with pkgs; [
|
||||
# libgit2
|
||||
# ];
|
||||
};
|
||||
|
||||
# environmentVariables:
|
||||
|
|
41
init.lua
41
init.lua
|
@ -21,38 +21,55 @@ local lazyOptions = {
|
|||
},
|
||||
}
|
||||
|
||||
-- NOTE: this the lazy wrapper. Use it like require('lazy').setup() but with an extra
|
||||
-- argument, the path to lazy.nvim as downloaded by nix, or nil, before the normal arguments.
|
||||
-- NOTE: this the lazy wrapper. Use it like require('lazy').setup() but with an
|
||||
-- extra argument, the path to lazy.nvim as downloaded by nix, or nil, before
|
||||
-- the normal arguments.
|
||||
require('nixCatsUtils.lazyCat').setup(nixCats.pawsible { 'allPlugins', 'start', 'lazy.nvim' }, {
|
||||
{ 'LazyVim/LazyVim', import = 'lazyvim.plugins' },
|
||||
|
||||
-- disable mason.nvim while using nix
|
||||
-- precompiled binaries do not agree with nixos, and we can just make nix install this stuff for us.
|
||||
{ 'williamboman/mason-lspconfig.nvim', enabled = require('nixCatsUtils').lazyAdd(true, false) },
|
||||
{ 'williamboman/mason.nvim', enabled = require('nixCatsUtils').lazyAdd(true, false) },
|
||||
|
||||
{
|
||||
'folke/lazydev.nvim',
|
||||
ft = 'lua',
|
||||
opts = {
|
||||
library = {
|
||||
-- adds type hints for nixCats global, but LazyDev is just nice in general
|
||||
-- Adds type hints for nixCats global, but LazyDev is just nice in
|
||||
-- general.
|
||||
{ path = (nixCats.nixCatsPath or '') .. '/lua', words = { 'nixCats' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- extras
|
||||
-- Extras.
|
||||
{ import = 'lazyvim.plugins.extras.coding.luasnip' },
|
||||
{ import = 'lazyvim.plugins.extras.coding.mini-comment' },
|
||||
{ import = 'lazyvim.plugins.extras.coding.mini-surround' },
|
||||
{ import = 'lazyvim.plugins.extras.coding.yanky' },
|
||||
|
||||
{ import = 'lazyvim.plugins.extras.editor.aerial' },
|
||||
{ import = 'lazyvim.plugins.extras.editor.navic' },
|
||||
{ import = 'lazyvim.plugins.extras.editor.neo-tree' },
|
||||
{ import = 'lazyvim.plugins.extras.editor.refactoring' },
|
||||
|
||||
{ import = 'lazyvim.plugins.extras.formatting.biome' },
|
||||
|
||||
{ import = 'lazyvim.plugins.extras.lang.nix' },
|
||||
|
||||
-- this needs to be after extras to prevent extras from overwriting it
|
||||
-- These need to be after extras to prevent extras from overwriting them.
|
||||
|
||||
-- Disable mason.nvim while using nix.
|
||||
-- Precompiled binaries do not agree with nixos, and we can just make nix
|
||||
-- install this stuff for us.
|
||||
{ 'williamboman/mason-lspconfig.nvim', enabled = require('nixCatsUtils').lazyAdd(true, false) },
|
||||
{ 'williamboman/mason.nvim', enabled = require('nixCatsUtils').lazyAdd(true, false) },
|
||||
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = require('nixCatsUtils').lazyAdd ':TSUpdate',
|
||||
opts_extend = require('nixCatsUtils').lazyAdd(nil, false),
|
||||
opts = {
|
||||
-- nix already ensured they were installed, and we would need to change the parser_install_dir if we wanted to use it instead.
|
||||
-- so we just disable install and do it via nix.
|
||||
-- Nix already ensured they were installed, and we would need to change
|
||||
-- the parser_install_dir if we wanted to use it instead.
|
||||
-- So we just disable install and do it via nix.
|
||||
ensure_installed = require('nixCatsUtils').lazyAdd({ 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, false),
|
||||
auto_install = require('nixCatsUtils').lazyAdd(true, false),
|
||||
},
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
vim.o.textwidth = 80
|
||||
vim.o.colorcolumn = '+1'
|
||||
|
||||
vim.g.lazyvim_prettier_needs_config = true
|
||||
|
|
14
lua/plugins/luasnip.lua
Normal file
14
lua/plugins/luasnip.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
return {
|
||||
'L3MON4D3/LuaSnip',
|
||||
opts = {
|
||||
store_selection_keys = '<TAB>',
|
||||
update_events = 'TextChanged,TextChangedI',
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('luasnip').setup(opts)
|
||||
|
||||
require('luasnip.loaders.from_lua').load { paths = {
|
||||
nixCats.configDir .. '/lua/snippets',
|
||||
} }
|
||||
end,
|
||||
}
|
18
lua/plugins/neo-tree-nvim.lua
Normal file
18
lua/plugins/neo-tree-nvim.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
return {
|
||||
{
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
opts = {
|
||||
close_if_last_window = true,
|
||||
window = {
|
||||
width = 30,
|
||||
},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = false,
|
||||
hide_hidden = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
101
lua/snippets/fish.lua
Normal file
101
lua/snippets/fish.lua
Normal file
|
@ -0,0 +1,101 @@
|
|||
local ls = require 'luasnip'
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local fmt = require('luasnip.extras.fmt').fmt
|
||||
local fill = require('snippets.helpers').fill
|
||||
|
||||
return {
|
||||
s({ trig = 'dc', desc = 'divider comment' }, f(fill, {}, { user_args = { '#%- ' } })),
|
||||
|
||||
s({ trig = '#!', desc = 'shebang' }, t '#!/usr/bin/env fish'),
|
||||
|
||||
s(
|
||||
{ trig = 'if', desc = 'if ... end' },
|
||||
fmt(
|
||||
[[
|
||||
if {}
|
||||
{}
|
||||
end
|
||||
]],
|
||||
{ i(1), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'elif', desc = 'else if ...' },
|
||||
fmt(
|
||||
[[
|
||||
else if {}
|
||||
{}
|
||||
]],
|
||||
{ i(1), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'fori', desc = 'for ... in ... end' },
|
||||
fmt(
|
||||
[[
|
||||
for {} in {}
|
||||
{}
|
||||
end
|
||||
]],
|
||||
{ i(1), i(2), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'wh', desc = 'while ... end' },
|
||||
fmt(
|
||||
[[
|
||||
while {}
|
||||
{}
|
||||
end
|
||||
]],
|
||||
{ i(1), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'wht', desc = 'while true ... end' },
|
||||
fmt(
|
||||
[[
|
||||
while true
|
||||
{}
|
||||
end
|
||||
]],
|
||||
{ i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'sw', desc = 'switch ... case ... end' },
|
||||
fmt(
|
||||
[[
|
||||
switch {}
|
||||
case {}
|
||||
{}
|
||||
end
|
||||
]],
|
||||
{ i(1), i(2), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'func', desc = 'function ... end' },
|
||||
fmt(
|
||||
[[
|
||||
function {}
|
||||
{}
|
||||
end
|
||||
]],
|
||||
{ i(1), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s({ trig = 'dn', desc = '&>/dev/null' }, t '&>/dev/null'),
|
||||
|
||||
s({ trig = 'abbr', desc = 'abbr -a ... --position ...' }, fmt('abbr -a {} --position {} "{}"', { i(1), i(2, 'command'), i(3) })),
|
||||
}
|
40
lua/snippets/helpers.lua
Normal file
40
lua/snippets/helpers.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
local ls = require 'luasnip'
|
||||
local sn = ls.snippet_node
|
||||
local i = ls.insert_node
|
||||
|
||||
local M = {}
|
||||
|
||||
M.fill = function(_, parent, args)
|
||||
local title = ''
|
||||
local chars = {}
|
||||
|
||||
if type(parent.snippet.env.LS_SELECT_RAW) == 'table' then
|
||||
for _, ele in ipairs(parent.snippet.env.LS_SELECT_RAW) do
|
||||
title = title .. ele .. ' '
|
||||
end
|
||||
end
|
||||
|
||||
for str in string.gmatch(args, '([^%%]+)') do
|
||||
table.insert(chars, str)
|
||||
end
|
||||
|
||||
local snip = chars[1] .. ' ' .. title
|
||||
|
||||
local _, c = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
|
||||
while #snip < (vim.bo.tw - c - 1) do
|
||||
snip = snip .. chars[2]
|
||||
end
|
||||
|
||||
return snip
|
||||
end
|
||||
|
||||
M.get_visual = function(_, parent)
|
||||
if #parent.snippet.env.LS_SELECT_RAW > 0 then
|
||||
return sn(nil, i(1, parent.snippet.env.LS_SELECT_RAW))
|
||||
else -- If LS_SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
142
lua/snippets/nix.lua
Normal file
142
lua/snippets/nix.lua
Normal file
|
@ -0,0 +1,142 @@
|
|||
local ls = require 'luasnip'
|
||||
local s = ls.snippet
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local fmta = require('luasnip.extras.fmt').fmta
|
||||
local rep = require('luasnip.extras').rep
|
||||
local fill = require('snippets.helpers').fill
|
||||
|
||||
return {
|
||||
s({ trig = 'dc', desc = 'divider comment' }, f(fill, {}, { user_args = { '#%- ' } })),
|
||||
|
||||
s(
|
||||
{ trig = 'mexpr', desc = 'Basic module expression' },
|
||||
fmta(
|
||||
[[
|
||||
{ <>... }:
|
||||
{
|
||||
<>
|
||||
}
|
||||
]],
|
||||
{ i(1), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'sov', desc = 'Snowfall lib overlay' },
|
||||
fmta(
|
||||
[[
|
||||
<>: final: prev: {
|
||||
<>
|
||||
}
|
||||
]],
|
||||
{ i(1, '_'), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'sovi', desc = 'Snowfall lib overlay pulling from inputs' },
|
||||
fmta(
|
||||
[[
|
||||
{inputs, ...}: final: prev: {
|
||||
<> = inputs.<>.<>."${prev.system}".<>;
|
||||
}
|
||||
]],
|
||||
{ i(1, 'pkg'), i(2, 'input'), i(3, 'packages'), i(4, 'default') }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'sovc', desc = 'Snowfall lib overlay pulling from channels' },
|
||||
fmta(
|
||||
[[
|
||||
{channels, ...}: final: prev: {
|
||||
inherit (channels.<>) <>;
|
||||
}
|
||||
]],
|
||||
{ i(1, 'unstable'), i(2, 'pkg') }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'ovr', desc = 'Override' },
|
||||
fmta(
|
||||
[[
|
||||
<> = prev.<>.override {
|
||||
<>
|
||||
};
|
||||
]],
|
||||
{ i(1, 'pkg'), rep(1), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'ovra', desc = 'OverrideAttrs' },
|
||||
fmta(
|
||||
[[
|
||||
<> = prev.<>.overrideAttrs (old: {
|
||||
<>
|
||||
});
|
||||
]],
|
||||
{ i(1, 'pkg'), rep(1), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'hpkg', desc = 'home.packages list' },
|
||||
fmta(
|
||||
[[
|
||||
home.packages = with pkgs; [
|
||||
<>
|
||||
];<>
|
||||
]],
|
||||
{ i(1), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'ospkg', desc = 'NixOS environment.systemPackages list' },
|
||||
fmta(
|
||||
[[
|
||||
environment.systemPackages = with pkgs; [
|
||||
<>
|
||||
];<>
|
||||
]],
|
||||
{ i(1), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = 'smod', desc = 'Snowfall lib module' },
|
||||
fmta(
|
||||
[[
|
||||
{
|
||||
lib,
|
||||
config,<>
|
||||
...
|
||||
}:
|
||||
let<>
|
||||
|
||||
cfg = config.marleyos.<>.<>;
|
||||
in
|
||||
{
|
||||
options.marleyos.<>.<>.enable = mkEnableOption "<>";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
<>
|
||||
};
|
||||
}
|
||||
]],
|
||||
{
|
||||
i(1), -- extra args
|
||||
i(2, { '', ' inherit (lib.marleyos) enabled;' }),
|
||||
i(3), -- group
|
||||
i(4), -- mod
|
||||
rep(3), -- group
|
||||
rep(4), -- mod
|
||||
rep(4), -- mod
|
||||
i(0), -- end
|
||||
}
|
||||
)
|
||||
),
|
||||
}
|
Loading…
Reference in a new issue