[feat] Add easy way to switch between lazy.nvim vs nixneovim
This commit is contained in:
@@ -2,14 +2,15 @@
|
|||||||
let
|
let
|
||||||
start-tmux = (import ../scripts/start-tmux.nix) pkgs;
|
start-tmux = (import ../scripts/start-tmux.nix) pkgs;
|
||||||
# https://mipmip.github.io/home-manager-option-search/
|
# https://mipmip.github.io/home-manager-option-search/
|
||||||
in {
|
lazy = true;
|
||||||
|
in
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
# Include the results of the hardware scan.
|
# Include the results of the hardware scan.
|
||||||
./tmux.nix
|
./tmux.nix
|
||||||
./wezterm.nix
|
./wezterm.nix
|
||||||
./nvim.nix
|
] ++ (if device.isLinux then [ ../linux ] else [ ])
|
||||||
|
++ (if !lazy then [ ./nvim ] else [ ]);
|
||||||
] ++ (if device.isLinux then [ ../linux ] else [ ]);
|
|
||||||
|
|
||||||
home.packages = with pkgs;
|
home.packages = with pkgs;
|
||||||
[
|
[
|
||||||
@@ -38,6 +39,7 @@ in {
|
|||||||
neovim-nightly
|
neovim-nightly
|
||||||
nil
|
nil
|
||||||
pkg-config
|
pkg-config
|
||||||
|
lua-language-server
|
||||||
# neovim
|
# neovim
|
||||||
(nerdfonts.override { fonts = [ "Hasklig" ]; })
|
(nerdfonts.override { fonts = [ "Hasklig" ]; })
|
||||||
mpv
|
mpv
|
||||||
@@ -121,12 +123,14 @@ in {
|
|||||||
enable = true;
|
enable = true;
|
||||||
enableFishIntegration = true;
|
enableFishIntegration = true;
|
||||||
enableNushellIntegration = true;
|
enableNushellIntegration = true;
|
||||||
settings = let flavour = "mocha"; # Replace with your preferred palette
|
settings =
|
||||||
|
let flavour = "mocha"; # Replace with your preferred palette
|
||||||
in {
|
in {
|
||||||
# Other config here
|
# Other config here
|
||||||
format = "$all"; # Remove this line to disable the default prompt format
|
format = "$all"; # Remove this line to disable the default prompt format
|
||||||
palette = "catppuccin_${flavour}";
|
palette = "catppuccin_${flavour}";
|
||||||
} // builtins.fromTOML (builtins.readFile (pkgs.fetchFromGitHub {
|
} // builtins.fromTOML (builtins.readFile (pkgs.fetchFromGitHub
|
||||||
|
{
|
||||||
owner = "catppuccin";
|
owner = "catppuccin";
|
||||||
repo = "starship";
|
repo = "starship";
|
||||||
rev = "main"; # Replace with the latest commit hash
|
rev = "main"; # Replace with the latest commit hash
|
||||||
@@ -159,7 +163,8 @@ in {
|
|||||||
enable = true;
|
enable = true;
|
||||||
config = { theme = "catppuccin"; };
|
config = { theme = "catppuccin"; };
|
||||||
themes = {
|
themes = {
|
||||||
catppuccin = let flavor = "mocha";
|
catppuccin =
|
||||||
|
let flavor = "mocha";
|
||||||
in {
|
in {
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "catppuccin";
|
owner = "catppuccin";
|
||||||
@@ -181,7 +186,8 @@ in {
|
|||||||
# Home Manager needs a bit of information about you and the paths it should
|
# Home Manager needs a bit of information about you and the paths it should
|
||||||
# manage.
|
# manage.
|
||||||
username = device.user;
|
username = device.user;
|
||||||
homeDirectory = if device.isMac then
|
homeDirectory =
|
||||||
|
if device.isMac then
|
||||||
lib.mkForce "/Users/${device.user}"
|
lib.mkForce "/Users/${device.user}"
|
||||||
else
|
else
|
||||||
lib.mkForce "/home/${device.user}";
|
lib.mkForce "/home/${device.user}";
|
||||||
@@ -190,8 +196,6 @@ in {
|
|||||||
|
|
||||||
file = {
|
file = {
|
||||||
".config/tmux/sessions".source = ../../tmux/sessions;
|
".config/tmux/sessions".source = ../../tmux/sessions;
|
||||||
# ".config/nvim/lua".source = ../../nvim/lua;
|
|
||||||
# ".config/nvim/init.lua".source = ../../nvim/init.lua;
|
|
||||||
".config/macchina".source = ../../macchina;
|
".config/macchina".source = ../../macchina;
|
||||||
|
|
||||||
# # You can also set the file content immediately.
|
# # You can also set the file content immediately.
|
||||||
@@ -199,7 +203,10 @@ in {
|
|||||||
# org.gradle.console=verbose
|
# org.gradle.console=verbose
|
||||||
# org.gradle.daemon.idletimeout=3600000
|
# org.gradle.daemon.idletimeout=3600000
|
||||||
# '';
|
# '';
|
||||||
};
|
} // (if lazy then {
|
||||||
|
".config/nvim/lua".source = ../../nvim/lua;
|
||||||
|
".config/nvim/init.lua".source = ../../nvim/init.lua;
|
||||||
|
} else { });
|
||||||
|
|
||||||
sessionVariables = {
|
sessionVariables = {
|
||||||
EDITOR = "nvim";
|
EDITOR = "nvim";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ pkgs, inputs, ... }: {
|
{ pkgs, config, inputs, ... }: {
|
||||||
imports = [ inputs.nixneovim.nixosModules.default ];
|
imports = [ inputs.nixneovim.nixosModules.default ];
|
||||||
programs.nixneovim = {
|
programs.nixneovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -15,13 +15,14 @@
|
|||||||
smartcase = true;
|
smartcase = true;
|
||||||
termguicolors = true;
|
termguicolors = true;
|
||||||
signcolumn = "yes";
|
signcolumn = "yes";
|
||||||
# "opt.list" = true;
|
|
||||||
wrap = true;
|
wrap = true;
|
||||||
|
completeopt = "menu,menuone,popup,noselect";
|
||||||
|
undodir = "${config.xdg.cacheHome}/undodir";
|
||||||
|
undofile = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
mapleader = " ";
|
mapleader = " ";
|
||||||
#copilot_no_tab_map = true;
|
|
||||||
};
|
};
|
||||||
plugins = {
|
plugins = {
|
||||||
lspconfig = {
|
lspconfig = {
|
||||||
@@ -44,52 +45,58 @@
|
|||||||
},
|
},
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
lua-language-server = {
|
lua-language-server = { enable = true; };
|
||||||
enable = true;
|
};
|
||||||
onAttachExtra = ''
|
extraLua.pre = ''
|
||||||
local lspconfig = require 'lspconfig'
|
|
||||||
local lsp_zero = require'lsp-zero'
|
local lsp_zero = require'lsp-zero'
|
||||||
local lua_opts = lsp_zero.nvim_lua_ls()
|
local lspconfig = require 'lspconfig'
|
||||||
lspconfig.lua_ls.setup(lua_opts)
|
lsp_zero.on_attach(function(client, bufnr)
|
||||||
'';
|
lsp_zero.default_keymaps({buffer = bufnr})
|
||||||
};
|
if client.server_capabilities.inlayHintProvider then
|
||||||
};
|
|
||||||
onAttach = ''
|
|
||||||
vim.lsp.inlay_hint.enable(bufnr, true)
|
vim.lsp.inlay_hint.enable(bufnr, true)
|
||||||
|
end
|
||||||
|
end)
|
||||||
'';
|
'';
|
||||||
|
# extraLua.post = ''
|
||||||
|
# vim.lsp.inlay_hint.enable(bufnr, true)
|
||||||
|
# '';
|
||||||
};
|
};
|
||||||
|
|
||||||
todo-comments.enable = true;
|
todo-comments.enable = true;
|
||||||
lualine.enable = true;
|
lualine.enable = true;
|
||||||
commentary.enable = true;
|
commentary.enable = true;
|
||||||
surround.enable = true;
|
surround.enable = true;
|
||||||
|
which-key.enable = true;
|
||||||
|
|
||||||
treesitter = {
|
treesitter = {
|
||||||
enable = true;
|
enable = true;
|
||||||
indent = true;
|
indent = true;
|
||||||
};
|
};
|
||||||
telescope = {
|
|
||||||
enable = true;
|
|
||||||
extensions = {
|
|
||||||
manix.enable = true;
|
|
||||||
# plenary.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
nvim-cmp = {
|
nvim-cmp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
completion = {
|
completion = { completeopt = "menu,menuone,popup,noselect"; };
|
||||||
completeopt = "menu,menuone,popup,noselect";
|
window = {
|
||||||
|
completion = { border = "rounded"; };
|
||||||
|
documentation = { border = "rounded"; };
|
||||||
};
|
};
|
||||||
sources = {
|
sources = {
|
||||||
nvim_lsp.enable = true;
|
nvim_lsp.enable = true;
|
||||||
luasnip.enable = true;
|
luasnip.enable = true;
|
||||||
buffer.enable = true;
|
buffer.enable = true;
|
||||||
path.enable = true;
|
path.enable = true;
|
||||||
cmdline.enable = true;
|
|
||||||
#copilot.enable = true;
|
|
||||||
git.enable = true;
|
git.enable = true;
|
||||||
|
cmdline.enable = true;
|
||||||
};
|
};
|
||||||
|
mappingPresets = [ "insert" ];
|
||||||
|
mapping = {
|
||||||
|
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
||||||
|
"<C-y>" = "cmp.mapping.complete()";
|
||||||
|
"<C-n>" = "cmp.config.next";
|
||||||
|
"<C-p>" = "cmp.config.prev";
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
snippet.luasnip.enable = true;
|
snippet.luasnip.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -104,35 +111,44 @@
|
|||||||
normal = {
|
normal = {
|
||||||
"<leader>ff" = "require'telescope.builtin'.find_files";
|
"<leader>ff" = "require'telescope.builtin'.find_files";
|
||||||
"<leader>gg" = "require'telescope.builtin'.live_grep";
|
"<leader>gg" = "require'telescope.builtin'.live_grep";
|
||||||
"<leader>mm" = "require'telescope-manix'.search";
|
|
||||||
"<leader>;" = "require'telescope.builtin'.buffers";
|
"<leader>;" = "require'telescope.builtin'.buffers";
|
||||||
|
"<leader>\\\"" = ''[["+]]'';
|
||||||
"<leader><leader>" = "'<c-^>'";
|
"<leader><leader>" = "'<c-^>'";
|
||||||
"vff" = "'<cmd>vertical Gdiffsplit<cr>'";
|
"vff" = "'<cmd>vertical Gdiffsplit<cr>'";
|
||||||
"<C-k>" = "vim.lsp.buf.definition";
|
"<C-k>" = "vim.lsp.buf.definition";
|
||||||
"gi" = "vim.lsp.buf.implementation";
|
"gi" = "vim.lsp.buf.implementation";
|
||||||
"<leader>a" = "vim.lsp.buf.code_action";
|
"<leader>a" = "vim.lsp.buf.code_action";
|
||||||
"F" = "function() vim.lsp.buf.format({ async = true }) end";
|
"F" = "function() vim.lsp.buf.format({ async = true }) end";
|
||||||
# "<C-l>" = ''copilot#Accept("<CR>")'';
|
"<C-l>" = "'copilot#Accept(\"<CR>\")'";
|
||||||
|
"<leader>q" = "[[<cmd>bw<cr>]]";
|
||||||
|
"<leader>n" = "[[<cmd>bnext<cr>]]";
|
||||||
|
"<leader>p" = "[[<cmd>bprev<cr>]]";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
extraPlugins =
|
extraPlugins = let
|
||||||
let
|
|
||||||
comfortable-motion = pkgs.fetchFromGitHub {
|
comfortable-motion = pkgs.fetchFromGitHub {
|
||||||
owner = "yuttie";
|
owner = "yuttie";
|
||||||
repo = "comfortable-motion.vim";
|
repo = "comfortable-motion.vim";
|
||||||
rev = "master";
|
rev = "master";
|
||||||
sha256 = "sha256-S1LJXmShhpCJIg/FEPx3jFbmPpS/1U4MAQN2RY/nkI0";
|
sha256 = "sha256-S1LJXmShhpCJIg/FEPx3jFbmPpS/1U4MAQN2RY/nkI0";
|
||||||
};
|
};
|
||||||
in
|
in [
|
||||||
[
|
|
||||||
comfortable-motion
|
comfortable-motion
|
||||||
|
pkgs.vimPlugins.vim-abolish
|
||||||
|
pkgs.vimPlugins.telescope-nvim
|
||||||
|
pkgs.vimPlugins.telescope-ui-select-nvim
|
||||||
|
pkgs.vimPlugins.telescope-fzf-native-nvim
|
||||||
|
pkgs.vimPlugins.telescope-file-browser-nvim
|
||||||
pkgs.vimExtraPlugins.rustaceanvim
|
pkgs.vimExtraPlugins.rustaceanvim
|
||||||
pkgs.vimExtraPlugins.cmp-nvim-lsp
|
pkgs.vimExtraPlugins.cmp-nvim-lsp
|
||||||
pkgs.vimExtraPlugins.fidget-nvim
|
pkgs.vimExtraPlugins.fidget-nvim
|
||||||
pkgs.vimExtraPlugins.rest-nvim
|
pkgs.vimExtraPlugins.copilot-lua
|
||||||
pkgs.vimExtraPlugins.lsp-zero-nvim
|
pkgs.vimExtraPlugins.lsp-zero-nvim
|
||||||
pkgs.vimPlugins.vim-abolish
|
pkgs.vimExtraPlugins.rest-nvim
|
||||||
];
|
];
|
||||||
|
extraConfigLua = builtins.readFile ./extraConfig.lua;
|
||||||
|
package = pkgs.neovim-nightly;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
74
config/nix/common/nvim/extraConfig.lua
Normal file
74
config/nix/common/nvim/extraConfig.lua
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
vim.g.rustaceanvim = {
|
||||||
|
server = {
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
if client.server_capabilities.inlayHintProvider then
|
||||||
|
vim.lsp.inlay_hint.enable(bufnr, true)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
dap = {
|
||||||
|
autoload_configurations = false
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require("copilot").setup({
|
||||||
|
suggestion = {
|
||||||
|
enabled = true,
|
||||||
|
auto_trigger = true,
|
||||||
|
keymap = {
|
||||||
|
accept = "<C-l>",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
panel = { enabled = true },
|
||||||
|
})
|
||||||
|
|
||||||
|
require 'fidget'.setup()
|
||||||
|
|
||||||
|
local cmp = require 'cmp'
|
||||||
|
cmp.setup.cmdline({ '/', '?' }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline {
|
||||||
|
['<C-n>'] = cmp.config.disable,
|
||||||
|
['<C-p>'] = cmp.config.disable,
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
mapping = cmp.mapping.preset.cmdline {
|
||||||
|
['<C-n>'] = cmp.config.disable,
|
||||||
|
['<C-p>'] = cmp.config.disable,
|
||||||
|
},
|
||||||
|
-- mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
}, {
|
||||||
|
{ name = 'cmdline' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.filetype('gitcommit', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
require('telescope').setup {
|
||||||
|
defaults = {
|
||||||
|
initial_mode = 'insert',
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require("telescope").load_extension("ui-select")
|
||||||
|
require('telescope').load_extension("fzf")
|
||||||
|
require('telescope').load_extension("file_browser")
|
||||||
Reference in New Issue
Block a user