{ description = "neovim config"; inputs = { }; outputs = { self, ... }@inputs: { module = {}: {}; hmModule = { config, lib, pkgs, ... }: { imports = []; home.packages = with pkgs; [ neovim-remote ]; home.sessionVariables.SUDO_EDITOR = "kitten edit-in-kitty"; programs.neovim = with pkgs; { enable = true; #package = neovim; defaultEditor = true; extraLuaConfig = '' vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' vim.opt.nu = true vim.opt.rnu = true vim.opt.scrolloff = 12 vim.opt.tabstop = 4 vim.opt.softtabstop = 4 vim.opt.shiftwidth = 4 vim.opt.expandtab = true vim.opt.smartindent = true vim.opt.wrap = false vim.opt.hlsearch = false vim.opt.incsearch = true vim.filetype.add({ pattern = { [".*/hypr/.*%.conf"] = "hyprlang" }, }) -- vim.opt.termguicolors = true require("nvim-tree").setup() local lsp_zero = require('lsp-zero') -- lsp_attach is where you enable features that only work -- if there is a language server active in the file local lsp_attach = function(client, bufnr) local opts = {buffer = bufnr} vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()', opts) vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()', opts) vim.keymap.set('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) vim.keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) vim.keymap.set('n', 'go', 'lua vim.lsp.buf.type_definition()', opts) vim.keymap.set('n', 'gr', 'lua vim.lsp.buf.references()', opts) vim.keymap.set('n', 'gs', 'lua vim.lsp.buf.signature_help()', opts) vim.keymap.set('n', '', 'lua vim.lsp.buf.rename()', opts) vim.keymap.set({'n', 'x'}, '', 'lua vim.lsp.buf.format({async = true})', opts) vim.keymap.set('n', '', 'lua vim.lsp.buf.code_action()', opts) end lsp_zero.extend_lspconfig({ sign_text = true, lsp_attach = lsp_attach, capabilities = require('cmp_nvim_lsp').default_capabilities(), }) local lspconfig = require("lspconfig") lspconfig.ccls.setup{} lspconfig.nil_ls.setup{} lspconfig.statix.setup{} lspconfig.pyright.setup{} lspconfig.gopls.setup{} -- local llm = require('llm') -- llm.setup({ -- api_token = nil, -- cf Install paragraph -- model = "codellama:7b", -- the model ID, behavior depends on backend -- backend = "ollama", -- backend ID, "huggingface" | "ollama" | "openai" | "tgi" -- url = "http://localhost:11434", -- the http url of the backend -- tokens_to_clear = { "<|endoftext|>" }, -- tokens to remove from the model's output -- parameters that are added to the request body, values are arbitrary, you can set any field:value pair here it will be passed as is to the backend -- request_body = { -- parameters = { -- temperature = 0.2, -- top_p = 0.95, -- }, -- }, -- set this if the model supports fill in the middle -- fim = { -- enabled = true, -- prefix = "", -- middle = "", -- suffix = "", -- }, -- debounce_ms = 150, -- accept_keymap = "", -- dismiss_keymap = "", -- tls_skip_verify_insecure = false, -- llm-ls configuration, cf llm-ls section -- lsp = { -- bin_path = vim.api.nvim_call_function("stdpath", { "data" }) .. "${pkgs.llm-ls}/bin/llm-ls", -- host = nil, -- port = nil, -- cmd_env = nil, -- or { LLM_LOG_LEVEL = "DEBUG" } to set the log level of llm-ls -- version = "0.5.3", -- }, -- tokenizer = nil, -- cf Tokenizer paragraph -- context_window = 1024, -- max number of tokens for the context window -- enable_suggestions_on_startup = true, -- enable_suggestions_on_files = "*", -- pattern matching syntax to enable suggestions on specific files, either a string or a list of strings -- disable_url_path_completion = false, -- cf Backend -- }) local luasnip = require("luasnip") -- nvim-cmp setup local cmp = require("cmp") cmp.setup({ snippet = { expand = function(args) luasnip.lsp_expand(args.body) end, }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.scroll_docs(-4), -- Up [''] = cmp.mapping.scroll_docs(4), -- Down -- C-b (back) C-f (forward) for snippet placeholder navigation. [''] = cmp.mapping.complete(), [''] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, }, [''] = 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' }), [''] = 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' }, }, }) require("noice").setup() require("barbar").setup() require("pywal").setup() require("lualine").setup({ options = { theme = 'pywal-nvim', }, }) vim.cmd[[colorscheme pywal]] vim.notify = require("notify") vim.keymap.set("n", "ff", "Telescope find_files", {desc = "find files"}) vim.keymap.set("n", "fa", "Telescope find_files no_ignore=true hidden=true", {desc = "find files"}) vim.keymap.set("n", "fc", "Telescope treesitter", {desc = "find code"}) vim.keymap.set("n", "t", "NvimTreeToggle", {desc = "toggle tree"}) vim.keymap.set("n", "", "BufferNext", {desc = "move to next tab"}) vim.keymap.set("n", "", "BufferPrevious", {desc = "move to previous tab"}) vim.keymap.set("n", "", "wincmd h", {desc = "move to left window"}) vim.keymap.set("n", "", "wincmd j", {desc = "move to below window"}) vim.keymap.set("n", "", "wincmd k", {desc = "move to above window"}) vim.keymap.set("n", "", "wincmd l", {desc = "move to right window"}) vim.keymap.set("v", "J", ":m '>+1gv=gv", {desc = "move selected down"}) vim.keymap.set("v", "K", ":m '<-2gv=gv", {desc = "move selected up"}) vim.keymap.set("n", "J", "mzJ`z", {desc = "cursor still when appending next line"}) vim.keymap.set("n", "", "zz", {desc = "cursor mid when page down"}) vim.keymap.set("n", "", "zz", {desc = "cursor mid when page up"}) vim.keymap.set("n", "n", "nzzzv", {desc = "search term mid"}) vim.keymap.set("n", "N", "Nzzzv", {desc = "search term mid"}) vim.keymap.set("x", "p", "\"_dP", {desc = "no overwrite paste buffer"}) vim.keymap.set("n", "y", "\"+y", {desc = "yank to system clipboard"}) vim.keymap.set("v", "y", "\"+y", {desc = "^"}) vim.keymap.set("n", "Y", "\"+Y", {desc = "^"}) vim.keymap.set("n", "Q", "", {desc = "unmap Q"}) vim.keymap.set("n", "s", [[:%s/\<\>//gI]], {desc = "replace current word entire file"}) vim.keymap.set("n", "F", function() vim.lsp.buf.format() end, {desc = "format buffer?"}) ''; plugins = with vimPlugins; [ telescope-nvim nvim-tree-lua nvim-web-devicons mini-nvim noice-nvim nvim-notify barbar-nvim pywal-nvim lualine-nvim tokyonight-nvim llm-nvim cmp-buffer cmp-nvim-lsp cmp_luasnip luasnip cmp-path cmp-cmdline nvim-cmp nvim-lspconfig lsp-zero-nvim nvim-treesitter nvim-treesitter-parsers.cpp nvim-treesitter-parsers.nix nvim-treesitter-parsers.bash nvim-treesitter-parsers.python nvim-treesitter-parsers.lua nvim-treesitter-parsers.vim nvim-treesitter-parsers.javascript nvim-treesitter-parsers.css nvim-treesitter-parsers.hyprlang ]; extraPackages = with pkgs; [ nil statix # Lints and suggestions for the nix programming language pyright gopls ccls ]; viAlias = true; vimAlias = true; vimdiffAlias = true; }; }; }; }