diff --git a/home/TODOS.txt b/home/TODOS.txt index 831f399..44dac49 100644 --- a/home/TODOS.txt +++ b/home/TODOS.txt @@ -1,57 +1,3 @@ -NeoVim: -- obsidian-nvim - -- plenary-nvim -- telescope-nvim -- telescope-fzf-native-nvim - -- neoscroll-nvim -- leap-nvim - -- bufferline-nvim -- lualine-nvim -- lualine-lsp-progress -- dropbar-nvim - -- vim-obsession - -- nvim-tree-lua -- oil-nvim -- nvim-web-devicons - -- nvim-cmp -- cmp-nvim-lua -- cmp-buffer -- cmp-path -- luasnip -- cmp_luasnip -- friendly-snippets -- lspkind-nvim -- cmp-conjure - -- conform-nvim - -- comment-nvim -- nvim-ts-context-commentstring -- nvim-surround -- nvim-autopairs - -- vimtex - -- nvim-treesitter.withAllGrammars -- nvim-treesitter-textobjects -- rainbow-delimiters-nvim - -- nvim-lspconfig -- neoconf.nvim -- neodev-nvim - -- lean-nvim -- nvim-lspconfig -- plenary-nvim - -- conjure - -- wich-key-nvim - -- markdown-preview-nvim +Zusatz: +- firefox Bookmarks neu +- obsidian vaults einrichten in home/programs/neovim/lua/plugins/obsidian.lua diff --git a/home/programs/neovim/default.nix b/home/programs/neovim/default.nix index 64a8d93..d21e4b4 100644 --- a/home/programs/neovim/default.nix +++ b/home/programs/neovim/default.nix @@ -21,21 +21,88 @@ in { withPython3 = true; plugins = with pkgs.vimPlugins; [ - # Plugin-Manager - lazy-nvim - - # Theme + bufferline-nvim catppuccin-nvim - - # Obsidian - obsidian-nvim - - plenary-nvim - telescope-nvim - + cmp-buffer# + cmp-conjure# + cmp-nvim-lua# + cmp-path# + cmp_luasnip# + comment-nvim# + conform-nvim + conjure + dropbar-nvim + friendly-snippets# + lazy-nvim# + lean-nvim + leap-nvim + lspkind-nvim# + lualine-lsp-progress# + lualine-nvim + luasnip# + markdown-preview-nvim + neoconf-nvim# + neodev-nvim# + neoscroll-nvim + nvim-autopairs nvim-cmp - + nvim-lspconfig + nvim-surround + nvim-tree-lua nvim-treesitter.withAllGrammars + nvim-treesitter-textobjects + nvim-ts-context-commentstring + nvim-web-devicons# + obsidian-nvim + oil-nvim + plenary-nvim + rainbow-delimiters-nvim# + telescope-fzf-native-nvim + telescope-nvim + vimtex + which-key-nvim + ]; + + extraPackages = with pkgs; [ + ripgrep + fd + codespell + prettierd + # Lua + lua-language-server + stylua + # Haskell + haskell-language-server + ghc + stack + cabal-install + haskellPackages.fourmolu + # Lean + lean4 + # Python + ruff-lsp + nodePackages.pyright + isort + python311Packages.autopep8 + # LaTeX + texliveFull + texlab + xdotool + pplatex + neovim-remote + # Nix + nixd + nixfmt + # Rust + rust-analyzer + # Bash + nodePackages.bash-language-server + shellcheck + shellharden + # sh + shfmt + # Scheme + chez ]; extraLuaConfig = '' diff --git a/home/programs/neovim/lua/plugins/bufferline-nvim.lua b/home/programs/neovim/lua/plugins/bufferline-nvim.lua new file mode 100644 index 0000000..ac68a25 --- /dev/null +++ b/home/programs/neovim/lua/plugins/bufferline-nvim.lua @@ -0,0 +1,15 @@ +return { + { + "akinsho/bufferline.nvim", + dependencies = { "nvim-tree/nvim-web-devicons", "catppuccin/nvim" }, + config = function() + vim.opt.termguicolors = true + require("bufferline").setup({ + highlights = require("catppuccin.groups.integrations.bufferline").get(), + options = { + diagnostics = "nvim_lsp", + }, + }) + end, + }, +} diff --git a/home/programs/neovim/lua/plugins/colorscheme.lua b/home/programs/neovim/lua/plugins/catppuccin-nvim.lua similarity index 100% rename from home/programs/neovim/lua/plugins/colorscheme.lua rename to home/programs/neovim/lua/plugins/catppuccin-nvim.lua diff --git a/home/programs/neovim/lua/plugins/conform-nvim.lua b/home/programs/neovim/lua/plugins/conform-nvim.lua new file mode 100644 index 0000000..1ee079c --- /dev/null +++ b/home/programs/neovim/lua/plugins/conform-nvim.lua @@ -0,0 +1,55 @@ +return { + { + "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = "ConformInfo", + keys = { + { + "cF", + function() + require("conform").format({ formatters = { "injected" } }) + end, + mode = { "n", "v" }, + desc = "Format Injected Langs", + }, + }, + config = function() + require("conform").setup({ + format_on_save = { + -- These options will be passed to conform.format() + timeout_ms = 500, + lsp_fallback = true, + }, + formatters_by_ft = { + lua = { "stylua" }, + python = { "isort", "autopep8" }, + haskell = { "fourmolu" }, + bash = { "shellcheck", "shellharden" }, + sh = { "shfmt" }, + markdown = { "prettierd" }, + json = { "prettierd" }, + yaml = { "prettierd" }, + nix = { "nixfmt" }, + tex = { "latexindent" }, + ["*"] = { "codespell" }, + ["_"] = { "trim_whitespace" }, + }, + formatters = { + stylua = { + inherit = true, + prepend_args = { "--indent-type", "Spaces", "--indent-width", "2" }, + }, + codespell = { + inherit = true, + prepend_args = { "-L", "launch" }, + }, + latexindent = { + inherit = true, + prepend_args = { "-y=\"defaultIndent:' '\"" }, + }, + }, + }) + end, + }, +} + diff --git a/home/programs/neovim/lua/plugins/conjure.lua b/home/programs/neovim/lua/plugins/conjure.lua new file mode 100644 index 0000000..361bb1e --- /dev/null +++ b/home/programs/neovim/lua/plugins/conjure.lua @@ -0,0 +1,34 @@ +return { + { + "Olical/conjure", + ft = { "lua", "python", "scheme" }, + dependencies = { + { + "PaterJason/cmp-conjure", + config = function() + local cmp = require("cmp") + local config = cmp.get_config() + table.insert(config.sources, { + name = "buffer", + option = { + sources = { + { name = "conjure" }, + }, + }, + }) + cmp.setup(config) + end, + }, + }, + config = function() + require("conjure.main").main() + require("conjure.mapping")["on-filetype"]() + vim.g["conjure#debug"] = false + vim.g["conjure#client#scheme#stdio#command"] = "scheme" + vim.g["conjure#client#scheme#stdio#prompt_pattern"] = "> $?" + vim.g["conjure#mapping#prefix"] = "," + vim.g["conjure#extract#tree_sitter#enabled"] = true + end, + }, +} + diff --git a/home/programs/neovim/lua/plugins/dropbar-nvim.lua b/home/programs/neovim/lua/plugins/dropbar-nvim.lua new file mode 100644 index 0000000..51f2c6f --- /dev/null +++ b/home/programs/neovim/lua/plugins/dropbar-nvim.lua @@ -0,0 +1,14 @@ +return { + { + "Bekaboo/dropbar.nvim", + -- optional, but required for fuzzy finder support + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + }, + config = function() + vim.keymap.set("n", "bs", function() + require("dropbar.api").pick(vim.v.count ~= 0 and vim.v.count) + end) + end, + }, +} diff --git a/home/programs/neovim/lua/plugins/lean-nvim.lua b/home/programs/neovim/lua/plugins/lean-nvim.lua new file mode 100644 index 0000000..91fa23e --- /dev/null +++ b/home/programs/neovim/lua/plugins/lean-nvim.lua @@ -0,0 +1,17 @@ +return { + 'Julian/lean.nvim', + event = { 'BufReadPre *.lean', 'BufNewFile *.lean' }, + dependencies = { + 'neovim/nvim-lspconfig', + 'nvim-lua/plenary.nvim', + 'hrsh7th/nvim-cmp', + }, + + -- see details below for full configuration options + opts = { + lsp = { + on_attach = on_attach, + }, + mappings = true, + } +} diff --git a/home/programs/neovim/lua/plugins/leap-nvim.lua b/home/programs/neovim/lua/plugins/leap-nvim.lua new file mode 100644 index 0000000..c4587be --- /dev/null +++ b/home/programs/neovim/lua/plugins/leap-nvim.lua @@ -0,0 +1,11 @@ +return { + { + "ggandor/leap.nvim", + config = function() + local leap = require("leap") + + leap.opts.special_keys.prev_target = "" + leap.opts.special_keys.prev_group = "" + end, + }, +} diff --git a/home/programs/neovim/lua/plugins/lualine-nvim.lua b/home/programs/neovim/lua/plugins/lualine-nvim.lua new file mode 100644 index 0000000..3df0745 --- /dev/null +++ b/home/programs/neovim/lua/plugins/lualine-nvim.lua @@ -0,0 +1,18 @@ +return { + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons", "arkav/lualine-lsp-progress" }, + config = function() + require("lualine").setup({ + options = { + theme = "catppuccin", + }, + sections = { + lualine_c = { + "lsp_progress", + }, + }, + }) + end, + }, +} diff --git a/home/programs/neovim/lua/plugins/markdown-preview-nvim.lua b/home/programs/neovim/lua/plugins/markdown-preview-nvim.lua new file mode 100644 index 0000000..a07f218 --- /dev/null +++ b/home/programs/neovim/lua/plugins/markdown-preview-nvim.lua @@ -0,0 +1,12 @@ +return { + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + config = function() + vim.g.mkdp_theme = "dark" + vim.g.mkdp_echo_preview_url = 1 + vim.g.mkdp_browser = "luakit" + end, + }, +} diff --git a/home/programs/neovim/lua/plugins/neoscroll-nvim.lua b/home/programs/neovim/lua/plugins/neoscroll-nvim.lua new file mode 100644 index 0000000..a7586dc --- /dev/null +++ b/home/programs/neovim/lua/plugins/neoscroll-nvim.lua @@ -0,0 +1,13 @@ +return { + { + "karb94/neoscroll.nvim", + config = function() + require("neoscroll").setup({ + -- All these keys will be mapped to their corresponding default scrolling animation + mappings = { "", "", "", "", "", "", "zt", "zz", "zb" }, + hide_cursor = true, -- Hide cursor while scrolling + stop_eof = true, -- Stop at when scrolling downwards + }) + end, + }, +} diff --git a/home/programs/neovim/lua/plugins/nvim-autopairs.lua b/home/programs/neovim/lua/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..19758cb --- /dev/null +++ b/home/programs/neovim/lua/plugins/nvim-autopairs.lua @@ -0,0 +1,28 @@ +return { + { + "windwp/nvim-autopairs", + event = { "InsertEnter" }, + dependencies = { + "hrsh7th/nvim-cmp", + }, + config = function() + -- import nvim-autopairs + local autopairs = require("nvim-autopairs") + + -- configure autopairs + autopairs.setup({ + check_ts = true, -- enable treesitter + }) + + -- import nvim-autopairs completion functionality + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + + -- import nvim-cmp plugin (completions plugin) + local cmp = require("cmp") + + -- make autopairs and completion work together + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + end, + }, +} + diff --git a/home/programs/neovim/lua/plugins/nvim-lspconfig.lua b/home/programs/neovim/lua/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..bc01912 --- /dev/null +++ b/home/programs/neovim/lua/plugins/nvim-lspconfig.lua @@ -0,0 +1,107 @@ +return { + -- lspconfig + { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + { "folke/neoconf.nvim", dependencies = { "nvim-lspconfig" } }, + { "folke/neodev.nvim", opts = {} }, + }, + config = function() + local lspconfig = require("lspconfig") + local cmp_nvim_lsp = require("cmp_nvim_lsp") + local keymap = vim.keymap + + local signs = { Error = " ", Warn = " ", Hint = "󰠠 ", Info = " " } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end + + local opts = { noremap = true, silent = true } + local on_attach = function(client, bufnr) + opts.buffer = bufnr + + -- set keybinds + opts.desc = "Show LSP references" + keymap.set("n", "gR", "Telescope lsp_references", opts) -- show definition, references + + opts.desc = "Go to declaration" + keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration + + opts.desc = "Show LSP definitions" + keymap.set("n", "gd", "Telescope lsp_definitions", opts) -- show lsp definitions + + opts.desc = "Show LSP implementations" + keymap.set("n", "gi", "Telescope lsp_implementations", opts) -- show lsp implementations + + opts.desc = "Show LSP type definitions" + keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) -- show lsp type definitions + + opts.desc = "See available code actions" + keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection + + opts.desc = "Smart rename" + keymap.set("n", "rn", vim.lsp.buf.rename, opts) -- smart rename + + opts.desc = "Show buffer diagnostics" + keymap.set("n", "D", "Telescope diagnostics bufnr=0", opts) -- show diagnostics for file + + opts.desc = "Show line diagnostics" + keymap.set("n", "d", vim.diagnostic.open_float, opts) -- show diagnostics for line + + opts.desc = "Go to previous diagnostic" + keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer + + opts.desc = "Go to next diagnostic" + keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer + + opts.desc = "Show documentation for what is under cursor" + keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor + + opts.desc = "Restart LSP" + keymap.set("n", "rs", ":LspRestart", opts) -- mapping to restart lsp if necessary + end + + local capabilities = cmp_nvim_lsp.default_capabilities() + + lspconfig["lua_ls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + lspconfig["hls"].setup({ + filetypes = { 'haskell', 'lhaskell', 'cabal' }, + capabilities = capabilities, + on_attach = on_attach, + }) + lspconfig["leanls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + lspconfig["bashls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + lspconfig["pyright"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + lspconfig["ruff_lsp"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + lspconfig["texlab"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + lspconfig["nixd"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + lspconfig["rust_analyzer"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + end, + }, +} diff --git a/home/programs/neovim/lua/plugins/nvim-surround.lua b/home/programs/neovim/lua/plugins/nvim-surround.lua new file mode 100644 index 0000000..aa3cbd4 --- /dev/null +++ b/home/programs/neovim/lua/plugins/nvim-surround.lua @@ -0,0 +1,10 @@ +return { + { + "kylechui/nvim-surround", + event = "VeryLazy", + config = function() + require("nvim-surround").setup({}) + end, + }, +} + diff --git a/home/programs/neovim/lua/plugins/nvim-tree-lua.lua b/home/programs/neovim/lua/plugins/nvim-tree-lua.lua new file mode 100644 index 0000000..3cd5977 --- /dev/null +++ b/home/programs/neovim/lua/plugins/nvim-tree-lua.lua @@ -0,0 +1,22 @@ +return { + { + "nvim-tree/nvim-tree.lua", + lazy = false, + keys = { + { "ft", "NvimTreeToggle", desc = "Nvim Tree" }, + }, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + require("nvim-tree").setup({ + hijack_netrw = false, + hijack_unnamed_buffer_when_opening = false, + hijack_directories = { + enable = false, + }, + }) + end, + }, +} + diff --git a/home/programs/neovim/lua/plugins/treesitter.lua b/home/programs/neovim/lua/plugins/nvim-treesitter.lua similarity index 91% rename from home/programs/neovim/lua/plugins/treesitter.lua rename to home/programs/neovim/lua/plugins/nvim-treesitter.lua index 9190496..af5e17a 100644 --- a/home/programs/neovim/lua/plugins/treesitter.lua +++ b/home/programs/neovim/lua/plugins/nvim-treesitter.lua @@ -46,11 +46,4 @@ return { end, }, }, - { - "nvim-treesitter/nvim-treesitter-textobjects", - dependencies = { - "nvim-treesitter/nvim-treesitter", - }, - }, } - diff --git a/home/programs/neovim/lua/plugins/nvim-treesitteri-textojects.lua b/home/programs/neovim/lua/plugins/nvim-treesitteri-textojects.lua new file mode 100644 index 0000000..6ce15e2 --- /dev/null +++ b/home/programs/neovim/lua/plugins/nvim-treesitteri-textojects.lua @@ -0,0 +1,9 @@ +return { + { + "nvim-treesitter/nvim-treesitter-textobjects", + dependencies = { + "nvim-treesitter/nvim-treesitter", + }, + }, +} + diff --git a/home/programs/neovim/lua/plugins/nvim-ts-context-commentstring.lua b/home/programs/neovim/lua/plugins/nvim-ts-context-commentstring.lua new file mode 100644 index 0000000..67a74bc --- /dev/null +++ b/home/programs/neovim/lua/plugins/nvim-ts-context-commentstring.lua @@ -0,0 +1,20 @@ +return { + { + "JoosepAlviste/nvim-ts-context-commentstring", + dependencies = { + { + "numToStr/Comment.nvim", + lazy = false, + config = function() + require("Comment").setup({ + pre_hook = function() + return vim.bo.commentstring + end, + }) + end, + }, + "nvim-treesitter/nvim-treesitter", + }, + }, +} + diff --git a/home/programs/neovim/lua/plugins/obsidian.lua b/home/programs/neovim/lua/plugins/obsidian-nvim.lua similarity index 100% rename from home/programs/neovim/lua/plugins/obsidian.lua rename to home/programs/neovim/lua/plugins/obsidian-nvim.lua diff --git a/home/programs/neovim/lua/plugins/oil-nvim.lua b/home/programs/neovim/lua/plugins/oil-nvim.lua new file mode 100644 index 0000000..bc7747b --- /dev/null +++ b/home/programs/neovim/lua/plugins/oil-nvim.lua @@ -0,0 +1,20 @@ +return { + { + "stevearc/oil.nvim", + opts = {}, + lazy = false, + config = function() + require("oil").setup({ + default_file_explorer = true, + delete_to_trash = true, + experimental_watch_for_changes = true, + use_default_keymaps = true, + }) + end, + keys = { + { "-", "Oil", desc = "Open parent directory" }, + }, + -- Optional dependencies + dependencies = { "nvim-tree/nvim-web-devicons" }, + }, +} diff --git a/home/programs/neovim/lua/plugins/plenary-nvim.lua b/home/programs/neovim/lua/plugins/plenary-nvim.lua new file mode 100644 index 0000000..a8dd8c3 --- /dev/null +++ b/home/programs/neovim/lua/plugins/plenary-nvim.lua @@ -0,0 +1,4 @@ +return { + { "nvim-lua/plenary.nvim" }, +} + diff --git a/home/programs/neovim/lua/plugins/tools.lua b/home/programs/neovim/lua/plugins/telescope-fzf-native-nvim.lua similarity index 61% rename from home/programs/neovim/lua/plugins/tools.lua rename to home/programs/neovim/lua/plugins/telescope-fzf-native-nvim.lua index 6c04134..6a51c71 100644 --- a/home/programs/neovim/lua/plugins/tools.lua +++ b/home/programs/neovim/lua/plugins/telescope-fzf-native-nvim.lua @@ -1,12 +1,4 @@ return { - { "nvim-lua/plenary.nvim" }, - { - "nvim-telescope/telescope.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - require("telescope").setup({}) - end, - }, { "nvim-telescope/telescope-fzf-native.nvim", config = function() @@ -17,4 +9,3 @@ return { end, }, } - diff --git a/home/programs/neovim/lua/plugins/telescope-nvim.lua b/home/programs/neovim/lua/plugins/telescope-nvim.lua new file mode 100644 index 0000000..558088a --- /dev/null +++ b/home/programs/neovim/lua/plugins/telescope-nvim.lua @@ -0,0 +1,10 @@ +return { + { + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("telescope").setup({}) + end, + }, +} + diff --git a/home/programs/neovim/lua/plugins/vimtex.lua b/home/programs/neovim/lua/plugins/vimtex.lua new file mode 100644 index 0000000..9a8aece --- /dev/null +++ b/home/programs/neovim/lua/plugins/vimtex.lua @@ -0,0 +1,19 @@ +return { + { + "lervag/vimtex", + lazy = false, -- lazy-loading will disable inverse search + config = function() + vim.api.nvim_create_autocmd({ "FileType" }, { + group = vim.api.nvim_create_augroup("lazyvim_vimtex_conceal", { clear = true }), + pattern = { "bib", "tex" }, + callback = function() + vim.wo.conceallevel = 2 + end, + }) + + vim.g.vimtex_mappings_disable = { ["n"] = { "K" } } -- disable `K` as it conflicts with LSP hover + vim.g.vimtex_quickfix_method = "pplatex" + vim.g.vimtex_view_method = "zathura" + end, + }, +} diff --git a/home/programs/neovim/lua/plugins/which-key-nvim.lua b/home/programs/neovim/lua/plugins/which-key-nvim.lua new file mode 100644 index 0000000..87595a9 --- /dev/null +++ b/home/programs/neovim/lua/plugins/which-key-nvim.lua @@ -0,0 +1,16 @@ +return { + { + "folke/which-key.nvim", + optional = true, + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, + opts = { + defaults = { + ["l"] = { name = "+vimtex" }, + }, + }, + }, +}