[feat] Add easy way to switch between lazy.nvim vs nixneovim
This commit is contained in:
@@ -2,14 +2,15 @@
|
||||
let
|
||||
start-tmux = (import ../scripts/start-tmux.nix) pkgs;
|
||||
# https://mipmip.github.io/home-manager-option-search/
|
||||
in {
|
||||
lazy = true;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./tmux.nix
|
||||
./wezterm.nix
|
||||
./nvim.nix
|
||||
|
||||
] ++ (if device.isLinux then [ ../linux ] else [ ]);
|
||||
] ++ (if device.isLinux then [ ../linux ] else [ ])
|
||||
++ (if !lazy then [ ./nvim ] else [ ]);
|
||||
|
||||
home.packages = with pkgs;
|
||||
[
|
||||
@@ -38,6 +39,7 @@ in {
|
||||
neovim-nightly
|
||||
nil
|
||||
pkg-config
|
||||
lua-language-server
|
||||
# neovim
|
||||
(nerdfonts.override { fonts = [ "Hasklig" ]; })
|
||||
mpv
|
||||
@@ -121,17 +123,19 @@ in {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
enableNushellIntegration = true;
|
||||
settings = let flavour = "mocha"; # Replace with your preferred palette
|
||||
in {
|
||||
# Other config here
|
||||
format = "$all"; # Remove this line to disable the default prompt format
|
||||
palette = "catppuccin_${flavour}";
|
||||
} // builtins.fromTOML (builtins.readFile (pkgs.fetchFromGitHub {
|
||||
owner = "catppuccin";
|
||||
repo = "starship";
|
||||
rev = "main"; # Replace with the latest commit hash
|
||||
sha256 = "sha256-nsRuxQFKbQkyEI4TXgvAjcroVdG+heKX5Pauq/4Ota0";
|
||||
} + /palettes/${flavour}.toml));
|
||||
settings =
|
||||
let flavour = "mocha"; # Replace with your preferred palette
|
||||
in {
|
||||
# Other config here
|
||||
format = "$all"; # Remove this line to disable the default prompt format
|
||||
palette = "catppuccin_${flavour}";
|
||||
} // builtins.fromTOML (builtins.readFile (pkgs.fetchFromGitHub
|
||||
{
|
||||
owner = "catppuccin";
|
||||
repo = "starship";
|
||||
rev = "main"; # Replace with the latest commit hash
|
||||
sha256 = "sha256-nsRuxQFKbQkyEI4TXgvAjcroVdG+heKX5Pauq/4Ota0";
|
||||
} + /palettes/${flavour}.toml));
|
||||
};
|
||||
eza = {
|
||||
enable = true;
|
||||
@@ -159,16 +163,17 @@ in {
|
||||
enable = true;
|
||||
config = { theme = "catppuccin"; };
|
||||
themes = {
|
||||
catppuccin = let flavor = "mocha";
|
||||
in {
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "catppuccin";
|
||||
repo = "bat";
|
||||
rev = "main";
|
||||
sha256 = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw";
|
||||
catppuccin =
|
||||
let flavor = "mocha";
|
||||
in {
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "catppuccin";
|
||||
repo = "bat";
|
||||
rev = "main";
|
||||
sha256 = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw";
|
||||
};
|
||||
file = "Catppuccin-${flavor}.tmTheme";
|
||||
};
|
||||
file = "Catppuccin-${flavor}.tmTheme";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -181,17 +186,16 @@ in {
|
||||
# Home Manager needs a bit of information about you and the paths it should
|
||||
# manage.
|
||||
username = device.user;
|
||||
homeDirectory = if device.isMac then
|
||||
lib.mkForce "/Users/${device.user}"
|
||||
else
|
||||
lib.mkForce "/home/${device.user}";
|
||||
homeDirectory =
|
||||
if device.isMac then
|
||||
lib.mkForce "/Users/${device.user}"
|
||||
else
|
||||
lib.mkForce "/home/${device.user}";
|
||||
|
||||
stateVersion = "23.11";
|
||||
|
||||
file = {
|
||||
".config/tmux/sessions".source = ../../tmux/sessions;
|
||||
# ".config/nvim/lua".source = ../../nvim/lua;
|
||||
# ".config/nvim/init.lua".source = ../../nvim/init.lua;
|
||||
".config/macchina".source = ../../macchina;
|
||||
|
||||
# # You can also set the file content immediately.
|
||||
@@ -199,7 +203,10 @@ in {
|
||||
# org.gradle.console=verbose
|
||||
# org.gradle.daemon.idletimeout=3600000
|
||||
# '';
|
||||
};
|
||||
} // (if lazy then {
|
||||
".config/nvim/lua".source = ../../nvim/lua;
|
||||
".config/nvim/init.lua".source = ../../nvim/init.lua;
|
||||
} else { });
|
||||
|
||||
sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ pkgs, inputs, ... }: {
|
||||
{ pkgs, config, inputs, ... }: {
|
||||
imports = [ inputs.nixneovim.nixosModules.default ];
|
||||
programs.nixneovim = {
|
||||
enable = true;
|
||||
@@ -15,13 +15,14 @@
|
||||
smartcase = true;
|
||||
termguicolors = true;
|
||||
signcolumn = "yes";
|
||||
# "opt.list" = true;
|
||||
wrap = true;
|
||||
completeopt = "menu,menuone,popup,noselect";
|
||||
undodir = "${config.xdg.cacheHome}/undodir";
|
||||
undofile = true;
|
||||
};
|
||||
|
||||
globals = {
|
||||
mapleader = " ";
|
||||
#copilot_no_tab_map = true;
|
||||
};
|
||||
plugins = {
|
||||
lspconfig = {
|
||||
@@ -44,52 +45,58 @@
|
||||
},
|
||||
'';
|
||||
};
|
||||
lua-language-server = {
|
||||
enable = true;
|
||||
onAttachExtra = ''
|
||||
local lspconfig = require 'lspconfig'
|
||||
local lsp_zero = require'lsp-zero'
|
||||
local lua_opts = lsp_zero.nvim_lua_ls()
|
||||
lspconfig.lua_ls.setup(lua_opts)
|
||||
'';
|
||||
};
|
||||
lua-language-server = { enable = true; };
|
||||
};
|
||||
onAttach = ''
|
||||
vim.lsp.inlay_hint.enable(bufnr, true)
|
||||
extraLua.pre = ''
|
||||
local lsp_zero = require'lsp-zero'
|
||||
local lspconfig = require 'lspconfig'
|
||||
lsp_zero.on_attach(function(client, bufnr)
|
||||
lsp_zero.default_keymaps({buffer = bufnr})
|
||||
if client.server_capabilities.inlayHintProvider then
|
||||
vim.lsp.inlay_hint.enable(bufnr, true)
|
||||
end
|
||||
end)
|
||||
'';
|
||||
# extraLua.post = ''
|
||||
# vim.lsp.inlay_hint.enable(bufnr, true)
|
||||
# '';
|
||||
};
|
||||
|
||||
todo-comments.enable = true;
|
||||
lualine.enable = true;
|
||||
commentary.enable = true;
|
||||
surround.enable = true;
|
||||
which-key.enable = true;
|
||||
|
||||
treesitter = {
|
||||
enable = true;
|
||||
indent = true;
|
||||
};
|
||||
telescope = {
|
||||
enable = true;
|
||||
extensions = {
|
||||
manix.enable = true;
|
||||
# plenary.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
nvim-cmp = {
|
||||
enable = true;
|
||||
completion = {
|
||||
completeopt = "menu,menuone,popup,noselect";
|
||||
completion = { completeopt = "menu,menuone,popup,noselect"; };
|
||||
window = {
|
||||
completion = { border = "rounded"; };
|
||||
documentation = { border = "rounded"; };
|
||||
};
|
||||
sources = {
|
||||
nvim_lsp.enable = true;
|
||||
luasnip.enable = true;
|
||||
buffer.enable = true;
|
||||
path.enable = true;
|
||||
cmdline.enable = true;
|
||||
#copilot.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;
|
||||
};
|
||||
|
||||
@@ -104,35 +111,44 @@
|
||||
normal = {
|
||||
"<leader>ff" = "require'telescope.builtin'.find_files";
|
||||
"<leader>gg" = "require'telescope.builtin'.live_grep";
|
||||
"<leader>mm" = "require'telescope-manix'.search";
|
||||
"<leader>;" = "require'telescope.builtin'.buffers";
|
||||
"<leader>\\\"" = ''[["+]]'';
|
||||
"<leader><leader>" = "'<c-^>'";
|
||||
"vff" = "'<cmd>vertical Gdiffsplit<cr>'";
|
||||
"<C-k>" = "vim.lsp.buf.definition";
|
||||
"gi" = "vim.lsp.buf.implementation";
|
||||
"<leader>a" = "vim.lsp.buf.code_action";
|
||||
"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 =
|
||||
let
|
||||
comfortable-motion = pkgs.fetchFromGitHub {
|
||||
owner = "yuttie";
|
||||
repo = "comfortable-motion.vim";
|
||||
rev = "master";
|
||||
sha256 = "sha256-S1LJXmShhpCJIg/FEPx3jFbmPpS/1U4MAQN2RY/nkI0";
|
||||
};
|
||||
in
|
||||
[
|
||||
comfortable-motion
|
||||
pkgs.vimExtraPlugins.rustaceanvim
|
||||
pkgs.vimExtraPlugins.cmp-nvim-lsp
|
||||
pkgs.vimExtraPlugins.fidget-nvim
|
||||
pkgs.vimExtraPlugins.rest-nvim
|
||||
pkgs.vimExtraPlugins.lsp-zero-nvim
|
||||
pkgs.vimPlugins.vim-abolish
|
||||
];
|
||||
extraPlugins = let
|
||||
comfortable-motion = pkgs.fetchFromGitHub {
|
||||
owner = "yuttie";
|
||||
repo = "comfortable-motion.vim";
|
||||
rev = "master";
|
||||
sha256 = "sha256-S1LJXmShhpCJIg/FEPx3jFbmPpS/1U4MAQN2RY/nkI0";
|
||||
};
|
||||
in [
|
||||
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.cmp-nvim-lsp
|
||||
pkgs.vimExtraPlugins.fidget-nvim
|
||||
pkgs.vimExtraPlugins.copilot-lua
|
||||
pkgs.vimExtraPlugins.lsp-zero-nvim
|
||||
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