diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/pml68/configs/lspconfig.lua | 33 | ||||
| -rw-r--r-- | lua/pml68/configs/mason.lua | 39 | ||||
| -rwxr-xr-x | lua/pml68/configs/settings/clangd.lua | 5 | ||||
| -rwxr-xr-x | lua/pml68/configs/settings/emmet_ls.lua | 3 | ||||
| -rwxr-xr-x | lua/pml68/configs/settings/jsonls.lua | 8 | ||||
| -rw-r--r-- | lua/pml68/configs/settings/lua_ls.lua | 19 | ||||
| -rwxr-xr-x | lua/pml68/configs/settings/pyright.lua | 3 | ||||
| -rwxr-xr-x | lua/pml68/configs/settings/rust_analyzer.lua | 10 | ||||
| -rw-r--r-- | lua/pml68/configs/telescope.lua | 7 | ||||
| -rw-r--r-- | lua/pml68/init.lua | 10 | ||||
| -rw-r--r-- | lua/pml68/lazy.lua | 16 | ||||
| -rw-r--r-- | lua/pml68/plugins.lua | 244 | ||||
| -rw-r--r-- | lua/pml68/remap.lua | 15 |
13 files changed, 412 insertions, 0 deletions
diff --git a/lua/pml68/configs/lspconfig.lua b/lua/pml68/configs/lspconfig.lua new file mode 100644 index 0000000..12aacf8 --- /dev/null +++ b/lua/pml68/configs/lspconfig.lua @@ -0,0 +1,33 @@ +local capabilities = require("cmp_nvim_lsp").default_capabilities() + +local lspconfig = require("lspconfig") + +local servers = { + "html", + "tsserver", + "cssls", + "svelte", + "bashls", + "clangd", + "pyright", + "emmet_ls", + "jsonls", + "rust_analyzer", + "dartls", + "kotlin_language_server", + "lua_ls", + "glsl_analyzer" +} + +for _, server in pairs(servers) do + local opts = { + capabilities = capabilities, + } + + local require_ok, conf_opts = pcall(require, "pml68.configs.settings." .. server) + if require_ok then + opts = vim.tbl_deep_extend("force", conf_opts, opts) + end + + lspconfig[server].setup(opts) +end diff --git a/lua/pml68/configs/mason.lua b/lua/pml68/configs/mason.lua new file mode 100644 index 0000000..fbc5af7 --- /dev/null +++ b/lua/pml68/configs/mason.lua @@ -0,0 +1,39 @@ +return { + ensure_installed = { + "bash-language-server", + "lua-language-server", + "clangd", + "codelldb", + "clang-format", + "jq", + "json-lsp", + "svelte-language-server", + "emmet-ls", + "html-lsp", + "css-lsp", + "typescript-language-server", + "pyright", + "rust-analyzer", + "glsl_analyzer", + "kotlin-language-server" + }, + PATH = "skip", + ui = { + icons = { + package_pending = " ", + package_installed = " ", + package_uninstalled = " ", + }, + keymaps = { + toggle_server_expand = "<CR>", + install_server = "i", + update_server = "u", + check_server_version = "c", + update_all_servers = "U", + check_outdated_servers = "C", + uninstall_server = "X", + cancel_installation = "<C-c>", + }, + }, + max_concurrent_installers = 10, +} diff --git a/lua/pml68/configs/settings/clangd.lua b/lua/pml68/configs/settings/clangd.lua new file mode 100755 index 0000000..21b4046 --- /dev/null +++ b/lua/pml68/configs/settings/clangd.lua @@ -0,0 +1,5 @@ +return { + on_attach = function(client, bufnr) + client.server_capabilities.signatureHelpProvider = false + end +} diff --git a/lua/pml68/configs/settings/emmet_ls.lua b/lua/pml68/configs/settings/emmet_ls.lua new file mode 100755 index 0000000..18073fd --- /dev/null +++ b/lua/pml68/configs/settings/emmet_ls.lua @@ -0,0 +1,3 @@ +return { + filetypes = { "html", "typescript", "javascript", "css", "sass", "scss", "less", "svelte" }, +} diff --git a/lua/pml68/configs/settings/jsonls.lua b/lua/pml68/configs/settings/jsonls.lua new file mode 100755 index 0000000..c6c0776 --- /dev/null +++ b/lua/pml68/configs/settings/jsonls.lua @@ -0,0 +1,8 @@ +return { + settings = { + json = { + schemas = require('schemastore').json.schemas(), + validate = { enable = true }, + }, + }, +} diff --git a/lua/pml68/configs/settings/lua_ls.lua b/lua/pml68/configs/settings/lua_ls.lua new file mode 100644 index 0000000..7db368c --- /dev/null +++ b/lua/pml68/configs/settings/lua_ls.lua @@ -0,0 +1,19 @@ +return { + settings = { + Lua = { + diagnostics = { + globals = { "vim " }, + }, + workspace = { + library = { + [vim.fn.expand "$VIMRUNTIME/lua"] = true, + [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true, + [vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types"] = true, + [vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true, + }, + maxPreload = 100000, + preloadFileSize = 10000, + } + } + } +} diff --git a/lua/pml68/configs/settings/pyright.lua b/lua/pml68/configs/settings/pyright.lua new file mode 100755 index 0000000..da468c7 --- /dev/null +++ b/lua/pml68/configs/settings/pyright.lua @@ -0,0 +1,3 @@ +return { + single_file_support = true, +} diff --git a/lua/pml68/configs/settings/rust_analyzer.lua b/lua/pml68/configs/settings/rust_analyzer.lua new file mode 100755 index 0000000..e89b07f --- /dev/null +++ b/lua/pml68/configs/settings/rust_analyzer.lua @@ -0,0 +1,10 @@ +return { + filetypes = {"rust"}, + settings = { + ['rust-analyzer'] = { + cargo = { + allFeatures = true, + }, + }, + }, +} diff --git a/lua/pml68/configs/telescope.lua b/lua/pml68/configs/telescope.lua new file mode 100644 index 0000000..54ddb0e --- /dev/null +++ b/lua/pml68/configs/telescope.lua @@ -0,0 +1,7 @@ +local builtin = require("telescope.builtin") +vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) +vim.keymap.set('n', '<leader>fw', builtin.live_grep, {}) +vim.keymap.set('n', '<leader>fb', builtin.buffers, {}) +vim.keymap.set('n', '<leader>fh', builtin.help_tags, {}) +vim.keymap.set('n', '<leader>fz', builtin.current_buffer_fuzzy_find, {}) +vim.keymap.set('n', '<leader>fg', builtin.git_files, {}) diff --git a/lua/pml68/init.lua b/lua/pml68/init.lua new file mode 100644 index 0000000..63c1093 --- /dev/null +++ b/lua/pml68/init.lua @@ -0,0 +1,10 @@ +require("pml68.remap") +require("pml68.lazy") + +vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) +vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + +vim.opt.relativenumber = true +vim.cmd("set nu") + +vim.opt.clipboard = "unnamedplus" diff --git a/lua/pml68/lazy.lua b/lua/pml68/lazy.lua new file mode 100644 index 0000000..6ac9111 --- /dev/null +++ b/lua/pml68/lazy.lua @@ -0,0 +1,16 @@ +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 = require("pml68.plugins") + +require("lazy").setup(plugins) diff --git a/lua/pml68/plugins.lua b/lua/pml68/plugins.lua new file mode 100644 index 0000000..9a4b0e8 --- /dev/null +++ b/lua/pml68/plugins.lua @@ -0,0 +1,244 @@ +local plugins = { + -- CMP + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + } + }, + -- Undotree + { + "mbbill/undotree", + cmd = "UndotreeToggle", + }, + -- Git + { + "tpope/vim-fugitive", + event = "BufReadPre" + }, + { + "lewis6991/gitsigns.nvim", + event = "BufReadPre", + opts = { + signs = { + add = { text = "│" }, + change = { text = "│" }, + delete = { text = "" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + untracked = { text = "│" }, + }, + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + map("n", "<leader>gb", gs.blame_line) + end, + }, + config = function(_, opts) + require("gitsigns").setup(opts) + end + }, + -- LSP + { + "neovim/nvim-lspconfig", + config = function () + require "pml68.configs.lspconfig" + end + }, + { + "williamboman/mason.nvim", + cmd = {"Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate"}, + opts = function() + require("pml68.configs.mason") + end, + config = function(_, opts) + require("mason").setup(opts) + vim.api.nvim_create_user_command("MasonInstallAll", function() + if opts.ensure_installed and #opts.ensure_installed > 0 then + vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " ")) + end + end, {}) + + vim.g.mason_binaries_list = opts.ensure_installed + end + }, + -- Fuzzy finder + { + "nvim-telescope/telescope.nvim", + tag = "0.1.6", + dependencies = { + "nvim-lua/plenary.nvim" + }, + config = function() + require("pml68.configs.telescope") + end + }, + -- Color scheme + { + "drewtempelmeyer/palenight.vim", + config = function() + vim.cmd("colorscheme palenight") + end + }, + -- Syntax highlighting + { + "nvim-treesitter/nvim-treesitter", + event = {"BufReadPost", "BufNewFile"}, + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "c", + "cpp", + "lua", + "kotlin", + "nasm", + "bash", + "html", + "scss", + "css", + "typescript", + "javascript", + "python", + "rust", + "markdown", + "json", + "glsl", + "dart", + } + }) + end + }, + -- Misc + { + "andweeb/presence.nvim", + lazy = false, + opts = { + main_image = "file", + log_level = "debug", + }, + }, + { + "stevearc/dressing.nvim", + event = "VeryLazy", + }, + { + "michaelrommel/nvim-silicon", + lazy = true, + cmd = "Silicon", + config = function() + require("silicon").setup({ + font = "JetBrainsMono Nerd Font=34;Noto Color Emoji=34", + theme = "Palenight", + background = "#1e1e2e", + window_title = function() + return vim.fn.fnamemodify( + vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), ":t" + ) + end + }) + end + }, + -- Formatting + { + "nvimdev/guard.nvim", + dependencies = { + "nvimdev/guard-collection" + }, + event = "BufReadPre", + config = function () + local ft = require("guard.filetype") + + ft("c,cpp,h"):fmt("clang-format") + ft("json"):fmt({ + cmd = "jq", + stdin = true + }) + + require("guard").setup({ + fmt_on_save = true, + lsp_as_default_formatter = false + }) + end + }, + -- Dap + { + "mfussenegger/nvim-dap", + }, + { + "jay-babu/mason-nvim-dap.nvim", + event = "VeryLazy", + dependencies = { + "williamboman/mason.nvim", + "mfussenegger/nvim-dap", + }, + opts = { + handlers = {}, + }, + }, + { + "rcarriga/nvim-dap-ui", + event = "VeryLazy", + dependencies = "mfussenegger/nvim-dap", + config = function() + local dap = require("dap") + local dapui = require("dapui") + + dapui.setup() + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + end + dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() + end + dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() + end + end, + }, + -- Dart/Flutter + { + "akinsho/flutter-tools.nvim", + lazy = false, + dependencies = { + "nvim-lua/plenary.nvim", + "stevearc/dressing.nvim", + }, + }, + -- PKL + { + "https://github.com/apple/pkl-neovim", + lazy = true, + event = "BufReadPre *.pkl", + dependencies = { + "nvim-treesitter/nvim-treesitter" + }, + build = function() + vim.cmd("TSInstall! pkl") + end + }, + -- JSON + { + "b0o/schemastore.nvim", + ft = "json", + }, + -- Rust + { + "rust-lang/rust.vim", + ft = "rust", + init = function() + vim.g.rustfmt_autosave = 1 + end, + }, +} + +return plugins diff --git a/lua/pml68/remap.lua b/lua/pml68/remap.lua new file mode 100644 index 0000000..578cb6f --- /dev/null +++ b/lua/pml68/remap.lua @@ -0,0 +1,15 @@ +vim.g.mapleader = " " +vim.keymap.set("n", "<C-n>", vim.cmd.Ex) +vim.keymap.set("n", "<leader>gB", "<cmd> Git blame <CR>") +vim.keymap.set("v", "<leader>cs", "<cmd> Silicon <CR>") +vim.keymap.set("n", "<leader>cp", ":!xclip -sel clip -target image/png -i 2024*.png && rm 2024*.png <CR>") +vim.keymap.set("n", "<leader>u", "<cmd>UndotreeToggle<CR>") + +function starting() + local pos = vim.api.nvim_win_get_cursor(0)[2] + local line = vim.api.nvim_get_current_line() + local nline = line:sub(0, pos) .. "<" .. line:sub(pos + 1) + vim.api.nvim_set_current_line(nline) +end + +vim.keymap.set("n", "<leader>s", "<cmd> lua starting() <CR>") |
