├── colorscheme.lua ├── default_theme └── colors.lua ├── plugins ├── mason-lspconfig.lua ├── session_manager.lua ├── packer.lua ├── notify.lua ├── toggleterm.lua ├── bufferline.lua ├── zk.lua ├── mason-tool-installer.lua ├── which-key.lua ├── feline.lua ├── colorizer.lua ├── telescope.lua ├── null-ls.lua ├── nightfox.lua ├── nvim-dapui.lua ├── WinShift.lua ├── alpha.lua ├── treesitter.lua ├── init.lua ├── cmp.lua ├── lualine.lua └── nvim-dap.lua ├── ui.lua ├── spell ├── en.utf-8.add.spl └── en.utf-8.add ├── diagnostics.lua ├── lsp ├── server-settings │ └── clangd.lua └── on_attach.lua ├── cmp └── source_priority.lua ├── luasnip.lua ├── .stylua.toml ├── updater.lua ├── polish.lua ├── options.lua ├── README.md ├── which-key └── register_mappings.lua └── mappings.lua /colorscheme.lua: -------------------------------------------------------------------------------- 1 | return "duskfox" 2 | -------------------------------------------------------------------------------- /default_theme/colors.lua: -------------------------------------------------------------------------------- 1 | return { 2 | bg = "none", 3 | } 4 | -------------------------------------------------------------------------------- /plugins/mason-lspconfig.lua: -------------------------------------------------------------------------------- 1 | return { 2 | automatic_installation = true, 3 | } 4 | -------------------------------------------------------------------------------- /plugins/session_manager.lua: -------------------------------------------------------------------------------- 1 | return { 2 | autosave_last_session = true, 3 | } 4 | -------------------------------------------------------------------------------- /ui.lua: -------------------------------------------------------------------------------- 1 | return { 2 | nui_input = true, 3 | telescope_select = true, 4 | } 5 | -------------------------------------------------------------------------------- /plugins/packer.lua: -------------------------------------------------------------------------------- 1 | return { 2 | compile_path = vim.fn.stdpath "data" .. "/packer_compiled.lua", 3 | } 4 | -------------------------------------------------------------------------------- /spell/en.utf-8.add.spl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/datamonsterr/astronvim_config/HEAD/spell/en.utf-8.add.spl -------------------------------------------------------------------------------- /diagnostics.lua: -------------------------------------------------------------------------------- 1 | return { 2 | virtual_text = true, 3 | underline = true, 4 | update_in_insert = false, 5 | } 6 | -------------------------------------------------------------------------------- /lsp/server-settings/clangd.lua: -------------------------------------------------------------------------------- 1 | return { 2 | capabilities = { 3 | offsetEncoding = "utf-8", 4 | }, 5 | } 6 | -------------------------------------------------------------------------------- /plugins/notify.lua: -------------------------------------------------------------------------------- 1 | return { 2 | timeout = 3000, 3 | opacity = 0, 4 | background_colour = "#000000", 5 | } 6 | -------------------------------------------------------------------------------- /cmp/source_priority.lua: -------------------------------------------------------------------------------- 1 | return { 2 | luasnip = 1000, 3 | nvim_lua = 800, 4 | nvim_lsp = 700, 5 | path = 500, 6 | buffer = 250, 7 | } 8 | -------------------------------------------------------------------------------- /luasnip.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- vscode_snippet_paths = { "/home/datamonster/.config/vscode_snippets/vscode-react-javascript-snippets" }, 3 | } 4 | -------------------------------------------------------------------------------- /.stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 120 2 | line_endings = "Unix" 3 | indent_type = "Spaces" 4 | indent_width = 2 5 | quote_style = "AutoPreferDouble" 6 | no_call_parentheses = true 7 | -------------------------------------------------------------------------------- /plugins/toggleterm.lua: -------------------------------------------------------------------------------- 1 | return { 2 | terminal_mappings = true, 3 | highlights = { 4 | NormalFloat = { 5 | link = "NormalFloat", 6 | }, 7 | FloatBorder = { 8 | link = "FloatBorder", 9 | }, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /updater.lua: -------------------------------------------------------------------------------- 1 | return { 2 | remote = "origin", -- remote to use 3 | channel = "nightly", -- "stable" or "nightly" 4 | version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY) 5 | branch = "main", -- branch name (NIGHTLY ONLY) 6 | } 7 | -------------------------------------------------------------------------------- /plugins/bufferline.lua: -------------------------------------------------------------------------------- 1 | return { 2 | options = { 3 | offsets = { 4 | { filetype = "neo-tree", text = "File Explorer", highlight = "NeoTreeNormal", padding = 0 }, 5 | }, 6 | show_close_icon = false, 7 | show_buffer_close_icons = false, 8 | themable = true, 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /plugins/zk.lua: -------------------------------------------------------------------------------- 1 | require("zk").setup { 2 | picker = "telescope", 3 | lsp = { 4 | config = { 5 | cmd = { "zk", "lsp" }, 6 | name = "zk", 7 | on_attach = require("configs.lsp.handlers").on_attach, 8 | capabilities = require("configs.lsp.handlers").capabilities, 9 | }, 10 | auto_attach = { enabled = true, filetypes = { "markdown" } }, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /plugins/mason-tool-installer.lua: -------------------------------------------------------------------------------- 1 | return { 2 | ensure_installed = { 3 | -- Lsp 4 | "clangd", 5 | "pyright", 6 | "lua-language-server", 7 | "typescript-language-server", 8 | "rust-analyzer", 9 | "vim-language-server", 10 | "html-lsp", 11 | "css-lsp", 12 | "emmet-ls", 13 | 14 | -- Formatter 15 | "prettierd", 16 | "shfmt", 17 | "stylua", 18 | "black", 19 | 20 | -- Dap 21 | "debugpy", 22 | "cpptools", 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /plugins/which-key.lua: -------------------------------------------------------------------------------- 1 | return { 2 | plugins = { 3 | marks = true, 4 | registers = true, 5 | spelling = { 6 | enabled = true, 7 | suggestions = 20, 8 | }, 9 | presets = { 10 | operators = false, 11 | motions = false, 12 | text_objects = true, 13 | windows = true, 14 | nav = false, 15 | z = true, 16 | g = true, 17 | }, 18 | }, 19 | layout = { 20 | align = "center", 21 | spacing = 8, 22 | }, 23 | -- ignore_missing = true, 24 | } 25 | -------------------------------------------------------------------------------- /plugins/feline.lua: -------------------------------------------------------------------------------- 1 | return { 2 | theme = { bg = "#000000", fg = "#cdcecf" }, 3 | components = { 4 | inactive = { 5 | { 6 | { 7 | provider = function() 8 | if vim.o.filetype == "toggleterm" then 9 | local display = " Term " .. vim.b.toggle_number .. " " 10 | return display 11 | else 12 | return " " .. vim.o.filetype .. " " 13 | end 14 | end, 15 | hl = { bg = "#000000" }, 16 | }, 17 | }, 18 | }, 19 | }, 20 | } 21 | -------------------------------------------------------------------------------- /plugins/colorizer.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { "*" }, 3 | { 4 | RGB = true, -- #RGB hex codes 5 | RRGGBB = true, -- #RRGGBB hex codes 6 | names = false, -- "Name" codes like Blue 7 | RRGGBBAA = true, -- #RRGGBBAA hex codes 8 | rgb_fn = true, -- CSS rgb() and rgba() functions 9 | hsl_fn = true, -- CSS hsl() and hsla() functions 10 | css = false, -- Enable all css features: rgb_fn, hsl_fn, names, RGB, RRGGBB 11 | css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn 12 | mode = "background", -- Set the display mode 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /plugins/telescope.lua: -------------------------------------------------------------------------------- 1 | local actions = require "telescope.actions" 2 | return { 3 | defaults = { 4 | prompt_prefix = " ", 5 | layout_strategy = "horizontal", 6 | layout_config = { 7 | horizontal = { 8 | prompt_position = "top", 9 | preview_width = 0.55, 10 | results_width = 0.8, 11 | }, 12 | vertical = { 13 | mirror = false, 14 | }, 15 | width = 0.87, 16 | height = 0.80, 17 | preview_cutoff = 120, 18 | }, 19 | mappings = { 20 | i = { 21 | [""] = actions.select_horizontal, 22 | }, 23 | 24 | n = { 25 | [""] = actions.select_horizontal, 26 | }, 27 | }, 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /polish.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | if vim.fn.exists "$TMUX" == 1 then 3 | local has_tmux, _ = pcall(require, "tmux") 4 | if has_tmux then 5 | require("tmux").setup { 6 | copy_sync = { 7 | enable = false, 8 | }, 9 | navigation = { 10 | cycle_navigation = true, 11 | enable_default_keybindings = true, 12 | }, 13 | resize = { 14 | enable_default_keybindings = true, 15 | }, 16 | } 17 | end 18 | end 19 | 20 | -- FileType 21 | vim.filetype.add { 22 | extension = { 23 | rasi = "rasi", 24 | conf = "config", 25 | }, 26 | filename = { 27 | ["CmakeLists.txt"] = "cmake", 28 | [".clang-format"] = "yaml", 29 | }, 30 | } 31 | end 32 | -------------------------------------------------------------------------------- /plugins/null-ls.lua: -------------------------------------------------------------------------------- 1 | return function(config) 2 | -- https://github.com/jose-elias-alvarez/null-ls.nvim 3 | local null_ls = require "null-ls" 4 | local formatting = null_ls.builtins.formatting 5 | config.sources = { 6 | formatting.stylua, 7 | formatting.black, 8 | formatting.prettierd.with { 9 | env = { 10 | PRETTIERD_DEFAULT_CONFIG = vim.fn.expand "~/.config/.prettierrc.json", 11 | }, 12 | }, 13 | formatting.shfmt, 14 | } 15 | config.on_attach = function(client) 16 | if client.server_capabilities.documentFormattingProvider then 17 | vim.api.nvim_create_augroup("format_on_save", { clear = true }) 18 | vim.api.nvim_create_autocmd("BufWritePre", { 19 | desc = "Auto format before save", 20 | group = "format_on_save", 21 | pattern = "", 22 | callback = function() 23 | vim.lsp.buf.formatting_sync { async = true } 24 | end, 25 | }) 26 | end 27 | end 28 | return config 29 | end 30 | -------------------------------------------------------------------------------- /lsp/on_attach.lua: -------------------------------------------------------------------------------- 1 | return function(client, bufnr) 2 | local diagnostics_active = true 3 | vim.keymap.set("n", "lt", function() 4 | diagnostics_active = not diagnostics_active 5 | if diagnostics_active then 6 | vim.diagnostic.show() 7 | else 8 | vim.diagnostic.hide() 9 | end 10 | end, { buffer = bufnr, desc = "Toggle diagnostics" }) 11 | 12 | if client.name == "tsserver" or client.name == "jsonls" or client.name == "html" or client.name == "sumneko_lua" then 13 | client.resolved_capabilities.document_formatting = false 14 | end 15 | if client.resolved_capabilities.document_formatting then 16 | vim.api.nvim_create_augroup("format_on_save", { clear = true }) 17 | vim.api.nvim_create_autocmd("BufWritePre", { 18 | desc = "Auto format before save", 19 | group = "format_on_save", 20 | pattern = "", 21 | callback = function() 22 | vim.lsp.buf.formatting_sync { async = true } 23 | end, 24 | }) 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /options.lua: -------------------------------------------------------------------------------- 1 | return { 2 | opt = { 3 | lazyredraw = false, 4 | relativenumber = true, 5 | spell = false, 6 | spelllang = "en,programming", 7 | timeoutlen = 300, 8 | updatetime = 300, 9 | numberwidth = 1, 10 | spellfile = vim.fn.has "win32" ~= 0 and "C:\\Users\\Lenovo\\AppData\\Local\\nvim\\lua\\user\\spell\\en.utf-8.add" 11 | or "/home/dat/.config/astronvim/lua/user/spell/en.utf-8.add", 12 | list = true, 13 | listchars = { 14 | tab = "→ ", 15 | extends = "⟩", 16 | precedes = "⟨", 17 | trail = "·", 18 | nbsp = "␣", 19 | eol = "↲", 20 | }, 21 | wrap = true, 22 | showbreak = "↪ ", 23 | guifont = "RecMonoCasual NF:h14", 24 | }, 25 | g = { 26 | vcoolor_disable_mappings = true, 27 | vcoolor_lowercase = true, 28 | loaded_matchit = true, 29 | loaded_matchparen = true, 30 | loaded_logiPat = true, 31 | loaded_rrhelper = true, 32 | loaded_man = true, 33 | loaded_shada_plugin = true, 34 | loaded_spellfile_plugin = true, 35 | loaded_netrw = true, 36 | loaded_tutor_mode_plugin = true, 37 | simple_todo_map_keys = false, 38 | }, 39 | } 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AstroNvim 2 | 3 | My AstroNvim configuration 4 | 5 | If you want to use AstroNvim, check out: [AstroNvim](https://github.com/kabinspace/AstroVim) 6 | 7 | # How to install my config 8 | 9 | You can config `AstroNvim` in both `.config/nvim/lua/user` or `.config/astronvim/lua/user`. 10 | But I recommend doing the second method for easily reinstallation. 11 | 12 | Install my config, use: 13 | 14 | ```bash 15 | git clone https://github.com/datamonsterr/astrovim_config ~/.config/astronvim/lua/user 16 | ``` 17 | 18 | # Another configuration method 19 | 20 | Basically, [AstroNvim](https://github.com/kabinspace/AstroVim) provides us two way to make 21 | an user's customization. You can use an user/init.lua (which I'm using in another_method branch) or 22 | without a user/init.lua (which I'm using in main branch). 23 | 24 | **Notes:** You can see that my `another_method` seems not in a single file because I split user/init.lua 25 | to many files and source it back to user/init.lua 26 | 27 | Install another_method of my config, use: 28 | 29 | ```bash 30 | git clone -b another_method https://github.com/datamonsterr/astrovim_config ~/.config/astronvim/lua/user 31 | ``` 32 | -------------------------------------------------------------------------------- /spell/en.utf-8.add: -------------------------------------------------------------------------------- 1 | autocommands 2 | sumneko 3 | githubusercontent 4 | vscode 5 | lua 6 | json 7 | map 8 | #utogroup 9 | autogroup/! 10 | autogroup 11 | Neovim 12 | cwd 13 | dirs 14 | spellfile 15 | Eslint 16 | linter 17 | eslint_d 18 | builtins 19 | nvim 20 | github 21 | linters 22 | config 23 | AstroNvim 24 | init 25 | css 26 | roadmaps 27 | F8 28 | javascript 29 | tiktok 30 | eslintConfig 31 | browserslist 32 | dom 33 | firefox 34 | Autoclose 35 | RRGGBB 36 | RRGGBBAA 37 | rgb 38 | rgba 39 | hsl 40 | hsla 41 | rgb_fn 42 | hsl_fn 43 | hsl_fn 44 | lsp 45 | addings 46 | yamlls 47 | yaml 48 | ansible 49 | schemastore 50 | yml 51 | bufnr 52 | filetypes 53 | filetype 54 | colorscheme 55 | ui 56 | #ndweeb 57 | andweeb/! 58 | BufRead 59 | cmd 60 | tabnew 61 | cr 62 | luasnip 63 | addEventListener 64 |  65 | Popup 66 | p 67 | Cursorhold 68 | Bufferline 69 | Statusline 70 | english 71 | DirChanged 72 | FileType 73 | bindsym 74 | bindsym 75 | picom 76 | xrandr 77 | goldendict 78 | polybar 79 | greenclip 80 | rofi 81 | Mod1 82 | ibus 83 | AUTOCMD 84 | autocmd 85 | BufUnload 86 | showtabline 87 | cursorline 88 | listchars 89 | astronvim 90 | astronvim 91 | #opPattern 92 | #r4ltz 93 | ur4ltz/! 94 | HopPattern/! 95 | dracula 96 | Lenovo 97 | utf 98 | AppData 99 | -------------------------------------------------------------------------------- /plugins/nightfox.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("nightfox").setup { 3 | options = { 4 | transparent = true, -- Disable setting background 5 | styles = { -- Style to be applied to different syntax groups 6 | comments = "italic", -- Value is any valid attr-list value `:help attr-list` 7 | conditionals = "italic", 8 | constants = "italic", 9 | functions = "italic,bold", 10 | keywords = "bold", 11 | }, 12 | inverse = { -- Inverse highlight for different types 13 | match_paren = true, 14 | search = true, 15 | }, 16 | modules = { 17 | barbar = false, 18 | fern = false, 19 | fidget = false, 20 | gitgutter = false, 21 | glyph_palette = false, 22 | illuminate = false, 23 | lightspeed = false, 24 | lsp_saga = false, 25 | lsp_trouble = false, 26 | mini = false, 27 | modes = false, 28 | neogit = false, 29 | nvimtree = false, 30 | pounce = false, 31 | sneak = false, 32 | symbol_outline = false, 33 | }, 34 | }, 35 | groups = { 36 | all = { 37 | NormalFloat = { bg = "#000000" }, 38 | WhichKeyFloat = { bg = "#000000" }, 39 | }, 40 | }, 41 | } 42 | end 43 | -------------------------------------------------------------------------------- /plugins/nvim-dapui.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local dap, dapui = require "dap", require "dapui" 3 | dapui.setup { 4 | icons = { expanded = "▾", collapsed = "▸" }, 5 | mappings = { 6 | expand = "", 7 | open = "o", 8 | remove = "d", 9 | edit = "e", 10 | repl = "r", 11 | toggle = "t", 12 | }, 13 | layouts = { 14 | { 15 | elements = { 16 | { id = "watches", size = 0.5 }, 17 | { id = "scopes", size = 0.5 }, 18 | { id = "breakpoints", size = 0.25 }, 19 | { id = "stacks", size = 0.25 }, 20 | }, 21 | size = 40, 22 | position = "left", 23 | }, 24 | { 25 | elements = { "repl", "console" }, 26 | size = 10, 27 | position = "bottom", 28 | }, 29 | }, 30 | floating = { 31 | border = "single", 32 | mappings = { 33 | close = { "q", "" }, 34 | }, 35 | }, 36 | windows = { indent = 1 }, 37 | } 38 | -- add listeners to auto open DAP UI 39 | dap.listeners.after.event_initialized["dapui_config"] = function() 40 | dapui.open() 41 | end 42 | dap.listeners.before.event_terminated["dapui_config"] = function() 43 | dapui.close() 44 | end 45 | dap.listeners.before.event_exited["dapui_config"] = function() 46 | dapui.close() 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /plugins/WinShift.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | require("winshift").setup { 3 | highlight_moving_win = true, -- Highlight the window being moved 4 | focused_hl_group = "Visual", -- The highlight group used for the moving window 5 | moving_win_options = { 6 | -- These are local options applied to the moving window while it's 7 | -- being moved. They are unset when you leave Win-Move mode. 8 | wrap = false, 9 | cursorline = false, 10 | cursorcolumn = false, 11 | colorcolumn = "", 12 | }, 13 | -- The window picker is used to select a window while swapping windows with 14 | -- ':WinShift swap'. 15 | -- A string of chars used as identifiers by the window picker. 16 | window_picker_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", 17 | window_picker_ignore = { 18 | -- This table allows you to indicate to the window picker that a window 19 | -- should be ignored if its buffer matches any of the following criteria. 20 | filetype = { -- List of ignored file types 21 | "NvimTree", 22 | "neo-tree", 23 | }, 24 | buftype = { -- List of ignored buftypes 25 | "terminal", 26 | "quickfix", 27 | }, 28 | bufname = { -- List of regex patterns matching ignored buffer names 29 | [[.*foo/bar/baz\.qux]], 30 | }, 31 | }, 32 | } 33 | end 34 | -------------------------------------------------------------------------------- /plugins/alpha.lua: -------------------------------------------------------------------------------- 1 | local utils = require "core.utils" 2 | local plugins_count = vim.fn.len(vim.fn.globpath(vim.fn.stdpath "data" .. "/site/pack/packer/start", "*", 0, 1)) 3 | + vim.fn.len(vim.fn.globpath(vim.fn.stdpath "data" .. "/site/pack/packer/opt", "*", 0, 1)) 4 | local plugins_loaded = vim.fn.len(vim.fn.globpath(vim.fn.stdpath "data" .. "/site/pack/packer/start", "*", 0, 1)) 5 | local startify = require "alpha.themes.startify" 6 | return { 7 | layout = { 8 | { type = "padding", val = 2 }, 9 | { 10 | type = "text", 11 | val = utils.user_plugin_opts("header", {}, false), 12 | opts = { position = "center", hl = "DashboardHeader" }, 13 | }, 14 | { type = "padding", val = 2 }, 15 | { 16 | type = "group", 17 | val = { 18 | utils.alpha_button("LDR f f", " Find File "), 19 | utils.alpha_button("LDR f o", " Recents "), 20 | utils.alpha_button("LDR f p", "P Projects "), 21 | utils.alpha_button("LDR f n", " New File "), 22 | utils.alpha_button("LDR S l", " Last Session "), 23 | }, 24 | opts = { spacing = 1 }, 25 | }, 26 | startify.section.mru, 27 | startify.section.mru_cwd, 28 | { 29 | type = "text", 30 | val = { 31 | " AstroNvim loaded " .. plugins_loaded .. " and has " .. plugins_count .. " plugins ", 32 | }, 33 | opts = { position = "center", hl = "DashboardFooter" }, 34 | }, 35 | }, 36 | } 37 | -------------------------------------------------------------------------------- /plugins/treesitter.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- this is a comment 3 | ensure_installed = { "cpp", "vim", "lua", "python", "rust", "javascript", "html", "css", "json", "toml" }, 4 | matchup = { 5 | enable = true, 6 | }, 7 | highlight = { 8 | disable = { "css" }, 9 | additional_vim_regex_highlighting = true, 10 | }, 11 | indent = { enable = true, disable = { "python" } }, 12 | incremental_selection = { enable = true }, 13 | textobjects = { 14 | select = { 15 | enable = true, 16 | lookahead = true, 17 | keymaps = { 18 | ["of"] = "@function.outer", 19 | ["if"] = "@function.inner", 20 | ["oc"] = "@class.outer", 21 | ["ic"] = "@class.inner", 22 | }, 23 | }, 24 | move = { 25 | enable = true, 26 | set_jumps = true, 27 | goto_next_start = { 28 | ["]f"] = "@function.outer", 29 | ["]c"] = "@class.outer", 30 | }, 31 | goto_next_end = { 32 | ["]F"] = "@function.outer", 33 | ["]C"] = "@class.outer", 34 | ["]/"] = "@comment.outer", 35 | }, 36 | goto_previous_start = { 37 | ["[f"] = "@function.outer", 38 | ["[c"] = "@class.outer", 39 | }, 40 | goto_previous_end = { 41 | ["[F"] = "@function.outer", 42 | ["[C"] = "@class.outer", 43 | ["[/"] = "@comment.outer", 44 | }, 45 | }, 46 | swap = { 47 | enable = false, 48 | }, 49 | }, 50 | } 51 | -------------------------------------------------------------------------------- /plugins/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | ["goolord/alpha-nvim"] = { disable = true }, 3 | ["max397574/better-escape.nvim"] = { disable = true }, 4 | ["EdenEast/nightfox.nvim"] = { 5 | config = require "user.plugins.nightfox", 6 | }, 7 | ["ur4ltz/surround.nvim"] = { 8 | event = "BufRead", 9 | config = function() 10 | require("surround").setup { mappings_style = "surround", map_insert_mode = false } 11 | end, 12 | }, 13 | ["phaazon/hop.nvim"] = { 14 | branch = "v1", -- optional but strongly recommended 15 | event = "BufRead", 16 | config = function() 17 | require("hop").setup() 18 | end, 19 | }, 20 | ["ray-x/lsp_signature.nvim"] = { 21 | event = "InsertEnter", 22 | config = function() 23 | require("lsp_signature").setup {} 24 | end, 25 | }, 26 | ["KabbAmine/vCoolor.vim"] = { 27 | cmd = "VCoolor", 28 | }, 29 | ["mfussenegger/nvim-dap"] = { 30 | module = "dap", 31 | config = require "user.plugins.nvim-dap", 32 | }, 33 | ["rcarriga/nvim-dap-ui"] = { 34 | after = "nvim-dap", 35 | config = require "user.plugins.nvim-dapui", 36 | }, 37 | ["sindrets/winshift.nvim"] = { 38 | cmd = "WinShift", 39 | config = require "user.plugins.WinShift", 40 | }, 41 | ["nvim-telescope/telescope-dap.nvim"] = { 42 | module = "telescope._extensions.dap", 43 | }, 44 | ["nvim-telescope/telescope-packer.nvim"] = { 45 | module = "telescope._extensions.packer", 46 | }, 47 | ["aserowy/tmux.nvim"] = { 48 | module = "tmux", 49 | }, 50 | ["nvim-treesitter/playground"] = { 51 | cmd = { "TSPlaygroundToggle", "TSHighlightCapturesUnderCursor" }, 52 | }, 53 | { 54 | "theHamsta/nvim-dap-virtual-text", 55 | after = "nvim-dap", 56 | config = function() 57 | require("nvim-dap-virtual-text").setup() 58 | end, 59 | }, 60 | ["ziontee113/syntax-tree-surfer"] = { module = "syntax-tree-surfer" }, 61 | ["nvim-treesitter/nvim-treesitter-textobjects"] = { after = "nvim-treesitter" }, 62 | ["andymass/vim-matchup"] = { 63 | event = "BufRead", 64 | config = function() 65 | vim.g.matchup_matchparen_offscreen = {} 66 | end, 67 | }, 68 | ["hrsh7th/cmp-nvim-lua"] = { after = "cmp_luasnip" }, 69 | ["jvgrootveld/telescope-zoxide"] = { 70 | module = "telescope._extensions.zoxide", 71 | }, 72 | ["mickael-menu/zk-nvim"] = { 73 | -- module = { "zk", "zk.commands" }, 74 | config = function() 75 | require "user.plugins.zk" 76 | end, 77 | }, 78 | } 79 | -------------------------------------------------------------------------------- /plugins/cmp.lua: -------------------------------------------------------------------------------- 1 | local function has_words_before() 2 | local line, col = unpack(vim.api.nvim_win_get_cursor(0)) 3 | return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil 4 | end 5 | local kind_icons = { 6 | Text = "", 7 | Method = "", 8 | Function = "", 9 | Constructor = "", 10 | Field = "ﰠ", 11 | Variable = "", 12 | Class = "", 13 | Interface = "", 14 | Module = "", 15 | Property = "", 16 | Unit = "", 17 | Value = "", 18 | Enum = "", 19 | Keyword = "", 20 | Snippet = "", 21 | Color = "", 22 | File = "", 23 | Reference = "", 24 | Folder = "", 25 | EnumMember = "", 26 | Constant = "", 27 | Struct = "פּ", 28 | Event = "", 29 | Operator = "", 30 | TypeParameter = "", 31 | } 32 | 33 | local cmp = require "cmp" 34 | local luasnip = require "luasnip" 35 | 36 | return { 37 | view = { 38 | entries = { name = "custom", selection_order = "near_cursor" }, 39 | }, 40 | window = { 41 | documentation = { 42 | -- border = { "┌", "─", "┐", "│", "┘", "─", "└", "│" }, 43 | border = { " ", " ", " ", " ", " ", " ", " ", " " }, 44 | }, 45 | }, 46 | formatting = { 47 | fields = { "abbr", "kind", "menu" }, 48 | format = function(entry, vim_item) 49 | local shorten_abbr = string.sub(vim_item.abbr, 1, 30) 50 | if shorten_abbr ~= vim_item.abbr then 51 | vim_item.abbr = shorten_abbr .. "..." 52 | end 53 | -- Kind icons 54 | vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind], vim_item.kind) 55 | -- Source 56 | vim_item.menu = ({ 57 | buffer = "[Buf]", 58 | nvim_lsp = "[LSP]", 59 | luasnip = "[LuaSnip]", 60 | nvim_lua = "[API]", 61 | latex_symbols = "[LaTeX]", 62 | cmp_tabnine = "[Tabnine]", 63 | path = "[Path]", 64 | emoji = "[Emoji]", 65 | })[entry.source.name] 66 | return vim_item 67 | end, 68 | }, 69 | sources = { 70 | { name = "nvim_lua" }, 71 | }, 72 | mapping = { 73 | [""] = cmp.mapping(function(fallback) 74 | if cmp.visible() then 75 | cmp.select_next_item() 76 | elseif luasnip.expand_or_locally_jumpable() then 77 | luasnip.expand_or_jump() 78 | elseif has_words_before() then 79 | cmp.complete() 80 | else 81 | fallback() 82 | end 83 | end, { 84 | "i", 85 | "s", 86 | }), 87 | [""] = cmp.config.disable, 88 | [""] = cmp.config.disable, 89 | }, 90 | } 91 | -------------------------------------------------------------------------------- /plugins/lualine.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local status = require "core.status" 3 | local conditions = { 4 | buffer_not_empty = function() 5 | return vim.fn.empty(vim.fn.expand "%:t") ~= 1 6 | end, 7 | hide_in_width = function() 8 | return vim.fn.winwidth(0) > 80 9 | end, 10 | check_git_workspace = function() 11 | local filepath = vim.fn.expand "%:p:h" 12 | local gitdir = vim.fn.finddir(".git", filepath .. ";") 13 | return gitdir and #gitdir > 0 and #gitdir < #filepath 14 | end, 15 | } 16 | local colors = require "nvim-dracula.colors" 17 | 18 | local filename = { 19 | function() 20 | if vim.o.filetype ~= "toggleterm" then 21 | return vim.fn.expand "%:t" 22 | else 23 | local display = "Terminal: " .. vim.b.toggle_number 24 | return display 25 | end 26 | end, 27 | padding = { left = 2, right = 2 }, 28 | color = { fg = colors.bright_cyan, gui = "bold" }, 29 | } 30 | 31 | require("lualine").setup { 32 | options = { 33 | theme = "dracula-nvim", 34 | globalstatus = true, 35 | component_separators = { left = "", right = "" }, 36 | section_separators = { left = "", right = "" }, 37 | }, 38 | sections = { 39 | lualine_b = { 40 | { 41 | "branch", 42 | icon = "", 43 | padding = { left = 2, right = 1 }, 44 | }, 45 | { 46 | "diff", 47 | symbols = { added = " ", modified = "柳", removed = " " }, 48 | cond = conditions.hide_in_width, 49 | padding = { left = 2, right = 1 }, 50 | }, 51 | }, 52 | lualine_c = { 53 | filename, 54 | }, 55 | lualine_x = { 56 | { 57 | "filetype", 58 | cond = conditions.buffer_not_empty, 59 | padding = { left = 2, right = 2 }, 60 | }, 61 | }, 62 | lualine_z = { 63 | { 64 | "location", 65 | padding = { left = 1, right = 1 }, 66 | }, 67 | }, 68 | lualine_y = { 69 | { 70 | status.lsp_name, 71 | icon = " ", 72 | color = { gui = "bold", fg = colors.bright_yellow }, 73 | padding = { left = 1, right = 2 }, 74 | cond = conditions.hide_in_width, 75 | }, 76 | { 77 | status.treesitter_status, 78 | color = { fg = colors.cyan, gui = "bold" }, 79 | padding = { left = 1, right = 2 }, 80 | cond = conditions.hide_in_width, 81 | }, 82 | }, 83 | }, 84 | } 85 | end 86 | -------------------------------------------------------------------------------- /which-key/register_mappings.lua: -------------------------------------------------------------------------------- 1 | return { 2 | n = { 3 | [""] = { 4 | name = "Plugins", 5 | x = { name = "Debugger" }, 6 | d = { name = "Document" }, 7 | h = { name = "Hop" }, 8 | n = { 9 | name = "Notes", 10 | ["."] = { ":cd ~/Notes", "Go Notes" }, 11 | b = { 12 | function() 13 | require "zk.commands" "ZkBacklinks"() 14 | end, 15 | "Backlink Picker", 16 | }, 17 | d = { 18 | function() 19 | require "zk.commands" "ZkCd"() 20 | end, 21 | "Change Directory", 22 | }, 23 | r = { 24 | function() 25 | require "zk.commands" "ZkIndex"() 26 | end, 27 | "Refresh Index", 28 | }, 29 | l = { 30 | function() 31 | require "zk.commands" "ZkLinks"() 32 | end, 33 | "Link Picker", 34 | }, 35 | s = { 36 | function() 37 | require("zk.commands").get "ZkNotes" { sort = { "modified" } } 38 | end, 39 | "Search", 40 | }, 41 | p = { 42 | function() 43 | require("zk.commands").get "ZkNew" { dir = "personal", title = vim.fn.input "Title: " } 44 | end, 45 | "New Personal Note", 46 | }, 47 | w = { 48 | function() 49 | require("zk.commands").get "ZkNew" { dir = "work", title = vim.fn.input "Title: " } 50 | end, 51 | "New Work Note", 52 | }, 53 | t = { 54 | function() 55 | require("zk.commands").get "ZkTags"() 56 | end, 57 | "Tags", 58 | }, 59 | }, 60 | }, 61 | ["]"] = { 62 | name = "Next objects", 63 | f = "Next function", 64 | c = "Next class", 65 | F = "Next end function", 66 | C = "Next end class", 67 | ["/"] = "Next comment", 68 | }, 69 | ["["] = { 70 | name = "Prev objects", 71 | f = "Prev function", 72 | c = "Prev class", 73 | F = "Prev end function", 74 | C = "Prev end class", 75 | ["/"] = "Prev comment", 76 | }, 77 | }, 78 | v = { 79 | [""] = { 80 | n = { 81 | name = "Notes", 82 | s = { ":'<,'>lua require('zk.commands').get('ZkMatch')()", "Search" }, 83 | n = { 84 | ":'<,'>lua require('zk.commands').get('ZkNewFromTitleSelection')({ dir = 'personal' })", 85 | "New Personal Note From Title", 86 | }, 87 | }, 88 | }, 89 | }, 90 | } 91 | -------------------------------------------------------------------------------- /plugins/nvim-dap.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local dap = require "dap" 3 | dap.adapters = { 4 | python = { 5 | type = "executable", 6 | command = "python", 7 | args = { "-m", "debugpy.adapter" }, 8 | }, 9 | cppdbg = { 10 | id = "cppdbg", 11 | type = "executable", 12 | command = "OpenDebugAD7", 13 | }, 14 | } 15 | dap.configurations = { 16 | python = { 17 | { 18 | type = "python", 19 | request = "launch", 20 | name = "Launch file", 21 | program = "${file}", 22 | pythonPath = function() 23 | return "python" 24 | end, 25 | }, 26 | }, 27 | cpp = { 28 | { 29 | name = "Launch (choose debug file manually)", 30 | type = "cppdbg", 31 | request = "launch", 32 | program = function() 33 | return vim.fn.input("Path to executable: ", vim.fn.expand "%:p", "file") 34 | end, 35 | cwd = "${workspaceFolder}", 36 | stopOnEntry = true, 37 | runInTerminal = true, 38 | externalTerminal = true, 39 | }, 40 | }, 41 | rust = { 42 | { 43 | name = "Launch file", 44 | type = "cppdbg", 45 | request = "launch", 46 | program = function() 47 | local function get_project(table) 48 | for index, value in pairs(table) do 49 | if value == "src" then 50 | return table[index - 1] 51 | end 52 | end 53 | end 54 | local pname = get_project(require("user.custom.utils").split(vim.fn.expand "%", "/")) 55 | return vim.fn.expand "%:h" .. "/../target/debug/" .. pname 56 | end, 57 | cwd = "${workspaceFolder}", 58 | stopOnEntry = true, 59 | runInTerminal = true, 60 | }, 61 | }, 62 | } 63 | -- get notify 64 | local function start_session(_, _) 65 | local info_string = string.format("%s", dap.session().config.program) 66 | vim.notify(info_string, "debug", { title = "Debugger Started", timeout = 500 }) 67 | end 68 | local function terminate_session(_, _) 69 | local info_string = string.format("%s", dap.session().config.program) 70 | vim.notify(info_string, "debug", { title = "Debugger Terminated", timeout = 500 }) 71 | end 72 | dap.listeners.after.event_initialized["dapui"] = start_session 73 | dap.listeners.before.event_terminated["dapui"] = terminate_session 74 | -- Define symbols 75 | vim.fn.sign_define("DapStopped", { text = "", texthl = "DiagnosticWarn" }) 76 | vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticInfo" }) 77 | vim.fn.sign_define("DapBreakpointRejected", { text = "", texthl = "DiagnosticError" }) 78 | vim.fn.sign_define("DapBreakpointCondition", { text = "", texthl = "DiagnosticInfo" }) 79 | vim.fn.sign_define("DapLogPoint", { text = ".>", texthl = "DiagnosticInfo" }) 80 | end 81 | -------------------------------------------------------------------------------- /mappings.lua: -------------------------------------------------------------------------------- 1 | local function vim_opt_toggle(user_opt, first, second) 2 | if first == nil then 3 | first = true 4 | end 5 | if second == nil then 6 | second = false 7 | end 8 | if vim.o[user_opt] == first then 9 | vim.opt[user_opt] = second 10 | else 11 | vim.opt[user_opt] = first 12 | end 13 | end 14 | 15 | return { 16 | n = { 17 | ["lF"] = { 18 | function() 19 | vim.api.nvim_del_augroup_by_name "format_on_save" 20 | end, 21 | desc = "Disable Format on Save", 22 | }, 23 | [""] = { '/<++>"_c4l', desc = "Next Template" }, 24 | ["dr"] = { 25 | function() 26 | local word = vim.fn.expand "" 27 | local rp = vim.fn.input "Replace with: " 28 | vim.cmd("%s/" .. word .. "/" .. rp .. "/g") 29 | end, 30 | }, 31 | [""] = { 32 | function() 33 | local word = vim.fn.expand "" 34 | vim.cmd(string.format("silent exec '!goldendict %s'", word)) 35 | end, 36 | silent = true, 37 | desc = "Goldendict", 38 | }, 39 | ["q"] = { ":Bdelete!", desc = "Quit Buffer" }, 40 | ["w"] = { ":WinShift", desc = "WinShift" }, 41 | ["hl"] = { ":HopLineStart", desc = "Hop Line Start" }, 42 | ["hp"] = { ":HopPattern", desc = "Hop Pattern" }, 43 | ["hw"] = { ":HopWord", desc = "Hop Word" }, 44 | ["."] = { "cd %:p:h", desc = "Set CWD" }, 45 | ["SD"] = { ":!rm -r /home/dat/.local/share/nvim/sessions/*", desc = "Delete all sessions" }, 46 | ["gg"] = { 47 | function() 48 | require("toggleterm.terminal").Terminal:new({ cmd = "lazygit", direction = "float", hidden = true }):toggle() 49 | end, 50 | desc = "Lazygit", 51 | }, 52 | ["dh"] = { ":nohlsearch", desc = "No highlight" }, 53 | ["ds"] = { 54 | function() 55 | vim_opt_toggle "spell" 56 | end, 57 | desc = "Spell", 58 | }, 59 | ["dc"] = { 60 | function() 61 | vim_opt_toggle "cursorline" 62 | end, 63 | desc = "Cursorline", 64 | }, 65 | ["dl"] = { 66 | function() 67 | vim_opt_toggle "cursorcolumn" 68 | end, 69 | desc = "Cursor Column", 70 | }, 71 | ["dC"] = { 72 | function() 73 | vim_opt_toggle("conceallevel", 0, 2) 74 | end, 75 | desc = "Conceal", 76 | }, 77 | [""] = { 78 | function() 79 | require("syntax-tree-surfer").select_current_node() 80 | end, 81 | desc = "Select current node", 82 | }, 83 | ["sb"] = false, 84 | ["st"] = { 85 | function() 86 | require("telescope.builtin").builtin() 87 | end, 88 | desc = "Telescope", 89 | }, 90 | [""] = { "m .-2", desc = "move line up" }, 91 | [""] = { "m .+1", desc = "move line down" }, 92 | ["n"] = { "nzzzv" }, 93 | ["N"] = { "Nzzzv" }, 94 | ["J"] = { "mzJ`z" }, 95 | ["x"] = { ":WinShift swap" }, 96 | ["f"] = { ":HopChar1CurrentLine", desc = "Hop 1 Char Current Line" }, 97 | ["F"] = { ":HopChar1", desc = "Hop 1 Char Whole Buf" }, 98 | [""] = { ":VCoolor", desc = "VCoolor" }, 99 | ["b"] = false, 101 | ["h"] = false, 102 | ["tp"] = false, 103 | ["tl"] = false, 104 | ["tu"] = false, 105 | ["tt"] = false, 106 | ["tn"] = false, 107 | ["c"] = false, 108 | ["fh"] = false, 109 | ["u"] = false, 110 | ["o"] = false, 111 | [""] = { 112 | function() 113 | require("dap").toggle_breakpoint() 114 | end, 115 | desc = "Toggle Breakpoint", 116 | }, 117 | ["xb"] = { 118 | function() 119 | require("dap").set_breakpoint(vim.fn.input "Breakpoints condition: ") 120 | end, 121 | desc = "Breakpoint with condition", 122 | }, 123 | ["xc"] = { 124 | function() 125 | require("dap").clear_breakpoints() 126 | end, 127 | desc = "Clear Breakpoints", 128 | }, 129 | [""] = { 130 | function() 131 | require("dap").continue() 132 | end, 133 | desc = "Continue", 134 | }, 135 | [""] = { 136 | function() 137 | require("dap").step_into() 138 | end, 139 | desc = "Step Into", 140 | }, 141 | [""] = { 142 | function() 143 | require("dap").step_over() 144 | end, 145 | desc = "Step Over", 146 | }, 147 | ["xq"] = { 148 | function() 149 | require("dap").close() 150 | require("dapui").close() 151 | end, 152 | desc = "Close Session", 153 | }, 154 | ["xQ"] = { 155 | function() 156 | require("dap").terminate() 157 | require("dapui").close() 158 | end, 159 | desc = "Terminate", 160 | }, 161 | ["xu"] = { 162 | function() 163 | require("dapui").toggle() 164 | end, 165 | desc = "Toggle Debugger UI", 166 | }, 167 | ["fdc"] = { 168 | function() 169 | require("telescope").extensions.dap.commands {} 170 | end, 171 | desc = "Commands", 172 | }, 173 | ["fdC"] = { 174 | function() 175 | require("telescope").extensions.dap.configurations {} 176 | end, 177 | desc = "Configurations", 178 | }, 179 | ["fdb"] = { 180 | function() 181 | require("telescope").extensions.dap.list_breakpoints {} 182 | end, 183 | desc = "Breakpoints", 184 | }, 185 | ["fdv"] = { 186 | function() 187 | require("telescope").extensions.dap.variables {} 188 | end, 189 | desc = "Variables", 190 | }, 191 | ["fdf"] = { 192 | function() 193 | require("telescope").extensions.dap.frames {} 194 | end, 195 | desc = "Frames", 196 | }, 197 | ["fz"] = { 198 | function() 199 | require("telescope").extensions.zoxide.list {} 200 | end, 201 | desc = "Zoxide", 202 | }, 203 | ["pp"] = { 204 | function() 205 | require("telescope").extensions.packer.packer() 206 | end, 207 | desc = "Packer Search", 208 | }, 209 | }, 210 | v = { 211 | [""] = { ":m '>+1gv=gv" }, 212 | [""] = { ":m '<-2gv=gv" }, 213 | J = { 214 | function() 215 | require("syntax-tree-surfer").surf("next", "visual") 216 | end, 217 | desc = "Next", 218 | }, 219 | K = { 220 | function() 221 | require("syntax-tree-surfer").surf("prev", "visual") 222 | end, 223 | desc = "Prev", 224 | }, 225 | H = { 226 | function() 227 | require("syntax-tree-surfer").surf("parent", "visual") 228 | end, 229 | desc = "Parent", 230 | }, 231 | L = { 232 | function() 233 | require("syntax-tree-surfer").surf("child", "visual") 234 | end, 235 | desc = "Child", 236 | }, 237 | [""] = { 238 | function() 239 | require("syntax-tree-surfer").surf("next", "visual", true) 240 | end, 241 | desc = "Swap Next", 242 | }, 243 | [""] = { 244 | function() 245 | require("syntax-tree-surfer").surf("prev", "visual", true) 246 | end, 247 | desc = "Swap Prev", 248 | }, 249 | }, 250 | i = { 251 | [""] = { 252 | function() 253 | vim.notify("Use Capslock Key", "warn", { title = "Change your habit" }) 254 | end, 255 | }, 256 | [""] = { ":wi", desc = "Save the file" }, 257 | [","] = ",u", 258 | ["."] = ".u", 259 | ["!"] = "!u", 260 | ["?"] = "?u", 261 | }, 262 | } 263 | --------------------------------------------------------------------------------