diff --git a/nvim/config/init.lua b/nvim/config/init.lua index c346b02..c21483b 100644 --- a/nvim/config/init.lua +++ b/nvim/config/init.lua @@ -1,54 +1,2 @@ -require('bootstrap') require('options') -require('keymaps') -require('syntax') - -vim.api.nvim_create_autocmd("BufWritePre", { - pattern = {"*.go"}, - callback = function() - -- Format the file - vim.lsp.buf.format({ - async = false, - }) - - -- Organize imports - local params = vim.lsp.util.make_range_params() - params.context = { only = { "source.organizeImports" } } - - local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 1000) - if not result then return end - - for _, res in pairs(result) do - for _, action in pairs(res.result or {}) do - if action.edit then - vim.lsp.util.apply_workspace_edit(action.edit, "utf-16") - else - vim.lsp.buf.execute_command(action.command) - end - end - end - end -}) - -vim.api.nvim_create_autocmd("BufWritePre", { - pattern = {"*.tf"}, - callback = function() - vim.lsp.buf.format() - end -}) - -vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { - pattern = "*.html", - command = "set filetype=html" -}) - -vim.api.nvim_create_autocmd("FileType", { - pattern = {"lua", "ruby", "yaml", "html", "json"}, - callback = function () - vim.opt_local.tabstop = 2 - vim.opt_local.shiftwidth = 2 - vim.opt_local.softtabstop = 2 - vim.opt_local.expandtab = true - vim.opt_local.smartindent = true - end -}) +require('autocmds') diff --git a/nvim/config/lazy-lock.json b/nvim/config/lazy-lock.json deleted file mode 100644 index 856fba8..0000000 --- a/nvim/config/lazy-lock.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" }, - "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, - "fzf-lua": { "branch": "main", "commit": "9f0432fdd7825ab163520045831a40b6df82ea28" }, - "git-blame.nvim": { "branch": "main", "commit": "5c536e2d4134d064aa3f41575280bc8a2a0e03d7" }, - "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, - "lualine.nvim": { "branch": "master", "commit": "8811f3f3f4dc09d740c67e9ce399e7a541e2e5b2" }, - "mason.nvim": { "branch": "main", "commit": "b03fb0f20bc1d43daf558cda981a2be22e73ac42" }, - "nvim-base16": { "branch": "master", "commit": "38e140f97b3cbefbf2cb29e32fcd098e43e77a42" }, - "nvim-lspconfig": { "branch": "master", "commit": "bedca8b426b2fee0ccac596d167d71bbe971253f" }, - "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, - "nvim-treesitter-context": { "branch": "master", "commit": "b0c45cefe2c8f7b55fc46f34e563bc428ef99636" }, - "nvim-treesitter-textobjects": { "branch": "main", "commit": "851e865342e5a4cb1ae23d31caf6e991e1c99f1e" }, - "nvim-web-devicons": { "branch": "master", "commit": "95b7a002d5dba1a42eb58f5fac5c565a485eefd0" }, - "oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" }, - "quick-scope": { "branch": "master", "commit": "6cee1d9e0b9ac0fbffeb538d4a5ba9f5628fabbc" }, - "vim-fugitive": { "branch": "master", "commit": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0" }, - "vim-gurl": { "branch": "master", "commit": "de3e14440fa72e0deaa5cf6c02eef91be706d75a" }, - "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }, - "vim-searchindex": { "branch": "master", "commit": "b0788c8213210b3bd23b62847dd5a9ebbe4ad648" }, - "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, - "vim-unimpaired": { "branch": "master", "commit": "db65482581a28e4ccf355be297f1864a4e66985c" } -} diff --git a/nvim/config/lua/autocmds.lua b/nvim/config/lua/autocmds.lua new file mode 100644 index 0000000..e71ede1 --- /dev/null +++ b/nvim/config/lua/autocmds.lua @@ -0,0 +1,20 @@ +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + pattern = "*.html", + command = "set filetype=html" +}) + +vim.api.nvim_create_autocmd("FileType", { + pattern = { "lua", "ruby", "yaml", "html", "json" }, + callback = function() + local opts = { + tabstop = 2, + shiftwidth = 2, + softtabstop = 2, + expandtab = true, + smartindent = true, + } + for k, v in pairs(opts) do + vim.opt_local[k] = v + end + end +}) diff --git a/nvim/config/lua/bootstrap.lua b/nvim/config/lua/bootstrap.lua deleted file mode 100644 index d983fde..0000000 --- a/nvim/config/lua/bootstrap.lua +++ /dev/null @@ -1,15 +0,0 @@ --- Lazy bootstrap -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.uv.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) - -require("lazy").setup("plugins") diff --git a/nvim/config/lua/keymaps.lua b/nvim/config/lua/keymaps.lua deleted file mode 100644 index 4682378..0000000 --- a/nvim/config/lua/keymaps.lua +++ /dev/null @@ -1,30 +0,0 @@ -local opts = { noremap = true, silent = true } - --- Global -vim.keymap.set('n', 'h', ':FzfLua helptags', opts) - --- LSP -vim.keymap.set('n', 'gD', ':FzfLua lsp_declarations', opts) -vim.keymap.set('n', 'gi', ':FzfLua lsp_implementations', opts) -vim.keymap.set('n', 'gr', ':FzfLua lsp_references', opts) -vim.keymap.set('n', 'g0', ':FzfLua lsp_document_symbols', opts) -vim.keymap.set('n', 'gW', ':FzfLua lsp_live_workspace_symbols', opts) -vim.keymap.set('n', 'cl', ':lua vim.lsp.codelens.run()', opts) - --- nvim-test -vim.keymap.set('n', 'tf', ':TestFile', opts) -vim.keymap.set('n', 'tt', ':TestNearest', opts) - --- FZF -vim.keymap.set('n', 'f', ':FzfLua files', { noremap = true }) -vim.keymap.set('n', 'gf', ':FzfLua git_files', { noremap = true }) -vim.keymap.set('n', 'b', ':FzfLua buffers', { noremap = true }) -vim.keymap.set('n', 'l', ':FzfLua lines', { noremap = true }) -vim.keymap.set('n', 'gs', ':FzfLua git_status', { noremap = true }) -vim.keymap.set('n', 'C', ':FzfLua git_commits', { noremap = true }) -vim.keymap.set('n', 'c', ':FzfLua git_bcommits', { noremap = true }) -vim.keymap.set('n', 'g', ':FzfLua grep_project', { noremap = true }) -vim.keymap.set('n', 'km', ':FzfLua keymaps', { noremap = true }) - --- Oil.nvim -vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) diff --git a/nvim/config/lua/languages.lua b/nvim/config/lua/languages.lua new file mode 100644 index 0000000..5ea2519 --- /dev/null +++ b/nvim/config/lua/languages.lua @@ -0,0 +1,37 @@ +return { + -- Build systems + { treesitter = "make" }, + { treesitter = "cmake" }, + { treesitter = "dockerfile" }, + + -- Scripting languages + { treesitter = "bash", lsp = "bashls" }, + { treesitter = "lua", lsp = "lua_ls" }, + + -- Programming languages + { treesitter = "go", lsp = "gopls" }, + { treesitter = "gomod" }, + { treesitter = "gosum" }, + { treesitter = "rust" }, + { treesitter = "proto", lsp = "buf_ls" }, + { treesitter = "zig", lsp = "zls" }, + { treesitter = "gleam", lsp = "gleam" }, + { treesitter = "elixir" }, + { treesitter = "html" }, + { treesitter = "css" }, + { treesitter = "typescript", lsp = "ts_ls" }, + { treesitter = "javascript" }, + + -- Data and documentation + { treesitter = "sql" }, + { treesitter = "csv" }, + { treesitter = "markdown", lsp = "marksman" }, + + -- Config and IaC + { treesitter = "terraform", lsp = "terraformls" }, + { treesitter = "hcl" }, + { treesitter = "json" }, + { treesitter = "yaml" }, + { treesitter = "toml" }, + { treesitter = "regex" }, +} diff --git a/nvim/config/lua/options.lua b/nvim/config/lua/options.lua index 0a2da92..69032b6 100644 --- a/nvim/config/lua/options.lua +++ b/nvim/config/lua/options.lua @@ -1,3 +1,6 @@ +-- New UI opt-in +require('vim._core.ui2').enable({}) + vim.opt.timeoutlen = 1000 vim.opt.ttimeoutlen = 0 vim.opt.number = true @@ -12,7 +15,6 @@ vim.opt.cursorline = true vim.opt.cursorcolumn = true vim.opt.autowrite = true vim.opt.shortmess = vim.opt.shortmess + 'c' -vim.opt.completeopt = {'menuone', 'noinsert', 'noselect'} vim.opt.incsearch = true -- show search matches as you type vim.opt.showmatch = true vim.opt.hlsearch = true @@ -32,6 +34,3 @@ vim.opt.spell = false -- Change how diagnostics appear vim.diagnostic.config({ virtual_text = true }) - --- Theme -vim.cmd.colorscheme('base16-gruvbox-dark-hard') diff --git a/nvim/config/lua/plugins/completion.lua b/nvim/config/lua/plugins/completion.lua deleted file mode 100644 index 572abac..0000000 --- a/nvim/config/lua/plugins/completion.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - { - "saghen/blink.cmp", - dependencies = 'rafamadriz/friendly-snippets', - version = "*", - - opts = { - keymap = { preset = 'default' }, - signature = { enabled = true }, - -- sources = { - -- default = { 'lsp', 'path', 'snippets', 'buffer', 'codecompanion', 'cmdline' }, - -- }, - }, - }, - - -- { - -- "github/copilot.vim", - -- }, -} diff --git a/nvim/config/lua/plugins/fzf.lua b/nvim/config/lua/plugins/fzf.lua deleted file mode 100644 index 9a1205b..0000000 --- a/nvim/config/lua/plugins/fzf.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - { - 'ibhagwan/fzf-lua', - dependencies = { "nvim-tree/nvim-web-devicons" }, - opts = { - fzf_colors = true, - }, - }, -} diff --git a/nvim/config/lua/plugins/git.lua b/nvim/config/lua/plugins/git.lua deleted file mode 100644 index 1c81874..0000000 --- a/nvim/config/lua/plugins/git.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - { - "tpope/vim-fugitive", -- Git client - }, - - { - "vitapluvia/vim-gurl", -- Github URL to clipboard - }, - - { - "f-person/git-blame.nvim", - }, -} diff --git a/nvim/config/lua/plugins/lsp.lua b/nvim/config/lua/plugins/lsp.lua deleted file mode 100644 index 617e695..0000000 --- a/nvim/config/lua/plugins/lsp.lua +++ /dev/null @@ -1,31 +0,0 @@ -return { - { - "neovim/nvim-lspconfig", - config = function() - local servers = { - "gopls", - "buf_ls", - "jsonls", - "html", - "htmx", - "cssls", - "ts_ls", - "bashls", - "terraformls", - "sqlls", - "zls", - "gleam", - "marksman", - } - - for _, server in ipairs(servers) do - vim.lsp.enable(server) - end - end - }, - - { - "mason-org/mason.nvim", -- Manage LSP servers. - opts = {}, - }, -} diff --git a/nvim/config/lua/plugins/motion.lua b/nvim/config/lua/plugins/motion.lua deleted file mode 100644 index 37ab99f..0000000 --- a/nvim/config/lua/plugins/motion.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - "tpope/vim-surround", - "tpope/vim-repeat", - "tpope/vim-unimpaired", - "unblevable/quick-scope", - "google/vim-searchindex", -} diff --git a/nvim/config/lua/plugins/oil.lua b/nvim/config/lua/plugins/oil.lua deleted file mode 100644 index 70ad66c..0000000 --- a/nvim/config/lua/plugins/oil.lua +++ /dev/null @@ -1,22 +0,0 @@ -return { - { - 'stevearc/oil.nvim', - ---@module 'oil' - ---@type oil.SetupOpts - opts = { - float = { - padding = 2, -- Padding around the floating window - max_width = 0.4, -- Max width (90% of screen) - max_height = 0.7, -- Max height (90% of screen) - border = "rounded", -- 'single', 'double', 'shadow', etc. - win_options = { - winblend = 10, -- Transparency - }, - }, - }, - -- Optional dependencies - -- dependencies = { { "echasnovski/mini.icons", opts = {} } }, - dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons - lazy = false, - }, -} diff --git a/nvim/config/lua/plugins/theme.lua b/nvim/config/lua/plugins/theme.lua deleted file mode 100644 index 3ab19f6..0000000 --- a/nvim/config/lua/plugins/theme.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - "RRethy/nvim-base16", - - { - "nvim-lualine/lualine.nvim", - dependencies = { 'nvim-tree/nvim-web-devicons' }, - opts = { - sections = { - lualine_b = { - { - "branch", - fmt = function(str) - if #str > 20 then - return str:sub(1, 17) .. "..." - end - return str - end, - }, - "diff", - "diagnostics", - }, - lualine_c = { - { - 'filename', - path = 1, - fmt = function(path) - local parts = vim.split(path, "/") - if #parts > 4 then - return ".../" .. table.concat(parts, "/", #parts - 2) - end - return path - end, - }, - }, - }, - }, - }, -} diff --git a/nvim/config/lua/plugins/treesitter.lua b/nvim/config/lua/plugins/treesitter.lua deleted file mode 100644 index 51e2081..0000000 --- a/nvim/config/lua/plugins/treesitter.lua +++ /dev/null @@ -1,40 +0,0 @@ -return { - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - branch = "main", - lazy = false, - opts = { - incremental_selection = { - enable = true, - }, - - textobjects = { - select = { - enable = true, - - -- Automatically jump forward to textobj, similar to targets.vim - lookahead = true, - - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ["af"] = "@function.outer", - ["if"] = "@function.inner", - }, - }, - }, - } - }, - - { - "nvim-treesitter/nvim-treesitter-context", -- Show the context you are in. - -- dependencies = { "nvim-treesitter/nvim-treesitter" }, - opts = {}, - }, - - { - "nvim-treesitter/nvim-treesitter-textobjects", - branch = "main", - -- dependencies = { "nvim-treesitter/nvim-treesitter" }, - }, -} diff --git a/nvim/config/lua/syntax.lua b/nvim/config/lua/syntax.lua deleted file mode 100644 index c2d2f3f..0000000 --- a/nvim/config/lua/syntax.lua +++ /dev/null @@ -1,21 +0,0 @@ -local grammer_list = { - 'go', - 'gomod', - 'gosum', - 'javascript', - 'typescript', - 'rust', - 'zig', - 'gleam', - 'elixir', - 'bash', - 'lua', -} - -require('nvim-treesitter').install(grammer_list) - -vim.api.nvim_create_autocmd('FileType', { - pattern = grammer_list, - callback = function() vim.treesitter.start() end, -}) - diff --git a/nvim/config/nvim-pack-lock.json b/nvim/config/nvim-pack-lock.json new file mode 100644 index 0000000..ad1392a --- /dev/null +++ b/nvim/config/nvim-pack-lock.json @@ -0,0 +1,82 @@ +{ + "plugins": { + "blink.cmp": { + "rev": "456d38d1cd3743926f329204c2340f3e7840aad6", + "src": "https://github.com/saghen/blink.cmp" + }, + "fzf-lua": { + "rev": "657c1bbb7357c61e26a20d868b53a460b05c18c0", + "src": "https://github.com/ibhagwan/fzf-lua" + }, + "git-blame.nvim": { + "rev": "5c536e2d4134d064aa3f41575280bc8a2a0e03d7", + "src": "https://github.com/f-person/git-blame.nvim" + }, + "lualine.nvim": { + "rev": "a905eeebc4e63fdc48b5135d3bf8aea5618fb21c", + "src": "https://github.com/nvim-lualine/lualine.nvim" + }, + "mason.nvim": { + "rev": "b03fb0f20bc1d43daf558cda981a2be22e73ac42", + "src": "https://github.com/mason-org/mason.nvim" + }, + "nvim-base16": { + "rev": "38e140f97b3cbefbf2cb29e32fcd098e43e77a42", + "src": "https://github.com/RRethy/nvim-base16" + }, + "nvim-lspconfig": { + "rev": "cb5bc0b2b35a6d513e3298d285db81453e791f4f", + "src": "https://github.com/neovim/nvim-lspconfig" + }, + "nvim-treesitter": { + "rev": "4916d6592ede8c07973490d9322f187e07dfefac", + "src": "https://github.com/nvim-treesitter/nvim-treesitter", + "version": "'main'" + }, + "nvim-treesitter-context": { + "rev": "b0c45cefe2c8f7b55fc46f34e563bc428ef99636", + "src": "https://github.com/nvim-treesitter/nvim-treesitter-context" + }, + "nvim-treesitter-textobjects": { + "rev": "851e865342e5a4cb1ae23d31caf6e991e1c99f1e", + "src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", + "version": "'main'" + }, + "nvim-web-devicons": { + "rev": "c72328a5494b4502947a022fe69c0c47e53b6aa6", + "src": "https://github.com/nvim-tree/nvim-web-devicons" + }, + "oil.nvim": { + "rev": "0fcc83805ad11cf714a949c98c605ed717e0b83e", + "src": "https://github.com/stevearc/oil.nvim" + }, + "quick-scope": { + "rev": "6cee1d9e0b9ac0fbffeb538d4a5ba9f5628fabbc", + "src": "https://github.com/unblevable/quick-scope" + }, + "vim-fugitive": { + "rev": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0", + "src": "https://github.com/tpope/vim-fugitive" + }, + "vim-gurl": { + "rev": "de3e14440fa72e0deaa5cf6c02eef91be706d75a", + "src": "https://github.com/vitapluvia/vim-gurl" + }, + "vim-repeat": { + "rev": "65846025c15494983dafe5e3b46c8f88ab2e9635", + "src": "https://github.com/tpope/vim-repeat" + }, + "vim-searchindex": { + "rev": "b0788c8213210b3bd23b62847dd5a9ebbe4ad648", + "src": "https://github.com/google/vim-searchindex" + }, + "vim-surround": { + "rev": "3d188ed2113431cf8dac77be61b842acb64433d9", + "src": "https://github.com/tpope/vim-surround" + }, + "vim-unimpaired": { + "rev": "db65482581a28e4ccf355be297f1864a4e66985c", + "src": "https://github.com/tpope/vim-unimpaired" + } + } +}