From 354709d26792db0b7ee6121e62198c7c3dc928fc Mon Sep 17 00:00:00 2001 From: Eduardo Cueto-Mendoza Date: Wed, 30 Aug 2023 10:55:40 +0100 Subject: [PATCH] Streamlined configuration for lazy and more healthy defaults --- .gitignore | 2 +- after/plugin/harpoon.lua | 10 + after/plugin/lsp.lua | 125 +++++++++++ after/plugin/neoclip.lua | 59 +++++ after/plugin/null-ls.lua | 17 ++ after/plugin/nvim-dap-vscode-js.lua | 38 ++++ after/plugin/nvim-ufo.lua | 13 ++ after/plugin/telescope.lua | 78 +++++++ init.lua | 4 +- lua/config/colorscheme.lua | 11 - lua/config/fuzzy_finder.lua | 100 --------- lua/core/init.lua | 3 - lua/core/keymaps.lua | 161 -------------- lua/core/lazy.lua | 176 --------------- lua/core/options.lua | 137 ------------ lua/eddie/lazy.lua | 332 ++++++++++++++++++++++++++++ lua/eddie/options.lua | 43 ++++ lua/eddie/remaps.lua | 110 +++++++++ lua/plugins/colorscheme.lua | 11 - lua/plugins/fuzzy_finder.lua | 6 - 20 files changed, 829 insertions(+), 607 deletions(-) create mode 100644 after/plugin/harpoon.lua create mode 100644 after/plugin/lsp.lua create mode 100644 after/plugin/neoclip.lua create mode 100644 after/plugin/null-ls.lua create mode 100644 after/plugin/nvim-dap-vscode-js.lua create mode 100644 after/plugin/nvim-ufo.lua create mode 100644 after/plugin/telescope.lua mode change 100755 => 100644 init.lua delete mode 100644 lua/config/colorscheme.lua delete mode 100644 lua/config/fuzzy_finder.lua delete mode 100755 lua/core/init.lua delete mode 100755 lua/core/keymaps.lua delete mode 100755 lua/core/lazy.lua delete mode 100755 lua/core/options.lua create mode 100644 lua/eddie/lazy.lua create mode 100644 lua/eddie/options.lua create mode 100644 lua/eddie/remaps.lua delete mode 100755 lua/plugins/colorscheme.lua delete mode 100644 lua/plugins/fuzzy_finder.lua diff --git a/.gitignore b/.gitignore index 9c1632e..21c7ff5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ *.json -packer_compiled.lua +config/* diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua new file mode 100644 index 0000000..9142d91 --- /dev/null +++ b/after/plugin/harpoon.lua @@ -0,0 +1,10 @@ +local mark = require("harpoon.mark") +local ui = require("harpoon.ui") + +vim.keymap.set("n", "a", mark.add_file, { desc = "Harpoon: Mark File"}) +vim.keymap.set("n", "", ui.toggle_quick_menu, { desc = "Toggle Harpoon Menu"}) + +vim.keymap.set("n", "", function() ui.nav_file(1) end) +vim.keymap.set("n", "", function() ui.nav_file(2) end) +vim.keymap.set("n", "", function() ui.nav_file(3) end) +vim.keymap.set("n", "", function() ui.nav_file(4) end) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100644 index 0000000..a882f87 --- /dev/null +++ b/after/plugin/lsp.lua @@ -0,0 +1,125 @@ +local lsp = require('lsp-zero') + +lsp.preset("recommended") + +lsp.ensure_installed({ + 'bashls', + 'clangd', + 'dockerls', + 'julials', + 'lua_ls', + 'ltex', + 'pylsp', + 'texlab', + 'zls' +}) + +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) + +--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", + } + }, + }, + }, +}) + +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/neoclip.lua b/after/plugin/neoclip.lua new file mode 100644 index 0000000..f2a7da7 --- /dev/null +++ b/after/plugin/neoclip.lua @@ -0,0 +1,59 @@ +require('neoclip').setup({ + history = 1000, + enable_persistent_history = false, + length_limit = 1048576, + continuous_sync = false, + db_path = vim.fn.stdpath("data") .. "/databases/neoclip.sqlite3", + filter = nil, + preview = true, + prompt = nil, + default_register = '"', + default_register_macros = 'q', + enable_macro_history = true, + content_spec_column = false, + disable_keycodes_parsing = false, + on_select = { + move_to_front = false, + close_telescope = true, + }, + on_paste = { + set_reg = false, + move_to_front = false, + close_telescope = true, + }, + on_replay = { + set_reg = false, + move_to_front = false, + close_telescope = true, + }, + on_custom_action = { + close_telescope = true, + }, + keys = { + telescope = { + i = { + select = '', + paste = '', + paste_behind = '', + replay = '', -- replay a macro + delete = '', -- delete an entry + edit = '', -- edit an entry + custom = {}, + }, + n = { + select = '', + paste = 'p', + --- It is possible to map to more than one key. + -- paste = { 'p', '' }, + paste_behind = 'P', + replay = 'q', + delete = 'd', + edit = 'e', + custom = {}, + }, + }, + }, +}) + +vim.keymap.set("n", "o", "Telescope neoclip", { desc = "Telescope Neoclip"}) + diff --git a/after/plugin/null-ls.lua b/after/plugin/null-ls.lua new file mode 100644 index 0000000..9486bda --- /dev/null +++ b/after/plugin/null-ls.lua @@ -0,0 +1,17 @@ +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-dap-vscode-js.lua b/after/plugin/nvim-dap-vscode-js.lua new file mode 100644 index 0000000..5c1145b --- /dev/null +++ b/after/plugin/nvim-dap-vscode-js.lua @@ -0,0 +1,38 @@ +require("dap-vscode-js").setup({ + debugger_path = '/Users/andrew/vscode-js-debug', + adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }, -- which adapters to register in nvim-dap +}) + +for _, language in ipairs({ "typescript", "javascript", "typescriptreact" }) do + require("dap").configurations[language] = { + { + type = "pwa-node", + request = "launch", + name = "Debug Jest Tests", + -- trace = true, -- include debugger info + runtimeExecutable = "node", + runtimeArgs = { + "./node_modules/jest/bin/jest.js", + "--runInBand", + }, + rootPath = "${workspaceFolder}", + cwd = "${workspaceFolder}", + console = "integratedTerminal", + internalConsoleOptions = "neverOpen", + }, + { + type = "pwa-node", + request = "launch", + name = "Launch file", + program = "${file}", + cwd = "${workspaceFolder}", + }, + { + type = "pwa-node", + request = "attach", + name = "Attach", + processId = require("dap.utils").pick_process, + cwd = "${workspaceFolder}", + }, + } +end diff --git a/after/plugin/nvim-ufo.lua b/after/plugin/nvim-ufo.lua new file mode 100644 index 0000000..978d4af --- /dev/null +++ b/after/plugin/nvim-ufo.lua @@ -0,0 +1,13 @@ +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/after/plugin/telescope.lua b/after/plugin/telescope.lua new file mode 100644 index 0000000..908a621 --- /dev/null +++ b/after/plugin/telescope.lua @@ -0,0 +1,78 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'ff', builtin.find_files, { desc = "Find Files"}) +vim.keymap.set('n', 'fg', "lua require('telescope').extensions.live_grep_args.live_grep_args()", { desc = "Live Grep"}) +vim.keymap.set('n', 'fc', 'lua require("telescope.builtin").live_grep({ glob_pattern = "!{spec,test}"})', { desc = "Live Grep Code"}) +vim.keymap.set('n', 'fb', builtin.buffers, { desc = "Find Buffers"}) +vim.keymap.set('n', 'fh', builtin.help_tags, { desc = "Find Help Tags"}) +vim.keymap.set('n', 'fs', builtin.lsp_document_symbols, { desc = "Find Symbols"}) +vim.keymap.set('n', 'fi', 'AdvancedGitSearch', { desc = "AdvancedGitSearch"}) +vim.keymap.set('n', 'fo', builtin.oldfiles, { desc = "Find Old Files"}) +vim.keymap.set('n', 'fw', builtin.grep_string, { desc = "Find Word under Cursor"}) + +local telescope = require("telescope") +local telescopeConfig = require("telescope.config") + +-- Clone the default Telescope configuration +local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) } + +-- I want to search in hidden/dot files. +table.insert(vimgrep_arguments, "--hidden") +-- I don't want to search in the `.git` directory. +table.insert(vimgrep_arguments, "--glob") +table.insert(vimgrep_arguments, "!**/.git/*") + +local actions = require "telescope.actions" + +telescope.setup({ + defaults = { + -- `hidden = true` is not supported in text grep commands. + vimgrep_arguments = vimgrep_arguments, + path_display = { "truncate" }, + mappings = { + n = { + [""] = actions.send_selected_to_qflist + actions.open_qflist, + }, + i = { + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + + [""] = actions.send_selected_to_qflist + actions.open_qflist, + } + }, + }, + pickers = { + find_files = { + -- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d. + find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" }, + }, + }, + extensions = { + undo = { + use_delta = true, + use_custom_command = nil, -- setting this implies `use_delta = false`. Accepted format is: { "bash", "-c", "echo '$DIFF' | delta" } + side_by_side = false, + diff_context_lines = vim.o.scrolloff, + entry_format = "state #$ID, $STAT, $TIME", + mappings = { + i = { + [""] = require("telescope-undo.actions").yank_additions, + [""] = require("telescope-undo.actions").yank_deletions, + [""] = require("telescope-undo.actions").restore, + }, + }, + }, + } +}) + +require("telescope").load_extension "neoclip" + +require('telescope').load_extension('fzf') + +require('telescope').load_extension('ui-select') +vim.g.zoxide_use_select = true + +require("telescope").load_extension("undo") + +require("telescope").load_extension("advanced_git_search") + +require("telescope").load_extension("live_grep_args") diff --git a/init.lua b/init.lua old mode 100755 new mode 100644 index d9a3b72..40f23b1 --- a/init.lua +++ b/init.lua @@ -1 +1,3 @@ -require("core") +require('eddie.lazy') +require('eddie.remaps') +require('eddie.options') diff --git a/lua/config/colorscheme.lua b/lua/config/colorscheme.lua deleted file mode 100644 index cd770e7..0000000 --- a/lua/config/colorscheme.lua +++ /dev/null @@ -1,11 +0,0 @@ -function ColorMyPencils(color) - color = color or "tokyonight-night" - vim.cmd.colorscheme(color) - - --vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - --vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) - -end - -ColorMyPencils() - diff --git a/lua/config/fuzzy_finder.lua b/lua/config/fuzzy_finder.lua deleted file mode 100644 index 8d2c312..0000000 --- a/lua/config/fuzzy_finder.lua +++ /dev/null @@ -1,100 +0,0 @@ -local status_ok, telescope = pcall(require, "telescope") -if not status_ok then - return -end - -local actions = require "telescope.actions" - -telescope.setup { - defaults = { - - prompt_prefix = " ", - selection_caret = " ", - path_display = { "smart" }, - - mappings = { - i = { - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - - [""] = actions.close, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, - - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - [""] = actions.complete_tag, - [""] = actions.which_key, -- keys from pressing - }, - - n = { - [""] = actions.close, - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - - ["j"] = actions.move_selection_next, - ["k"] = actions.move_selection_previous, - ["H"] = actions.move_to_top, - ["M"] = actions.move_to_middle, - ["L"] = actions.move_to_bottom, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - ["gg"] = actions.move_to_top, - ["G"] = actions.move_to_bottom, - - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, - - ["?"] = actions.which_key, - }, - }, - }, - pickers = { - -- Default configuration for builtin pickers goes here: - -- picker_name = { - -- picker_config_key = value, - -- ... - -- } - -- Now the picker_config_key will be applied every time you call this - -- builtin picker - planets = { - show_pluto = true, - }, - }, - extensions = { - -- Your extension configuration goes here: - -- extension_name = { - -- extension_config_key = value, - -- } - -- please take a look at the readme of the extension you want to configure - }, -} - diff --git a/lua/core/init.lua b/lua/core/init.lua deleted file mode 100755 index 37a490f..0000000 --- a/lua/core/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -require("core.keymaps") -require("core.options") -require("core.lazy") diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua deleted file mode 100755 index 402be22..0000000 --- a/lua/core/keymaps.lua +++ /dev/null @@ -1,161 +0,0 @@ -local opts = { noremap = true, silent = true } - -local term_opts = { silent = true } - --- Shorten function name -local keymap = vim.api.nvim_set_keymap - ---Remap space as leader key -keymap("", "", "", opts) -vim.g.mapleader = " " -vim.g.maplocalleader = " " - --- Modes --- normal_mode = "n", --- insert_mode = "i", --- visual_mode = "v", --- visual_block_mode = "x", --- term_mode = "t", --- command_mode = "c", - --- Normal -- --- Better window navigation -keymap("n", "", "h", opts) -keymap("n", "", "j", opts) -keymap("n", "", "k", opts) -keymap("n", "", "l", opts) - -keymap("n", "e", ":Lex 30", opts) - --- Resize with arrows -keymap("n", "", ":resize -2", opts) -keymap("n", "", ":resize +2", opts) -keymap("n", "", ":vertical resize -2", opts) -keymap("n", "", ":vertical resize +2", opts) - --- Navigate buffers -keymap("n", "", ":bnext", opts) -keymap("n", "", ":bprevious", opts) - --- Move text up and down -keymap("n", "", ":m .+1==gi", opts) -keymap("n", "", ":m .-2==gi", opts) - --- Insert -- --- Press jk fast to enter -keymap("i", "jk", "", opts) -keymap("i", "kj", "", opts) - --- Visual -- --- Stay in indent mode -keymap("v", "<", "", ">gv", opts) - --- Move text up and down -keymap("v", "", ":m .+1==", opts) -keymap("v", "", ":m .-2==", opts) -keymap("v", "p", '"_dP', opts) - --- Visual Block -- --- Move text up and down -keymap("x", "J", ":move '>+1gv-gv", opts) -keymap("x", "K", ":move '<-2gv-gv", opts) -keymap("x", "", ":move '>+1gv-gv", opts) -keymap("x", "", ":move '<-2gv-gv", opts) - --- Terminal -- --- Better terminal navigation -keymap("t", "", "h", term_opts) -keymap("t", "", "j", term_opts) -keymap("t", "", "k", term_opts) -keymap("t", "", "l", term_opts) - --- keymap("n", "f", "Telescope find_files", opts) -keymap("n", "f", "lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))", opts) -keymap("n", "", "Telescope live_grep", opts) - -keymap("n", "pv", "Ex", opts) - -------------------- ----- Normal mode -- -------------------- ---local opts = { noremap = true, silent = true } --- ---local term_opts = { silent = true } --- ----- Shorten function name ---local keymap = vim.api.nvim_set_keymap --- -----Remap space as leader key ---keymap("", "", "", opts) --- ----- Hint: see `:h vim.map.set()` ----- Better window navigation ---vim.keymap.set("n", "", "h", opts) ---vim.keymap.set("n", "", "j", opts) ---vim.keymap.set("n", "", "k", opts) ---vim.keymap.set("n", "", "l", opts) --- ----- Resize with arrows ----- delta: 2 lines ---vim.keymap.set("n", "", ":resize -2", opts) ---vim.keymap.set("n", "", ":resize +2", opts) ---vim.keymap.set("n", "", ":vertical resize -2", opts) ---vim.keymap.set("n", "", ":vertical resize +2", opts) --- ----- open File Explorer ---vim.keymap.set("n", "pv", vim.cmd.Ex) --- ----- Navigate buffers ---vim.keymap.set("n", "", ":bnext", opts) ---vim.keymap.set("n", "", ":bprevious", opts) --- ----- Telescope -----local builtin = require("telescope.builtin") -----vim.keymap.set("n", "pf", builtin.find_files, {}) -----vim.keymap.set("n", "", builtin.git_files, {}) -----vim.keymap.set("n", "ps", function () ----- builtin.grep_string( { search = vim.fn.input("Grep > ") } ); -----end) --- ----- Harpoon -----local mark = require("harpoon.mark") -----local ui = require("harpoon.ui") -----vim.keymap.set("n", "a", mark.add_file) -----vim.keymap.set("n", "", ui.toggle_quick_menu) ----- -----vim.keymap.set("n", "", function () ui.nav_file(1) end) -----vim.keymap.set("n", "", function () ui.nav_file(2) end) -----vim.keymap.set("n", "", function () ui.nav_file(3) end) -----vim.keymap.set("n", "", function () ui.nav_file(4) end) --- ----- Undotree ---vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) --- ----- Fugitive ---vim.keymap.set("n", "gs", vim.cmd.Git) --- ----- Put line bellow in-front of line ---vim.keymap.set("n", "J", "mzJ`z") --- ----- Keep cursor in the middle ---vim.keymap.set("n", "", "zz") ---vim.keymap.set("n", "", "zz") ---vim.keymap.set("n", "n", "nzzzv") ---vim.keymap.set("n", "N", "Nzzzv") --- ----- Don't loose buffer ---vim.keymap.set("x", "p", "\"_dP") --- --- -------------------- ----- Visual mode -- -------------------- --- ----- Hint: start visual mode with the same area as the previous area and the same mode ---vim.keymap.set("v", "<", "", ">gv", opts) --- ----- Move text on visual mode ---vim.keymap.set("v", "J", ":m '>+1gv=gv", opts) ---vim.keymap.set("v", "K", ":m '<-2gv=gv", opts) diff --git a/lua/core/lazy.lua b/lua/core/lazy.lua deleted file mode 100755 index 1c43742..0000000 --- a/lua/core/lazy.lua +++ /dev/null @@ -1,176 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - -local plugins = { - spec = { - import = "plugins" - }, -} - -local opts = { -root = vim.fn.stdpath("data") .. "/lazy", -- directory where plugins will be installed - defaults = { - lazy = false, -- should plugins be lazy-loaded? - version = nil, - -- default `cond` you can use to globally disable a lot of plugins - -- when running inside vscode for example - cond = nil, ---@type boolean|fun(self:LazyPlugin):boolean|nil - -- version = "*", -- enable this to try installing the latest stable versions of plugins - }, - -- leave nil when passing the spec as the first argument to setup() - spec = nil, ---@type LazySpec - lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json", -- lockfile generated after running update. - concurrency = jit.os:find("Windows") and (vim.loop.available_parallelism() * 2) or nil, ---@type number limit the maximum amount of concurrent tasks - git = { - -- defaults for the `Lazy log` command - -- log = { "-10" }, -- show the last 10 commits - log = { "-8" }, -- show commits from the last 3 days - timeout = 120, -- kill processes that take more than 2 minutes - url_format = "https://github.com/%s.git", - -- lazy.nvim requires git >=2.19.0. If you really want to use lazy with an older version, - -- then set the below to false. This should work, but is NOT supported and will - -- increase downloads a lot. - filter = true, - }, - dev = { - -- directory where you store your local plugin projects - path = "~/projects", - ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub - patterns = {}, -- For example {"folke"} - fallback = false, -- Fallback to git when local plugin doesn't exist - }, - install = { - -- install missing plugins on startup. This doesn't increase startup time. - missing = true, - -- try to load one of these colorschemes when starting an installation during startup - colorscheme = { "habamax" }, - }, - ui = { - -- a number <1 is a percentage., >1 is a fixed size - size = { width = 0.8, height = 0.8 }, - wrap = true, -- wrap the lines in the ui - -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. - border = "none", - title = nil, ---@type string only works when border is not "none" - title_pos = "center", ---@type "center" | "left" | "right" - -- Show pills on top of the Lazy window - pills = true, ---@type boolean - icons = { - cmd = " ", - config = "", - event = "", - ft = " ", - init = " ", - import = " ", - keys = " ", - lazy = "󰒲 ", - loaded = "●", - not_loaded = "○", - plugin = " ", - runtime = " ", - source = " ", - start = "", - task = "✔ ", - list = { - "●", - "➜", - "★", - "‒", - }, - }, - -- leave nil, to automatically select a browser depending on your OS. - -- If you want to use a specific browser, you can define it here - browser = nil, ---@type string? - throttle = 20, -- how frequently should the ui process render events - custom_keys = { - -- you can define custom key maps here. - -- To disable one of the defaults, set it to false - - -- open lazygit log - ["l"] = function(plugin) - require("lazy.util").float_term({ "lazygit", "log" }, { - cwd = plugin.dir, - }) - end, - - -- open a terminal for the plugin dir - ["t"] = function(plugin) - require("lazy.util").float_term(nil, { - cwd = plugin.dir, - }) - end, - }, - }, - diff = { - -- diff command can be one of: - -- * browser: opens the github compare view. Note that this is always mapped to as well, - -- so you can have a different command for diff - -- * git: will run git diff and open a buffer with filetype git - -- * terminal_git: will open a pseudo terminal with git diff - -- * diffview.nvim: will open Diffview to show the diff - cmd = "git", - }, - checker = { - -- automatically check for plugin updates - enabled = false, - concurrency = nil, ---@type number? set to 1 to check for updates very slowly - notify = true, -- get a notification when new updates are found - frequency = 3600, -- check for updates every hour - }, - change_detection = { - -- automatically check for config file changes and reload the ui - enabled = true, - notify = true, -- get a notification when changes are found - }, - performance = { - cache = { - enabled = true, - }, - reset_packpath = true, -- reset the package path to improve startup time - rtp = { - reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory - ---@type string[] - paths = {}, -- add any custom paths here that you want to includes in the rtp - ---@type string[] list any plugins you want to disable here - disabled_plugins = { - -- "gzip", - -- "matchit", - -- "matchparen", - -- "netrwPlugin", - -- "tarPlugin", - -- "tohtml", - -- "tutor", - -- "zipPlugin", - }, - }, - }, - -- lazy can generate helptags from the headings in markdown readme files, - -- so :help works even for plugins that don't have vim docs. - -- when the readme opens with :help it will be correctly displayed as markdown - readme = { - enabled = true, - root = vim.fn.stdpath("state") .. "/lazy/readme", - files = { "README.md", "lua/**/README.md" }, - -- only generate markdown helptags for plugins that dont have docs - skip_if_doc_exists = true, - }, - state = vim.fn.stdpath("state") .. "/lazy/state.json", -- state info for checker and other things - build = { - -- Plugins can provide a `build.lua` file that will be executed when the plugin is installed - -- or updated. When the plugin spec also has a `build` command, the plugin's `build.lua` not be - -- executed. In this case, a warning message will be shown. - warn_on_override = true, - }, -} - -require("lazy").setup(plugins, opts) diff --git a/lua/core/options.lua b/lua/core/options.lua deleted file mode 100755 index 4572f36..0000000 --- a/lua/core/options.lua +++ /dev/null @@ -1,137 +0,0 @@ -local options = { - backup = false, -- creates a backup file - clipboard = "unnamedplus", -- allows neovim to access the system clipboard - cmdheight = 2, -- more space in the neovim command line for displaying messages - completeopt = { "menuone", "noselect" }, -- mostly just for cmp - conceallevel = 0, -- so that `` is visible in markdown files - fileencoding = "utf-8", -- the encoding written to a file - hlsearch = true, -- highlight all matches on previous search pattern - ignorecase = true, -- ignore case in search patterns - mouse = "a", -- allow the mouse to be used in neovim - pumheight = 10, -- pop up menu height - showmode = false, -- we don't need to see things like -- INSERT -- anymore - showtabline = 2, -- always show tabs - smartcase = true, -- smart case - smartindent = true, -- make indenting smarter again - splitbelow = true, -- force all horizontal splits to go below current window - splitright = true, -- force all vertical splits to go to the right of current window - swapfile = false, -- creates a swapfile - -- termguicolors = true, -- set term gui colors (most terminals support this) - timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds) - undofile = true, -- enable persistent undo - updatetime = 300, -- faster completion (4000ms default) - writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited - expandtab = true, -- convert tabs to spaces - shiftwidth = 4, -- the number of spaces inserted for each indentation - tabstop = 4, -- insert 4 spaces for a tab - cursorline = true, -- highlight the current line - number = true, -- set numbered lines - relativenumber = true, -- set relative numbered lines - numberwidth = 4, -- set number column width to 2 {default 4} - signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time - wrap = true, -- display lines as one long line - scrolloff = 8, -- is one of my fav - sidescrolloff = 8, - guifont = "monospace:h17", -- the font used in graphical neovim applications -} - -vim.opt.shortmess:append "c" - -for k, v in pairs(options) do - vim.opt[k] = v -end - -vim.cmd "set whichwrap+=<,>,[,],h,l" -vim.cmd [[set iskeyword+=-]] -vim.cmd [[set formatoptions-=cro]] -- TODO: this doesn't seem to work - ----- Hint: use `:h