commit f4140dc7c24b6dfc2c42241b544cb3326a3e6c28 Author: qugalet Date: Sat Oct 19 10:57:01 2024 +0300 initial commit diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..b1d9955 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,14 @@ +{ + "runtime.version": "LuaJIT", + "runtime.path": [ + "lua/?.lua", + "lua/?/init.lua" + ], + "diagnostics.globals": ["vim"], + "workspace.checkThirdParty": false, + "workspace.library": [ + "$VIMRUNTIME", + "./lua" + ] +} + diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua new file mode 100644 index 0000000..c9dab0a --- /dev/null +++ b/after/plugin/colors.lua @@ -0,0 +1,8 @@ +function colorscheming(color) + vim.cmd.colorscheme(color) + + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + -- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) +end + +colorscheming("gruvbox") diff --git a/after/plugin/dap.lua b/after/plugin/dap.lua new file mode 100644 index 0000000..47c242b --- /dev/null +++ b/after/plugin/dap.lua @@ -0,0 +1,27 @@ +local dap = require('dap') +local dapui = require("dapui") + +vim.keymap.set("n", "dd", function() dap.continue() end) +vim.keymap.set("n", "db", function() dap.toggle_breakpoint() end) +vim.keymap.set("n", "dn", function() dap.step_over() end) + +dapui.setup() + +vim.keymap.set("n", "vd", function() dapui.toggle() end) + +dap.listeners.before.attach.dapui_config = function() + dapui.open() +end +dap.listeners.before.launch.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 + +-- python + +require('dap-python').setup('~/.local/share/nvim/.virtualenvs/debugpy/bin/python') diff --git a/after/plugin/format.lua b/after/plugin/format.lua new file mode 100644 index 0000000..13e9cda --- /dev/null +++ b/after/plugin/format.lua @@ -0,0 +1,42 @@ +require("conform").setup({ + formatters_by_ft = { + lua = { "stylua" }, + -- Conform will run multiple formatters sequentially + python = { "black" }, + -- Use a sub-list to run only the first available formatter + javascript = { { "prettierd", "prettier" } }, + + nix = { "nixfmt" }, + + golang = { "gofmt" }, + + templ = { "templ" }, + }, + format_on_save = function(bufnr) + -- Disable with a global or buffer-local variable + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { timeout_ms = 500, lsp_format = "fallback" } + end, +}) + +vim.api.nvim_create_user_command("FormatDisable", function(args) + if args.bang then + -- FormatDisable! will disable formatting just for this buffer + vim.b.disable_autoformat = true + else + vim.g.disable_autoformat = true + end +end, { + desc = "Disable autoformat-on-save", + bang = true, +}) +vim.api.nvim_create_user_command("FormatEnable", function() + vim.b.disable_autoformat = false + vim.g.disable_autoformat = false +end, { + desc = "Re-enable autoformat-on-save", +}) + +vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" diff --git a/after/plugin/ftplugin/markdown.lua b/after/plugin/ftplugin/markdown.lua new file mode 100644 index 0000000..e69de29 diff --git a/after/plugin/fugitive.lua b/after/plugin/fugitive.lua new file mode 100644 index 0000000..80c9070 --- /dev/null +++ b/after/plugin/fugitive.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "gs", vim.cmd.Git) diff --git a/after/plugin/git.lua b/after/plugin/git.lua new file mode 100644 index 0000000..2e28e87 --- /dev/null +++ b/after/plugin/git.lua @@ -0,0 +1,2 @@ +vim.keymap.set("n", "gs", vim.cmd.Git) +require('gitsigns').setup() diff --git a/after/plugin/go.lua b/after/plugin/go.lua new file mode 100644 index 0000000..f3bb9c6 --- /dev/null +++ b/after/plugin/go.lua @@ -0,0 +1,10 @@ +require('go').setup() + +local format_sync_grp = vim.api.nvim_create_augroup("goimports", {}) +vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*.go", + callback = function() + require('go.format').goimports() + end, + group = format_sync_grp, +}) diff --git a/after/plugin/harpoon.lua b/after/plugin/harpoon.lua new file mode 100644 index 0000000..3e28da1 --- /dev/null +++ b/after/plugin/harpoon.lua @@ -0,0 +1,15 @@ +local harpoon = require("harpoon") + +harpoon:setup() + +vim.keymap.set("n", "a", function() harpoon:list():add() end) +vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) + +vim.keymap.set("n", "1", function() harpoon:list():select(1) end) +vim.keymap.set("n", "2", function() harpoon:list():select(2) end) +vim.keymap.set("n", "3", function() harpoon:list():select(3) end) +vim.keymap.set("n", "4", function() harpoon:list():select(4) end) + +-- Toggle previous & next buffers stored within Harpoon list +vim.keymap.set("n", "", function() harpoon:list():prev() end) +vim.keymap.set("n", "", function() harpoon:list():next() end) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100644 index 0000000..5236f5c --- /dev/null +++ b/after/plugin/lsp.lua @@ -0,0 +1,143 @@ +local lsp_zero = require("lsp-zero") +local lspconfig = require("lspconfig") + + +lsp_zero.on_attach(function(client, bufnr) + -- see :help lsp-zero-keybindings + -- to learn the available actions + lsp_zero.default_keymaps({ buffer = bufnr }) + + local opts = { buffer = bufnr, remap = false } + + -- Code action + vim.keymap.set("n", "la", function() + vim.lsp.buf.code_action() + end, opts) + + -- Diagnostic + vim.keymap.set("n", "ld", function() + vim.diagnostic.open_float() + end, opts) + + -- Get docs + vim.keymap.set("n", "K", function() + vim.lsp.buf.hover() + end, opts) + + -- Jump to definition + vim.keymap.set("n", "gd", function() + vim.lsp.buf.definition() + end) + + -- Jump to declaration + vim.keymap.set('n', 'gD', function() + vim.lsp.buf.declaration() + end) + + -- Lists all the implementations for the symbol under the cursor + vim.keymap.set('n', 'gi', function() + vim.lsp.buf.implementation() + end) + + -- Jumps to the definition of the type symbol + vim.keymap.set('n', 'go', function() + vim.lsp.buf.type_definition() + end) + + -- Lists all the references + vim.keymap.set('n', 'gr', function() + vim.lsp.buf.references() + end) + + -- -- Displays a function's signature information + -- vim.keymap.set('n', '', function() + -- vim.lsp.buf.signature_help() + -- end) + + -- Renames all references to the symbol under the cursor + vim.keymap.set('n', '', function() + vim.lsp.buf.rename() + end) + + require("lsp_signature").on_attach({}, bufnr) +end) + +vim.filetype.add({ extension = { templ = "templ" } }) + +lsp_zero.setup_servers({ "gopls", "lua_ls", "nil_ls", "pylsp", "clangd" }) + +lspconfig.lua_ls.setup({ + settings = { + Lua = { + workspace = { + checkThirdParty = false, + library = vim.tbl_deep_extend('force', vim.api.nvim_get_runtime_file("", true), { + "${3rd}/luv/library", + "${3rd}/busted/library", + "/usr/share/awesome/lib", + "/usr/share/lua", + }), + }, + diagnostics = { + globals = { + "awesome", + "awful", + "client", + "screen", + "tag", + "root", + }, + }, + runtime = { version = 'LuaJIT' }, + completion = { callSnippet = "Replace", }, + telemetry = { enable = false, }, + } + } +}) + +-- lspconfig.tailwindcss.setup({ +-- filetypes = { "templ", "astro", "javascript", "typescript", "react" }, +-- init_options = { userLanguages = { templ = "html" } }, +-- }) +-- +-- lspconfig.htmx.setup({ +-- filetypes = { "html", "templ" }, +-- }) + +local cmp = require("cmp") +local cmp_action = require("lsp-zero").cmp_action() + +local cmp_select = { behavior = cmp.SelectBehavior.Select } + +cmp.setup({ + mapping = cmp.mapping.preset.insert({ + -- `Enter` key to confirm completion + [""] = cmp.mapping.confirm({ select = false }), + + [""] = cmp.mapping.select_next_item(cmp_select), + [""] = cmp.mapping.select_prev_item(cmp_select), + [""] = cmp.mapping.confirm({ select = true }), + + -- Ctrl+Space to trigger completion menu + [""] = cmp.mapping.complete(), + + -- Navigate between snippet placeholder + [""] = cmp_action.luasnip_jump_forward(), + [""] = cmp_action.luasnip_jump_backward(), + + -- Scroll up and down in the completion documentation + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + }), + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + sources = { + { name = 'path' }, + { name = 'nvim_lsp', keyword_length = 1 }, + { name = 'vim-dadbod-completion', keyword_length = 1 }, + { name = 'buffer', keyword_length = 3 }, + } +}) diff --git a/after/plugin/lualine.lua b/after/plugin/lualine.lua new file mode 100644 index 0000000..3f15ff2 --- /dev/null +++ b/after/plugin/lualine.lua @@ -0,0 +1,40 @@ +require('lualine').setup { + options = { + icons_enabled = true, + theme = 'gruvbox_dark', + component_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + 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 = {} +} diff --git a/after/plugin/mason.lua b/after/plugin/mason.lua new file mode 100644 index 0000000..ac26661 --- /dev/null +++ b/after/plugin/mason.lua @@ -0,0 +1 @@ +require("mason").setup() diff --git a/after/plugin/neorg.lua b/after/plugin/neorg.lua new file mode 100644 index 0000000..82db06d --- /dev/null +++ b/after/plugin/neorg.lua @@ -0,0 +1,26 @@ +require("neorg").setup({ + load = { + ["core.defaults"] = {}, + ["core.concealer"] = {}, + ["core.dirman"] = { + config = { + workspaces = { + notes = "~/documents/notes" + }, + default_workspace = "notes", + } + }, + ["core.journal"] = { + journal_folder = "~/documents/notes/journal" + }, + } +}) + +vim.api.nvim_create_autocmd("Filetype", { + pattern = "norg", + callback = function() + end, +}) + +vim.keymap.set("n", "gi", " Neorg index") +vim.keymap.set("n", "gr", " Neorg return") diff --git a/after/plugin/nvim-tree.lua b/after/plugin/nvim-tree.lua new file mode 100644 index 0000000..67e0e3a --- /dev/null +++ b/after/plugin/nvim-tree.lua @@ -0,0 +1,333 @@ +-- vim.g.loaded_netrw = 1 +-- vim.g.loaded_netrwPlugin = 1 +-- +-- vim.keymap.set("n", "e", " NvimTreeToggle") +-- +-- require("nvim-tree").setup({ +-- sort = { +-- sorter = "case_sensitive", +-- }, +-- view = { +-- width = 30, +-- }, +-- renderer = { +-- group_empty = true, +-- icons = { +-- glyphs = { +-- git = { +-- unstaged = "x", +-- staged = "✓", +-- unmerged = "", +-- renamed = "", +-- untracked = "󰓎", +-- deleted = "", +-- ignored = "◌", +-- } +-- } +-- } +-- }, +-- filters = { +-- dotfiles = true, +-- }, +-- }) + +-- Neotree +-- If you want icons for diagnostic errors, you'll need to define them somewhere: +vim.fn.sign_define("DiagnosticSignError", + { text = " ", texthl = "DiagnosticSignError" }) +vim.fn.sign_define("DiagnosticSignWarn", + { text = " ", texthl = "DiagnosticSignWarn" }) +vim.fn.sign_define("DiagnosticSignInfo", + { text = " ", texthl = "DiagnosticSignInfo" }) +vim.fn.sign_define("DiagnosticSignHint", + { text = "󰌵", texthl = "DiagnosticSignHint" }) + +vim.keymap.set("n", "e", " Neotree") + +require("neo-tree").setup({ + close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab + popup_border_style = "rounded", + enable_git_status = true, + enable_diagnostics = true, + open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes + sort_case_insensitive = false, -- used when sorting files and directories in the tree + sort_function = nil, -- use a custom function for sorting files and directories in the tree + -- sort_function = function (a,b) + -- if a.type == b.type then + -- return a.path > b.path + -- else + -- return a.type > b.type + -- end + -- end , -- this sorts files and directories descendantly + default_component_configs = { + container = { + enable_character_fade = true + }, + indent = { + indent_size = 2, + padding = 1, -- extra padding on left hand side + -- indent guides + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + highlight = "NeoTreeIndentMarker", + -- expander config, needed for nesting files + with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "󰜌", + provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available + if node.type == "file" or node.type == "terminal" then + local success, web_devicons = pcall(require, "nvim-web-devicons") + local name = node.type == "terminal" and "terminal" or node.name + if success then + local devicon, hl = web_devicons.get_icon(name) + icon.text = devicon or icon.text + icon.highlight = hl or icon.highlight + end + end + end, + -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = "*", + highlight = "NeoTreeFileIcon" + }, + modified = { + symbol = "[+]", + highlight = "NeoTreeModified", + }, + name = { + trailing_slash = false, + use_git_status_colors = true, + highlight = "NeoTreeFileName", + }, + git_status = { + symbols = { + -- Change type + added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name + modified = "", -- or "", but this is redundant info if you use git_status_colors on the name + deleted = "✖", -- this can only be used in the git_status source + renamed = "󰁕", -- this can only be used in the git_status source + -- Status type + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", + conflict = "", + } + }, + -- If you don't want to use these columns, you can set `enabled = false` for each of them individually + file_size = { + enabled = true, + required_width = 64, -- min width of window required to show this column + }, + type = { + enabled = true, + required_width = 122, -- min width of window required to show this column + }, + last_modified = { + enabled = true, + required_width = 88, -- min width of window required to show this column + }, + created = { + enabled = true, + required_width = 110, -- min width of window required to show this column + }, + symlink_target = { + enabled = false, + }, + }, + -- A list of functions, each representing a global custom command + -- that will be available in all sources (if not overridden in `opts[source_name].commands`) + -- see `:h neo-tree-custom-commands-global` + commands = {}, + window = { + position = "left", + width = 30, + mapping_options = { + noremap = true, + nowait = true, + }, + mappings = { + [""] = { + "toggle_node", + nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use + }, + ["<2-LeftMouse>"] = "open", + [""] = "open", + -- [""] = "open", + [""] = "cancel", -- close preview or floating neo-tree window + ["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } }, + -- Read `# Preview Mode` for more information + ["l"] = "focus_preview", + ["S"] = "open_split", + ["s"] = "open_vsplit", + -- ["S"] = "split_with_window_picker", + -- ["s"] = "vsplit_with_window_picker", + ["t"] = "open_tabnew", + -- [""] = "open_drop", + -- ["t"] = "open_tab_drop", + ["w"] = "open_with_window_picker", + [""] = "open_with_window_picker", + --["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing + ["C"] = "close_node", + -- ['C'] = 'close_all_subnodes', + ["z"] = "close_all_nodes", + --["Z"] = "expand_all_nodes", + ["a"] = { + "add", + -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details + -- some commands may take optional config options, see `:h neo-tree-mappings` for details + config = { + show_path = "none" -- "none", "relative", "absolute" + } + }, + ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. + ["d"] = "delete", + ["r"] = "rename", + ["y"] = "copy_to_clipboard", + ["x"] = "cut_to_clipboard", + ["p"] = "paste_from_clipboard", + ["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": + -- ["c"] = { + -- "copy", + -- config = { + -- show_path = "none" -- "none", "relative", "absolute" + -- } + --} + ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". + ["q"] = "close_window", + ["R"] = "refresh", + ["?"] = "show_help", + ["<"] = "prev_source", + [">"] = "next_source", + ["i"] = "show_file_details", + } + }, + nesting_rules = {}, + filesystem = { + filtered_items = { + visible = false, -- when true, they will just be displayed differently than normal items + hide_dotfiles = true, + hide_gitignored = true, + hide_hidden = true, -- only works on Windows for hidden files/directories + hide_by_name = { + --"node_modules" + }, + hide_by_pattern = { -- uses glob style patterns + --"*.meta", + --"*/src/*/tsconfig.json", + }, + always_show = { -- remains visible even if other settings would normally hide it + --".gitignored", + }, + always_show_by_pattern = { -- uses glob style patterns + --".env*", + }, + never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show + --".DS_Store", + --"thumbs.db" + }, + never_show_by_pattern = { -- uses glob style patterns + --".null-ls_*", + }, + }, + follow_current_file = { + enabled = false, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + group_empty_dirs = false, -- when true, empty folders will be grouped together + hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree + -- in whatever position is specified in window.position + -- "open_current", -- netrw disabled, opening a directory opens within the + -- window like netrw would, regardless of window.position + -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs + use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes + -- instead of relying on nvim autocmd events. + window = { + mappings = { + [""] = "navigate_up", + ["."] = "set_root", + ["H"] = "toggle_hidden", + ["/"] = "fuzzy_finder", + ["D"] = "fuzzy_finder_directory", + ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm + -- ["D"] = "fuzzy_sorter_directory", + ["f"] = "filter_on_submit", + [""] = "clear_filter", + ["[g"] = "prev_git_modified", + ["]g"] = "next_git_modified", + ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["og"] = { "order_by_git_status", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + -- [''] = function(state) ... end, + }, + fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode + [""] = "move_cursor_down", + [""] = "move_cursor_down", + [""] = "move_cursor_up", + [""] = "move_cursor_up", + -- [''] = function(state, scroll_padding) ... end, + }, + }, + + commands = {} -- Add a custom command or override a global one using the same function name + }, + buffers = { + follow_current_file = { + enabled = true, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + group_empty_dirs = true, -- when true, empty folders will be grouped together + show_unloaded = true, + window = { + mappings = { + ["bd"] = "buffer_delete", + [""] = "navigate_up", + ["."] = "set_root", + ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + } + }, + }, + git_status = { + window = { + position = "float", + mappings = { + ["A"] = "git_add_all", + ["gu"] = "git_unstage_file", + ["ga"] = "git_add_file", + ["gr"] = "git_revert_file", + ["gc"] = "git_commit", + ["gp"] = "git_push", + ["gg"] = "git_commit_and_push", + ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + } + } + } +}) + +vim.cmd([[nnoremap \ :Neotree reveal]]) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua new file mode 100644 index 0000000..d2ee9f0 --- /dev/null +++ b/after/plugin/telescope.lua @@ -0,0 +1,8 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', '.', builtin.find_files, {}) +vim.keymap.set('n', '', builtin.git_files, {}) +vim.keymap.set('n', 'fg', builtin.live_grep, {}) + +-- vim.keymap.set('n', 'pf', function() +-- builtin.grep_string({ search = vim.fn.input("Grep > ") }) +-- end) diff --git a/after/plugin/tmux.lua b/after/plugin/tmux.lua new file mode 100644 index 0000000..6e37ef8 --- /dev/null +++ b/after/plugin/tmux.lua @@ -0,0 +1,5 @@ +vim.keymap.set("n", "", " TmuxNavigateLeft") +vim.keymap.set("n", "", " TmuxNavigateRight") +vim.keymap.set("n", "", " TmuxNavigateDown") +vim.keymap.set("n", "", " TmuxNavigateUp") + diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua new file mode 100644 index 0000000..6bb41e5 --- /dev/null +++ b/after/plugin/treesitter.lua @@ -0,0 +1,21 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "python", "go" }, + + -- 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, + + highlight = { + enable = true, + + -- 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, + }, +} diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua new file mode 100644 index 0000000..ba0b954 --- /dev/null +++ b/after/plugin/undotree.lua @@ -0,0 +1,2 @@ +vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle) + diff --git a/after/plugin/xkbswitch.lua b/after/plugin/xkbswitch.lua new file mode 100644 index 0000000..724dd2d --- /dev/null +++ b/after/plugin/xkbswitch.lua @@ -0,0 +1 @@ +require('xkbswitch').setup() diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..c21bc92 --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require("qvim") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..c1d7778 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,43 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, + "auto-pairs": { "branch": "master", "commit": "39f06b873a8449af8ff6a3eee716d3da14d63a76" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "conform.nvim": { "branch": "master", "commit": "f5bd8419f8a29451e20bdb1061a54fe13d5c8de3" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" }, + "go.nvim": { "branch": "master", "commit": "fb612d13c34d3d1d2caa4d5785733abe70dc22f0" }, + "gruvbox.nvim": { "branch": "main", "commit": "49d9c0b150ba70efcd831ec7b3cb8ee740067045" }, + "guihua.lua": { "branch": "master", "commit": "225db770e36aae6a1e9e3a65578095c8eb4038d3" }, + "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, + "indent-blankline.nvim": { "branch": "master", "commit": "e7a4442e055ec953311e77791546238d1eaae507" }, + "lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "56db3d5ce5476b183783160e6045f7337ba12b83" }, + "lsp_signature.nvim": { "branch": "master", "commit": "fc38521ea4d9ec8dbd4c2819ba8126cea743943b" }, + "lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, + "neogit": { "branch": "master", "commit": "3e44062d164d11848a1663831e4366b86ef6d889" }, + "neorg": { "branch": "main", "commit": "81ee90cb2d72ac43bfadb7dd276646f34c8f85be" }, + "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" }, + "nvim-dap-python": { "branch": "master", "commit": "03fe9592409236b9121c03b66a682dfca15a5cac" }, + "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, + "nvim-lspconfig": { "branch": "master", "commit": "d6b0c3b38cdb45dcbd658efc2bb721568f68d93f" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, + "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, + "nvim-treesitter": { "branch": "master", "commit": "68b2bdd99d889e9705f7e90ae64d990f3ff03cf3" }, + "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, + "pathlib.nvim": { "branch": "main", "commit": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "telescope.nvim": { "branch": "master", "commit": "df534c3042572fb958586facd02841e10186707c" }, + "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, + "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" }, + "vim-tmux-navigator": { "branch": "master", "commit": "a9b52e7d36114d40350099f254b5f299a35df978" }, + "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" }, + "window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" }, + "xkbswitch.nvim": { "branch": "master", "commit": "1e14fe0ff9e11ff1671c9db30a8702d9d21f3816" } +} diff --git a/lua/qvim/init.lua b/lua/qvim/init.lua new file mode 100644 index 0000000..868bdfb --- /dev/null +++ b/lua/qvim/init.lua @@ -0,0 +1,3 @@ +require("qvim.remap") +require("qvim.lazy") +require("qvim.set") diff --git a/lua/qvim/lazy.lua b/lua/qvim/lazy.lua new file mode 100644 index 0000000..ec40c9f --- /dev/null +++ b/lua/qvim/lazy.lua @@ -0,0 +1,91 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "qvim.plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "gruvbox" } }, + -- automatically check for plugin updates + checker = { enabled = true, notify = false }, +}) + +-- return require("packer").startup(function(use) +-- use({ +-- "vimwiki/vimwiki", +-- config = function() +-- vim.g.vimwiki_list = { +-- { +-- path = "~/documents/wiki", +-- syntax = "markdown", +-- ext = ".md", +-- }, +-- } +-- vim.g.vimwiki_markdown_link_ext = 1 +-- end, +-- }) +-- use({ "tools-life/taskwiki" }) +-- -- use({ +-- -- "andrewferrier/wrapping.nvim", +-- -- config = function() +-- -- require("wrapping").setup({ +-- -- softener = { +-- -- { markdown = true }, +-- -- }, +-- -- }) +-- -- end, +-- -- }) +-- -- use({ +-- -- "MeanderingProgrammer/markdown.nvim", +-- -- as = "render-markdown", -- Only needed if you have another plugin named markdown.nvim +-- -- after = { "nvim-treesitter" }, +-- -- config = function() +-- -- require("render-markdown").setup({}) +-- -- end, +-- -- }) +-- use({ +-- "tadmccorkle/markdown.nvim", +-- config = function() +-- require("markdown").setup({ +-- -- configuration here or empty for defaults +-- }) +-- end, +-- }) +-- use({ +-- "folke/which-key.nvim", +-- config = function() +-- vim.o.timeout = true +-- vim.o.timeoutlen = 300 +-- require("which-key").setup({ +-- -- your configuration comes here +-- -- or leave it empty to use the default settings +-- -- refer to the configuration section below +-- }) +-- end, +-- }) +-- -- golang +-- use 'ray-x/go.nvim' +-- use 'ray-x/guihua.lua' +-- +-- use "tpope/vim-dadbod" +-- use "kristijanhusak/vim-dadbod-completion" +-- use "kristijanhusak/vim-dadbod-ui" +-- end) diff --git a/lua/qvim/plugins.lua b/lua/qvim/plugins.lua new file mode 100644 index 0000000..475725e --- /dev/null +++ b/lua/qvim/plugins.lua @@ -0,0 +1,144 @@ +return { + -- Theming + "ellisonleao/gruvbox.nvim", + + 'nvim-telescope/telescope.nvim', + tag = '0.1.8', + dependencies = { 'nvim-lua/plenary.nvim' }, + + { + "nvim-treesitter/nvim-treesitter", + -- build = function() + -- require("nvim-treesitter.install").update({ with_sync = true })() + -- end, + }, + + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" }, + }, + + "mbbill/undotree", + + "christoomey/vim-tmux-navigator", + + 'ivanesmantovich/xkbswitch.nvim', + + { + "kylechui/nvim-surround", + version = "*", + config = function() + require("nvim-surround").setup({}) + end, + }, + + { + "numToStr/Comment.nvim", + config = function() + require("Comment").setup() + end, + }, + + -- { + -- "nvim-tree/nvim-tree.lua", + -- dependencies = { + -- { "nvim-tree/nvim-web-devicons" }, + -- }, + -- }, + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + } + }, + + { + 's1n7ax/nvim-window-picker', + name = 'window-picker', + event = 'VeryLazy', + version = '2.*', + config = function() + require 'window-picker'.setup() + end, + }, + + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons", lazy = true }, + }, + + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + ---@module "ibl" + ---@type ibl.config + opts = {}, + }, + + { + "folke/which-key.nvim", + config = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + require("which-key").setup({}) + end, + }, + + "jiangmiao/auto-pairs", + + "williamboman/mason.nvim", + + -- lsp/format + { + "VonHeikemen/lsp-zero.nvim", + branch = "v3.x", + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "neovim/nvim-lspconfig", + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-nvim-lsp", + "L3MON4D3/LuaSnip", + "ray-x/lsp_signature.nvim", + }, + }, + + { "rcarriga/nvim-dap-ui", dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" } }, + { "mfussenegger/nvim-dap-python", dependencies = { "mfussenegger/nvim-dap" } }, + + { + "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, + }, + + -- Git + "tpope/vim-fugitive", + "lewis6991/gitsigns.nvim", + { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim", + "nvim-telescope/telescope.nvim", + }, + config = true + }, + + -- Go + 'ray-x/go.nvim', + 'ray-x/guihua.lua', + + -- note-taking + { + "nvim-neorg/neorg", + lazy = false, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default + version = "*", -- Pin Neorg to the latest stable release + -- config = true, + }, +} diff --git a/lua/qvim/remap.lua b/lua/qvim/remap.lua new file mode 100644 index 0000000..4193561 --- /dev/null +++ b/lua/qvim/remap.lua @@ -0,0 +1,20 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = "," + +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("n", "J", "mzJ`z") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") + +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +vim.keymap.set("x", "p", "\"_dP") + +vim.keymap.set("v", ">", ">gv") +vim.keymap.set("v", "<", "