From b96c09207810d0051334e97d5b9265334001410a Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 3 Apr 2024 14:08:46 +0100 Subject: [PATCH] First attempt at a minimal configuration --- after/plugin/dictionary-gb.txt | 17 --- after/plugin/lsp.lua | 238 --------------------------------- after/plugin/null-ls.lua | 17 --- after/plugin/nvim-ufo.lua | 13 -- init.lua | 22 +++ lua/eddie/lazy.lua | 128 +++--------------- lua/eddie/options.lua | 30 ----- lua/eddie/remaps.lua | 28 ---- spell/en.utf-8.add | 17 +++ 9 files changed, 61 insertions(+), 449 deletions(-) delete mode 100644 after/plugin/dictionary-gb.txt delete mode 100644 after/plugin/lsp.lua delete mode 100644 after/plugin/null-ls.lua delete mode 100644 after/plugin/nvim-ufo.lua diff --git a/after/plugin/dictionary-gb.txt b/after/plugin/dictionary-gb.txt deleted file mode 100644 index 936a363..0000000 --- a/after/plugin/dictionary-gb.txt +++ /dev/null @@ -1,17 +0,0 @@ -CIFAR -MNIST -LeNet -MUL -BCNN -Grangegorman -Cueto -Mendoza -Maynooth -Frobenius -Neuromorphic -neuromorphic -NN -pytorch -Pytorch -SOTA - diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua deleted file mode 100644 index 2892ba9..0000000 --- a/after/plugin/lsp.lua +++ /dev/null @@ -1,238 +0,0 @@ -local lsp = require('lsp-zero') - -local f = io.popen("uname -s") -if (f ~= nil) then - MY_OS = f:read("*a") - MY_OS = string.gsub(MY_OS, "%s+", "") - f:close() -end - - -lsp.preset("recommended") - -if (MY_OS == 'Linux') -then - lsp.ensure_installed({ - -- Replace these with whatever servers you want to install - 'bashls', - 'clangd', - 'dockerls', - 'julials', - 'lua_ls', - 'ltex', - 'pylsp', - 'rust_analyzer', - 'texlab', - 'zls' - }) -elseif (MY_OS == 'FreeBSD') or (MY_OS == 'OpenBSD') -then - lsp.ensure_installed({ - -- Replace these with whatever servers you want to install - 'bashls', - 'dockerls', - 'pylsp' - }) -else - print('Should never be here') -end - -local cmp = require("cmp") -local cmp_select = { behavior = cmp.SelectBehavior.Select } -local cmp_mappings = lsp.defaults.cmp_mappings({ - [""] = cmp.mapping.select_prev_item(cmp_select), - [""] = cmp.mapping.select_next_item(cmp_select), - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.confirm({ select = true }), - [''] = cmp.mapping.complete(), -}) - -lsp.setup_nvim_cmp({ - mapping = cmp_mappings -}) - -lsp.on_attach(function(client, bufnr) - local opts = { buffer = bufnr, remap = false } - - vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, opts, { desc = "LSP Goto Reference" }) - vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts, { desc = "LSP Goto Definition" }) - vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts, { desc = "LSP Hover" }) - vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts, - { desc = "LSP Workspace Symbol" }) - vim.keymap.set("n", "vd", function() vim.diagnostic.setloclist() end, opts, { desc = "LSP Show Diagnostics" }) - vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts, { desc = "Next Diagnostic" }) - vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts, { desc = "Previous Diagnostic" }) - vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, opts, { desc = "LSP Code Action" }) - vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts, { desc = "LSP References" }) - vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts, { desc = "LSP Rename" }) - vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts, { desc = "LSP Signature Help" }) -end) - - -if (MY_OS == 'Linux') -then - -- Installed for Linux - require('lspconfig').bashls.setup({}) - - require('lspconfig').clangd.setup({}) - - --require('lspconfig').gopls.setup({}) - - require('lspconfig').julials.setup({}) - - --require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls()) - require('lspconfig').lua_ls.setup({ - 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' }, - neededFileStatus = { - ["codestyle-check"] = "Any", - }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - format = { - enable = true, - -- Put format options here - -- NOTE: the value should be STRING!! - defaultConfig = { - indent_style = "space", - indent_size = "4", - } - }, - }, - }, - }) - - local path = vim.fn.stdpath("config") .. "/after/plugin/dictionary-gb.txt" - local words = {} - - for word in io.open(path, "r"):lines() do - table.insert(words, word) - end - - require('lspconfig').ltex.setup({ - settings = { - ltex = { - language = "en-GB", - dictionary = { - ["en-GB"] = words, - }, - }, - }, - }) - - require('lspconfig').rust_analyzer.setup({ - settings = { - ["rust-analyzer"] = { - diagnostics = { - enable = false; - } - } - } - }) - - require('lspconfig').texlab.setup({}) - - require('lspconfig').zls.setup({}) - -elseif (MY_OS == 'FreeBSD') or (MY_OS == 'OpenBSD') -then - -- Installed for BSD - require('lspconfig').bashls.setup({}) - - require('lspconfig').clangd.setup({}) - - --local path = vim.fn.stdpath("config") .. "/after/plugin/dictionary-gb.txt" - --local words = {} - - --for word in io.open(path, "r"):lines() do - -- table.insert(words, word) - --end - - --require('lspconfig').ltex.setup({ - -- settings = { - -- ltex = { - -- language = "en-GB", - -- dictionary = { - -- ["en-GB"] = words, - -- }, - -- }, - -- }, - --}) - - require('lspconfig').rust_analyzer.setup({ - settings = { - ["rust-analyzer"] = { - diagnostics = { - enable = false; - } - } - } - }) - - require('lspconfig').texlab.setup({}) - - require('lspconfig').zls.setup({}) - -else - print('Should never be here') -end - - - -lsp.setup() - -local cmp_action = require('lsp-zero').cmp_action() - -require('luasnip.loaders.from_vscode').lazy_load() - --- `/` cmdline setup. -cmp.setup.cmdline('/', { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' } - } -}) - --- `:` cmdline setup. -cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' } - }, { - { - name = 'cmdline', - option = { - ignore_cmds = { 'Man', '!' } - } - } - }) -}) - -cmp.setup({ - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip', keyword_length = 2 }, - { name = 'buffer', keyword_length = 3 }, - { name = 'path' }, - }, - mapping = { - [''] = cmp_action.luasnip_jump_forward(), - [''] = cmp_action.luasnip_jump_backward(), - [''] = cmp_action.luasnip_supertab(), - [''] = cmp_action.luasnip_shift_supertab(), - }, -}) diff --git a/after/plugin/null-ls.lua b/after/plugin/null-ls.lua deleted file mode 100644 index da7da54..0000000 --- a/after/plugin/null-ls.lua +++ /dev/null @@ -1,17 +0,0 @@ -vim.keymap.set("n", "l", 'lua vim.lsp.buf.format()') - -local null_ls = require("null-ls") - -null_ls.setup({ - sources = { - null_ls.builtins.formatting.stylua, - null_ls.builtins.formatting.prettier, - --null_ls.builtins.diagnostics.eslint, - null_ls.builtins.completion.spell, - null_ls.builtins.code_actions.eslint, - --null_ls.builtins.diagnostics.jsonlint, - null_ls.builtins.diagnostics.ktlint, - null_ls.builtins.diagnostics.markdownlint, - --null_ls.builtins.diagnostics.protoc_gen_lint, - }, -}) diff --git a/after/plugin/nvim-ufo.lua b/after/plugin/nvim-ufo.lua deleted file mode 100644 index 978d4af..0000000 --- a/after/plugin/nvim-ufo.lua +++ /dev/null @@ -1,13 +0,0 @@ -vim.o.foldcolumn = '1' -- '0' is not bad -vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value -vim.o.foldlevelstart = 99 -vim.o.foldenable = true - -vim.keymap.set('n', 'zR', require('ufo').openAllFolds, { desc = "Open all folds"}) -vim.keymap.set('n', 'zM', require('ufo').closeAllFolds, { desc = "Close all folds"}) - -require('ufo').setup({ - provider_selector = function(bufnr, filetype, buftype) - return {'treesitter', 'indent'} - end -}) diff --git a/init.lua b/init.lua index 40f23b1..5150b74 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,25 @@ require('eddie.lazy') require('eddie.remaps') require('eddie.options') + +--[[ + +local f = io.popen("uname -s") +if (f ~= nil) then + MY_OS = f:read("*a") + MY_OS = string.gsub(MY_OS, "%s+", "") + f:close() +end + +if (MY_OS == 'Linux') +then + print('Should be here if on Linux') +elseif (MY_OS == 'FreeBSD') or (MY_OS == 'OpenBSD') +then + print('Should be here if on BSD') +else + print('Should never be here') +end + +]]-- + diff --git a/lua/eddie/lazy.lua b/lua/eddie/lazy.lua index d4d2a42..9d157a1 100644 --- a/lua/eddie/lazy.lua +++ b/lua/eddie/lazy.lua @@ -1,4 +1,4 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +local lazypath= vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", @@ -15,57 +15,23 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' local plugins = { - { - 'pwntester/octo.nvim', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-telescope/telescope.nvim', - 'nvim-tree/nvim-web-devicons', - }, - config = function() - require "octo".setup() - end - }, { 'nvim-telescope/telescope.nvim', tag = '0.1.5', dependencies = { { 'nvim-lua/plenary.nvim' } } }, - { - "windwp/nvim-ts-autotag", - dependencies = "nvim-treesitter/nvim-treesitter", - config = function() - require('nvim-ts-autotag').setup({}) - end, - lazy = true, - event = "VeryLazy" - }, - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - config = function() - local configs = require("nvim-treesitter.configs") - - configs.setup({ - ensure_installed = { - "bash", - "c", - "dockerfile", - "json", - "julia", - "latex", - "lua", - "vim", - "vimdoc", - "zig", - }, - sync_install = false, - highlight = { enable = true }, - indent = { enable = true }, - }) - end - }, { 'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }, + { "nvim-telescope/telescope-live-grep-args.nvim" }, + { + "aaronhallaert/advanced-git-search.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + "tpope/vim-fugitive", + 'tpope/vim-rhubarb', + }, + }, + 'nvim-telescope/telescope-ui-select.nvim', + 'debugloop/telescope-undo.nvim', { "folke/tokyonight.nvim", lazy = false, -- make sure we load this during startup if it is your main colorscheme @@ -75,7 +41,7 @@ local plugins = { vim.cmd('colorscheme tokyonight-night') end, }, - 'nvim-treesitter/playground', + 'ThePrimeagen/harpoon', { 'mbbill/undotree', @@ -102,6 +68,15 @@ local plugins = { require("nvim-autopairs").setup() end }, + { + "kylechui/nvim-surround", + version = "*", -- Use for stability; omit to use `main` branch for the latest features + event = "VeryLazy", + config = function() + require("nvim-surround").setup({ + }) + end + }, { 'vimwiki/vimwiki' }, { "nvim-tree/nvim-tree.lua" }, { @@ -115,28 +90,13 @@ local plugins = { }) end }, - { - 'lervag/vimtex' - }, { 'bronson/vim-trailing-whitespace' }, - { - "kylechui/nvim-surround", - version = "*", -- Use for stability; omit to use `main` branch for the latest features - event = "VeryLazy", - config = function() - require("nvim-surround").setup({ - }) - end - }, { 'junegunn/fzf', build = ":call fzf#install()" }, - 'nanotee/zoxide.vim', - 'nvim-telescope/telescope-ui-select.nvim', - 'debugloop/telescope-undo.nvim', { "AckslD/nvim-neoclip.lua", dependencies = { @@ -168,45 +128,10 @@ local plugins = { }, 'airblade/vim-gitgutter', 'mg979/vim-visual-multi', - 'tpope/vim-rails', { 'kevinhwang91/nvim-ufo', dependencies = 'kevinhwang91/promise-async' }, - { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v2.x', - dependencies = { - -- LSP Support - { 'neovim/nvim-lspconfig' }, -- Required - { -- Optional - 'williamboman/mason.nvim', - build = function() - pcall(vim.cmd, 'MasonUpdate') - end, - }, - { 'williamboman/mason-lspconfig.nvim' }, -- Optional - - -- Autocompletion - { 'hrsh7th/nvim-cmp' }, -- Required - { 'hrsh7th/cmp-nvim-lsp' }, -- Required - { 'L3MON4D3/LuaSnip' }, -- Required - { "rafamadriz/friendly-snippets" }, - { 'hrsh7th/cmp-buffer' }, - { 'hrsh7th/cmp-path' }, - { 'hrsh7th/cmp-cmdline' }, - { 'saadparwaiz1/cmp_luasnip' }, - } - }, - { - 'nvimtools/none-ls.nvim', - config = function() - require('null-ls').setup({ - - }) - end, - dependencies = { 'nvim-lua/plenary.nvim' }, - }, { 'folke/which-key.nvim', event = "VeryLazy", @@ -216,15 +141,6 @@ local plugins = { end, opts = {} }, - { "nvim-telescope/telescope-live-grep-args.nvim" }, - { - "aaronhallaert/advanced-git-search.nvim", - dependencies = { - "nvim-telescope/telescope.nvim", - "tpope/vim-fugitive", - 'tpope/vim-rhubarb', - }, - }, } require('lazy').setup(plugins, { diff --git a/lua/eddie/options.lua b/lua/eddie/options.lua index 448c9d8..f88a5a5 100644 --- a/lua/eddie/options.lua +++ b/lua/eddie/options.lua @@ -36,37 +36,7 @@ vim.opt.updatetime = 50 vim.opt.colorcolumn = "80" --- LSP options -vim.diagnostic.config({ - virtual_text = false -}) - -- Show line diagnostics automatically in hover window vim.o.updatetime = 250 vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]] --- Vimtex options: -vim.g.vimtex_view_method = "zathura" -vim.g.vimtex_general_viewer = "zathura" -vim.g.vimtex_quickfix_mode = 0 - --- OBSD options ---vim.g.vimtex_compiler_latexmk={ 'cmd': '' } - --- Ignore mappings -vim.g.vimtex_mappings_enabled = 1 - ----- Auto Indent ---vim.g["vimtex_indent_enabled"] = 1 - ----- Syntax highlighting -vim.g.vimtex_syntax_enabled = 0 - --- Error suppression: -vim.g.vimtex_log_ignore = ({ - "Underfull", - "Overfull", - "specifier changed to", - "Token not allowed in a PDF string", -}) - diff --git a/lua/eddie/remaps.lua b/lua/eddie/remaps.lua index 4180e98..1dd8a35 100644 --- a/lua/eddie/remaps.lua +++ b/lua/eddie/remaps.lua @@ -53,31 +53,6 @@ vim.keymap.set("n", "x", "!chmod +x %", { silent = true, desc = -- Jump to plugin management file vim.keymap.set("n", "vpp", "e ~/.config/nvim/lua/exosyphon/lazy.lua", { desc = "Jump to lazy.lua" }) --- Run Tests -vim.keymap.set("n", "t", "lua require('neotest').run.run()", { desc = "Run Test" }) -vim.keymap.set("n", "tf", "lua require('neotest').run.run(vim.fn.expand('%'))", { desc = "Run Test File" } ) -vim.keymap.set("n", "td", "lua require('neotest').run.run(vim.fn.getcwd())", { desc = "Run Current Test Directory" }) -vim.keymap.set("n", "tp", "lua require('neotest').output_panel.toggle()", { desc = "Toggle Test Output Panel" }) -vim.keymap.set("n", "tl", "lua require('neotest').run.run_last()", { desc = "Run Last Test" }) -vim.keymap.set("n", "ts", "lua require('neotest').summary.toggle()", { desc = "Toggle Test Summary" }) - --- Debug Tests -vim.keymap.set("n", "dt", "DapContinue", { desc = "Start Debugging" }) -vim.keymap.set("n", "dc", "DapContinue", { desc = "Start Debugging" }) -vim.keymap.set("n", "dso", "DapStepOver", { desc = "Step Over" }) -vim.keymap.set("n", "dsi", "DapStepInto", { desc = "Step Into" }) -vim.keymap.set("n", "dsu", "DapStepOut", { desc = "Step Out" }) -vim.keymap.set("n", "dst", "DapStepTerminate", { desc = "Stop Debugger" }) -vim.keymap.set("n", "b", "lua require'dap'.toggle_breakpoint()", { desc = "Toggle Breakpoint" }) -vim.keymap.set("n", "B", "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", { desc = "Toggle Breakpoint Condition" }) -vim.keymap.set("n", "E", "lua require'dap'.set_exception_breakpoints()", { desc = "Toggle Exception Breakpoint" }) -vim.keymap.set("n", "dr", "lua require'dapui'.float_element('repl', { width = 100, height = 40, enter = true })", { desc = "Show DAP REPL" }) -vim.keymap.set("n", "ds", "lua require'dapui'.float_element('scopes', { width = 150, height = 50, enter = true })", { desc = "Show DAP Scopes" }) -vim.keymap.set("n", "df", "lua require'dapui'.float_element('stacks', { width = 150, height = 50, enter = true })", { desc = "Show DAP Stacks" }) -vim.keymap.set("n", "db", "lua require'dapui'.float_element('breakpoints', { enter = true })", { desc = "Show DAP breakpoints" }) -vim.keymap.set("n", "do", "lua require'dapui'.toggle()", { desc = "Toggle DAP UI" }) -vim.keymap.set("n", "dl", "lua require'dap'.run_last()", { desc = "Debug Last Test" }) - -- Git revert at current cursor location vim.keymap.set("n", "U", "GitGutterUndoHunk", { desc = "Revert Git Hunk" }) @@ -89,9 +64,6 @@ vim.keymap.set("n", "", function() vim.cmd("so") end, { desc = "Source current file" }) --- Open Zoxide telescope extension -vim.keymap.set("n", "Z", "Zi", { desc = "Open Zoxide" }) - -- Resize with arrows vim.keymap.set("n", "", ":resize +2", { desc = "Resize Horizontal Split Down" }) vim.keymap.set("n", "", ":resize -2", { desc = "Resize Horizontal Split Up" }) diff --git a/spell/en.utf-8.add b/spell/en.utf-8.add index 735ef98..fb12787 100644 --- a/spell/en.utf-8.add +++ b/spell/en.utf-8.add @@ -1,3 +1,20 @@ hyperparameter hyperparameters NVIDIA +CIFAR +MNIST +LeNet +MUL +BCNN +Grangegorman +Cueto +Mendoza +Maynooth +Frobenius +Neuromorphic +neuromorphic +NN +pytorch +Pytorch +SOTA +