summaryrefslogtreecommitdiff
path: root/lua/aotrix
diff options
context:
space:
mode:
Diffstat (limited to 'lua/aotrix')
-rw-r--r--lua/aotrix/multigrep.lua53
-rw-r--r--lua/aotrix/plugins/duskfox.lua12
-rw-r--r--lua/aotrix/plugins/harpoon.lua12
-rw-r--r--lua/aotrix/plugins/lsp.lua6
-rw-r--r--lua/aotrix/plugins/nvim_dap.lua51
-rw-r--r--lua/aotrix/plugins/statusline.lua40
-rw-r--r--lua/aotrix/plugins/telescope.lua41
-rw-r--r--lua/aotrix/plugins/transparent.lua16
-rw-r--r--lua/aotrix/plugins/treesitter.lua47
-rw-r--r--lua/aotrix/remap.lua40
-rw-r--r--lua/aotrix/set.lua35
11 files changed, 353 insertions, 0 deletions
diff --git a/lua/aotrix/multigrep.lua b/lua/aotrix/multigrep.lua
new file mode 100644
index 0000000..749102e
--- /dev/null
+++ b/lua/aotrix/multigrep.lua
@@ -0,0 +1,53 @@
+local pickers = require "telescope.pickers"
+local finders = require "telescope.finders"
+local make_entry = require "telescope.make_entry"
+local conf = require "telescope.config".values
+
+local M = {}
+
+local live_multigrep = function(opts)
+ opts = opts or {}
+ opts.cwd = opts.cwd or vim.uv.cwd()
+
+ local finder = finders.new_async_job {
+ command_generator = function(prompt)
+ if not prompt or prompt == "" then
+ return nil
+ end
+
+ local pieces = vim.split(prompt, " ")
+ local args = { "rg" }
+ if pieces[1] then
+ table.insert(args, "-e")
+ table.insert(args, pieces[1])
+ end
+
+ if pieces[2] then
+ table.insert(args, "-g")
+ table.insert(args, pieces[2])
+ end
+
+ ---@diagnostic disable-next-line: deprecated
+ return vim.tbl_flatten {
+ args,
+ { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" },
+ }
+ end,
+ entry_maker = make_entry.gen_from_vimgrep(opts),
+ cwd = opts.cwd,
+ }
+
+ pickers.new(opts, {
+ debounce = 100,
+ prompt_title = "Multi Grep",
+ finder = finder,
+ previewer = conf.grep_previewer(opts),
+ sorter = require("telescope.sorters").empty(),
+ }):find()
+end
+
+M.setup = function()
+ vim.keymap.set("n", "<leader>pg", live_multigrep)
+end
+
+return M
diff --git a/lua/aotrix/plugins/duskfox.lua b/lua/aotrix/plugins/duskfox.lua
new file mode 100644
index 0000000..ac59521
--- /dev/null
+++ b/lua/aotrix/plugins/duskfox.lua
@@ -0,0 +1,12 @@
+return {
+ "EdenEast/nightfox.nvim",
+ config = function()
+ local colorscheme = "duskfox"
+ local ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
+ vim.o.background = "dark" -- or "light" for light mode
+ if not ok then
+ vim.notify("colorscheme " .. colorscheme .. " not found!")
+ return
+ end
+ end
+}
diff --git a/lua/aotrix/plugins/harpoon.lua b/lua/aotrix/plugins/harpoon.lua
new file mode 100644
index 0000000..c016b32
--- /dev/null
+++ b/lua/aotrix/plugins/harpoon.lua
@@ -0,0 +1,12 @@
+return {
+ 'ThePrimeagen/harpoon',
+ dependencies = {'nvim-lua/plenary.nvim'},
+ config = function()
+ vim.keymap.set("n", "<leader>a", function() require("harpoon.mark").add_file() end)
+ vim.keymap.set("n", "<leader>hv", function() require("harpoon.ui").toggle_quick_menu() end)
+ vim.keymap.set("n", "<C-t>", function() require("harpoon.ui").nav_file(1) end)
+ vim.keymap.set("n", "<C-h>", function() require("harpoon.ui").nav_file(2) end)
+ vim.keymap.set("n", "<C-m>", function() require("harpoon.ui").nav_file(3) end)
+ vim.keymap.set("n", "<C-l>", function() require("harpoon.ui").nav_file(4) end)
+ end
+}
diff --git a/lua/aotrix/plugins/lsp.lua b/lua/aotrix/plugins/lsp.lua
new file mode 100644
index 0000000..625618f
--- /dev/null
+++ b/lua/aotrix/plugins/lsp.lua
@@ -0,0 +1,6 @@
+return {
+ "neovim/nvim-lspconfig",
+ config = function()
+ require('lspconfig').clangd.setup({})
+ end,
+}
diff --git a/lua/aotrix/plugins/nvim_dap.lua b/lua/aotrix/plugins/nvim_dap.lua
new file mode 100644
index 0000000..19ab17e
--- /dev/null
+++ b/lua/aotrix/plugins/nvim_dap.lua
@@ -0,0 +1,51 @@
+return {
+ 'mfussenegger/nvim-dap',
+ dependencies = {
+ 'rcarriga/nvim-dap-ui',
+ 'theHamsta/nvim-dap-virtual-text',
+ 'nvim-neotest/nvim-nio',
+ 'williamboman/mason.nvim',
+ },
+
+ config = function()
+ local dap = require("dap")
+ local ui = require("dapui")
+
+ require("dapui").setup()
+ require("nvim-dap-virtual-text").setup()
+ require("mason").setup()
+
+ dap.adapters.codelldb = {
+ type = "executable",
+ command = "codelldb", -- or if not in $PATH: "/absolute/path/to/codelldb"
+ }
+
+ dap.configurations.cpp = {
+ {
+ name = "Launch file",
+ type = "codelldb",
+ request = "launch",
+ program = function()
+ return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
+ end,
+ cwd = '${workspaceFolder}',
+ stopOnEntry = false,
+ },
+ }
+
+ dap.listeners.before.attach.dapui_config = function()
+ ui.open()
+ end
+ dap.listeners.before.launch.dapui_config = function()
+ ui.open()
+ end
+ dap.listeners.before.event_terminated.dapui_config = function()
+ ui.close()
+ end
+ dap.listeners.before.event_exited.dapui_config = function()
+ ui.close()
+ end
+
+ end,
+}
+
diff --git a/lua/aotrix/plugins/statusline.lua b/lua/aotrix/plugins/statusline.lua
new file mode 100644
index 0000000..3563a98
--- /dev/null
+++ b/lua/aotrix/plugins/statusline.lua
@@ -0,0 +1,40 @@
+return {
+ 'nvim-lualine/lualine.nvim',
+ config = function()
+ require('lualine').setup({
+ options = {
+ icons_enabled = false,
+ theme = 'material',
+ component_separators = { left = '', right = ''},
+ section_separators = { left = '', right = ''},
+ disabled_filetypes = {
+ statusline = {},
+ winbar = {},
+ },
+ ignore_focus = {},
+ always_divide_middle = true,
+ globalstatus = false,
+ },
+ sections = {
+ lualine_a = {'mode'},
+ lualine_b = {'branch', 'diff', 'diagnostics'},
+ lualine_c = {'filename'},
+ lualine_x = {'encoding', 'fileformat', 'filetype'},
+ lualine_y = {'progress'},
+ lualine_z = {'location'}
+ },
+ inactive_sections = {
+ lualine_a = {},
+ lualine_b = {},
+ lualine_c = {'filename'},
+ lualine_x = {'location'},
+ lualine_y = {},
+ lualine_z = {}
+ },
+ tabline = {},
+ winbar = {},
+ inactive_winbar = {},
+ extensions = {}
+ })
+ end
+}
diff --git a/lua/aotrix/plugins/telescope.lua b/lua/aotrix/plugins/telescope.lua
new file mode 100644
index 0000000..780fde5
--- /dev/null
+++ b/lua/aotrix/plugins/telescope.lua
@@ -0,0 +1,41 @@
+return {
+ 'nvim-telescope/telescope.nvim', tag = '0.1.5',
+ -- or , branch = '0.1.x',
+ dependencies = {
+ 'nvim-lua/plenary.nvim',
+ 'nvim-telescope/telescope-live-grep-args.nvim',
+ 'nvim-telescope/telescope-file-browser.nvim',
+ {'nvim-telescope/telescope-fzf-native.nvim', build = 'make'},
+ },
+
+ config = function()
+ require('telescope').load_extension('fzf')
+ local actions = require("telescope.actions")
+ require("telescope").setup({
+ defaults = {
+ -- Default configuration for telescope goes here:
+ -- config_key = value,
+ mappings = {
+ i = {
+ -- map actions.which_key to <C-h> (default: <C-/>)
+ -- actions.which_key shows the mappings for your picker,
+ -- e.g. git_{create, delete, ...}_branch for the git_branches picker
+ ["<C-j>"] = actions.move_selection_next,
+ ["<C-k>"] = actions.move_selection_previous,
+ ["<C-n>"] = actions.preview_scrolling_down,
+ ["<C-p>"] = actions.preview_scrolling_up,
+ ["<esc>"] = actions.close,
+ }
+ }
+ },
+ extensions = {
+ fzf = {}
+ },
+ })
+
+ vim.keymap.set("n", "<leader>pv", function() require("telescope").extensions.file_browser.file_browser() end)
+ vim.keymap.set("n", "<leader>pf", function() require("telescope.builtin").find_files() end)
+
+ require('aotrix.multigrep').setup()
+ end
+}
diff --git a/lua/aotrix/plugins/transparent.lua b/lua/aotrix/plugins/transparent.lua
new file mode 100644
index 0000000..f4e2e45
--- /dev/null
+++ b/lua/aotrix/plugins/transparent.lua
@@ -0,0 +1,16 @@
+return {
+ "xiyaowong/transparent.nvim",
+ config = function()
+ require("transparent").setup({
+ extra_groups = { -- table/string: additional groups that should be cleared
+ -- In particular, when you set it to 'all', that means all available groups
+ -- "NormalFloat",
+ -- "FloatBorder",
+ -- "TelescopeBorder",
+ -- "TelescopeNormal",
+ -- "TelescopeSelection",
+ -- "TelescopeSelectionCaret"
+ },
+ })
+ end
+}
diff --git a/lua/aotrix/plugins/treesitter.lua b/lua/aotrix/plugins/treesitter.lua
new file mode 100644
index 0000000..09dc61c
--- /dev/null
+++ b/lua/aotrix/plugins/treesitter.lua
@@ -0,0 +1,47 @@
+return {
+ "nvim-treesitter/nvim-treesitter",
+ config = function()
+ require('nvim-treesitter.configs').setup({
+ -- A list of parser names, or "all" (the five listed parsers should always be installed)
+ ensure_installed = { "c", "cpp", "lua", "vim", "vimdoc", "python"},
+
+ -- Install parsers synchronously (only applied to `ensure_installed`)
+ sync_install = false,
+
+ -- Automatically install missing parsers when entering buffer
+ -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
+ auto_install = true,
+
+ -- List of parsers to ignore installing (or "all")
+ ignore_install = { "html" },
+
+ ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
+ -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
+
+ highlight = {
+ enable = true,
+
+ -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
+ -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
+ -- the name of the parser)
+ -- list of language that will be disabled
+ -- disable = { "c", "rust" },
+ disable = { "cpp" },
+ -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
+ -- disable = function(lang, buf)
+ -- local max_filesize = 100 * 1024 -- 100 KB
+ -- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
+ -- if ok and stats and stats.size > max_filesize then
+ -- return true
+ -- end
+ -- end,
+
+ -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
+ -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
+ -- Using this option may slow down your editor, and you may see some duplicate highlights.
+ -- Instead of true it can also be a list of languages
+ additional_vim_regex_highlighting = false,
+ },
+ })
+ end
+}
diff --git a/lua/aotrix/remap.lua b/lua/aotrix/remap.lua
new file mode 100644
index 0000000..cb70a7b
--- /dev/null
+++ b/lua/aotrix/remap.lua
@@ -0,0 +1,40 @@
+vim.g.mapleader = " "
+
+vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
+vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
+
+vim.keymap.set("n", "J", "mzJ`z")
+vim.keymap.set("n", "<C-d>", "<C-d>zz")
+vim.keymap.set("n", "<C-u>", "<C-u>zz")
+vim.keymap.set("n", "n", "nzzzv")
+vim.keymap.set("n", "N", "Nzzzv")
+
+vim.keymap.set("x", "<leader>p", [["_dP]])
+
+vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
+vim.keymap.set("n", "<leader>Y", [["+Y]])
+
+-- GoTo code navigation
+-- vim.keymap.set("n", "gD", "<Plug>(coc-declaration)", {silent = true})
+-- vim.keymap.set("n", "gd", "<Plug>(coc-definition)", {silent = true})
+-- vim.keymap.set("n", "gr", "<CMD>Telescope coc references<CR>", {silent = true})
+-- vim.keymap.set("n", "gy", "<Plug>(coc-type-definition)", {silent = true})
+-- vim.keymap.set("n", "gi", "<Plug>(coc-implementation)", {silent = true})
+-- vim.keymap.set("n", "K", '<CMD>lua _G.show_docs()<CR>', {silent = true})
+
+-- Remove <C-c> because it is not fast enough
+vim.keymap.set({'n', 'i', 'v'}, '<C-c>', '<nop>')
+
+-- nvim-dap
+vim.keymap.set("n", "<leader>b", function() require("dap").toggle_breakpoint() end)
+vim.keymap.set("n", "<leader>gb", function() require("dap").run_to_cursor() end)
+-- Eval var under cursor
+vim.keymap.set("n", "<leader>?", function()
+ require("dapui").eval(nil, { enter = true })
+end)
+vim.keymap.set("n", "<F1>", function() require("dap").continue() end)
+vim.keymap.set("n", "<F2>", function() require("dap").step_into() end)
+vim.keymap.set("n", "<F3>", function() require("dap").step_over() end)
+vim.keymap.set("n", "<F4>", function() require("dap").step_out() end)
+vim.keymap.set("n", "<F5>", function() require("dap").step_back() end)
+vim.keymap.set("n", "<F13>", function() require("dap").restart() end)
diff --git a/lua/aotrix/set.lua b/lua/aotrix/set.lua
new file mode 100644
index 0000000..2c71437
--- /dev/null
+++ b/lua/aotrix/set.lua
@@ -0,0 +1,35 @@
+vim.opt.guicursor = ""
+
+vim.opt.nu = true
+vim.opt.relativenumber = true
+
+vim.opt.tabstop = 4
+vim.opt.softtabstop = 4
+vim.opt.shiftwidth = 4
+vim.opt.expandtab = true
+
+vim.opt.smartindent = true
+
+vim.opt.wrap = false
+
+vim.opt.swapfile = false
+vim.opt.backup = false
+
+if vim.fn.has('unix') == 1 then
+ vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
+else
+ vim.opt.undodir = os.getenv("USERPROFILE") .. "/AppData/Local/nvim-data"
+end
+
+vim.opt.undofile = true
+
+vim.opt.hlsearch = false
+vim.opt.incsearch = true
+
+vim.opt.termguicolors = true
+
+vim.opt.scrolloff = 8
+vim.opt.signcolumn = "yes"
+vim.opt.isfname:append("@-@")
+
+vim.opt.updatetime = 50