Compare commits
2 commits
819aff7644
...
1679f84978
| Author | SHA1 | Date | |
|---|---|---|---|
| 1679f84978 | |||
| 29def924b3 |
15 changed files with 817 additions and 230 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
imports = with inputs; [
|
imports = with inputs; [
|
||||||
easy-hosts.flakeModule
|
easy-hosts.flakeModule
|
||||||
|
nixvim.homeModules.nixvim
|
||||||
home-manager.flakeModules.home-manager
|
home-manager.flakeModules.home-manager
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -25,10 +26,7 @@
|
||||||
inputs.home-manager.lib.homeManagerConfiguration {
|
inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
extraSpecialArgs = { inherit inputs; };
|
extraSpecialArgs = { inherit inputs; };
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||||
modules = [
|
modules = [ ./hmModules ] ++ extraModules;
|
||||||
./hmModules
|
|
||||||
inputs.nixvim.homeModules.nixvim
|
|
||||||
] ++ extraModules;
|
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
"pan@juri" = userConfig "x86_64-linux" [ ./users/juri ];
|
"pan@juri" = userConfig "x86_64-linux" [ ./users/juri ];
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
options.beets = {
|
|
||||||
enable = lib.mkEnableOption "Enables beets music";
|
|
||||||
plugins = {
|
|
||||||
the.enable = lib.mkOption { default = true; };
|
|
||||||
ftintitle.enable = lib.mkOption { default = true; };
|
|
||||||
lyrics.enable = lib.mkOption { default = true; };
|
|
||||||
fetchart = {
|
|
||||||
enable = lib.mkOption { default = true; };
|
|
||||||
embed = lib.mkOption { default = true; };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf config.beets.enable {
|
|
||||||
programs.beets.enable = true;
|
|
||||||
|
|
||||||
programs.beets.settings = {
|
|
||||||
directory = "${config.xdg.userDirs.music}";
|
|
||||||
library = "${config.xdg.userDirs.music}.db";
|
|
||||||
|
|
||||||
paths.default = with config.beets.plugins; let
|
|
||||||
# raw_artist = if ftintitle.enable
|
|
||||||
# then "$album_artist_no_feat"
|
|
||||||
# else "$albumartist";
|
|
||||||
raw_artist = "$albumartist";
|
|
||||||
artist = if the.enable
|
|
||||||
then "%the{${raw_artist}}/"
|
|
||||||
else raw_artist;
|
|
||||||
|
|
||||||
the_rest = "$album%aunique{}/$track $title";
|
|
||||||
in artist + the_rest;
|
|
||||||
|
|
||||||
embedart = with config.beets.plugins.fetchart;
|
|
||||||
lib.mkIf (enable && embed) {
|
|
||||||
maxwidth = 500;
|
|
||||||
};
|
|
||||||
|
|
||||||
plugins = with lib; with config.beets.plugins;
|
|
||||||
optional (the.enable) "the" ++
|
|
||||||
optional (ftintitle.enable) "ftintitle" ++
|
|
||||||
optional (lyrics.enable) "lyrics" ++
|
|
||||||
optional (fetchart.enable) "fetchart" ++
|
|
||||||
optional (fetchart.embed) "embedart" ++ [
|
|
||||||
"musicbrainz"
|
|
||||||
"info"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
169
hmModules/apps/neovim.old/app.nix
Normal file
169
hmModules/apps/neovim.old/app.nix
Normal file
|
|
@ -0,0 +1,169 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
options.neovim = {
|
||||||
|
enable = lib.mkEnableOption "Enables neovim";
|
||||||
|
languages = {
|
||||||
|
c.enable = lib.mkEnableOption "Enables c support";
|
||||||
|
go.enable = lib.mkEnableOption "Enables go support";
|
||||||
|
nix.enable = lib.mkEnableOption "Enables nix support";
|
||||||
|
rust.enable = lib.mkEnableOption "Enables rust support";
|
||||||
|
typescript.enable = lib.mkEnableOption "Enables typescript support";
|
||||||
|
};
|
||||||
|
themes = {
|
||||||
|
catppuccin.enable = lib.mkEnableOption "Enables catppuccin theme";
|
||||||
|
};
|
||||||
|
plugins = {
|
||||||
|
comments.enable = lib.mkEnableOption "Enables nvim-comment";
|
||||||
|
fugitive.enable = lib.mkEnableOption "Enables git-fugitive";
|
||||||
|
lualine.enable = lib.mkEnableOption "Enables lualine";
|
||||||
|
luasnip.enable = lib.mkEnableOption "Enables luasnip snippets";
|
||||||
|
nvimcmp.enable = lib.mkEnableOption "Enables nvim completion";
|
||||||
|
telescope = {
|
||||||
|
enable = lib.mkEnableOption "Enables telescope";
|
||||||
|
fzf.enable = lib.mkEnableOption "Enables telescope-fzf";
|
||||||
|
};
|
||||||
|
treesitter.enable = lib.mkEnableOption "Enables treesitter";
|
||||||
|
wiki.enable = lib.mkEnableOption "Enables a wiki";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
./plugin/lsp.nix
|
||||||
|
./plugin/nvimcmp.nix
|
||||||
|
./plugin/telescope.nix
|
||||||
|
./plugin/treesitter.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
config = lib.mkIf config.neovim.enable {
|
||||||
|
home.sessionVariables = {
|
||||||
|
EDITOR = "nvim";
|
||||||
|
VISUAL = "nvim";
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.neovim = {
|
||||||
|
enable = true;
|
||||||
|
viAlias = true;
|
||||||
|
vimAlias = true;
|
||||||
|
vimdiffAlias = true;
|
||||||
|
|
||||||
|
extraLuaConfig = ''
|
||||||
|
${builtins.readFile ./options.lua}
|
||||||
|
'';
|
||||||
|
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
(lib.mkIf config.neovim.languages.c.enable libclang)
|
||||||
|
(lib.mkIf config.neovim.languages.go.enable gopls)
|
||||||
|
(lib.mkIf config.neovim.languages.nix.enable nil)
|
||||||
|
(lib.mkIf config.neovim.languages.rust.enable rust-analyzer)
|
||||||
|
];
|
||||||
|
|
||||||
|
# Additional packages are added through imports
|
||||||
|
plugins = let
|
||||||
|
lopts = lib.lists.optionals;
|
||||||
|
cfgp = config.neovim.plugins;
|
||||||
|
cfgl = config.neovim.languages;
|
||||||
|
cfgt = config.neovim.themes;
|
||||||
|
|
||||||
|
comments = lopts cfgp.comments.enable (with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = comment-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config = "require(\"Comment\").setup()";
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
fugitive = lopts cfgp.fugitive.enable (with pkgs.vimPlugins; [
|
||||||
|
vim-fugitive
|
||||||
|
]);
|
||||||
|
|
||||||
|
luasnip-pkg = lopts cfgp.luasnip.enable (with pkgs.vimPlugins; [
|
||||||
|
luasnip
|
||||||
|
friendly-snippets
|
||||||
|
(lib.mkIf cfgp.nvimcmp.enable cmp_luasnip)
|
||||||
|
]);
|
||||||
|
|
||||||
|
lualine = lopts cfgp.lualine.enable (with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = lualine-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config = ''
|
||||||
|
require("lualine").setup {
|
||||||
|
options = {
|
||||||
|
icons_enabled = true,
|
||||||
|
'' + lib.strings.optionalString cfgt.catppuccin.enable ''
|
||||||
|
theme = "catppuccin"
|
||||||
|
'' + ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
nvim-web-devicons
|
||||||
|
]);
|
||||||
|
|
||||||
|
nix-pkg = lopts cfgl.nix.enable (with pkgs.vimPlugins; [
|
||||||
|
vim-nix
|
||||||
|
]);
|
||||||
|
|
||||||
|
rust-pkg = lopts cfgl.rust.enable (with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = rustaceanvim;
|
||||||
|
type = "lua";
|
||||||
|
config = ''
|
||||||
|
vim.g.rust_recommended_style = 0
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
go-pkg = lopts cfgl.go.enable (with pkgs.vimPlugins; [
|
||||||
|
go-nvim
|
||||||
|
]);
|
||||||
|
|
||||||
|
typescript-pkg = lopts cfgl.typescript.enable (with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = typescript-tools-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config = ''
|
||||||
|
require("typescript-tools").setup {}
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
catppuccin-pkg = lopts cfgt.catppuccin.enable (with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = catppuccin-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config = ''
|
||||||
|
vim.cmd.colorscheme "catppuccin-mocha"
|
||||||
|
require('catppuccin').setup({
|
||||||
|
integrations = {
|
||||||
|
'' + lib.strings.optionalString cfgp.wiki.enable ''
|
||||||
|
vimwiki = true
|
||||||
|
'' + ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
wiki = lopts cfgp.wiki.enable (with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = vimwiki;
|
||||||
|
type = "lua";
|
||||||
|
config = ''
|
||||||
|
vim.g.vimwiki_list = {
|
||||||
|
{
|
||||||
|
path = '${config.xdg.userDirs.documents}/wiki',
|
||||||
|
links_space_char = '_',
|
||||||
|
ext = '.md',
|
||||||
|
syntax = 'markdown',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
in comments ++ fugitive ++ luasnip-pkg ++ lualine ++ nix-pkg ++ rust-pkg
|
||||||
|
++ go-pkg ++ wiki ++ catppuccin-pkg ++ typescript-pkg;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
60
hmModules/apps/neovim.old/options.lua
Normal file
60
hmModules/apps/neovim.old/options.lua
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
-- Globals
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
vim.g.maplocalleader = ' '
|
||||||
|
vim.opt.list = true
|
||||||
|
vim.bo.filetype = "on"
|
||||||
|
vim.opt.updatetime = 300
|
||||||
|
|
||||||
|
-- Indentations
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.softtabstop = 0
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
vim.opt.smarttab = true
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
|
-- Style
|
||||||
|
vim.opt.colorcolumn = "80"
|
||||||
|
vim.opt.showmatch = true
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
|
-- Easy Split Navigation
|
||||||
|
-- nnoremap <C-J> <C-W><C-J>
|
||||||
|
-- nnoremap <C-K> <C-W><C-K>
|
||||||
|
-- nnoremap <C-L> <C-W><C-L>
|
||||||
|
-- nnoremap <C-H> <C-W><C-H>
|
||||||
|
|
||||||
|
-- Searching
|
||||||
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
|
-- Backups
|
||||||
|
vim.opt.swapfile = false
|
||||||
|
vim.opt.backup = false
|
||||||
|
vim.opt.undofile = true
|
||||||
|
vim.opt.undodir = '/home/pan/.config/nvim/undodir'
|
||||||
|
|
||||||
|
-- Error viewing
|
||||||
|
vim.keymap.set('n', '<Leader>d', function() vim.diagnostic.open_float() end)
|
||||||
|
|
||||||
|
-- Easy copy and pasting to external programs
|
||||||
|
-- map <C-y> "+yy
|
||||||
|
-- map <C-p> "+P
|
||||||
|
|
||||||
|
-- autocmd BufRead,BufNewFile *.md call WritingMode()
|
||||||
|
-- autocmd BufRead,BufNewFile *.tex call WritingMode()
|
||||||
|
-- autocmd BufRead,BufNewFile *.svx call WritingMode()
|
||||||
|
|
||||||
|
-- autocmd BufRead,BufNewFile *.py call PythonMode()
|
||||||
|
|
||||||
|
-- function! WritingMode()
|
||||||
|
-- setlocal textwidth=80
|
||||||
|
-- setlocal wrap linebreak nolist
|
||||||
|
-- setlocal whichwrap+=<,>,h,l
|
||||||
|
-- nnoremap j gj
|
||||||
|
-- nnoremap k gk
|
||||||
|
-- setlocal spell spelllang=en_us
|
||||||
|
-- endfunction
|
||||||
|
-- function! PythonMode()
|
||||||
|
-- setlocal foldmethod=indent
|
||||||
|
-- setlocal foldlevel=99
|
||||||
|
-- endfunction
|
||||||
53
hmModules/apps/neovim.old/plugin/lsp.nix
Normal file
53
hmModules/apps/neovim.old/plugin/lsp.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
config = lib.mkIf config.neovim.enable {
|
||||||
|
programs.neovim.plugins = let
|
||||||
|
cfgp = config.neovim.plugins;
|
||||||
|
cfgl = config.neovim.languages;
|
||||||
|
|
||||||
|
configText = ''
|
||||||
|
local on_attach = function(_, bufnr)
|
||||||
|
|
||||||
|
local bufmap = function(keys, func)
|
||||||
|
vim.keymap.set('n', keys, func, { buffer = bufnr })
|
||||||
|
end
|
||||||
|
|
||||||
|
bufmap('<leader>r', vim.lsp.buf.rename)
|
||||||
|
bufmap('<leader>a', vim.lsp.buf.code_action)
|
||||||
|
|
||||||
|
bufmap('gd', vim.lsp.buf.definition)
|
||||||
|
bufmap('gD', vim.lsp.buf.declaration)
|
||||||
|
bufmap('gI', vim.lsp.buf.implementation)
|
||||||
|
bufmap('<leader>D', vim.lsp.buf.type_definition)
|
||||||
|
|
||||||
|
'' + lib.strings.optionalString cfgp.telescope.enable ''
|
||||||
|
bufmap('gr', require('telescope.builtin').lsp_references)
|
||||||
|
bufmap('<leader>s', require('telescope.builtin').lsp_document_symbols)
|
||||||
|
bufmap('<leader>S', require('telescope.builtin').lsp_dynamic_workspace_symbols)
|
||||||
|
'' + ''
|
||||||
|
|
||||||
|
bufmap('K', vim.lsp.buf.hover)
|
||||||
|
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||||
|
vim.lsp.buf.format()
|
||||||
|
end, {})
|
||||||
|
end
|
||||||
|
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
'' + lib.strings.optionalString cfgl.c.enable ''
|
||||||
|
require('lspconfig').clangd.setup {}
|
||||||
|
'' + lib.strings.optionalString cfgl.go.enable ''
|
||||||
|
require('lspconfig').gopls.setup {}
|
||||||
|
'' + lib.strings.optionalString cfgl.nix.enable ''
|
||||||
|
require('lspconfig').nil_ls.setup {}
|
||||||
|
'';
|
||||||
|
in with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = nvim-lspconfig;
|
||||||
|
type = "lua";
|
||||||
|
config = configText;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
72
hmModules/apps/neovim.old/plugin/nvimcmp.nix
Normal file
72
hmModules/apps/neovim.old/plugin/nvimcmp.nix
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfgp = config.neovim.plugins;
|
||||||
|
in {
|
||||||
|
config = lib.mkIf (config.neovim.enable && cfgp.nvimcmp.enable) {
|
||||||
|
programs.neovim.plugins = let
|
||||||
|
|
||||||
|
configText = ''
|
||||||
|
local cmp = require('cmp')
|
||||||
|
'' + lib.strings.optionalString cfgp.luasnip.enable ''
|
||||||
|
local luasnip = require('luasnip')
|
||||||
|
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
luasnip.config.setup {}
|
||||||
|
'' + ''
|
||||||
|
|
||||||
|
cmp.setup {
|
||||||
|
mapping = cmp.mapping.preset.insert {
|
||||||
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-Space>'] = cmp.mapping.complete {},
|
||||||
|
['<CR>'] = cmp.mapping.confirm {
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = true,
|
||||||
|
},
|
||||||
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
'' + lib.strings.optionalString cfgp.luasnip.enable ''
|
||||||
|
elseif luasnip.expand_or_locally_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
'' + ''
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
'' + lib.strings.optionalString cfgp.luasnip.enable ''
|
||||||
|
elseif luasnip.locally_jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
'' + ''
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
},
|
||||||
|
'' + lib.strings.optionalString cfgp.luasnip.enable ''
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
},
|
||||||
|
'' + ''
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
in with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = nvim-cmp;
|
||||||
|
type = "lua";
|
||||||
|
config = configText;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
43
hmModules/apps/neovim.old/plugin/telescope.nix
Normal file
43
hmModules/apps/neovim.old/plugin/telescope.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfgp = config.neovim.plugins;
|
||||||
|
in {
|
||||||
|
config = lib.mkIf (config.neovim.enable && cfgp.telescope.enable) {
|
||||||
|
programs.neovim.plugins = let
|
||||||
|
configText = ''
|
||||||
|
require('telescope').setup({
|
||||||
|
extensions = {
|
||||||
|
'' + lib.strings.optionalString cfgp.telescope.fzf.enable ''
|
||||||
|
fzf = {
|
||||||
|
fuzzy = true, -- false will only do exact matching
|
||||||
|
override_generic_sorter = true, -- override the generic sorter
|
||||||
|
override_file_sorter = true, -- override the file sorter
|
||||||
|
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||||
|
-- the default case_mode is "smart_case"
|
||||||
|
}
|
||||||
|
'' + ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||||
|
vim.keymap.set('n', '<leader>fg', builtin.git_files, {})
|
||||||
|
|
||||||
|
'' + lib.strings.optionalString cfgp.telescope.fzf.enable ''
|
||||||
|
require('telescope').load_extension('fzf')
|
||||||
|
'';
|
||||||
|
in with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = telescope-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config = configText;
|
||||||
|
}
|
||||||
|
(lib.mkIf cfgp.nvimcmp.enable telescope-fzf-native-nvim)
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
(lib.mkIf cfgp.telescope.fzf.enable fzf)
|
||||||
|
];
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
38
hmModules/apps/neovim.old/plugin/treesitter.nix
Normal file
38
hmModules/apps/neovim.old/plugin/treesitter.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfgp = config.neovim.plugins;
|
||||||
|
cfgl = config.neovim.languages;
|
||||||
|
in {
|
||||||
|
config = lib.mkIf (config.neovim.enable && cfgp.treesitter.enable) {
|
||||||
|
programs.neovim.plugins = let
|
||||||
|
configText = ''
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
|
ensure_installed = {},
|
||||||
|
|
||||||
|
auto_install = false,
|
||||||
|
|
||||||
|
highlight = { enable = true },
|
||||||
|
|
||||||
|
indent = { enable = true },
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# I've tried many things, and can't get treesitter plugins changing
|
||||||
|
# dynamically. For not just have them always loaded regardless of config
|
||||||
|
treeplugs = p: [
|
||||||
|
p.tree-sitter-c
|
||||||
|
p.tree-sitter-go
|
||||||
|
p.tree-sitter-nix
|
||||||
|
p.tree-sitter-rust
|
||||||
|
p.tree-sitter-typescript
|
||||||
|
];
|
||||||
|
in with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = (nvim-treesitter.withPlugins treeplugs);
|
||||||
|
type = "lua";
|
||||||
|
config = configText;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -14,20 +14,27 @@
|
||||||
catppuccin.enable = lib.mkEnableOption "Enables catppuccin theme";
|
catppuccin.enable = lib.mkEnableOption "Enables catppuccin theme";
|
||||||
};
|
};
|
||||||
plugins = {
|
plugins = {
|
||||||
comments.enable = lib.mkOption { default = true; };
|
comments.enable = lib.mkEnableOption "Enables nvim-comment";
|
||||||
fugitive.enable = lib.mkOption { default = true; };
|
fugitive.enable = lib.mkEnableOption "Enables git-fugitive";
|
||||||
lualine.enable = lib.mkOption { default = true; };
|
lualine.enable = lib.mkEnableOption "Enables lualine";
|
||||||
luasnip.enable = lib.mkOption { default = false; };
|
luasnip.enable = lib.mkEnableOption "Enables luasnip snippets";
|
||||||
nvimcmp.enable = lib.mkOption { default = true; };
|
nvimcmp.enable = lib.mkEnableOption "Enables nvim completion";
|
||||||
telescope = {
|
telescope = {
|
||||||
enable = lib.mkOption { default = true; };
|
enable = lib.mkEnableOption "Enables telescope";
|
||||||
fzf.enable = lib.mkOption { default = true; };
|
fzf.enable = lib.mkEnableOption "Enables telescope-fzf";
|
||||||
};
|
};
|
||||||
treesitter.enable = lib.mkOption { default = true; };
|
treesitter.enable = lib.mkEnableOption "Enables treesitter";
|
||||||
wiki.enable = lib.mkOption { default = false; };
|
wiki.enable = lib.mkEnableOption "Enables a wiki";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# imports = [
|
||||||
|
# ./plugin/lsp.nix
|
||||||
|
# ./plugin/nvimcmp.nix
|
||||||
|
# ./plugin/telescope.nix
|
||||||
|
# ./plugin/treesitter.nix
|
||||||
|
# ];
|
||||||
|
|
||||||
config = lib.mkIf config.neovim.enable {
|
config = lib.mkIf config.neovim.enable {
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
EDITOR = "nvim";
|
EDITOR = "nvim";
|
||||||
|
|
@ -38,60 +45,18 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
viAlias = true;
|
viAlias = true;
|
||||||
vimAlias = true;
|
vimAlias = true;
|
||||||
|
vimdiffAlias = true;
|
||||||
globals = {
|
|
||||||
mapleader = " ";
|
|
||||||
maplocalleader = " ";
|
|
||||||
rust_recommended_style = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
opts = {
|
|
||||||
list = true;
|
|
||||||
updatetime = 750;
|
|
||||||
|
|
||||||
tabstop = 2;
|
|
||||||
softtabstop = 0;
|
|
||||||
shiftwidth = 2;
|
|
||||||
smarttab = true;
|
|
||||||
expandtab = true;
|
|
||||||
|
|
||||||
colorcolumn = "81";
|
|
||||||
showmatch = true;
|
|
||||||
number = true;
|
|
||||||
relativenumber = true;
|
|
||||||
|
|
||||||
swapfile = false;
|
|
||||||
backup = false;
|
|
||||||
undofile = true;
|
|
||||||
undodir = "${config.xdg.configHome}/nvim/undodir";
|
|
||||||
|
|
||||||
smartcase = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
keymaps = [
|
|
||||||
{
|
|
||||||
key = "<leader>d";
|
|
||||||
mode = "n";
|
|
||||||
action = "vim.diagnostic.open_float()";
|
|
||||||
}
|
|
||||||
# -- Easy Split Navigation
|
|
||||||
# -- nnoremap <C-J> <C-W><C-J>
|
|
||||||
# -- nnoremap <C-K> <C-W><C-K>
|
|
||||||
# -- nnoremap <C-L> <C-W><C-L>
|
|
||||||
# -- nnoremap <C-H> <C-W><C-H>
|
|
||||||
#
|
|
||||||
# -- Easy copy and pasting to external programs
|
|
||||||
# -- map <C-y> "+yy
|
|
||||||
# -- map <C-p> "+P
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
# extraLuaConfig = ''
|
||||||
|
# ${builtins.readFile ./options.lua}
|
||||||
|
# '';
|
||||||
|
|
||||||
programs.nixvim.colorschemes = with config.neovim.themes; {
|
programs.nixvim.colorschemes = with config.neovim.themes; {
|
||||||
catppuccin = lib.mkIf catppuccin.enable {
|
catppuccin = lib.mkIf catppuccin.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
flavour = "mocha";
|
flavour = "mocha";
|
||||||
integrations.vimwiki = lib.mkIf wiki.enable true;
|
integrations.vimwiki = lib.mkIf wiki.enable true;
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.nixvim.plugins = with config.neovim.plugins; {
|
programs.nixvim.plugins = with config.neovim.plugins; {
|
||||||
|
|
@ -111,115 +76,79 @@
|
||||||
cmp = {
|
cmp = {
|
||||||
enable = nvimcmp.enable;
|
enable = nvimcmp.enable;
|
||||||
autoEnableSources = true;
|
autoEnableSources = true;
|
||||||
settings.sources = [
|
settings.sources = lib.options luasnip.enable { name = "cmp-luasnip" };
|
||||||
{ name = "nvim_lsp"; }
|
|
||||||
{ name = "path"; }
|
|
||||||
{ name = "buffer"; }
|
|
||||||
] ++ lib.optional luasnip.enable { name = "cmp-luasnip"; };
|
|
||||||
|
|
||||||
mapping = {
|
|
||||||
"<C-Space>" = "cmp.mapping.complete {}";
|
|
||||||
"<CR>" = "cmp.mapping.confirm {
|
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
|
||||||
select = true,
|
|
||||||
}";
|
|
||||||
"<Tab>" = {
|
|
||||||
actions = ''
|
|
||||||
function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
'' + lib.optionalString luasnip.enable ''
|
|
||||||
elseif luasnip.expand_or_locally_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
'' + ''
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
modes = [ "i" "s" ];
|
|
||||||
};
|
|
||||||
"<S-Tab>" = {
|
|
||||||
actions = ''
|
|
||||||
function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
'' + lib.optionalString luasnip.enable ''
|
|
||||||
elseif luasnip.locally_jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
'' + ''
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
modes = [ "i" "s" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
telescope = {
|
|
||||||
enable = telescope.enable;
|
|
||||||
keymaps = {
|
|
||||||
"<leader>ff" = "find_files";
|
|
||||||
"<leader>fg" = "git_files";
|
|
||||||
};
|
|
||||||
extensions = {
|
|
||||||
fzf = lib.mkIf telescope.fzf.enable {
|
|
||||||
enable = true;
|
|
||||||
fuzzy = true;
|
|
||||||
override_generic_sorter = true;
|
|
||||||
override_file_sorter = true;
|
|
||||||
case_mode = "smart_case";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
treesitter = {
|
|
||||||
enable = treesitter.enable;
|
|
||||||
highlight.enable = true;
|
|
||||||
indent.enable = true;
|
|
||||||
folding.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
vimwiki = {
|
|
||||||
enable = wiki.enable;
|
# telescope = {
|
||||||
list = [
|
# enable = lib.mkEnableOption "Enables telescope";
|
||||||
{
|
# fzf.enable = lib.mkEnableOption "Enables telescope-fzf";
|
||||||
path = "${config.xdg.userDirs.documents}/wiki";
|
# };
|
||||||
links_space_char = "_";
|
# treesitter.enable = lib.mkEnableOption "Enables treesitter";
|
||||||
ext = ".md";
|
# wiki.enable = lib.mkEnableOption "Enables a wiki";
|
||||||
syntax = "markdown";
|
#
|
||||||
|
#
|
||||||
|
# wiki = lopts cfgp.wiki.enable (with pkgs.vimPlugins; [
|
||||||
|
# {
|
||||||
|
# plugin = vimwiki;
|
||||||
|
# type = "lua";
|
||||||
|
# config = ''
|
||||||
|
# vim.g.vimwiki_list = {
|
||||||
|
# {
|
||||||
|
# path = '${config.xdg.userDirs.documents}/wiki',
|
||||||
|
# links_space_char = '_',
|
||||||
|
# ext = '.md',
|
||||||
|
# syntax = 'markdown',
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# '';
|
||||||
|
# }
|
||||||
|
# ]);
|
||||||
}
|
}
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
nvim-lspconfig.enable = true;
|
# extraPackages = with pkgs; [
|
||||||
nix.enable = config.neovim.languages.nix.enable;
|
# (lib.mkIf config.neovim.languages.c.enable libclang)
|
||||||
rustaceanvim.enable = config.neovim.languages.rust.enable;
|
# (lib.mkIf config.neovim.languages.go.enable gopls)
|
||||||
typsecript-tools.enable = config.neovim.languages.typescript.enable;
|
# (lib.mkIf config.neovim.languages.nix.enable nil)
|
||||||
};
|
# (lib.mkIf config.neovim.languages.rust.enable rust-analyzer)
|
||||||
|
# ];
|
||||||
programs.nixvim.lsp = {
|
#
|
||||||
enable = true;
|
# # Additional packages are added through imports
|
||||||
servers = with config.neovim.languages; {
|
# plugins = let
|
||||||
clangd.enable = c.enable;
|
# lopts = lib.lists.optionals;
|
||||||
gopls.enable = go.enable;
|
# cfgp = config.neovim.plugins;
|
||||||
nil_ls.enable = nix.enable;
|
# cfgl = config.neovim.languages;
|
||||||
rust_analyzer.enable = rust.enable;
|
# cfgt = config.neovim.themes;
|
||||||
tsserver.enable = typescript.enable;
|
#
|
||||||
};
|
# nix-pkg = lopts cfgl.nix.enable (with pkgs.vimPlugins; [
|
||||||
keymaps = [
|
# vim-nix
|
||||||
{ key = "gd"; lspBufAction = "definition"; }
|
# ]);
|
||||||
{ key = "gD"; lspBufAction = "declaration"; }
|
#
|
||||||
{ key = "gi"; lspBufAction = "implementation"; }
|
# rust-pkg = lopts cfgl.rust.enable (with pkgs.vimPlugins; [
|
||||||
{ key = "gt"; lspBufAction = "type_definition"; }
|
# {
|
||||||
{ key = "K"; lspBufAction = "hover"; }
|
# plugin = rustaceanvim;
|
||||||
] ++ lib.optional config.neovim.plugins.telescope.enable {
|
# type = "lua";
|
||||||
key = "gr";
|
# config = ''
|
||||||
action = config.lib.nixvim.mkRaw
|
# vim.g.rust_recommended_style = 0
|
||||||
"require('telescope.builtin').lsp_references";
|
# '';
|
||||||
};
|
# }
|
||||||
};
|
# ]);
|
||||||
|
#
|
||||||
|
# go-pkg = lopts cfgl.go.enable (with pkgs.vimPlugins; [
|
||||||
|
# go-nvim
|
||||||
|
# ]);
|
||||||
|
#
|
||||||
|
# typescript-pkg = lopts cfgl.typescript.enable (with pkgs.vimPlugins; [
|
||||||
|
# {
|
||||||
|
# plugin = typescript-tools-nvim;
|
||||||
|
# type = "lua";
|
||||||
|
# config = ''
|
||||||
|
# require("typescript-tools").setup {}
|
||||||
|
# '';
|
||||||
|
# }
|
||||||
|
# ]);
|
||||||
|
# };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
60
hmModules/apps/neovim/options.lua
Normal file
60
hmModules/apps/neovim/options.lua
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
-- Globals
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
vim.g.maplocalleader = ' '
|
||||||
|
vim.opt.list = true
|
||||||
|
vim.bo.filetype = "on"
|
||||||
|
vim.opt.updatetime = 300
|
||||||
|
|
||||||
|
-- Indentations
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.softtabstop = 0
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
vim.opt.smarttab = true
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
|
-- Style
|
||||||
|
vim.opt.colorcolumn = "80"
|
||||||
|
vim.opt.showmatch = true
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
|
-- Easy Split Navigation
|
||||||
|
-- nnoremap <C-J> <C-W><C-J>
|
||||||
|
-- nnoremap <C-K> <C-W><C-K>
|
||||||
|
-- nnoremap <C-L> <C-W><C-L>
|
||||||
|
-- nnoremap <C-H> <C-W><C-H>
|
||||||
|
|
||||||
|
-- Searching
|
||||||
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
|
-- Backups
|
||||||
|
vim.opt.swapfile = false
|
||||||
|
vim.opt.backup = false
|
||||||
|
vim.opt.undofile = true
|
||||||
|
vim.opt.undodir = '/home/pan/.config/nvim/undodir'
|
||||||
|
|
||||||
|
-- Error viewing
|
||||||
|
vim.keymap.set('n', '<Leader>d', function() vim.diagnostic.open_float() end)
|
||||||
|
|
||||||
|
-- Easy copy and pasting to external programs
|
||||||
|
-- map <C-y> "+yy
|
||||||
|
-- map <C-p> "+P
|
||||||
|
|
||||||
|
-- autocmd BufRead,BufNewFile *.md call WritingMode()
|
||||||
|
-- autocmd BufRead,BufNewFile *.tex call WritingMode()
|
||||||
|
-- autocmd BufRead,BufNewFile *.svx call WritingMode()
|
||||||
|
|
||||||
|
-- autocmd BufRead,BufNewFile *.py call PythonMode()
|
||||||
|
|
||||||
|
-- function! WritingMode()
|
||||||
|
-- setlocal textwidth=80
|
||||||
|
-- setlocal wrap linebreak nolist
|
||||||
|
-- setlocal whichwrap+=<,>,h,l
|
||||||
|
-- nnoremap j gj
|
||||||
|
-- nnoremap k gk
|
||||||
|
-- setlocal spell spelllang=en_us
|
||||||
|
-- endfunction
|
||||||
|
-- function! PythonMode()
|
||||||
|
-- setlocal foldmethod=indent
|
||||||
|
-- setlocal foldlevel=99
|
||||||
|
-- endfunction
|
||||||
53
hmModules/apps/neovim/plugin/lsp.nix
Normal file
53
hmModules/apps/neovim/plugin/lsp.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
config = lib.mkIf config.neovim.enable {
|
||||||
|
programs.neovim.plugins = let
|
||||||
|
cfgp = config.neovim.plugins;
|
||||||
|
cfgl = config.neovim.languages;
|
||||||
|
|
||||||
|
configText = ''
|
||||||
|
local on_attach = function(_, bufnr)
|
||||||
|
|
||||||
|
local bufmap = function(keys, func)
|
||||||
|
vim.keymap.set('n', keys, func, { buffer = bufnr })
|
||||||
|
end
|
||||||
|
|
||||||
|
bufmap('<leader>r', vim.lsp.buf.rename)
|
||||||
|
bufmap('<leader>a', vim.lsp.buf.code_action)
|
||||||
|
|
||||||
|
bufmap('gd', vim.lsp.buf.definition)
|
||||||
|
bufmap('gD', vim.lsp.buf.declaration)
|
||||||
|
bufmap('gI', vim.lsp.buf.implementation)
|
||||||
|
bufmap('<leader>D', vim.lsp.buf.type_definition)
|
||||||
|
|
||||||
|
'' + lib.strings.optionalString cfgp.telescope.enable ''
|
||||||
|
bufmap('gr', require('telescope.builtin').lsp_references)
|
||||||
|
bufmap('<leader>s', require('telescope.builtin').lsp_document_symbols)
|
||||||
|
bufmap('<leader>S', require('telescope.builtin').lsp_dynamic_workspace_symbols)
|
||||||
|
'' + ''
|
||||||
|
|
||||||
|
bufmap('K', vim.lsp.buf.hover)
|
||||||
|
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||||
|
vim.lsp.buf.format()
|
||||||
|
end, {})
|
||||||
|
end
|
||||||
|
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
'' + lib.strings.optionalString cfgl.c.enable ''
|
||||||
|
require('lspconfig').clangd.setup {}
|
||||||
|
'' + lib.strings.optionalString cfgl.go.enable ''
|
||||||
|
require('lspconfig').gopls.setup {}
|
||||||
|
'' + lib.strings.optionalString cfgl.nix.enable ''
|
||||||
|
require('lspconfig').nil_ls.setup {}
|
||||||
|
'';
|
||||||
|
in with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = nvim-lspconfig;
|
||||||
|
type = "lua";
|
||||||
|
config = configText;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
72
hmModules/apps/neovim/plugin/nvimcmp.nix
Normal file
72
hmModules/apps/neovim/plugin/nvimcmp.nix
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfgp = config.neovim.plugins;
|
||||||
|
in {
|
||||||
|
config = lib.mkIf (config.neovim.enable && cfgp.nvimcmp.enable) {
|
||||||
|
programs.neovim.plugins = let
|
||||||
|
|
||||||
|
configText = ''
|
||||||
|
local cmp = require('cmp')
|
||||||
|
'' + lib.strings.optionalString cfgp.luasnip.enable ''
|
||||||
|
local luasnip = require('luasnip')
|
||||||
|
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
luasnip.config.setup {}
|
||||||
|
'' + ''
|
||||||
|
|
||||||
|
cmp.setup {
|
||||||
|
mapping = cmp.mapping.preset.insert {
|
||||||
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-Space>'] = cmp.mapping.complete {},
|
||||||
|
['<CR>'] = cmp.mapping.confirm {
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = true,
|
||||||
|
},
|
||||||
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
'' + lib.strings.optionalString cfgp.luasnip.enable ''
|
||||||
|
elseif luasnip.expand_or_locally_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
'' + ''
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
'' + lib.strings.optionalString cfgp.luasnip.enable ''
|
||||||
|
elseif luasnip.locally_jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
'' + ''
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
},
|
||||||
|
'' + lib.strings.optionalString cfgp.luasnip.enable ''
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
},
|
||||||
|
'' + ''
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
in with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = nvim-cmp;
|
||||||
|
type = "lua";
|
||||||
|
config = configText;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
43
hmModules/apps/neovim/plugin/telescope.nix
Normal file
43
hmModules/apps/neovim/plugin/telescope.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfgp = config.neovim.plugins;
|
||||||
|
in {
|
||||||
|
config = lib.mkIf (config.neovim.enable && cfgp.telescope.enable) {
|
||||||
|
programs.neovim.plugins = let
|
||||||
|
configText = ''
|
||||||
|
require('telescope').setup({
|
||||||
|
extensions = {
|
||||||
|
'' + lib.strings.optionalString cfgp.telescope.fzf.enable ''
|
||||||
|
fzf = {
|
||||||
|
fuzzy = true, -- false will only do exact matching
|
||||||
|
override_generic_sorter = true, -- override the generic sorter
|
||||||
|
override_file_sorter = true, -- override the file sorter
|
||||||
|
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||||
|
-- the default case_mode is "smart_case"
|
||||||
|
}
|
||||||
|
'' + ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||||
|
vim.keymap.set('n', '<leader>fg', builtin.git_files, {})
|
||||||
|
|
||||||
|
'' + lib.strings.optionalString cfgp.telescope.fzf.enable ''
|
||||||
|
require('telescope').load_extension('fzf')
|
||||||
|
'';
|
||||||
|
in with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = telescope-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config = configText;
|
||||||
|
}
|
||||||
|
(lib.mkIf cfgp.nvimcmp.enable telescope-fzf-native-nvim)
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
(lib.mkIf cfgp.telescope.fzf.enable fzf)
|
||||||
|
];
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
38
hmModules/apps/neovim/plugin/treesitter.nix
Normal file
38
hmModules/apps/neovim/plugin/treesitter.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfgp = config.neovim.plugins;
|
||||||
|
cfgl = config.neovim.languages;
|
||||||
|
in {
|
||||||
|
config = lib.mkIf (config.neovim.enable && cfgp.treesitter.enable) {
|
||||||
|
programs.neovim.plugins = let
|
||||||
|
configText = ''
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
|
ensure_installed = {},
|
||||||
|
|
||||||
|
auto_install = false,
|
||||||
|
|
||||||
|
highlight = { enable = true },
|
||||||
|
|
||||||
|
indent = { enable = true },
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# I've tried many things, and can't get treesitter plugins changing
|
||||||
|
# dynamically. For not just have them always loaded regardless of config
|
||||||
|
treeplugs = p: [
|
||||||
|
p.tree-sitter-c
|
||||||
|
p.tree-sitter-go
|
||||||
|
p.tree-sitter-nix
|
||||||
|
p.tree-sitter-rust
|
||||||
|
p.tree-sitter-typescript
|
||||||
|
];
|
||||||
|
in with pkgs.vimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = (nvim-treesitter.withPlugins treeplugs);
|
||||||
|
type = "lua";
|
||||||
|
config = configText;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
# "DP-2" = [
|
# "DP-2" = [
|
||||||
|
|
@ -66,18 +66,28 @@
|
||||||
mpv.enable = true;
|
mpv.enable = true;
|
||||||
zathura.enable = true;
|
zathura.enable = true;
|
||||||
feh.enable = true;
|
feh.enable = true;
|
||||||
beets.enable = true;
|
|
||||||
|
|
||||||
neovim = {
|
neovim.enable = true;
|
||||||
enable = true;
|
neovim.languages = {
|
||||||
languages = {
|
|
||||||
c.enable = true;
|
c.enable = true;
|
||||||
nix.enable = true;
|
nix.enable = true;
|
||||||
rust.enable = true;
|
rust.enable = true;
|
||||||
typescript.enable = true;
|
typescript.enable = true;
|
||||||
};
|
};
|
||||||
themes.catppuccin.enable = true;
|
neovim.plugins = {
|
||||||
|
comments.enable = true;
|
||||||
|
fugitive.enable = true;
|
||||||
|
lualine.enable = true;
|
||||||
|
luasnip.enable = true;
|
||||||
|
nvimcmp.enable = true;
|
||||||
|
telescope = {
|
||||||
|
enable = true;
|
||||||
|
fzf.enable = true;
|
||||||
};
|
};
|
||||||
|
treesitter.enable = true;
|
||||||
|
wiki.enable = true;
|
||||||
|
};
|
||||||
|
neovim.themes.catppuccin.enable = true;
|
||||||
|
|
||||||
lf.enable = true;
|
lf.enable = true;
|
||||||
lf.hiddenfiles = [
|
lf.hiddenfiles = [
|
||||||
|
|
@ -93,6 +103,7 @@
|
||||||
|
|
||||||
gimp.enable = true;
|
gimp.enable = true;
|
||||||
|
|
||||||
|
beeper.enable = true;
|
||||||
discord.enable = true;
|
discord.enable = true;
|
||||||
|
|
||||||
lutris.enable = true;
|
lutris.enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue