From 35550c608576d7debfee2f4ec7c4ef3995115da4 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 12:52:58 +0200 Subject: [PATCH] refactor: extract neovim config --- horsch/home.nix | 2 +- {horsch/neovim => neovim}/auto-session.lua | 0 {horsch/neovim => neovim}/commands.lua | 0 {horsch/neovim => neovim}/comment.lua | 0 {horsch/neovim => neovim}/dap.lua | 0 {horsch/neovim => neovim}/default.nix | 11 +- {horsch/neovim => neovim}/gitsigns.lua | 0 {horsch/neovim => neovim}/illuminate.lua | 0 .../neovim => neovim}/indent-blankline.lua | 0 {horsch/neovim => neovim}/keymaps.lua | 0 {horsch/neovim => neovim}/lspconfig.lua | 0 {horsch/neovim => neovim}/lualine.lua | 0 {horsch/neovim => neovim}/luasnip.lua | 0 {horsch/neovim => neovim}/neorg.lua | 0 {horsch/neovim => neovim}/notify.lua | 0 {horsch/neovim => neovim}/nvim-cmp.lua | 0 {horsch/neovim => neovim}/options.lua | 0 {horsch/neovim => neovim}/project-nvim.lua | 0 {horsch/neovim => neovim}/tabline.lua | 0 {horsch/neovim => neovim}/telescope.lua | 0 {horsch/neovim => neovim}/themes.lua | 0 {horsch/neovim => neovim}/toggleterm.lua | 0 {horsch/neovim => neovim}/treesitter.lua | 0 private/home.nix | 2 +- private/neovim/auto-session.lua | 3 - private/neovim/commands.lua | 1 - private/neovim/comment.lua | 1 - private/neovim/dap.lua | 35 ---- private/neovim/default.nix | 167 ---------------- private/neovim/gitsigns.lua | 1 - private/neovim/indent-blankline.lua | 5 - private/neovim/keymaps.lua | 69 ------- private/neovim/lspconfig.lua | 184 ------------------ private/neovim/lualine.lua | 7 - private/neovim/luasnip.lua | 1 - private/neovim/neorg.lua | 16 -- private/neovim/notify.lua | 2 - private/neovim/nvim-cmp.lua | 87 --------- private/neovim/options.lua | 61 ------ private/neovim/project-nvim.lua | 1 - private/neovim/tabline.lua | 1 - private/neovim/telescope.lua | 29 --- private/neovim/themes.lua | 1 - private/neovim/toggleterm.lua | 1 - private/neovim/treesitter.lua | 14 -- 45 files changed, 6 insertions(+), 696 deletions(-) rename {horsch/neovim => neovim}/auto-session.lua (100%) rename {horsch/neovim => neovim}/commands.lua (100%) rename {horsch/neovim => neovim}/comment.lua (100%) rename {horsch/neovim => neovim}/dap.lua (100%) rename {horsch/neovim => neovim}/default.nix (94%) rename {horsch/neovim => neovim}/gitsigns.lua (100%) rename {horsch/neovim => neovim}/illuminate.lua (100%) rename {horsch/neovim => neovim}/indent-blankline.lua (100%) rename {horsch/neovim => neovim}/keymaps.lua (100%) rename {horsch/neovim => neovim}/lspconfig.lua (100%) rename {horsch/neovim => neovim}/lualine.lua (100%) rename {horsch/neovim => neovim}/luasnip.lua (100%) rename {horsch/neovim => neovim}/neorg.lua (100%) rename {horsch/neovim => neovim}/notify.lua (100%) rename {horsch/neovim => neovim}/nvim-cmp.lua (100%) rename {horsch/neovim => neovim}/options.lua (100%) rename {horsch/neovim => neovim}/project-nvim.lua (100%) rename {horsch/neovim => neovim}/tabline.lua (100%) rename {horsch/neovim => neovim}/telescope.lua (100%) rename {horsch/neovim => neovim}/themes.lua (100%) rename {horsch/neovim => neovim}/toggleterm.lua (100%) rename {horsch/neovim => neovim}/treesitter.lua (100%) delete mode 100644 private/neovim/auto-session.lua delete mode 100644 private/neovim/commands.lua delete mode 100644 private/neovim/comment.lua delete mode 100644 private/neovim/dap.lua delete mode 100644 private/neovim/default.nix delete mode 100644 private/neovim/gitsigns.lua delete mode 100644 private/neovim/indent-blankline.lua delete mode 100644 private/neovim/keymaps.lua delete mode 100644 private/neovim/lspconfig.lua delete mode 100644 private/neovim/lualine.lua delete mode 100644 private/neovim/luasnip.lua delete mode 100644 private/neovim/neorg.lua delete mode 100644 private/neovim/notify.lua delete mode 100644 private/neovim/nvim-cmp.lua delete mode 100644 private/neovim/options.lua delete mode 100644 private/neovim/project-nvim.lua delete mode 100644 private/neovim/tabline.lua delete mode 100644 private/neovim/telescope.lua delete mode 100644 private/neovim/themes.lua delete mode 100644 private/neovim/toggleterm.lua delete mode 100644 private/neovim/treesitter.lua diff --git a/horsch/home.nix b/horsch/home.nix index c0c0df6..7fc5243 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -24,6 +24,7 @@ ../eza.nix ../fzf.nix ../git.nix + ../neovim ../picocom.nix ../podman.nix ../ripgrep.nix @@ -33,7 +34,6 @@ ../tree.nix ../zoxide.nix ./gpg - ./neovim ./ssh.nix ./zsh.nix ]; diff --git a/horsch/neovim/auto-session.lua b/neovim/auto-session.lua similarity index 100% rename from horsch/neovim/auto-session.lua rename to neovim/auto-session.lua diff --git a/horsch/neovim/commands.lua b/neovim/commands.lua similarity index 100% rename from horsch/neovim/commands.lua rename to neovim/commands.lua diff --git a/horsch/neovim/comment.lua b/neovim/comment.lua similarity index 100% rename from horsch/neovim/comment.lua rename to neovim/comment.lua diff --git a/horsch/neovim/dap.lua b/neovim/dap.lua similarity index 100% rename from horsch/neovim/dap.lua rename to neovim/dap.lua diff --git a/horsch/neovim/default.nix b/neovim/default.nix similarity index 94% rename from horsch/neovim/default.nix rename to neovim/default.nix index d144971..77082d5 100644 --- a/horsch/neovim/default.nix +++ b/neovim/default.nix @@ -1,18 +1,15 @@ { pkgs, theme, ... }: -let - pkg_src = pkgs; -in { # symlink for a stable path - home.file.".vscode-extensions/vscode-lldb".source = pkg_src.vscode-extensions.vadimcn.vscode-lldb; + home.file.".vscode-extensions/vscode-lldb".source = pkgs.vscode-extensions.vadimcn.vscode-lldb; programs = { neovim = { enable = true; - package = pkg_src.neovim-unwrapped; + package = pkgs.neovim-unwrapped; defaultEditor = true; - plugins = with pkg_src.vimPlugins; [ + plugins = with pkgs.vimPlugins; [ # theme nvim-solarized-lua @@ -93,7 +90,7 @@ in withNodeJs = true; - extraPackages = with pkg_src; [ + extraPackages = with pkgs; [ # language servers lua-language-server terraform-ls diff --git a/horsch/neovim/gitsigns.lua b/neovim/gitsigns.lua similarity index 100% rename from horsch/neovim/gitsigns.lua rename to neovim/gitsigns.lua diff --git a/horsch/neovim/illuminate.lua b/neovim/illuminate.lua similarity index 100% rename from horsch/neovim/illuminate.lua rename to neovim/illuminate.lua diff --git a/horsch/neovim/indent-blankline.lua b/neovim/indent-blankline.lua similarity index 100% rename from horsch/neovim/indent-blankline.lua rename to neovim/indent-blankline.lua diff --git a/horsch/neovim/keymaps.lua b/neovim/keymaps.lua similarity index 100% rename from horsch/neovim/keymaps.lua rename to neovim/keymaps.lua diff --git a/horsch/neovim/lspconfig.lua b/neovim/lspconfig.lua similarity index 100% rename from horsch/neovim/lspconfig.lua rename to neovim/lspconfig.lua diff --git a/horsch/neovim/lualine.lua b/neovim/lualine.lua similarity index 100% rename from horsch/neovim/lualine.lua rename to neovim/lualine.lua diff --git a/horsch/neovim/luasnip.lua b/neovim/luasnip.lua similarity index 100% rename from horsch/neovim/luasnip.lua rename to neovim/luasnip.lua diff --git a/horsch/neovim/neorg.lua b/neovim/neorg.lua similarity index 100% rename from horsch/neovim/neorg.lua rename to neovim/neorg.lua diff --git a/horsch/neovim/notify.lua b/neovim/notify.lua similarity index 100% rename from horsch/neovim/notify.lua rename to neovim/notify.lua diff --git a/horsch/neovim/nvim-cmp.lua b/neovim/nvim-cmp.lua similarity index 100% rename from horsch/neovim/nvim-cmp.lua rename to neovim/nvim-cmp.lua diff --git a/horsch/neovim/options.lua b/neovim/options.lua similarity index 100% rename from horsch/neovim/options.lua rename to neovim/options.lua diff --git a/horsch/neovim/project-nvim.lua b/neovim/project-nvim.lua similarity index 100% rename from horsch/neovim/project-nvim.lua rename to neovim/project-nvim.lua diff --git a/horsch/neovim/tabline.lua b/neovim/tabline.lua similarity index 100% rename from horsch/neovim/tabline.lua rename to neovim/tabline.lua diff --git a/horsch/neovim/telescope.lua b/neovim/telescope.lua similarity index 100% rename from horsch/neovim/telescope.lua rename to neovim/telescope.lua diff --git a/horsch/neovim/themes.lua b/neovim/themes.lua similarity index 100% rename from horsch/neovim/themes.lua rename to neovim/themes.lua diff --git a/horsch/neovim/toggleterm.lua b/neovim/toggleterm.lua similarity index 100% rename from horsch/neovim/toggleterm.lua rename to neovim/toggleterm.lua diff --git a/horsch/neovim/treesitter.lua b/neovim/treesitter.lua similarity index 100% rename from horsch/neovim/treesitter.lua rename to neovim/treesitter.lua diff --git a/private/home.nix b/private/home.nix index 2c3ce9a..a55d592 100644 --- a/private/home.nix +++ b/private/home.nix @@ -62,6 +62,7 @@ ../fzf.nix ../git.nix ../kitty.nix + ../neovim ../nextcloud.nix ../ripgrep.nix ../shell_aliases.nix @@ -70,7 +71,6 @@ ../tree.nix ../zoxide.nix ./gpg - ./neovim ./zsh.nix ]; } diff --git a/private/neovim/auto-session.lua b/private/neovim/auto-session.lua deleted file mode 100644 index a3dc5d9..0000000 --- a/private/neovim/auto-session.lua +++ /dev/null @@ -1,3 +0,0 @@ -require("auto-session").setup { - log_level = "error", -} diff --git a/private/neovim/commands.lua b/private/neovim/commands.lua deleted file mode 100644 index 10e03a5..0000000 --- a/private/neovim/commands.lua +++ /dev/null @@ -1 +0,0 @@ -vim.api.nvim_create_user_command("BufOnly", "%bd|e#|bd#", {}) diff --git a/private/neovim/comment.lua b/private/neovim/comment.lua deleted file mode 100644 index 5060319..0000000 --- a/private/neovim/comment.lua +++ /dev/null @@ -1 +0,0 @@ -require('Comment').setup({}) diff --git a/private/neovim/dap.lua b/private/neovim/dap.lua deleted file mode 100644 index d491267..0000000 --- a/private/neovim/dap.lua +++ /dev/null @@ -1,35 +0,0 @@ -local dap = require("dap") -local dapui = require("dapui") - -dapui.setup() - -vim.fn.sign_define("DapBreakpoint", { text = "🔴", texthl = "", linehl = "", numhl = "" }) - --- debugging keymaps -vim.keymap.set("n", "", dap.continue, { noremap = true, silent = true }) -vim.keymap.set("n", "", dap.toggle_breakpoint, { noremap = true, silent = true }) -vim.keymap.set("n", "", dap.step_over, { noremap = true, silent = true }) -vim.keymap.set("n", "", dap.step_into, { noremap = true, silent = true }) - -vim.keymap.set("n", "", dap.step_out, { noremap = true, silent = true }) -vim.keymap.set("n", "", dap.step_out, { noremap = true, silent = true }) -- in kitty - -vim.keymap.set("n", "", dapui.eval, { noremap = true, silent = true }) - --- trigger auto-completion in repl -vim.cmd([[ - augroup TriggerDapReplAutoCompletion - autocmd! - autocmd FileType dap-repl lua require("dap.ext.autocompl").attach() - augroup END -]]) - -dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() -end -dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close() -end -dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close() -end diff --git a/private/neovim/default.nix b/private/neovim/default.nix deleted file mode 100644 index 0026390..0000000 --- a/private/neovim/default.nix +++ /dev/null @@ -1,167 +0,0 @@ -{ pkgs, theme, ... }: - -{ - - # symlink for a stable path - home.file.".vscode-extensions/vscode-lldb".source = pkgs.vscode-extensions.vadimcn.vscode-lldb; - - programs = { - neovim = { - enable = true; - package = pkgs.neovim-unwrapped; - defaultEditor = true; - plugins = with pkgs.vimPlugins; [ - # theme - nvim-solarized-lua - - delimitMate - vim-bbye - ansible-vim - - # ui - dressing-nvim - - # session handling - project-nvim - auto-session - - # escape handling - better-escape-nvim - - nvim-treesitter.withAllGrammars - markdown-preview-nvim # use({ "iamcco/markdown-preview.nvim", run = ":call mkdp#util#install()" }) - toggleterm-nvim - nvim-notify - comment-nvim - lualine-nvim - tabline-nvim - indent-blankline-nvim - plenary-nvim - vim-illuminate - registers-nvim - vim-surround - - editorconfig-nvim - - # git - gitsigns-nvim - vim-fugitive - vim-flog - git-blame-nvim - nvim-web-devicons # used by diffview-nvim - - # snippets - friendly-snippets - luasnip - - # auto-completion - nvim-cmp - cmp-nvim-lsp - cmp-buffer - cmp-path - cmp-cmdline - cmp-nvim-lua - cmp_luasnip - cmp-calc - cmp-nvim-lsp-signature-help - - # telescope - telescope-nvim - telescope-fzf-native-nvim - telescope-ui-select-nvim - - # LSP - nvim-lspconfig - lsp-status-nvim - rustaceanvim - neodev-nvim - null-ls-nvim - lsp_lines-nvim - lsp-inlayhints-nvim - - # debugging - nvim-dap - nvim-dap-ui - - # neorg - neorg - neorg-telescope - ]; - - withNodeJs = true; - - extraPackages = with pkgs; [ - # language servers - lua-language-server - terraform-ls - tflint - bash-language-server - nodePackages.dockerfile-language-server-nodejs - nodePackages.eslint_d - nodePackages.prettier - nodePackages.typescript - nodePackages.typescript-language-server - nodePackages.vscode-langservers-extracted - nodePackages.yaml-language-server - lldb - vscode-extensions.vadimcn.vscode-lldb - marksman - clang-tools - cmake-language-server - texlab - nixd - nixpkgs-fmt - ]; - - extraLuaPackages = luaPackages: [ - luaPackages.lua-utils-nvim - luaPackages.pathlib-nvim - ]; - - extraConfig = '' - lua << EOF - vim.o.guifont = "DejaVu Sans Mono:h10" - - if vim.g.neovide then - vim.g.neovide_fullscreen = true - vim.g.neovide_cursor_animation_length = 0.01 - vim.g.neovide_cursor_trail_length = 0.01 - end - - ${builtins.readFile ./keymaps.lua } - ${builtins.readFile ./options.lua } - ${builtins.readFile ./commands.lua } - ${builtins.readFile ./treesitter.lua } - ${builtins.readFile ./lspconfig.lua } - ${builtins.readFile ./auto-session.lua } - ${builtins.readFile ./toggleterm.lua } - ${builtins.readFile ./notify.lua } - ${builtins.readFile ./comment.lua } - ${builtins.readFile ./lualine.lua } - ${builtins.readFile ./tabline.lua } - ${builtins.readFile ./indent-blankline.lua } - ${builtins.readFile ./gitsigns.lua } - ${builtins.readFile ./luasnip.lua } - ${builtins.readFile ./nvim-cmp.lua } - ${builtins.readFile ./telescope.lua } - - ${builtins.readFile ./themes.lua } - vim.opt.background = '${theme}' - - ${builtins.readFile ./project-nvim.lua } - ${builtins.readFile ./dap.lua } - ${builtins.readFile ./neorg.lua } - - vim.g.gitblame_date_format = "%r" - - -- setup illuminate highlight groups - vim.api.nvim_set_hl(0, "IlluminatedWordText", { bold = true }) - vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "IlluminatedWordText" }) - vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "IlluminatedWordText" }) - EOF - ''; - }; - }; -} - - diff --git a/private/neovim/gitsigns.lua b/private/neovim/gitsigns.lua deleted file mode 100644 index 91fa65b..0000000 --- a/private/neovim/gitsigns.lua +++ /dev/null @@ -1 +0,0 @@ -require('gitsigns').setup() diff --git a/private/neovim/indent-blankline.lua b/private/neovim/indent-blankline.lua deleted file mode 100644 index d7e7b6c..0000000 --- a/private/neovim/indent-blankline.lua +++ /dev/null @@ -1,5 +0,0 @@ -require("ibl").setup { - indent = { - char = "┊", - }, -} diff --git a/private/neovim/keymaps.lua b/private/neovim/keymaps.lua deleted file mode 100644 index 721631d..0000000 --- a/private/neovim/keymaps.lua +++ /dev/null @@ -1,69 +0,0 @@ -local function nnoremap(key, command) - vim.api.nvim_set_keymap("n", key, command, { noremap = true }) -end - -vim.g.mapleader = " " -vim.g.maplocalleader = " " - --- Move around windows -nnoremap("", ":wincmd h") -nnoremap("", ":wincmd j") -nnoremap("", ":wincmd k") -nnoremap("", ":wincmd l") - --- Switch buffers -nnoremap("", ":TablineBufferNext") -nnoremap("", ":TablineBufferPrevious") - --- fugitive -nnoremap("g", ":0Git") - --- vim-flog -nnoremap("G", ":Flog -all -date=relative -open-cmd=new") - --- telescope -local telescope = require("telescope.builtin") -local telescope_themes = require("telescope.themes") -local telescope_projects = require("telescope").extensions.projects - -local function map_telescope(key, telescope_function) - vim.api.nvim_set_keymap("n", key, "", { - noremap = true, - callback = function() - local theme = telescope_themes.get_dropdown({ layout_config = { width = 0.9 } }) - telescope_function(theme) - end, - }) -end - -map_telescope("ff", telescope.find_files) -map_telescope("fb", telescope.buffers) -map_telescope("fg", telescope.git_files) -map_telescope("fp", telescope_projects.projects) -map_telescope("fs", telescope.lsp_document_symbols) -map_telescope("fS", telescope.lsp_dynamic_workspace_symbols) -map_telescope("", telescope.grep_string) -map_telescope("", telescope.live_grep) - --- terminal -vim.api.nvim_create_autocmd("TermOpen", { - pattern = "term://*", - callback = function() - local opts = { noremap = true } - vim.api.nvim_buf_set_keymap(0, 't', '', [[]], opts) - vim.api.nvim_buf_set_keymap(0, 't', '', [[h]], opts) - vim.api.nvim_buf_set_keymap(0, 't', '', [[j]], opts) - vim.api.nvim_buf_set_keymap(0, 't', '', [[k]], opts) - vim.api.nvim_buf_set_keymap(0, 't', '', [[l]], opts) - end, - desc = "Map terminal esc and window switch keys", -}) - --- buffer closing -nnoremap("gq", ":Bdelete") - --- toggle search highlighting -vim.cmd('nnoremap * v:hlsearch ? ":nohlsearch" : "*"') - --- insert-map jj/jk to escape -require("better_escape").setup() diff --git a/private/neovim/lspconfig.lua b/private/neovim/lspconfig.lua deleted file mode 100644 index bda96da..0000000 --- a/private/neovim/lspconfig.lua +++ /dev/null @@ -1,184 +0,0 @@ -local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) - -local on_attach = function(client, bufnr) - local function nnoremap(key, command) - vim.keymap.set("n", key, command, { noremap = true, silent = true, buffer = bufnr }) - end - - local function format_buffer() - vim.lsp.buf.format({ - timeout_ms = 3000, - async = false, - filter = function(formatter) - return formatter.name ~= "tsserver" and formatter.name ~= "volar" - end - }) - end - - require("lsp-inlayhints").on_attach(client, bufnr) - - local telescope = require("telescope.builtin") - - nnoremap("gD", vim.lsp.buf.declaration) - nnoremap("gd", telescope.lsp_definitions) - nnoremap("gt", telescope.lsp_type_definitions) - nnoremap("gi", telescope.lsp_implementations) - nnoremap("gr", telescope.lsp_references) - nnoremap("K", vim.lsp.buf.hover) - nnoremap("rn", vim.lsp.buf.rename) - nnoremap("ca", vim.lsp.buf.code_action) - nnoremap("f", format_buffer) - nnoremap("d", telescope.diagnostics) - nnoremap("D", require("lsp_lines").toggle) - nnoremap("", vim.diagnostic.goto_prev) - nnoremap("", vim.diagnostic.goto_next) - - if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = format_buffer, - }) - end -end - -require("lsp-inlayhints").setup({}) - -local lsp_status = require("lsp-status") -lsp_status.config({ - current_function = false, - show_filename = false, - diagnostics = true, - status_symbol = "", -}) -lsp_status.register_progress() - --- setup lua language server for init.nvim and nvim plugin development -require("neodev").setup({ - override = function(root_dir, options) - if require("neodev.util").has_file(root_dir, "/etc/nixos") then - options.enabled = true - options.plugins = true - end - end, -}) - -local capabilities = require("cmp_nvim_lsp").default_capabilities(lsp_status.capabilities) - -local servers = { - ["bashls"] = {}, - ["clangd"] = {}, - ["cmake"] = {}, - ["dockerls"] = {}, - ["eslint"] = {}, - ["html"] = {}, - ["jsonls"] = {}, - ["lua_ls"] = { - Lua = { - runtime = { - version = "LuaJIT", - }, - diagnostics = { - globals = { "vim" }, - }, - workspace = { - library = vim.api.nvim_get_runtime_file("", true), - }, - telemetry = { - enable = false, - }, - }, - }, - ["marksman"] = {}, - ["nixd"] = {}, - ["pylsp"] = { - pylsp = { - plugins = { - pycodestyle = { - maxLineLength = 120 - } - } - } - }, - ["pyright"] = {}, - ["terraformls"] = {}, - ["texlab"] = {}, - ["tflint"] = {}, - ["tsserver"] = {}, - ["yamlls"] = { - yaml = { - keyOrdering = false - } - }, -} - -local lspconfig = require("lspconfig") - -for lsp, settings in pairs(servers) do - lspconfig[lsp].setup({ - settings = settings, - on_attach = on_attach, - capabilities = capabilities, - }) -end - --- setup rustaceanvim -vim.g.rustaceanvim = { - server = { - on_attach = on_attach, - settings = { - ["rust-analyzer"] = { - cargo = { - loadOutDirsFromCheck = true, - }, - checkOnSave = { command = "clippy" }, - procMacro = { - enable = true, - }, - }, - }, - }, -} - --- setup null-ls for markdown formatting -local null_ls = require("null-ls") -null_ls.setup({ - sources = { - null_ls.builtins.formatting.prettier, - null_ls.builtins.diagnostics.tsc, - }, - on_attach = on_attach, -}) - --- setup lsp_lines -require("lsp_lines").setup() - --- setup vim diagnostics -vim.diagnostic.config({ - virtual_text = false, - signs = true, - update_in_insert = true, - underline = true, - severity_sort = true, - float = { - border = "rounded", - source = "always", - header = "", - prefix = "", - }, -}) - --- setup diagnostics signs -local diagnostics_signs = { Error = "", Warn = "", Hint = "", Info = "" } -for type, icon in pairs(diagnostics_signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) -end - --- setup volar -lspconfig["volar"].setup({ - filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' }, - on_attach = on_attach, - capabilities = capabilities, -}) diff --git a/private/neovim/lualine.lua b/private/neovim/lualine.lua deleted file mode 100644 index 982987a..0000000 --- a/private/neovim/lualine.lua +++ /dev/null @@ -1,7 +0,0 @@ -require('lualine').setup({ - options = { globalstatus = true }, - sections = { - lualine_c = { { "filename", path = 1 }, "require('lsp-status').status()" } - }, - extensions = { "toggleterm" } -}) diff --git a/private/neovim/luasnip.lua b/private/neovim/luasnip.lua deleted file mode 100644 index 80309d7..0000000 --- a/private/neovim/luasnip.lua +++ /dev/null @@ -1 +0,0 @@ -require("luasnip.loaders.from_vscode").lazy_load() diff --git a/private/neovim/neorg.lua b/private/neovim/neorg.lua deleted file mode 100644 index eb9fe84..0000000 --- a/private/neovim/neorg.lua +++ /dev/null @@ -1,16 +0,0 @@ -local neorg = require("neorg") - -neorg.setup({ - load = { - ["core.defaults"] = {}, - ["core.concealer"] = {}, - ["core.dirman"] = { - config = { - workspaces = { - notes = "~/notes", - }, - default_workspace = "notes", - }, - }, - } -}) diff --git a/private/neovim/notify.lua b/private/neovim/notify.lua deleted file mode 100644 index 6fd7a22..0000000 --- a/private/neovim/notify.lua +++ /dev/null @@ -1,2 +0,0 @@ -require("notify").setup({ stages = "fade" }) -vim.notify = require("notify") diff --git a/private/neovim/nvim-cmp.lua b/private/neovim/nvim-cmp.lua deleted file mode 100644 index 7b0f78b..0000000 --- a/private/neovim/nvim-cmp.lua +++ /dev/null @@ -1,87 +0,0 @@ -local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and - vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub( - col, col):match("%s") == nil -end - -local cmp = require("cmp") -local luasnip = require("luasnip") - -cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end - }, - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "nvim_lsp_signature_help" }, - { name = "luasnip" }, - { name = "path" }, - { name = "buffer" }, - { name = "nvim-lua" }, - { name = "calc" }, - }), - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete({}), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - 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" }), - }), - experimental = { ghost_text = true }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - formatting = { - fields = { "menu", "abbr", "kind" }, - format = function(entry, item) - local menu_icon = { - nvim_lsp = "λ", - luasnip = "⋗", - buffer = "Ω", - path = "🖿", - } - - item.menu = menu_icon[entry.source.name] - return item - end, - }, -}) - --- `/` cmdline setup. -cmp.setup.cmdline("/", { - sources = cmp.config.sources( - { name = "buffer" } - ) -}) - --- `:` cmdline setup. -cmp.setup.cmdline(":", { - sources = cmp.config.sources( - { name = "path" }, - { name = "cmdline" } - ) -}) diff --git a/private/neovim/options.lua b/private/neovim/options.lua deleted file mode 100644 index 5d9aa53..0000000 --- a/private/neovim/options.lua +++ /dev/null @@ -1,61 +0,0 @@ --- termguicolors -vim.opt.termguicolors = true - --- line numbers -vim.opt.number = true - --- tabwidth -vim.opt.tabstop = 4 -vim.opt.shiftwidth = 4 - --- indent with spaces -vim.opt.expandtab = true - --- scroll offset -vim.opt.scrolloff = 4 - --- don't warp lines -vim.opt.wrap = false - --- split to right/below -vim.opt.splitright = true -vim.opt.splitbelow = true - --- presistent undo -vim.opt.undofile = true - --- searching -vim.opt.ignorecase = true -vim.opt.smartcase = true - --- preview commands -vim.opt.inccommand = "split" - --- completion -vim.opt.completeopt = "menu,menuone,noselect" - --- folding -vim.opt.foldmethod = "expr" -vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' -vim.opt.foldlevelstart = 99 - --- disable mouse -vim.opt.mouse = "" - --- set cursorline in active window -vim.cmd([[ - augroup CursorLine - autocmd! - autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline - autocmd WinLeave * setlocal nocursorline - augroup END -]]) - --- configure terminal -vim.cmd([[ - augroup terminal_setup - autocmd! - autocmd TermOpen * startinsert - autocmd TermOpen * setlocal nonumber norelativenumber - augroup END -]]) diff --git a/private/neovim/project-nvim.lua b/private/neovim/project-nvim.lua deleted file mode 100644 index 3b5902f..0000000 --- a/private/neovim/project-nvim.lua +++ /dev/null @@ -1 +0,0 @@ -require('project_nvim').setup({}) diff --git a/private/neovim/tabline.lua b/private/neovim/tabline.lua deleted file mode 100644 index 74da8bb..0000000 --- a/private/neovim/tabline.lua +++ /dev/null @@ -1 +0,0 @@ -require('tabline').setup({ enable = true, options = { show_bufnr = true, show_filename_only = true } }) diff --git a/private/neovim/telescope.lua b/private/neovim/telescope.lua deleted file mode 100644 index 2bb00cd..0000000 --- a/private/neovim/telescope.lua +++ /dev/null @@ -1,29 +0,0 @@ -local telescope = require("telescope") -local actions = require("telescope.actions") -local themes = require("telescope.themes") - -telescope.setup({ - defaults = { - mappings = { - i = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - [""] = actions.close, - [""] = actions.close - }, - n = { - [""] = actions.close, - [""] = actions.close - } - } - }, - extensions = { - ["ui-select"] = { - themes.get_dropdown({}) - }, - } -}) - -telescope.load_extension("fzf") -telescope.load_extension("ui-select") -telescope.load_extension("projects") diff --git a/private/neovim/themes.lua b/private/neovim/themes.lua deleted file mode 100644 index 8d0b48e..0000000 --- a/private/neovim/themes.lua +++ /dev/null @@ -1 +0,0 @@ -vim.cmd("colorscheme solarized") diff --git a/private/neovim/toggleterm.lua b/private/neovim/toggleterm.lua deleted file mode 100644 index 37cbe4c..0000000 --- a/private/neovim/toggleterm.lua +++ /dev/null @@ -1 +0,0 @@ -require("toggleterm").setup({ size = 32, open_mapping = [[]] }) diff --git a/private/neovim/treesitter.lua b/private/neovim/treesitter.lua deleted file mode 100644 index eca7e14..0000000 --- a/private/neovim/treesitter.lua +++ /dev/null @@ -1,14 +0,0 @@ -require('nvim-treesitter.configs').setup({ - highlight = { - enable = true, - }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "v", - node_decremental = "<", - node_incremental = ">", - scope_incremental = false, - }, - }, -})