From 9b85f90eb1b11dd00dc80791dfb6236466558419 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Thu, 21 Dec 2023 13:56:10 +0100 Subject: [PATCH] feat(neovim): get rid of old nvim config --- modules/tui/default.nix | 2 +- .../tui/{neovim/default.nix => neovim.nix} | 0 .../neovim/lua/after/ftplugin/PKGBUILD.lua | 2 - .../tui/neovim/lua/after/ftplugin/html.lua | 2 - .../neovim/lua/after/ftplugin/makefile.lua | 2 - modules/tui/neovim/lua/after/ftplugin/nix.lua | 2 - .../tui/neovim/lua/after/ftplugin/svelte.lua | 2 - modules/tui/neovim/lua/init.lua | 16 -- modules/tui/neovim/lua/lua/.luarc.json | 3 - modules/tui/neovim/lua/lua/dap_conf.lua | 1 - modules/tui/neovim/lua/lua/diagnostic.lua | 12 -- modules/tui/neovim/lua/lua/global.lua | 15 -- modules/tui/neovim/lua/lua/keymap.lua | 7 - modules/tui/neovim/lua/lua/lsp.lua | 97 --------- modules/tui/neovim/lua/lua/opts.lua | 39 ---- modules/tui/neovim/lua/lua/plugins.lua | 186 ------------------ 16 files changed, 1 insertion(+), 387 deletions(-) rename modules/tui/{neovim/default.nix => neovim.nix} (100%) delete mode 100644 modules/tui/neovim/lua/after/ftplugin/PKGBUILD.lua delete mode 100644 modules/tui/neovim/lua/after/ftplugin/html.lua delete mode 100644 modules/tui/neovim/lua/after/ftplugin/makefile.lua delete mode 100644 modules/tui/neovim/lua/after/ftplugin/nix.lua delete mode 100644 modules/tui/neovim/lua/after/ftplugin/svelte.lua delete mode 100644 modules/tui/neovim/lua/init.lua delete mode 100644 modules/tui/neovim/lua/lua/.luarc.json delete mode 100644 modules/tui/neovim/lua/lua/dap_conf.lua delete mode 100644 modules/tui/neovim/lua/lua/diagnostic.lua delete mode 100644 modules/tui/neovim/lua/lua/global.lua delete mode 100644 modules/tui/neovim/lua/lua/keymap.lua delete mode 100644 modules/tui/neovim/lua/lua/lsp.lua delete mode 100644 modules/tui/neovim/lua/lua/opts.lua delete mode 100644 modules/tui/neovim/lua/lua/plugins.lua diff --git a/modules/tui/default.nix b/modules/tui/default.nix index e845d80e..a42abe18 100644 --- a/modules/tui/default.nix +++ b/modules/tui/default.nix @@ -1,8 +1,8 @@ _: { imports = [ - ./neovim ./btop.nix ./helix.nix + ./neovim.nix ./newsboat.nix ]; } diff --git a/modules/tui/neovim/default.nix b/modules/tui/neovim.nix similarity index 100% rename from modules/tui/neovim/default.nix rename to modules/tui/neovim.nix diff --git a/modules/tui/neovim/lua/after/ftplugin/PKGBUILD.lua b/modules/tui/neovim/lua/after/ftplugin/PKGBUILD.lua deleted file mode 100644 index 9fd7363c..00000000 --- a/modules/tui/neovim/lua/after/ftplugin/PKGBUILD.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.opt.shiftwidth=2 -vim.opt.tabstop=2 diff --git a/modules/tui/neovim/lua/after/ftplugin/html.lua b/modules/tui/neovim/lua/after/ftplugin/html.lua deleted file mode 100644 index 9fd7363c..00000000 --- a/modules/tui/neovim/lua/after/ftplugin/html.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.opt.shiftwidth=2 -vim.opt.tabstop=2 diff --git a/modules/tui/neovim/lua/after/ftplugin/makefile.lua b/modules/tui/neovim/lua/after/ftplugin/makefile.lua deleted file mode 100644 index 465fa626..00000000 --- a/modules/tui/neovim/lua/after/ftplugin/makefile.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.opt.shiftwidth=8 -vim.opt.tabstop=8 diff --git a/modules/tui/neovim/lua/after/ftplugin/nix.lua b/modules/tui/neovim/lua/after/ftplugin/nix.lua deleted file mode 100644 index 75f2a880..00000000 --- a/modules/tui/neovim/lua/after/ftplugin/nix.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.opt.shiftwidth=4 -vim.opt.tabstop=4 diff --git a/modules/tui/neovim/lua/after/ftplugin/svelte.lua b/modules/tui/neovim/lua/after/ftplugin/svelte.lua deleted file mode 100644 index 9fd7363c..00000000 --- a/modules/tui/neovim/lua/after/ftplugin/svelte.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.opt.shiftwidth=2 -vim.opt.tabstop=2 diff --git a/modules/tui/neovim/lua/init.lua b/modules/tui/neovim/lua/init.lua deleted file mode 100644 index b74b4ec0..00000000 --- a/modules/tui/neovim/lua/init.lua +++ /dev/null @@ -1,16 +0,0 @@ -require("global") -require("keymap") -require("plugins") -require("opts") -require("diagnostic") -require("lsp") -require("dap_conf") - --- shit I haven't been able to port yet -vim.cmd [[ - if has('termguicolors') - set termguicolors - endif - filetype plugin indent on - autocmd VimEnter * hi Normal guibg=none -]] diff --git a/modules/tui/neovim/lua/lua/.luarc.json b/modules/tui/neovim/lua/lua/.luarc.json deleted file mode 100644 index 23b9ee27..00000000 --- a/modules/tui/neovim/lua/lua/.luarc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "workspace.checkThirdParty": false -} \ No newline at end of file diff --git a/modules/tui/neovim/lua/lua/dap_conf.lua b/modules/tui/neovim/lua/lua/dap_conf.lua deleted file mode 100644 index 0d7d022e..00000000 --- a/modules/tui/neovim/lua/lua/dap_conf.lua +++ /dev/null @@ -1 +0,0 @@ -local dap = require("dap") diff --git a/modules/tui/neovim/lua/lua/diagnostic.lua b/modules/tui/neovim/lua/lua/diagnostic.lua deleted file mode 100644 index c193cc07..00000000 --- a/modules/tui/neovim/lua/lua/diagnostic.lua +++ /dev/null @@ -1,12 +0,0 @@ -vim.diagnostic.config({ - -- text after the erroneous line - virtual_text = true, - signs = false, - --float = { border = "single" }, -}) - -local opts = { noremap = true, silent = true } -vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) diff --git a/modules/tui/neovim/lua/lua/global.lua b/modules/tui/neovim/lua/lua/global.lua deleted file mode 100644 index f18fad79..00000000 --- a/modules/tui/neovim/lua/lua/global.lua +++ /dev/null @@ -1,15 +0,0 @@ --- no triangles without it -vim.g.airline_powerline_fonts = true -vim.g.airline_theme="catppuccin" - --- TODO idk if these actually do anything -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' - -if vim.fn.exists("g:neovide") then - vim.g.neovide_refresh_rate = 165 - vim.g.neovide_transparency = 0.85 - vim.g.neovide_cursor_vfx_mode = "railgun" -end - -vim.g.lichess_api_token = os.getenv("LICHESS_API_TOKEN") diff --git a/modules/tui/neovim/lua/lua/keymap.lua b/modules/tui/neovim/lua/lua/keymap.lua deleted file mode 100644 index 55fe4f81..00000000 --- a/modules/tui/neovim/lua/lua/keymap.lua +++ /dev/null @@ -1,7 +0,0 @@ ---vim.keymap.set("n", "n", "h") ---vim.keymap.set("n", "e", "j") ---vim.keymap.set("n", "i", "k") ---vim.keymap.set("n", "o", "l") ---vim.keymap.set("n", "K", "N") ---vim.keymap.set("n", "k", "n") ---vim.keymap.set("n", "z", "b") diff --git a/modules/tui/neovim/lua/lua/lsp.lua b/modules/tui/neovim/lua/lua/lsp.lua deleted file mode 100644 index 0950e30b..00000000 --- a/modules/tui/neovim/lua/lua/lsp.lua +++ /dev/null @@ -1,97 +0,0 @@ -require("mason").setup() -require("mason-lspconfig").setup { - ensure_installed = { - "rust_analyzer", - "wgsl_analyzer", - "tsserver", - "svelte", - "lua_ls", - "clangd", - "kotlin_language_server", - "jedi_language_server", - "jdtls", - }, -} - -local servers = { - "tsserver", - "svelte", - "lua_ls", - "clangd", - "kotlin_language_server", - "html", - "cssls", - "bashls", - "cmake", - "jedi_language_server", - "jdtls", - "wgsl_analyzer", - "nil_ls", -} - --- shit wouldn't stop whining about an unused local variable ----@diagnostic disable-next-line: unused-local -local on_attach = function(client, bufnr) - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - local bufopts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) - vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) - vim.keymap.set('n', 'r', vim.lsp.buf.rename, bufopts) - vim.keymap.set('n', 'a', vim.lsp.buf.code_action, bufopts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', '', function() vim.lsp.buf.format { async = true } end, bufopts) -end - -local lsp_flags = { -} - -for _, server in ipairs(servers) do - require("lspconfig")[server].setup(require("coq").lsp_ensure_capabilities({ - on_attach = on_attach, - flags = lsp_flags, - })) -end - -require("flutter-tools").setup { - lsp = require("coq").lsp_ensure_capabilities({ - on_attach = on_attach, - flags = lsp_flags, - virtual_text = true, - }), -} - -local rt = require("rust-tools") -rt.setup({ - tools = { - inlay_hints = { - auto = true, - only_current_line = true, - show_parameter_hints = true, - } - }, - server = { - on_attach = function(client, bufnr) - on_attach(client, bufnr) - -- Hover actions - vim.keymap.set("n", "", rt.hover_actions.hover_actions, { buffer = bufnr }) - -- Code action groups - vim.keymap.set("n", "a", rt.code_action_group.code_action_group, { buffer = bufnr }) - end, - -- https://github.com/simrat39/rust-tools.nvim/issues/300 - settings = { - ["rust-analyzer"] = { - inlayHints = { locationLinks = false }, - }, - }, - }, -}) diff --git a/modules/tui/neovim/lua/lua/opts.lua b/modules/tui/neovim/lua/lua/opts.lua deleted file mode 100644 index d5270f96..00000000 --- a/modules/tui/neovim/lua/lua/opts.lua +++ /dev/null @@ -1,39 +0,0 @@ --- line numbers on the left -vim.opt.number = true --- show number relative to current line -vim.opt.relativenumber = true --- re-reads a file when it's changed -vim.opt.autoread = true --- it scrolls the file when the cursor is x amount of lines from the edge -vim.opt.so = 7 --- show cmd even if not used -vim.opt.cmdheight = 1 --- ignores the case when searching -vim.opt.ignorecase = true --- IDK do :help options and read the part about this I don't understand -vim.opt.smartcase = true --- when you type a closing bracket it briefly jump to the opening one -vim.opt.showmatch = true --- time in millis how long it wauts for another key in a sequence -vim.opt.timeoutlen = 500 --- yeah -vim.opt.encoding = "utf8" --- IDK read the manual -vim.opt.smarttab = true --- insert 4 spaces instead of tab -vim.opt.shiftwidth = 4 -vim.opt.tabstop = 4 -vim.opt.expandtab = true --- breaks line when too long -vim.opt.linebreak = true --- indents but smart ! -vim.opt.smartindent = true --- saves the swap file to disk after this many millis -vim.opt.updatetime = 300 --- to keep the terminals from toggleterm on when hidden -vim.opt.hidden = true -vim.opt.background = "dark" --- for bufferline hover shit -vim.opt.mousemoveevent = true --- true color ---vim.opt.termguicolors = true diff --git a/modules/tui/neovim/lua/lua/plugins.lua b/modules/tui/neovim/lua/lua/plugins.lua deleted file mode 100644 index 1b084cf4..00000000 --- a/modules/tui/neovim/lua/lua/plugins.lua +++ /dev/null @@ -1,186 +0,0 @@ -require "paq" { - -- the paq: - "savq/paq-nvim", - -- tj lib - "nvim-lua/plenary.nvim", - -- TODO do I need this - "cdelledonne/vim-cmake", - -- TODO do I need this - "tpope/vim-fugitive", - -- the line on the bottom - "vim-airline/vim-airline", - "vim-airline/vim-airline-themes", - -- switch between .c and .h - "nacitar/a.vim", - -- sitting on the tree - "nvim-treesitter/nvim-treesitter", - -- fast as FUCK completion - "ms-jpq/coq_nvim", - "ms-jpq/coq.artifacts", - -- file explorer - { "ms-jpq/chadtree", run = "python3 -m chadtree deps" }, - -- better term - "akinsho/toggleterm.nvim", - -- hide secrets and shit - "laytan/cloak.nvim", - -- some cool icons for other plugins - "nvim-tree/nvim-web-devicons", - -- shows git changes at the start of the line - "lewis6991/gitsigns.nvim", - -- lsp manager - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - -- the one and only - "neovim/nvim-lspconfig", - -- flutter takes up too much space man - "akinsho/flutter-tools.nvim", - -- <3 - "simrat39/rust-tools.nvim", - -- s to jump to what you see on the screen - "ggandor/leap.nvim", - -- color picker - "uga-rosa/ccc.nvim", - -- some fun shit - "Eandrju/cellular-automaton.nvim", - -- progress thingy for lsp loading - { "j-hui/fidget.nvim", branch = "legacy" }, - -- better lsp for nvim config - "folke/neodev.nvim", - -- zen like me kernel - "folke/zen-mode.nvim", - -- dims inactive code - "folke/twilight.nvim", - -- the scope: - "nvim-telescope/telescope.nvim", - -- the comment: - "numToStr/Comment.nvim", - -- needed for cheat sheet - "RishabhRD/popfix", - -- cheat sheet - "RishabhRD/nvim-cheat.sh", - -- rust :3 - "Saecki/crates.nvim", - -- chess :3 - "luk400/vim-lichess", - -- - "mfussenegger/nvim-dap", - "lrangell/theme-cycler.nvim", - { "catppuccin/nvim", as="catppuccin" }, -} - -vim.filetype.add({extension = {wgsl = "wgsl"}}) - -require("nvim-treesitter.configs").setup { - highlight = { enable = true, }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "gnn", - node_incremental = "gzn", - node_decremental = "gzm", - scope_incremental = "gzb", - }, - }, -} - -vim.wo.foldmethod = "expr" -vim.wo.foldexpr = "nvim_treesitter#foldexpr()" -vim.o.foldlevelstart = 99 - -require("toggleterm").setup { - size = 10, - open_mapping = [[]], - shade_terminals = true, - shading_factor = 2, - auto_scroll = true, - direction = "float", -} - --- cock -vim.g.coq_settings = { - auto_start = "shut-up", - display = { - pum = { - fast_close = true, - }, - }, - completion = { - always = false, - }, -} - -vim.keymap.set("n", "v", vim.cmd.CHADopen) - -require("neodev").setup() - -require("cloak").setup({ - cloak_character = "•", -}) - -vim.keymap.set("n", "", require("cloak").toggle) - -require("gitsigns").setup { - signcolumn = true, - numhl = true, - word_diff = true, - current_line_blame = true, -} - -require("leap").add_default_mappings() - -require("fidget").setup() - -require("ccc").setup({ - highlighter = { - auto_enable = true - } -}) - -local opts = { noremap = true, silent = true } - -local builtin = require("telescope.builtin") -vim.keymap.set("n", "ff", builtin.find_files, opts) -vim.keymap.set("n", "fg", builtin.live_grep, opts) -vim.keymap.set("n", "fb", builtin.buffers, opts) -vim.keymap.set("n", "fh", builtin.help_tags, opts) - -require("Comment").setup() - -local chadtree_settings = { - keymap = { - tertiary = { "t", "" } - } -} -vim.api.nvim_set_var("chadtree_settings", chadtree_settings) - -local crates = require("crates") - -crates.setup { - src = { - coq = { - enabled = true, - name = "crates.nvim", - } - } -} - -vim.keymap.set('n', 'ct', crates.toggle, opts) -vim.keymap.set('n', 'cr', crates.reload, opts) - -vim.keymap.set('n', 'cv', crates.show_versions_popup, opts) -vim.keymap.set('n', 'cf', crates.show_features_popup, opts) -vim.keymap.set('n', 'cd', crates.show_dependencies_popup, opts) - -vim.keymap.set('n', 'cu', crates.update_crate, opts) -vim.keymap.set('v', 'cu', crates.update_crates, opts) -vim.keymap.set('n', 'ca', crates.update_all_crates, opts) -vim.keymap.set('n', 'cU', crates.upgrade_crate, opts) -vim.keymap.set('v', 'cU', crates.upgrade_crates, opts) -vim.keymap.set('n', 'cA', crates.upgrade_all_crates, opts) - -vim.keymap.set('n', 'cH', crates.open_homepage, opts) -vim.keymap.set('n', 'cR', crates.open_repository, opts) -vim.keymap.set('n', 'cD', crates.open_documentation, opts) -vim.keymap.set('n', 'cC', crates.open_crates_io, opts) - -vim.keymap.set("n", "t", require("themeCycler").open_lazy)