summaryrefslogtreecommitdiff
path: root/.config/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/plugins/lsp.lua60
-rw-r--r--.config/nvim/lua/plugins/neo-tree.lua35
-rw-r--r--.config/nvim/lua/plugins/none-ls.lua27
-rw-r--r--.config/nvim/lua/plugins/nvim-dap.lua140
-rw-r--r--.config/nvim/lua/plugins/render-markdown.lua25
-rw-r--r--.config/nvim/lua/plugins/telescope.lua32
-rw-r--r--.config/nvim/lua/plugins/theme.lua14
-rw-r--r--.config/nvim/lua/plugins/treesitter.lua13
8 files changed, 346 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua
new file mode 100644
index 0000000..ad6f420
--- /dev/null
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -0,0 +1,60 @@
+return {
+ {
+ "williamboman/mason.nvim",
+ config = function()
+ require("mason").setup()
+ end
+ },
+
+ {
+ "williamboman/mason-lspconfig.nvim",
+ config = function()
+ require("mason-lspconfig").setup({
+ -- Add languages
+ ensure_installed = {
+ "bashls",
+ "clangd",
+ "lua_ls",
+ "marksman",
+ "pyright",
+ "rust_analyzer",
+ }
+ })
+ end
+ },
+
+ {
+ "neovim/nvim-lspconfig",
+ config = function()
+ local lspconfig = require("lspconfig")
+ lspconfig.bashls.setup({})
+ lspconfig.lua_ls.setup({})
+ lspconfig.clangd.setup({})
+ lspconfig.marksman.setup({})
+ lspconfig.pyright.setup({})
+ lspconfig.rust_analyzer.setup({})
+
+ -- 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/neo-tree.lua b/.config/nvim/lua/plugins/neo-tree.lua
new file mode 100644
index 0000000..e7414b0
--- /dev/null
+++ b/.config/nvim/lua/plugins/neo-tree.lua
@@ -0,0 +1,35 @@
+-- https://github.com/nvim-neo-tree/neo-tree.nvim
+return {
+ "nvim-neo-tree/neo-tree.nvim",
+ branch = "v3.x",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ "nvim-tree/nvim-web-devicons",
+ "MunifTanjim/nui.nvim",
+ "3rd/image.nvim",
+ },
+
+ config = function()
+ -- Tree config
+ require('neo-tree').setup {
+ filesystem = {
+ filtered_items = {
+ visible = true,
+ show_hidden_count = true,
+ hide_dotfiles = false,
+ hide_gitignored = false,
+ hide_by_name = {
+ ".DS_Store",
+ "thumbs.db",
+ },
+ never_show = {
+ ".git"
+ }
+ }
+ }
+ }
+ -- Key mapping
+ -- Toggle tree
+ vim.keymap.set('n', '<leader>t', ':Neotree filesystem reveal left toggle=true<CR>', {})
+ end
+}
diff --git a/.config/nvim/lua/plugins/none-ls.lua b/.config/nvim/lua/plugins/none-ls.lua
new file mode 100644
index 0000000..3a912ae
--- /dev/null
+++ b/.config/nvim/lua/plugins/none-ls.lua
@@ -0,0 +1,27 @@
+-- https://github.com/nvimtools/none-ls.nvim
+return {
+ "nvimtools/none-ls.nvim",
+ config = function()
+ local null_ls = require("null-ls")
+ null_ls.setup({
+ sources = {
+ -- Formatting
+ -- null_ls.builtins.formatting.<package>,
+ --
+ -- 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
new file mode 100644
index 0000000..7720526
--- /dev/null
+++ b/.config/nvim/lua/plugins/nvim-dap.lua
@@ -0,0 +1,140 @@
+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
new file mode 100644
index 0000000..d0d0639
--- /dev/null
+++ b/.config/nvim/lua/plugins/render-markdown.lua
@@ -0,0 +1,25 @@
+-- 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>)',
+ }
+ }
+}
diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua
new file mode 100644
index 0000000..ed58043
--- /dev/null
+++ b/.config/nvim/lua/plugins/telescope.lua
@@ -0,0 +1,32 @@
+-- https://github.com/nvim-telescope/telescope.nvim
+return {
+ {
+ 'nvim-telescope/telescope.nvim',
+ tag = '0.1.5',
+ dependencies = {
+ 'nvim-lua/plenary.nvim',
+ 'BurntSushi/ripgrep'
+ },
+
+ config = function()
+ local builtin = require("telescope.builtin")
+ vim.keymap.set('n', '<leader>f', builtin.find_files, {})
+ vim.keymap.set('n', '<leader>/', builtin.live_grep, {})
+ end
+ },
+ {
+ "nvim-telescope/telescope-ui-select.nvim",
+ config = function()
+ require("telescope").setup {
+ extensions = {
+ ["ui-select"] = {
+ require("telescope.themes").get_dropdown {
+ -- even more opts
+ }
+ }
+ }
+ }
+ require("telescope").load_extension("ui-select")
+ end
+ }
+}
diff --git a/.config/nvim/lua/plugins/theme.lua b/.config/nvim/lua/plugins/theme.lua
new file mode 100644
index 0000000..985e70b
--- /dev/null
+++ b/.config/nvim/lua/plugins/theme.lua
@@ -0,0 +1,14 @@
+return {
+ {
+ -- Bottom bar theme
+ -- https://github.com/nvim-lualine/lualine.nvim
+ "nvim-lualine/lualine.nvim",
+ config = function()
+ require('lualine').setup({
+ options = {
+ theme = 'jellybeans'
+ }
+ })
+ end
+ }
+}
diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua
new file mode 100644
index 0000000..778f5a0
--- /dev/null
+++ b/.config/nvim/lua/plugins/treesitter.lua
@@ -0,0 +1,13 @@
+-- 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
+}