diff options
Diffstat (limited to '.config/nvim/lua')
| -rw-r--r-- | .config/nvim/lua/configs/basic.lua | 1 | ||||
| -rw-r--r-- | .config/nvim/lua/configs/filetype.lua | 7 | ||||
| -rw-r--r-- | .config/nvim/lua/configs/lazyvim.lua | 40 | ||||
| -rw-r--r-- | .config/nvim/lua/configs/lsp.lua | 48 | ||||
| -rw-r--r-- | .config/nvim/lua/configs/vim-plug.lua | 8 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/completions.lua | 53 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lsp.lua | 62 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/marks.lua | 18 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/mason.lua | 10 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/none-ls.lua | 29 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/nvim-dap.lua | 142 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/render-markdown.lua | 33 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/rust_analyzer.lua | 56 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/rustaceanvim.lua | 53 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/telescope.lua | 8 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/treesitter.lua | 14 |
16 files changed, 137 insertions, 445 deletions
diff --git a/.config/nvim/lua/configs/basic.lua b/.config/nvim/lua/configs/basic.lua index f4ccce1..b39412c 100644 --- a/.config/nvim/lua/configs/basic.lua +++ b/.config/nvim/lua/configs/basic.lua @@ -61,7 +61,6 @@ vim.keymap.set('n', '<A-k>', '<cmd>wincmd k<CR>', { desc = 'Move cursor to windo vim.keymap.set('n', '<A-j>', '<cmd>wincmd j<CR>', { desc = 'Move cursor to window below' }) vim.keymap.set('n', '<A-h>', '<cmd>wincmd h<CR>', { desc = 'Move cursor to window left' }) vim.keymap.set('n', '<A-l>', '<cmd>wincmd l<CR>', { desc = 'Move cursor to window right' }) --------------------------------------------- ----------------- -- Diagnostics -- diff --git a/.config/nvim/lua/configs/filetype.lua b/.config/nvim/lua/configs/filetype.lua deleted file mode 100644 index 82725e2..0000000 --- a/.config/nvim/lua/configs/filetype.lua +++ /dev/null @@ -1,7 +0,0 @@ -vim.filetype.add({ - extension = { - mq4 = "c", - mq5 = "cpp", - mqh = "cpp", - } -}) diff --git a/.config/nvim/lua/configs/lazyvim.lua b/.config/nvim/lua/configs/lazyvim.lua deleted file mode 100644 index 0b643b4..0000000 --- a/.config/nvim/lua/configs/lazyvim.lua +++ /dev/null @@ -1,40 +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) - --- Rename Tmux Window to File Opened by Neovim --- https://github.com/Dyslectric/neovim-tmux-window-rename -if vim.env.TMUX ~= nil then - -- Define an autocommand for BufEnter and FocusGained events - vim.api.nvim_create_autocmd({"BufEnter", "FocusGained"}, { - pattern = "*", - callback = function() - local file_name = vim.fn.expand("%:t") - local folder_name = vim.fn.expand("%:p:h:t") - local tmux_command = string.format( - "tmux rename-window 'Nv:%s/%s'", folder_name, file_name - ) - vim.fn.system(tmux_command) - end - }) - - -- Define an autocommand for the VimLeave event - vim.api.nvim_create_autocmd("VimLeave", { - pattern = "*", - callback = function() - local shell = vim.env.SHELL or "sh" - vim.fn.system("tmux set-window-option automatic-rename on") - end - }) -end - -require("lazy").setup("plugins") diff --git a/.config/nvim/lua/configs/lsp.lua b/.config/nvim/lua/configs/lsp.lua new file mode 100644 index 0000000..7acbeba --- /dev/null +++ b/.config/nvim/lua/configs/lsp.lua @@ -0,0 +1,48 @@ +-- Language server for specified languages +-- Hover with 'K' +-- Goto definition with :Goto +-- Open code action with :Codeact + +local servers = { + "lua_ls", "bashls", "clangd", "marksman", "pyright", "lemminx", +} + +vim.pack.add({ + { + src = "https://github.com/mason-org/mason.nvim.git", + version = 'main', + }, + { + src = "https://github.com/mason-org/mason-lspconfig.nvim.git", + version = 'main', + }, +}) + +require("mason").setup({}) +require("mason-lspconfig").setup({ + ensure_installed = servers, + automatic_installation = true, + automatic_enable = true, +}) + +-- Key mapping +-- Hover for definition +vim.keymap.set('n', 'K', vim.lsp.buf.hover, {}) + +-- Move to definition +vim.api.nvim_create_user_command( + "Goto", + function() + vim.lsp.buf.definition() + end, + {} +) + +-- Code action +vim.api.nvim_create_user_command( + "Codeact", + function() + vim.lsp.buf.code_action() + end, + {} +) diff --git a/.config/nvim/lua/configs/vim-plug.lua b/.config/nvim/lua/configs/vim-plug.lua new file mode 100644 index 0000000..01620e1 --- /dev/null +++ b/.config/nvim/lua/configs/vim-plug.lua @@ -0,0 +1,8 @@ +vim.api.nvim_create_user_command( + "Update", + function() + vim.pack.update() + end, + {} +) + diff --git a/.config/nvim/lua/plugins/completions.lua b/.config/nvim/lua/plugins/completions.lua deleted file mode 100644 index 483fac7..0000000 --- a/.config/nvim/lua/plugins/completions.lua +++ /dev/null @@ -1,53 +0,0 @@ --- Autocompletions --- https://github.com/hrsh7th/nvim-cmp --- https://github.com/L3MON4D3/LuaSnip --- https://github.com/saadparwaiz1/cmp_luasnip --- https://github.com/rafamadriz/friendly-snippets --- https://github.com/hrsh7th/cmp-nvim-lsp - -return { - { - "hrsh7th/cmp-nvim-lsp", - }, - { - 'L3MON4D3/LuaSnip', - dependencies = { - 'saadparwaiz1/cmp_luasnip', - 'rafamadriz/friendly-snippets', - } - }, - { - "hrsh7th/nvim-cmp", - config = function() - local cmp = require'cmp' - require("luasnip.loaders.from_vscode").lazy_load() - - cmp.setup({ - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - ['<C-b>'] = cmp.mapping.scroll_docs(-4), - ['<C-f>'] = cmp.mapping.scroll_docs(4), - ['<C-Space>'] = cmp.mapping.complete(), - ['<C-e>'] = cmp.mapping.abort(), - ['<CR>'] = cmp.mapping.confirm({ select = true }), - ['<C-j>'] = cmp.mapping.select_next_item(), - ['<C-k>'] = cmp.mapping.select_prev_item(), - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, { - { name = 'buffer' }, - }) - }) - end, - } -} diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua deleted file mode 100644 index 0314c42..0000000 --- a/.config/nvim/lua/plugins/lsp.lua +++ /dev/null @@ -1,62 +0,0 @@ --- Language server for specified languages --- Hover with 'K' --- Goto definition with :Goto --- Open code action with :Codeact - -local servers = { - "lua_ls", "bashls", "clangd", "marksman", "pyright", "lemminx", -} - -return { - { - "williamboman/mason.nvim", - config = function() - require("mason").setup() - end - }, - - { - "williamboman/mason-lspconfig.nvim", - config = function() - require("mason-lspconfig").setup { - ensure_installed = servers, - automatic_installation = true, - } - end - }, - - { - "neovim/nvim-lspconfig", - config = function() - -- Advertise autocompletion to lsp - local capabilities = require('cmp_nvim_lsp').default_capabilities() - for _, server in ipairs(servers) do - vim.lsp.config(server, { - capabilities = capabilities, - }) - end - - -- Key mapping - -- Hover for definition - vim.keymap.set('n', 'K', vim.lsp.buf.hover, {}) - - -- Move to definition - vim.api.nvim_create_user_command( - "Goto", - function() - vim.lsp.buf.definition() - end, - {} - ) - - -- Code action - vim.api.nvim_create_user_command( - "Codeact", - function() - vim.lsp.buf.code_action() - end, - {} - ) - end - } -} diff --git a/.config/nvim/lua/plugins/marks.lua b/.config/nvim/lua/plugins/marks.lua index 1d452ce..841d390 100644 --- a/.config/nvim/lua/plugins/marks.lua +++ b/.config/nvim/lua/plugins/marks.lua @@ -1,9 +1,11 @@ -return { +vim.pack.add({ { - -- https://github.com/chentoast/marks.nvim - -- Makes marks visible - "chentoast/marks.nvim", - event = "VeryLazy", - opts = {}, - } -} + src = 'https://github.com/chentoast/marks.nvim.git', + version = 'main', + }, +}) + +require("marks").setup({ + event = "VeryLazy", + opts = {}, +}) diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..c085313 --- /dev/null +++ b/.config/nvim/lua/plugins/mason.lua @@ -0,0 +1,10 @@ +vim.pack.add({ + { + src = "https://github.com/mason-org/mason.nvim.git", + version = 'main', + }, + { + src = "https://github.com/mason-org/mason-lspconfig.nvim.git", + version = 'main', + }, +}) diff --git a/.config/nvim/lua/plugins/none-ls.lua b/.config/nvim/lua/plugins/none-ls.lua deleted file mode 100644 index ee6d859..0000000 --- a/.config/nvim/lua/plugins/none-ls.lua +++ /dev/null @@ -1,29 +0,0 @@ --- Formatter --- https://github.com/nvimtools/none-ls.nvim --- Press '=' to format highlighted code -return { - "nvimtools/none-ls.nvim", - config = function() - local null_ls = require("null-ls") - null_ls.setup({ - sources = { - -- Formatting - null_ls.builtins.formatting.black, - -- - -- Diagnostics - -- null_ls.builtins.diagnostics.<package>, - -- - -- Completion - -- null_ls.builtins.completion.<package>, - } - }) - - vim.api.nvim_create_user_command( - "Format", - function() - vim.lsp.buf.format() - end, - {} - ) - end -} diff --git a/.config/nvim/lua/plugins/nvim-dap.lua b/.config/nvim/lua/plugins/nvim-dap.lua deleted file mode 100644 index 5a6d1ae..0000000 --- a/.config/nvim/lua/plugins/nvim-dap.lua +++ /dev/null @@ -1,142 +0,0 @@ --- Debugger --- https://github.com/mfussenegger/nvim-dap -return { - "mfussenegger/nvim-dap", - event = "BufRead", - dependencies = { - "rcarriga/nvim-dap-ui", - "theHamsta/nvim-dap-virtual-text", - "nvim-telescope/telescope-dap.nvim", - "nvim-neotest/nvim-nio" - }, - config = function() - local dap = require("dap") - local dapui = require("dapui") - local virtual_text = require("nvim-dap-virtual-text") - - dap.adapters.lldb = { - type = 'executable', - command = '/usr/bin/lldb-dap', - name = 'lldb' - } - - local lldb = { - name = "Launch lldb", - type = "lldb", - request = "launch", - program = function() - return vim.fn.input( - "Path to executable: ", vim.fn.getcwd() .. "/", "file" - ) - end, - cwd = "${workspaceFolder}", - stopOnEntry = false, - args = {}, - runInTerminal = false, - } - - dap.configurations.rust = {lldb} - dap.configurations.c = {lldb} - - dapui.setup( - { - controls = { - element = "repl", - enabled = true, - icons = { - disconnect = "🔗❌", - pause = "⏸", - play = "▶", - run_last = "⏭", - step_back = "↶", - step_into = "↓", - step_out = "↑", - step_over = "↷", - terminate = "⏹" - } - }, - element_mappings = {}, - expand_lines = true, - floating = { - border = "single", - mappings = { - close = { "q", "<Esc>" } - } - }, - force_buffers = true, - icons = { - collapsed = "", - current_frame = "", - expanded = "" - }, - layouts = { - { - elements = { - { - id = "scopes", - size = 0.25 - }, - { - id = "breakpoints", - size = 0.25 - }, - { - id = "stacks", - size = 0.25 - }, - { - id = "watches", - size = 0.25 - } - }, - position = "left", - size = 40 - }, - { - elements = { - { - id = "repl", - size = 0.5 - }, - { - id = "console", - size = 0.5 - } - }, - position = "bottom", - size = 10 - } - }, - mappings = { - edit = "e", - expand = { "<CR>", "<2-LeftMouse>" }, - open = "o", - remove = "d", - repl = "r", - toggle = "t" - }, - render = { - indent = 1, - max_value_lines = 100 - } - } - ) - - virtual_text.setup() - - vim.api.nvim_create_user_command( - "Debug", - function() - dapui.toggle() - end, - {} - ) - vim.keymap.set('n', "<Leader>b", dap.toggle_breakpoint, {}) - vim.keymap.set('n', "<F2>", dap.continue, {}) - vim.keymap.set('n', "<F3>", dap.step_over, {}) - vim.keymap.set('n', "<F4>", dap.step_back, {}) - vim.keymap.set('n', "<F5>", dap.step_into, {}) - vim.keymap.set('n', "<F6>", dap.step_out, {}) - vim.keymap.set('n', "<Leader>n", dap.restart, {}) - end -} diff --git a/.config/nvim/lua/plugins/render-markdown.lua b/.config/nvim/lua/plugins/render-markdown.lua index d0d0639..3f2a800 100644 --- a/.config/nvim/lua/plugins/render-markdown.lua +++ b/.config/nvim/lua/plugins/render-markdown.lua @@ -1,25 +1,8 @@ --- https://github.com/MeanderingProgrammer/render-markdown.nvim -return { - { - 'MeanderingProgrammer/render-markdown.nvim', - opts = {}, - dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' } - }, - { - 'ChuufMaster/markdown-toc', --https://github.com/ChuufMaster/markdown-toc - -- ":GenerateTOC" - -- ":DeleteTOC" - opts = { - - -- The heading level to match (i.e the number of "#"s to match to) max 6 - heading_level_to_match = -1, - - -- Set to True display a dropdown to allow you to select the heading level - ask_for_heading_level = false, - - -- TOC default string - -- WARN - toc_format = '%s- [%s](<%s#%s>)', - } - } -} +vim.pack.add({ + 'https://github.com/nvim-treesitter/nvim-treesitter', + 'https://github.com/nvim-mini/mini.nvim', -- if you use the mini.nvim suite + -- 'https://github.com/nvim-mini/mini.icons', -- if you use standalone mini plugins + -- 'https://github.com/nvim-tree/nvim-web-devicons', -- if you prefer nvim-web-devicons + 'https://github.com/MeanderingProgrammer/render-markdown.nvim', +}) +require('render-markdown').setup({}) -- only mandatory if you want to set custom options diff --git a/.config/nvim/lua/plugins/rust_analyzer.lua b/.config/nvim/lua/plugins/rust_analyzer.lua deleted file mode 100644 index 914befe..0000000 --- a/.config/nvim/lua/plugins/rust_analyzer.lua +++ /dev/null @@ -1,56 +0,0 @@ --- https://github.com/mrcjkb/rustaceanvim - -return { - { - 'mrcjkb/rustaceanvim', - version = '^6', -- Recommended - lazy = false, -- This plugin is already lazy - config = function () - vim.g.rustaceanvim = { - -- Plugin configuration - tools = { - }, - -- LSP configuration - server = { - default_settings = { - -- rust-analyzer language server configuration - -- https://rust-analyzer.github.io/book/configuration.html - ['rust-analyzer'] = { - checkOnSave = true, - check = { - enable = true, - command = "clippy", - features = "all", - }, - completion = { - autoimport = { - enable = false; - } - }, - files = { - exclude = { - "build-dir/", - ".flatpak-builder", - } - } - --settings = { - -- cargo = { allFeatures = true }, - -- imports = { group = { enable = false } }, - -- completion = { postfix = { enable = false } }, - -- -- https://www.reddit.com/r/rust/comments/1e978l7/comment/led7ibp/ - -- -- checkOnSave = { command = "clippy" }, - -- checkOnSave = { command = false }, - - -- diagnostics = { enable = true }, - -- rustfmt = { enable = true }, - --} - }, - }, - }, - -- DAP configuration - dap = { - }, - } - end - }, -} diff --git a/.config/nvim/lua/plugins/rustaceanvim.lua b/.config/nvim/lua/plugins/rustaceanvim.lua new file mode 100644 index 0000000..dee1dc1 --- /dev/null +++ b/.config/nvim/lua/plugins/rustaceanvim.lua @@ -0,0 +1,53 @@ +vim.pack.add({ + { + src = 'https://github.com/mrcjkb/rustaceanvim.git', + version = 'master', + lazy = false, -- This plugin is already lazy + }, +}) + +vim.g.rustaceanvim = { + -- Plugin configuration + tools = { + }, + -- LSP configuration + server = { + default_settings = { + -- rust-analyzer language server configuration + -- https://rust-analyzer.github.io/book/configuration.html + ['rust-analyzer'] = { + checkOnSave = true, + check = { + enable = true, + command = "clippy", + features = "all", + }, + completion = { + autoimport = { + enable = false; + } + }, + files = { + exclude = { + "build-dir/", + ".flatpak-builder", + } + } + --settings = { + -- cargo = { allFeatures = true }, + -- imports = { group = { enable = false } }, + -- completion = { postfix = { enable = false } }, + -- -- https://www.reddit.com/r/rust/comments/1e978l7/comment/led7ibp/ + -- -- checkOnSave = { command = "clippy" }, + -- checkOnSave = { command = false }, + + -- diagnostics = { enable = true }, + -- rustfmt = { enable = true }, + --} + }, + }, + }, + -- DAP configuration + dap = { + }, +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua deleted file mode 100644 index e3ab856..0000000 --- a/.config/nvim/lua/plugins/telescope.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - -- https://github.com/nvim-telescope/telescope.nvim - 'nvim-telescope/telescope.nvim', - tag = '0.1.8', - dependencies = { - 'nvim-lua/plenary.nvim' - } -} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua deleted file mode 100644 index f04198f..0000000 --- a/.config/nvim/lua/plugins/treesitter.lua +++ /dev/null @@ -1,14 +0,0 @@ --- Syntax highlighting --- https://github.com/nvim-treesitter/nvim-treesitter -return { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - - config = function() - require("nvim-treesitter.configs").setup({ - auto_install = true, - highlight = { enable = true }, - indent = { enable = true }, - }) - end -} |
