diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 3716358..74150cf 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -5,20 +5,21 @@ "bufferline.nvim": { "branch": "main", "commit": "e48ce1805697e4bb97bc171c081e849a65859244" }, "catppuccin": { "branch": "main", "commit": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "conform.nvim": { "branch": "master", "commit": "ad2b5ecd907128ed1b66b1cf4bed57902ef836ee" }, + "crates.nvim": { "branch": "main", "commit": "81c6325b7f8875857ec09e5d24f3b6d7986f29e2" }, "dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" }, "dressing.nvim": { "branch": "master", "commit": "94b0d24483d56f3777ee0c8dc51675f21709318c" }, "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, "friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, "gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" }, - "gruvbox.nvim": { "branch": "main", "commit": "4176b0b720db0c90ab4030e5c1b4893faf41fd51" }, + "headlines.nvim": { "branch": "master", "commit": "e3d7bfdf40e41a020d966d35f8b48d75b90367d2" }, "indent-blankline.nvim": { "branch": "master", "commit": "3c8a185da4b8ab7aef487219f5e001b11d4b6aaf" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, "mason.nvim": { "branch": "main", "commit": "a09da6ac634926a299dd439da08bdb547a8ca011" }, "mini.ai": { "branch": "main", "commit": "f7787cff9cc42004f722ca1e64e6af4e64e34177" }, @@ -31,14 +32,13 @@ "neoconf.nvim": { "branch": "main", "commit": "64437787dba70fce50dad7bfbb97d184c5bc340f" }, "neodev.nvim": { "branch": "main", "commit": "2a8630847dbb93455936156c0689678e4eaee319" }, "noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" }, - "none-ls.nvim": { "branch": "main", "commit": "e7382de51b4cf629e56f1fa18192e716e5ba8145" }, "nui.nvim": { "branch": "main", "commit": "80445d015d2b5f9af0d9e8bce63d303bc86eda8a" }, "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, "nvim-lint": { "branch": "master", "commit": "4dbc7ec60b33b656f7c54bb945671a55b18699f2" }, "nvim-lspconfig": { "branch": "master", "commit": "ce0e625df61be77abe1340fbc9afe9ad39b31dd8" }, "nvim-notify": { "branch": "master", "commit": "ebcdd8219e2a2cbc0a4bef68002f6867f1fde269" }, "nvim-spectre": { "branch": "master", "commit": "d8906855f1949ac97b1e77aaf8d3fe12ed158ddc" }, - "nvim-treesitter": { "branch": "master", "commit": "e49f1e8ef3e8450a8446cb1f2bbb53c919f60b6d" }, + "nvim-treesitter": { "branch": "master", "commit": "65ef62092ef997d2ecf68ede01a0afbda17808c3" }, "nvim-treesitter-context": { "branch": "master", "commit": "652ec514d6ba8bc4a3c2de76c855fe668e2c7196" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "85b9d0cbd4ff901abcda862b50dbb34e0901848b" }, "nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" }, @@ -47,7 +47,7 @@ "persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" }, "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, - "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" }, + "solarized-osaka.nvim": { "branch": "main", "commit": "d3272bc510deecd423833771e443ab0eaf8cd802" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope.nvim": { "branch": "master", "commit": "3466159b0fcc1876483f6f53587562628664d850" }, "todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" }, diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index 1796e80..f1005ba 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -1,14 +1,14 @@ --- Autocmds are automatically loaded on the VeryLazy event --- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- Turn off paste mode when leaving insert +vim.api.nvim_create_autocmd("InsertLeave", { + pattern = "*", + command = "set nopaste", +}) ----- Disable autoformat for lua files --- vim.api.nvim_create_autocmd({ "FileType" }, { --- pattern = { --- --[[ --- Add here any file extensions you would like to disable autoformat on --- --]] --- }, --- callback = function() --- vim.b.autoformat = false --- end, --- }) +-- Disable the concealing in some file formats +-- The default conceallevel is 3 in LazyVim +vim.api.nvim_create_autocmd("FileType", { + pattern = { "json", "jsonc", "markdown" }, + callback = function() + vim.opt.conceallevel = 0 + end, +}) diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index 3631c9d..1f3ed1b 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -1,9 +1,45 @@ --- Keymaps are automatically loaded on the VeryLazy event --- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua --- Add any additional keymaps here -vim.keymap.set( - "n", - "sx", - require("telescope.builtin").resume, - { noremap = true, silent = true, desc = "Resume" } -) +local discipline = require("discipline") + +discipline.cowboy() + +local keymap = vim.keymap +local opts = { noremap = true, silent = true } + +keymap.set("n", "sx", require("telescope.builtin").resume, opts) + +keymap.set("n", "x", '"_x') + +-- Increment/decrement +keymap.set("n", "+", "") +keymap.set("n", "-", "") + +-- Delete a word backwards +keymap.set("n", "dw", 'vb"_d') + +-- Select all +keymap.set("n", "", "ggG") + +-- Split window +keymap.set("n", "ss", ":split", opts) +keymap.set("n", "sv", ":vsplit", opts) + +-- Move window +keymap.set("n", "sh", "h") +keymap.set("n", "sk", "k") +keymap.set("n", "sj", "j") +keymap.set("n", "sl", "l") + +-- Resize window +keymap.set("n", "", "<") +keymap.set("n", "", ">") +keymap.set("n", "", "+") +keymap.set("n", "", "-") + +-- Diagnostics +keymap.set("n", "", function() + vim.diagnostic.goto_next() +end, opts) + +keymap.set("n", "r", function() + require("craftzdog.utils").replaceHexWithHSL() +end) diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua index 891b190..1106266 100644 --- a/.config/nvim/lua/config/lazy.lua +++ b/.config/nvim/lua/config/lazy.lua @@ -11,9 +11,15 @@ require("lazy").setup({ -- add LazyVim and import its plugins { "LazyVim/LazyVim", import = "lazyvim.plugins" }, -- import any extras modules here - -- { import = "lazyvim.plugins.extras.lang.typescript" }, - -- { import = "lazyvim.plugins.extras.lang.json" }, - -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, + { import = "lazyvim.plugins.extras.linting.eslint" }, + { import = "lazyvim.plugins.extras.formatting.prettier" }, + { import = "lazyvim.plugins.extras.lang.typescript" }, + { import = "lazyvim.plugins.extras.lang.json" }, + { import = "lazyvim.plugins.extras.lang.rust" }, + { import = "lazyvim.plugins.extras.lang.docker" }, + { import = "lazyvim.plugins.extras.lang.markdown" }, + { import = "lazyvim.plugins.extras.lang.yaml" }, + { import = "lazyvim.plugins.extras.lang.elixir" }, -- import/override with your plugins { import = "plugins" }, }, @@ -26,16 +32,12 @@ require("lazy").setup({ version = false, -- always use the latest git commit -- version = "*", -- try installing the latest stable version for plugins that support semver }, - install = { colorscheme = { "tokyonight", "habamax" } }, checker = { enabled = true }, -- automatically check for plugin updates performance = { rtp = { -- disable some rtp plugins disabled_plugins = { "gzip", - -- "matchit", - -- "matchparen", - -- "netrwPlugin", "tarPlugin", "tohtml", "tutor", diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua index 5c23ba2..1aa2d41 100644 --- a/.config/nvim/lua/config/options.lua +++ b/.config/nvim/lua/config/options.lua @@ -1,4 +1,4 @@ --- Options are automatically loaded before lazy.nvim startup --- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua --- Add any additional options here -vim.opt.winbar = "%=%m %f" +vim.opt.mouse = "" +vim.scriptencoding = "utf-8" +vim.opt.encoding = "utf-8" +vim.opt.fileencoding = "utf-8" diff --git a/.config/nvim/lua/discipline.lua b/.config/nvim/lua/discipline.lua new file mode 100644 index 0000000..93a4051 --- /dev/null +++ b/.config/nvim/lua/discipline.lua @@ -0,0 +1,40 @@ +local M = {} + +local max = 5 + +function M.cowboy() + ---@type table? + local id + local ok = true + for _, key in ipairs({ "h", "j", "k", "l", "+", "-" }) do + local count = 0 + local timer = assert(vim.loop.new_timer()) + local map = key + vim.keymap.set("n", key, function() + if vim.v.count > 0 then + count = 0 + end + if count >= max then + ok, id = pcall(vim.notify, "Hold it Cowboy!", vim.log.levels.WARN, { + icon = "🤠", + replace = id, + keep = function() + return count >= max + end, + }) + if not ok then + id = nil + return map + end + else + count = count + 1 + timer:start(2000, 0, function() + count = 0 + end) + return map + end + end, { expr = true, silent = true }) + end +end + +return M diff --git a/.config/nvim/lua/plugins/cholorscheme.lua b/.config/nvim/lua/plugins/cholorscheme.lua new file mode 100644 index 0000000..5d7e3f3 --- /dev/null +++ b/.config/nvim/lua/plugins/cholorscheme.lua @@ -0,0 +1,10 @@ +return { + "craftzdog/solarized-osaka.nvim", + lazy = true, + priority = 1000, + opts = function() + return { + transparent = true, + } + end, +} diff --git a/.config/nvim/lua/plugins/core.lua b/.config/nvim/lua/plugins/core.lua index 8dcece1..9d3984d 100644 --- a/.config/nvim/lua/plugins/core.lua +++ b/.config/nvim/lua/plugins/core.lua @@ -1,84 +1,8 @@ --- every spec file under config.plugins will be loaded automatically by lazy.nvim --- --- In your plugin files, you can: --- * add extra plugins --- * disable/enabled LazyVim plugins --- * override the configuration of LazyVim plugins return { - -- add symbols-outline { - "simrat39/symbols-outline.nvim", - cmd = "SymbolsOutline", - keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, - config = true, - }, - - -- override nvim-cmp and add cmp-emoji - { - "hrsh7th/nvim-cmp", - dependencies = { "hrsh7th/cmp-emoji" }, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - local cmp = require("cmp") - opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } })) - end, - }, - - -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, - -- treesitter, mason and typescript.nvim. So instead of the above, you can use: - { import = "lazyvim.plugins.extras.lang.typescript" }, - -- add jsonls and schemastore ans setup treesitter for json, json5 and jsonc - { import = "lazyvim.plugins.extras.lang.json" }, - - -- Use for completion and snippets (supertab) - -- first: disable default and behavior in LuaSnip - { - "L3MON4D3/LuaSnip", - keys = function() - return {} - end, - }, - -- then: setup supertab in cmp - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-emoji", + "LazyVim/LazyVim", + opts = { + colorscheme = "solarized-osaka", }, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - local has_words_before = function() - unpack = unpack or table.unpack - 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 luasnip = require("luasnip") - local cmp = require("cmp") - - opts.mapping = vim.tbl_extend("force", opts.mapping, { - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() - -- they way you will only jump inside the snippet region - 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" }), - }) - end, }, } diff --git a/.config/nvim/lua/plugins/gruvbox.lua b/.config/nvim/lua/plugins/gruvbox.lua deleted file mode 100644 index f206ac3..0000000 --- a/.config/nvim/lua/plugins/gruvbox.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - -- add gruvbox - { "ellisonleao/gruvbox.nvim" }, - - -- Configure LazyVim to load gruvbox - { - "LazyVim/LazyVim", - opts = { - colorscheme = "gruvbox", - }, - }, -} diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua deleted file mode 100644 index 4d82874..0000000 --- a/.config/nvim/lua/plugins/lsp.lua +++ /dev/null @@ -1,41 +0,0 @@ -return { - { - "neovim/nvim-lspconfig", - ---@class PluginLspOpts - opts = { - ---@type lspconfig.options - servers = { - elixirls = {}, - rust_analyzer = {}, - gopls = {}, - bashls = {}, - -- The configuration below for Deno is no longer required in LazyVim - -- I'll leave it here just in case I need it on the future - denols = { - -- root_dir = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc"), - }, - tsserver = { - -- root_dir = require("lspconfig.util").root_pattern("package.json"), - -- single_file_support = false, - }, - }, - }, - }, - { - "neovim/nvim-lspconfig", - dependencies = { - "simrat39/rust-tools.nvim", - }, - opts = { - servers = { - rust_analyzer = {}, - }, - setup = { - rust_analyzer = function(_, opts) - require("rust-tools").setup({ server = opts }) - return true - end, - }, - }, - }, -} diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua deleted file mode 100644 index b45b85a..0000000 --- a/.config/nvim/lua/plugins/lualine.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - -- the opts function can also be used to change the default opts: - { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - opts = function(_, opts) - table.insert(opts.sections.lualine_x, "😄") - end, - }, -} diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua deleted file mode 100644 index 068c9ef..0000000 --- a/.config/nvim/lua/plugins/mason.lua +++ /dev/null @@ -1,21 +0,0 @@ -return { - { - "williamboman/mason.nvim", - opts = { - -- add any tools you want to have installed below - ensure_installed = { - "stylua", - "shellcheck", - "shfmt", - "bash-language-server", - "flake8", - "elixir-ls", - "rustfmt", - "rust-analyzer", - "deno" - -- "gopls", - -- "gofumpt", - }, - }, - }, -} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua deleted file mode 100644 index 2021ac4..0000000 --- a/.config/nvim/lua/plugins/telescope.lua +++ /dev/null @@ -1,36 +0,0 @@ -return { - -- change some telescope options and a keymap to browse plugin files - { - "nvim-telescope/telescope.nvim", - keys = { - -- add a keymap to browse plugin files - -- stylua: ignore - { - "fp", - function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, - desc = "Find Plugin File", - }, - }, - -- change some options - opts = { - defaults = { - layout_strategy = "horizontal", - layout_config = { prompt_position = "top" }, - sorting_strategy = "ascending", - winblend = 0, - }, - }, - }, - - -- add telescope-fzf-native - { - "telescope.nvim", - dependencies = { - "nvim-telescope/telescope-fzf-native.nvim", - build = "make", - config = function() - require("telescope").load_extension("fzf") - end, - }, - }, -} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua deleted file mode 100644 index 7569f57..0000000 --- a/.config/nvim/lua/plugins/treesitter.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - opts.ignore_install = { "help" } - - if type(opts.ensure_installed) == "table" then - vim.list_extend(opts.ensure_installed, { - "bash", - "html", - "javascript", - "json", - "lua", - "markdown", - "markdown_inline", - "python", - "query", - "regex", - "tsx", - "typescript", - "vim", - "yaml", - "elixir", - "rust", - "go", - }) - end - end, -} diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua deleted file mode 100644 index 9643fa9..0000000 --- a/.config/nvim/lua/plugins/trouble.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - -- change trouble config - { - "folke/trouble.nvim", - -- opts will be merged with the parent spec - opts = { use_diagnostic_signs = true }, - }, -}