Compare commits

...

4 Commits

Author SHA1 Message Date
Moritz Böhme ec9cb2fb3e
use flake provided packages 2023-02-17 12:39:03 +01:00
Moritz Böhme d63cee0e98
add lsp 2023-02-17 12:38:44 +01:00
Moritz Böhme 5a4bea05d6
fix catppuccin theme 2023-02-17 12:38:02 +01:00
Moritz Böhme be3818d719
add neovim-nightly 2023-02-17 12:31:31 +01:00
5 changed files with 213 additions and 19 deletions

View File

@ -210,6 +210,21 @@
} }
}, },
"flake-utils_5": { "flake-utils_5": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_6": {
"locked": { "locked": {
"lastModified": 1644229661, "lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
@ -419,6 +434,27 @@
"type": "github" "type": "github"
} }
}, },
"neovim": {
"inputs": {
"flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_6"
},
"locked": {
"dir": "contrib",
"lastModified": 1676603980,
"narHash": "sha256-EWHGiO/1dulYfzdUnxXqW6nu79T+soBC/YS0tZPtlQ0=",
"owner": "neovim",
"repo": "neovim",
"rev": "371a74e4e1685f21e83c70eb8f0bd05c2ce24e49",
"type": "github"
},
"original": {
"dir": "contrib",
"owner": "neovim",
"repo": "neovim",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1673540789, "lastModified": 1673540789,
@ -532,6 +568,22 @@
} }
}, },
"nixpkgs_6": { "nixpkgs_6": {
"locked": {
"lastModified": 1671983799,
"narHash": "sha256-Z2Ro6hFPZHkBqkVXY5/aBUzxi5xizQGvuHQ9+T5B/ks=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "fad51abd42ca17a60fc1d4cb9382e2d79ae31836",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_7": {
"locked": { "locked": {
"lastModified": 1675940568, "lastModified": 1675940568,
"narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=", "narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=",
@ -547,7 +599,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_7": { "nixpkgs_8": {
"locked": { "locked": {
"lastModified": 1671271357, "lastModified": 1671271357,
"narHash": "sha256-xRJdLbWK4v2SewmSStYrcLa0YGJpleufl44A19XSW8k=", "narHash": "sha256-xRJdLbWK4v2SewmSStYrcLa0YGJpleufl44A19XSW8k=",
@ -619,9 +671,9 @@
"pre-commit-hooks_3": { "pre-commit-hooks_3": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_4", "flake-utils": "flake-utils_5",
"gitignore": "gitignore_2", "gitignore": "gitignore_2",
"nixpkgs": "nixpkgs_7", "nixpkgs": "nixpkgs_8",
"nixpkgs-stable": "nixpkgs-stable_2" "nixpkgs-stable": "nixpkgs-stable_2"
}, },
"locked": { "locked": {
@ -651,7 +703,8 @@
"hyprland": "hyprland", "hyprland": "hyprland",
"hyprpaper": "hyprpaper", "hyprpaper": "hyprpaper",
"master": "master", "master": "master",
"nixpkgs": "nixpkgs_6", "neovim": "neovim",
"nixpkgs": "nixpkgs_7",
"pre-commit-hooks": "pre-commit-hooks_3", "pre-commit-hooks": "pre-commit-hooks_3",
"stable": "stable", "stable": "stable",
"utils": "utils_2" "utils": "utils_2"
@ -690,7 +743,7 @@
}, },
"utils_2": { "utils_2": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_5" "flake-utils": "flake-utils_6"
}, },
"locked": { "locked": {
"lastModified": 1657226504, "lastModified": 1657226504,

View File

@ -48,6 +48,8 @@
emacs.url = "git+ssh://git@gitea.moritzboeh.me/moritz/emacs.git?ref=main"; emacs.url = "git+ssh://git@gitea.moritzboeh.me/moritz/emacs.git?ref=main";
neovim.url = "github:neovim/neovim?dir=contrib";
# Hyprland # Hyprland
hyprland.url = "github:hyprwm/Hyprland"; hyprland.url = "github:hyprwm/Hyprland";
hyprpaper.url = "github:hyprwm/hyprpaper"; hyprpaper.url = "github:hyprwm/hyprpaper";
@ -70,12 +72,10 @@
overlay = import ./overlays { inherit inputs; }; overlay = import ./overlays { inherit inputs; };
channels.nixpkgs.overlaysBuilder = channels: [ channels.nixpkgs.overlaysBuilder = channels: [
inputs.agenix.overlays.default
inputs.emacs.overlays.default inputs.emacs.overlays.default
inputs.howdy.overlays.default inputs.howdy.overlays.default
inputs.hypr-contrib.overlays.default inputs.hypr-contrib.overlays.default
inputs.hyprland.overlays.default inputs.hyprland.overlays.default
inputs.hyprpaper.overlays.default
inputs.utils.overlay inputs.utils.overlay
self.overlay self.overlay
]; ];

View File

@ -20,22 +20,33 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.moritz.programs.neovim = { home-manager.users.moritz.programs.neovim = {
enable = true; enable = true;
package = pkgs.neovim-nightly;
vimAlias = true; vimAlias = true;
vimdiffAlias = true; vimdiffAlias = true;
withNodeJs = true; withNodeJs = true;
withPython3 = true; withPython3 = true;
extraLuaConfig = builtins.readFile ./init.lua; extraLuaConfig = builtins.readFile ./init.lua;
extraPackages = with pkgs; [
sumneko-lua-language-server
nil
];
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [
catppuccin-nvim catppuccin-nvim
cmp-nvim-lsp
dashboard-nvim dashboard-nvim
neogit neogit
noice-nvim noice-nvim
nui-nvim # for noice-nvim nui-nvim # for noice-nvim
nvim-cmp
nvim-lspconfig
nvim-treesitter.withAllGrammars nvim-treesitter.withAllGrammars
nvim-web-devicons # for dashboard-nvim nvim-web-devicons # for dashboard-nvim
plenary-nvim # for telescope, neogit plenary-nvim # for telescope, neogit
telescope-nvim telescope-nvim
which-key-nvim which-key-nvim
cmp_luasnip
luasnip
lsp_lines-nvim
]; ];
}; };
}; };

View File

@ -33,11 +33,13 @@ vim.opt.updatetime = 300
vim.opt_local.spell = true vim.opt_local.spell = true
vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling
-- plugins
require("catppuccin").setup({ require("catppuccin").setup({
flavour = "macchiato", compile_path = vim.fn.stdpath("cache") .. "/catppuccin", -- fix issue of writing to nix store
integrations = {
which_key = true,
},
}) })
vim.cmd.colorscheme("catppuccin") vim.cmd.colorscheme("catppuccin-macchiato")
vim.o.timeout = true vim.o.timeout = true
vim.o.timeoutlen = 300 vim.o.timeoutlen = 300
@ -63,20 +65,20 @@ require("noice").setup({
}) })
wk.register({ wk.register({
f = { f = {
name="find", name = "find",
f = { "<cmd>Telescope find_files<cr>", "find file" }, f = { "<cmd>Telescope find_files<cr>", "find file" },
g = { "<cmd>Telescope live_grep<cr>", "live grep" }, g = { "<cmd>Telescope live_grep<cr>", "live grep" },
b = { "<cmd>Telescope buffers<cr>", "find buffer" }, b = { "<cmd>Telescope buffers<cr>", "find buffer" },
}, },
}, { prefix = "<leader>" }) }, { prefix = "<leader>" })
require("neogit").setup({ require("neogit").setup({
disable_commit_confirmation = true, disable_commit_confirmation = true,
}) })
wk.register({ wk.register({
g = { "<cmd>Neogit<cr>", "git" } g = { "<cmd>Neogit<cr>", "git" },
}, { prefix = "<leader>"}) }, { prefix = "<leader>" })
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
sync_install = false, sync_install = false,
@ -86,3 +88,127 @@ require("nvim-treesitter.configs").setup({
additional_vim_regex_highlighting = true, additional_vim_regex_highlighting = true,
}, },
}) })
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_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()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
},
})
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require("lspconfig")
local on_attach_def = function(_, bufnr)
wk.register({
K = { vim.lsp.buf.hover, "show info" },
["<leader>l"] = {
name = "lsp",
d = { vim.diagnostic.open_float, "open diagnostic window" },
n = { vim.diagnostic.goto_next, "next error" },
p = { vim.diagnostic.goto_prev, "prev error" },
c = { vim.lsp.buf.code_action, "code action" },
r = { vim.lsp.buf.rename, "rename" },
f = {
function()
vim.lsp.buf.format({ async = true })
end,
"format",
},
},
g = {
name = "goto",
r = { vim.lsp.buf.references, "references" },
d = { vim.lsp.buf.definition, "definition" },
D = { vim.lsp.buf.declaration, "declaration" },
i = { vim.lsp.buf.implementation, "implementation" },
t = { vim.lsp.buf.type_definition, "type defininition" },
},
}, { noremap = true, silent = true, buffer = bufnr })
end
local servers = { "nil_ls", "pylsp" }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup({
on_attach = on_attach_def,
capabilities = capabilities,
flags = {
debounce_text_changes = 100,
},
})
end
lspconfig.sumneko_lua.setup({
on_attach = on_attach_def,
capabilities = capabilities,
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { "vim" },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
})
local lsp_lines = require("lsp_lines")
lsp_lines.setup()
-- Disable virtual_text since it's redundant due to lsp_lines.
vim.diagnostic.config({
virtual_text = false,
})
wk.register({
t = {
name = "toggle",
l = { lsp_lines.toggle, "lsp lines" },
},
{ prefix = "<leader>" },
})

View File

@ -1,4 +1,8 @@
{ inputs }: final: prev: { { inputs }: final: prev: {
agenix = inputs.agenix.packages.${prev.system}.default;
hyprpaper = inputs.hyprpaper.packages.${prev.system}.default;
neovim-nightly = inputs.neovim.packages.${prev.system}.default;
logseq-wayland = prev.symlinkJoin { logseq-wayland = prev.symlinkJoin {
name = "logseq-wayland"; name = "logseq-wayland";
paths = [ prev.logseq ]; paths = [ prev.logseq ];