diff --git a/init.lua b/init.lua index de4466cc..02e4ecbd 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,3 @@ -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' - local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ @@ -14,30 +11,9 @@ if not vim.loop.fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) -local plugins = { - { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, - { - 'nvim-telescope/telescope.nvim', tag = '0.1.5', - dependencies = { 'nvim-lua/plenary.nvim' } - }, - {"nvim-treesitter/nvim-treesitter", build = ":TSUpdate"} -} + local opts = {} -require("lazy").setup(plugins, opts) - -vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) -vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) - -local configs = require("nvim-treesitter.configs") - - configs.setup({ - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, - sync_install = false, - highlight = { enable = true }, - indent = { enable = true }, - }) - -require("catppuccin").setup() -vim.cmd.colorscheme "catppuccin" +require("vim-options") +require("lazy").setup("plugins") diff --git a/lazy-lock.json b/lazy-lock.json index e5c14b7e..a16ae795 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,7 +1,15 @@ { - "catppuccin": { "branch": "main", "commit": "045e3499d9ec8d84635fb08877ae44fd33f6a38d" }, "lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" }, + "lualine.nvim": { "branch": "master", "commit": "8b56462bfb746760465264de41b4907310f113ec" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" }, + "mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "459c60317cc1d251f6eb3b6f010d015d5d24b806" }, + "nui.nvim": { "branch": "main", "commit": "756c59f46057cd2d43619cd3a6d4e01b2aa60295" }, + "nvim": { "branch": "main", "commit": "045e3499d9ec8d84635fb08877ae44fd33f6a38d" }, + "nvim-lspconfig": { "branch": "master", "commit": "94cf4adb81158817520e18d2174963d8e1424df9" }, "nvim-treesitter": { "branch": "master", "commit": "57205313dda0ac82ac69e21d5e2a80f3297c14cc" }, + "nvim-web-devicons": { "branch": "master", "commit": "4adea17610d140a99c313e3f79a9dc01825d59ae" }, "plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" } } \ No newline at end of file diff --git a/lua/plugins/lsp-config.lua b/lua/plugins/lsp-config.lua new file mode 100644 index 00000000..369e0d09 --- /dev/null +++ b/lua/plugins/lsp-config.lua @@ -0,0 +1,89 @@ +return { + { + "williamboman/mason.nvim", + config = function() + require("mason").setup() + end + }, + { + "williamboman/mason-lspconfig.nvim", + config = function() + require("mason-lspconfig").setup { + ensure_installed = { "lua_ls","angularls","ansiblels","clangd","cssls","cssmodules_ls","unocss","diagnosticls","dockerls","docker_compose_language_service","eslint","golangci_lint_ls","gopls","grammarly","graphql","html","helm_ls","jsonls","biome","tsserver","sqlls","tailwindcss","templ","terraformls","tflint","yamlls"}, + } + end + }, + { + 'neovim/nvim-lspconfig', + config = function() + local lspconfig = require('lspconfig') + lspconfig.lua_ls.setup({}) + lspconfig.angularls.setup({}) + lspconfig.ansiblels.setup({}) + lspconfig.clangd.setup({}) + lspconfig.cssls.setup({}) + lspconfig.cssmodules_ls.setup({}) + lspconfig.unocss.setup({}) + lspconfig.diagnosticls.setup({}) + lspconfig.dockerls.setup({}) + lspconfig.docker_compose_language_service.setup({}) + lspconfig.eslint.setup({}) + lspconfig.golangci_lint_ls.setup({}) + lspconfig.gopls.setup({}) + lspconfig.grammarly.setup({}) + lspconfig.graphql.setup({}) + lspconfig.html.setup({}) + lspconfig.helm_ls.setup({}) + lspconfig.jsonls.setup({}) + lspconfig.biome.setup({}) + lspconfig.tsserver.setup({}) + lspconfig.sqlls.setup({}) + lspconfig.tailwindcss.setup({}) + lspconfig.templ.setup({}) + lspconfig.terraformls.setup({}) + lspconfig.tflint.setup({}) + lspconfig.yamlls.setup({}) + lspconfig.terraformls.setup({}) + lspconfig.terraformls.setup({}) + lspconfig.terraformls.setup({}) + + -- Global mappings. + -- See `:help vim.diagnostic.*` for documentation on any of the below functions + vim.keymap.set('n', 'e', vim.diagnostic.open_float) + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next) + vim.keymap.set('n', 'q', vim.diagnostic.setloclist) + + -- Use LspAttach autocommand to only map the following keys + -- after the language server attaches to the current buffer + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', 'f', function() + vim.lsp.buf.format { async = true } + end, opts) + end, + }) + end + } +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 00000000..87cd2a81 --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,10 @@ +return { + 'nvim-lualine/lualine.nvim', + config = function() + require('lualine').setup { + options = { + theme = 'everforest' + } + } + end +} diff --git a/lua/plugins/neotree.lua b/lua/plugins/neotree.lua new file mode 100644 index 00000000..864c739c --- /dev/null +++ b/lua/plugins/neotree.lua @@ -0,0 +1,13 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + config = function() + vim.keymap.set('n', '', ':Neotree filesystem reveal left', {}) + end +} + diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 00000000..86d72024 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,26 @@ +return { + { 'nvim-telescope/telescope.nvim', + tag = '0.1.5', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local builtin = require("telescope.builtin") + vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + end + }, + { + 'nvim-telescope/telescope-ui-select.nvim', + config = function() + require("telescope").setup { + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown {} + + } + } + } + require("telescope").load_extension("ui-select") + end + } +} + diff --git a/lua/plugins/theme.lua b/lua/plugins/theme.lua new file mode 100644 index 00000000..e404050b --- /dev/null +++ b/lua/plugins/theme.lua @@ -0,0 +1,7 @@ +return { + 'catppuccin/nvim', + priority = 1000, + config = function() + vim.cmd.colorscheme 'catppuccin' + end, +} diff --git a/lua/plugins/treeSitter.lua b/lua/plugins/treeSitter.lua new file mode 100644 index 00000000..6f9e0d65 --- /dev/null +++ b/lua/plugins/treeSitter.lua @@ -0,0 +1,13 @@ +return {"nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local configs = require("nvim-treesitter.configs") + configs.setup({ + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, +} + diff --git a/lua/vim-options.lua b/lua/vim-options.lua new file mode 100644 index 00000000..c203e8ee --- /dev/null +++ b/lua/vim-options.lua @@ -0,0 +1,20 @@ +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +local opt = vim.opt + +-- line numbers +opt.relativenumber = true +opt.number = true + +-- tabs & indentation +opt.tabstop = 2 +opt.shiftwidth = 2 +opt.expandtab = true +opt.autoindent = true + +-- line wrap +opt.wrap = false + +-- Sync clipboard between OS and Neovim. +opt.clipboard = 'unnamedplus'