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": {
"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": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
@ -419,6 +434,27 @@
"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": {
"locked": {
"lastModified": 1673540789,
@ -532,6 +568,22 @@
}
},
"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": {
"lastModified": 1675940568,
"narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=",
@ -547,7 +599,7 @@
"type": "github"
}
},
"nixpkgs_7": {
"nixpkgs_8": {
"locked": {
"lastModified": 1671271357,
"narHash": "sha256-xRJdLbWK4v2SewmSStYrcLa0YGJpleufl44A19XSW8k=",
@ -619,9 +671,9 @@
"pre-commit-hooks_3": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_4",
"flake-utils": "flake-utils_5",
"gitignore": "gitignore_2",
"nixpkgs": "nixpkgs_7",
"nixpkgs": "nixpkgs_8",
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
@ -651,7 +703,8 @@
"hyprland": "hyprland",
"hyprpaper": "hyprpaper",
"master": "master",
"nixpkgs": "nixpkgs_6",
"neovim": "neovim",
"nixpkgs": "nixpkgs_7",
"pre-commit-hooks": "pre-commit-hooks_3",
"stable": "stable",
"utils": "utils_2"
@ -690,7 +743,7 @@
},
"utils_2": {
"inputs": {
"flake-utils": "flake-utils_5"
"flake-utils": "flake-utils_6"
},
"locked": {
"lastModified": 1657226504,

View File

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

View File

@ -20,22 +20,33 @@ in
config = mkIf cfg.enable {
home-manager.users.moritz.programs.neovim = {
enable = true;
package = pkgs.neovim-nightly;
vimAlias = true;
vimdiffAlias = true;
withNodeJs = true;
withPython3 = true;
extraLuaConfig = builtins.readFile ./init.lua;
extraPackages = with pkgs; [
sumneko-lua-language-server
nil
];
plugins = with pkgs.vimPlugins; [
catppuccin-nvim
cmp-nvim-lsp
dashboard-nvim
neogit
noice-nvim
nui-nvim # for noice-nvim
nvim-cmp
nvim-lspconfig
nvim-treesitter.withAllGrammars
nvim-web-devicons # for dashboard-nvim
plenary-nvim # for telescope, neogit
telescope-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.spelllang = { "en", "de_20" } -- all English regions and new German spelling
-- plugins
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.timeoutlen = 300
@ -63,20 +65,20 @@ require("noice").setup({
})
wk.register({
f = {
name="find",
f = { "<cmd>Telescope find_files<cr>", "find file" },
g = { "<cmd>Telescope live_grep<cr>", "live grep" },
b = { "<cmd>Telescope buffers<cr>", "find buffer" },
},
f = {
name = "find",
f = { "<cmd>Telescope find_files<cr>", "find file" },
g = { "<cmd>Telescope live_grep<cr>", "live grep" },
b = { "<cmd>Telescope buffers<cr>", "find buffer" },
},
}, { prefix = "<leader>" })
require("neogit").setup({
disable_commit_confirmation = true,
disable_commit_confirmation = true,
})
wk.register({
g = { "<cmd>Neogit<cr>", "git" }
}, { prefix = "<leader>"})
g = { "<cmd>Neogit<cr>", "git" },
}, { prefix = "<leader>" })
require("nvim-treesitter.configs").setup({
sync_install = false,
@ -86,3 +88,127 @@ require("nvim-treesitter.configs").setup({
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: {
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 {
name = "logseq-wayland";
paths = [ prev.logseq ];