diff --git a/.config/aliasrc/work b/.config/aliasrc/work index ed840e6..0df7a74 100755 --- a/.config/aliasrc/work +++ b/.config/aliasrc/work @@ -34,5 +34,5 @@ alias kot="cd $KOT" alias krd="cd $KRD" alias neg="cd $NEG" alias nego="cd $NEGO && source .venv/bin/activate && make" -alias negn="cd $NEGN" +alias negn="cd $NEGN && source .venv/bin/activate" alias negs="cd $NEGS" diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..bba220d --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,4 @@ +require("config.options") +require("config.lazy") +require("config.keymaps") +require("config.autocmds") diff --git a/.config/nvim/lua/.luarc.json b/.config/nvim/lua/.luarc.json new file mode 100644 index 0000000..429bd14 --- /dev/null +++ b/.config/nvim/lua/.luarc.json @@ -0,0 +1,56 @@ +{ + "workspace.library": [ + "/Users/doman/.local/share/nvim/lazy/neodev.nvim/types/stable", + "/opt/homebrew/Cellar/neovim/0.9.1/share/nvim/runtime/lua", + "/Users/doman/.local/share/nvim/lazy/trouble.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/mini.ai/lua", + "/Users/doman/.local/share/nvim/lazy/todo-comments.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/indent-blankline.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/catppuccin/lua", + "/Users/doman/.local/share/nvim/lazy/mason-lspconfig.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/nvim-treesitter/lua", + "/Users/doman/.local/share/nvim/lazy/mason.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/mini.bufremove/lua", + "/Users/doman/.local/share/nvim/lazy/bufferline.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/neo-tree.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/lazy.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/neoconf.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/persistence.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/neodev.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/vim-startuptime/lua", + "/Users/doman/.local/share/nvim/lazy/nui.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/telescope.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/alpha-nvim/lua", + "/Users/doman/.local/share/nvim/lazy/nvim-web-devicons/lua", + "/Users/doman/.local/share/nvim/lazy/null-ls.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/LuaSnip/lua", + "/Users/doman/.local/share/nvim/lazy/nvim-navic/lua", + "/Users/doman/.local/share/nvim/lazy/noice.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/nvim-cmp/lua", + "/Users/doman/.local/share/nvim/lazy/mini.comment/lua", + "/Users/doman/.local/share/nvim/lazy/mini.surround/lua", + "/Users/doman/.local/share/nvim/lazy/tokyonight.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/LazyVim/lua", + "/Users/doman/.local/share/nvim/lazy/mini.indentscope/lua", + "/Users/doman/.local/share/nvim/lazy/lualine.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/mini.pairs/lua", + "/Users/doman/.local/share/nvim/lazy/cmp-nvim-lsp/lua", + "/Users/doman/.local/share/nvim/lazy/which-key.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/cmp-path/lua", + "/Users/doman/.local/share/nvim/lazy/nvim-treesitter-textobjects/lua", + "/Users/doman/.local/share/nvim/lazy/nvim-lspconfig/lua", + "/Users/doman/.local/share/nvim/lazy/cmp_luasnip/lua", + "/Users/doman/.local/share/nvim/lazy/nvim-notify/lua", + "/Users/doman/.local/share/nvim/lazy/flash.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/vim-illuminate/lua", + "/Users/doman/.local/share/nvim/lazy/dressing.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/nvim-spectre/lua", + "/Users/doman/.local/share/nvim/lazy/cmp-buffer/lua", + "/Users/doman/.local/share/nvim/lazy/nvim-ts-context-commentstring/lua", + "/Users/doman/.local/share/nvim/lazy/gitsigns.nvim/lua", + "/Users/doman/.local/share/nvim/lazy/plenary.nvim/lua", + "/Users/doman/.config/nvim/lua", + "/Users/doman/.local/share/nvim/mason/packages/lua-language-server/libexec/meta/32f52be3", + "/Users/doman/.local/share/nvim/mason/packages/lua-language-server/libexec/meta/1480a74c" + ] +} \ No newline at end of file diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..e69de29 diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..490898e --- /dev/null +++ b/.config/nvim/lua/config/keymaps.lua @@ -0,0 +1,121 @@ +vim.api.nvim_set_keymap("n", "j", "bprev", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "k", "bnext", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("x", "", '"_dP', { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "/", "gcc", { noremap = false, silent = true }) +vim.api.nvim_set_keymap( + "v", + "/", + "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", + { noremap = true, silent = true } +) + +-- Move to window using the hjkl keys +vim.keymap.set("n", "", "h", { desc = "Go to left window", remap = true }) +vim.keymap.set("n", "", "j", { desc = "Go to lower window", remap = true }) +vim.keymap.set("n", "", "k", { desc = "Go to upper window", remap = true }) +vim.keymap.set("n", "", "l", { desc = "Go to right window", remap = true }) + +-- Resize window using arrow keys +vim.keymap.set("n", "", "resize +2", { desc = "Increase window height" }) +vim.keymap.set("n", "", "resize -2", { desc = "Decrease window height" }) +vim.keymap.set("n", "", "vertical resize -2", { desc = "Decrease window width" }) +vim.keymap.set("n", "", "vertical resize +2", { desc = "Increase window width" }) + +vim.keymap.set("n", "bb", "e #", { desc = "Switch to Other Buffer" }) +vim.keymap.set("n", "`", "e #", { desc = "Switch to Other Buffer" }) + +-- Clear search with +vim.keymap.set({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) + +-- Clear search, diff update and redraw +-- taken from runtime/lua/_editor.lua +vim.keymap.set( + "n", + "ur", + "nohlsearchdiffupdatenormal! ", + { desc = "Redraw / clear hlsearch / diff update" } +) + +vim.keymap.set({ "n", "x" }, "gw", "*N", { desc = "Search word under cursor" }) + +-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n +vim.keymap.set("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +vim.keymap.set("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +vim.keymap.set("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +vim.keymap.set("n", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +vim.keymap.set("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +vim.keymap.set("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) + +-- Add undo break-points +vim.keymap.set("i", ",", ",u") +vim.keymap.set("i", ".", ".u") +vim.keymap.set("i", ";", ";u") + +-- save file +vim.keymap.set({ "i", "v", "n", "s" }, "", "w", { desc = "Save file" }) + +--keywordprg +vim.keymap.set("n", "K", "norm! K", { desc = "Keywordprg" }) + +-- better indenting +vim.keymap.set("v", "<", "", ">gv") + +-- lazy +vim.keymap.set("n", "l", "Lazy", { desc = "Lazy" }) + +-- new file +vim.keymap.set("n", "fn", "enew", { desc = "New File" }) + +vim.keymap.set("n", "xl", "lopen", { desc = "Location List" }) +vim.keymap.set("n", "xq", "copen", { desc = "Quickfix List" }) + +vim.keymap.set("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" }) + +-- highlights under cursor +if vim.fn.has("nvim-0.9.0") == 1 then + vim.keymap.set("n", "ui", vim.show_pos, { desc = "Inspect Pos" }) +end + +-- Terminal vim.keymap.setpings +vim.keymap.set("t", "", "", { desc = "Enter Normal Mode" }) +vim.keymap.set("t", "", "wincmd h", { desc = "Go to left window" }) +vim.keymap.set("t", "", "wincmd j", { desc = "Go to lower window" }) +vim.keymap.set("t", "", "wincmd k", { desc = "Go to upper window" }) +vim.keymap.set("t", "", "wincmd l", { desc = "Go to right window" }) +vim.keymap.set("t", "", "close", { desc = "Hide Terminal" }) +vim.keymap.set("t", "", "close", { desc = "which_key_ignore" }) + +-- windows +vim.keymap.set("n", "ww", "p", { desc = "Other window", remap = true }) +vim.keymap.set("n", "wd", "c", { desc = "Delete window", remap = true }) +vim.keymap.set("n", "w-", "s", { desc = "Split window below", remap = true }) +vim.keymap.set("n", "w|", "v", { desc = "Split window right", remap = true }) +vim.keymap.set("n", "-", "s", { desc = "Split window below", remap = true }) +vim.keymap.set("n", "|", "v", { desc = "Split window right", remap = true }) + +-- tabs +vim.keymap.set("n", "l", "tablast", { desc = "Last Tab" }) +vim.keymap.set("n", "f", "tabfirst", { desc = "First Tab" }) +vim.keymap.set("n", "", "tabnew", { desc = "New Tab" }) +vim.keymap.set("n", "]", "tabnext", { desc = "Next Tab" }) +vim.keymap.set("n", "d", "tabclose", { desc = "Close Tab" }) +vim.keymap.set("n", "[", "tabprevious", { desc = "Previous Tab" }) + +-- lsp +vim.keymap.set("n", "gd", "lua vim.lsp.buf.definition()", { desc = "Goto Definition" }) +vim.keymap.set("n", "gs", "vsplit | lua vim.lsp.buf.definition()", { desc = "Goto Definition in vertical split" }) +vim.keymap.set("n", "gS", "belowright | lua vim.lsp.buf.definition()", { desc = "Goto Definition in horizontal split" }) +vim.keymap.set("n", "gD", "lua vim.lsp.buf.declaration()", { desc = "Goto Declaration" }) +vim.keymap.set("n", "gi", "lua vim.lsp.buf.implementation()", { desc = "Goto Implementation" }) +vim.keymap.set("n", "gr", "lua vim.lsp.buf.references()", { desc = "Goto References" }) +vim.keymap.set("n", "K", "lua vim.lsp.buf.hover()", { desc = "Hover" }) + +vim.keymap.set("n", "ld", vim.diagnostic.open_float, { desc = "Line Diagnostics" }) +vim.keymap.set("n", "ll", "LspInfo", { desc = "Lsp Info" }) +vim.keymap.set("n", "lf", vim.lsp.buf.format, { desc = "Format document" }) +vim.keymap.set("n", "la", "lua vim.lsp.buf.code_action()", { desc = "Code actions" }) +vim.keymap.set("n", "lr", "lua vim.lsp.buf.rename()", { desc = "Rename" }) + +-- colorizer +vim.keymap.set("n", "cs", "ColorizerToggle", { desc = "Toggle show colors" }) diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..e42dfc4 --- /dev/null +++ b/.config/nvim/lua/config/lazy.lua @@ -0,0 +1,14 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + -- bootstrap lazy.nvim + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +require("lazy").setup({ + spec = { + { import = "plugins" }, + }, + checker = { enabled = true }, +}) diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua new file mode 100644 index 0000000..9ec954a --- /dev/null +++ b/.config/nvim/lua/config/options.lua @@ -0,0 +1,58 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" +vim.g.autoformat_enabled = true +vim.g.cmp_enabled = true +vim.g.icons_enabled = true + +local opt = vim.opt + +opt.autowrite = true -- Enable auto write +opt.clipboard = "unnamedplus" -- Sync with system clipboard +opt.completeopt = "menu,menuone,noselect" +opt.conceallevel = 3 -- Hide * markup for bold and italic +opt.confirm = true -- Confirm to save changes before exiting modified buffer +opt.cursorline = true -- Enable highlighting of the current line +opt.expandtab = true -- Use spaces instead of tabs +opt.formatoptions = "jcroqlnt" -- tcqj +opt.grepformat = "%f:%l:%c:%m" +opt.grepprg = "rg --vimgrep" +opt.ignorecase = true -- Ignore case +opt.inccommand = "nosplit" -- preview incremental substitute +opt.laststatus = 0 +opt.list = true -- Show some invisible characters (tabs... +opt.mouse = "a" -- Enable mouse mode +opt.number = true -- Print line number +opt.pumblend = 10 -- Popup blend +opt.pumheight = 10 -- Maximum number of entries in a popup +opt.relativenumber = true -- Relative line numbers +opt.scrolloff = 4 -- Lines of context +opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" } +opt.shiftround = true -- Round indent +opt.shiftwidth = 2 -- Size of an indent +opt.shortmess:append({ W = true, I = true, c = true }) +opt.showmode = false -- Dont show mode since we have a statusline +opt.sidescrolloff = 8 -- Columns of context +opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time +opt.smartcase = true -- Don't ignore case with capitals +opt.smartindent = true -- Insert indents automatically +opt.spell = true +opt.spelllang = { "en_us,pl" } +opt.splitbelow = true -- Put new windows below current +opt.splitright = true -- Put new windows right of current +opt.tabstop = 2 -- Number of spaces tabs count for +opt.termguicolors = true -- True color support +opt.timeoutlen = 300 +opt.undofile = true +opt.undolevels = 10000 +opt.updatetime = 200 -- Save swap file and trigger CursorHold +opt.wildmode = "longest:full,full" -- Command-line completion mode +opt.winminwidth = 5 -- Minimum window width +opt.wrap = false -- Disable line wrap + +if vim.fn.has("nvim-0.9.0") == 1 then + opt.splitkeep = "screen" + opt.shortmess:append({ C = true }) +end + +-- Fix markdown indentation settings +vim.g.markdown_recommended_style = 0 diff --git a/.config/nvim/lua/plugins/comment.lua b/.config/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..c710381 --- /dev/null +++ b/.config/nvim/lua/plugins/comment.lua @@ -0,0 +1,7 @@ +return { + { + "numToStr/Comment.nvim", + opts = {}, + lazy = false, + }, +} diff --git a/.config/nvim/lua/plugins/copilot.lua b/.config/nvim/lua/plugins/copilot.lua new file mode 100644 index 0000000..47f4d92 --- /dev/null +++ b/.config/nvim/lua/plugins/copilot.lua @@ -0,0 +1,52 @@ +return { + { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", + config = function() + require("copilot").setup({ + panel = { + enabled = true, + auto_refresh = false, + keymap = { + jump_prev = "[[", + jump_next = "]]", + accept = "", + refresh = "", + open = "", + }, + layout = { + position = "bottom", -- | top | left | right + ratio = 0.4, + }, + }, + suggestion = { + enabled = true, + auto_trigger = true, + debounce = 80, + keymap = { + accept = "", + accept_word = false, + accept_line = false, + next = "", + prev = "", + dismiss = "", + }, + }, + filetypes = { + yaml = false, + markdown = false, + help = false, + gitcommit = false, + gitrebase = false, + hgcommit = false, + svn = false, + cvs = false, + ["."] = false, + }, + copilot_node_command = "node", -- Node.js version must be > 16.x + server_opts_overrides = {}, + }) + end, + }, +} diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..e44b43e --- /dev/null +++ b/.config/nvim/lua/plugins/git.lua @@ -0,0 +1,37 @@ +return { + { + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + opts = { + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, + }, + on_attach = function(buffer) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, desc) + vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) + end + + -- stylua: ignore start + map("n", "]h", gs.next_hunk, "Next Hunk") + map("n", "[h", gs.prev_hunk, "Prev Hunk") + map({ "n", "v" }, "ghs", ":Gitsigns stage_hunk", "Stage Hunk") + map({ "n", "v" }, "ghr", ":Gitsigns reset_hunk", "Reset Hunk") + map("n", "ghS", gs.stage_buffer, "Stage Buffer") + map("n", "ghu", gs.undo_stage_hunk, "Undo Stage Hunk") + map("n", "ghR", gs.reset_buffer, "Reset Buffer") + map("n", "ghp", gs.preview_hunk, "Preview Hunk") + map("n", "ghb", function() gs.blame_line({ full = true }) end, "Blame Line") + map("n", "ghd", gs.diffthis, "Diff This") + map("n", "ghD", function() gs.diffthis("~") end, "Diff This ~") + map({ "o", "x" }, "ih", ":Gitsigns select_hunk", "GitSigns Select Hunk") + end, + }, + }, +} diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..9277b5e --- /dev/null +++ b/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,54 @@ +return { + { + "VonHeikemen/lsp-zero.nvim", + branch = "v2.x", + lazy = true, + config = function() + require("lsp-zero.settings").preset({}) + end, + }, + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + { "L3MON4D3/LuaSnip" }, + }, + config = function() + require("lsp-zero.cmp").extend() + local cmp = require("cmp") + local cmp_action = require("lsp-zero.cmp").action() + + cmp.setup({ + mapping = { + [""] = cmp.mapping.complete(), + [""] = cmp_action.luasnip_jump_forward(), + [""] = cmp_action.luasnip_jump_backward(), + [''] = cmp.mapping.confirm({ select = true }), + }, + }) + end, + }, + + -- LSP + { + "neovim/nvim-lspconfig", + cmd = "LspInfo", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + { "hrsh7th/cmp-nvim-lsp" }, + { "williamboman/mason-lspconfig.nvim" }, + { "williamboman/mason.nvim" }, + }, + config = function() + local lsp = require("lsp-zero") + + lsp.on_attach(function(client, bufnr) + lsp.default_keymaps({ buffer = bufnr }) + end) + + require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls()) + + lsp.setup() + 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..f93ea82 --- /dev/null +++ b/.config/nvim/lua/plugins/neo-tree.lua @@ -0,0 +1,317 @@ +return { + { + "nvim-neo-tree/neo-tree.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + { + 's1n7ax/nvim-window-picker', + name = 'window-picker', + event = 'VeryLazy', + version = '2.*', + config = function() + require 'window-picker'.setup() + end, + } + }, + lazy = false, + keys = { + { + "fe", + function() + require("neo-tree.command").execute({ toggle = true, dir = vim.loop.cwd() }) + end, + desc = "Explorer NeoTree (cwd)", + }, + { "e", "fe", desc = "Explorer NeoTree", remap = true }, + }, + deactivate = function() + vim.cmd([[Neotree close]]) + end, + init = function() + if vim.fn.argc() == 1 then + local stat = vim.loop.fs_stat(vim.fn.argv(0)) + if stat and stat.type == "directory" then + require("neo-tree") + end + end + end, + config = function() + -- 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" }) + + require("neo-tree").setup({ + close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab + popup_border_style = "rounded", + enable_git_status = true, + enable_diagnostics = true, + enable_normal_mode_for_inputs = false, -- Enable normal mode for input dialogs. + 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 = "󰜌", + -- 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 = 40, + 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", + ["o"] = "open", + [""] = "cancel", -- close preview or floating neo-tree window + ["P"] = { "toggle_preview", config = { use_float = true } }, + ["l"] = "focus_preview", + -- ["S"] = "open_split", + -- ["s"] = "open_vsplit", + ["S"] = "split_with_window_picker", + ["s"] = "vsplit_with_window_picker", + -- ["t"] = "open_tabnew", + -- ["t"] = "open_drop", + -- ["t"] = "open_tab_drop", + ["w"] = "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", + }, + 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", + ["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 }, + }, + 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", + }, + }, + + 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]]) + end, + }, +} diff --git a/.config/nvim/lua/plugins/outline.lua b/.config/nvim/lua/plugins/outline.lua new file mode 100644 index 0000000..8e8f12f --- /dev/null +++ b/.config/nvim/lua/plugins/outline.lua @@ -0,0 +1,8 @@ +return { + { + "simrat39/symbols-outline.nvim", + cmd = "SymbolsOutline", + keys = { { "ls", "SymbolsOutline", desc = "Symbols Outline" } }, + config = true, + }, +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..05ba732 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,39 @@ +return { + { + "nvim-telescope/telescope.nvim", + keys = { + { + "ff", + function() + require("telescope.builtin").find_files() + end, + desc = "Find Plugin File", + }, + { + "fw", + function() + require("telescope.builtin").live_grep() + end, + desc = "Find File", + }, + }, + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + { + "telescope.nvim", + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + config = function() + require("telescope").load_extension("fzf") + end, + }, + }, +} diff --git a/.config/nvim/lua/plugins/theme.lua b/.config/nvim/lua/plugins/theme.lua new file mode 100644 index 0000000..78fbbdb --- /dev/null +++ b/.config/nvim/lua/plugins/theme.lua @@ -0,0 +1,14 @@ +return { + { + "RRethy/nvim-base16", + name = "nvim-base16", + lazy = false, + priority = 1000, + config = function() + vim.cmd.colorscheme "base16-ocean" + end, + }, + { + "norcalli/nvim-colorizer.lua", + }, +} diff --git a/.config/nvim/lua/plugins/todo.lua b/.config/nvim/lua/plugins/todo.lua new file mode 100644 index 0000000..511b20d --- /dev/null +++ b/.config/nvim/lua/plugins/todo.lua @@ -0,0 +1,13 @@ +return { + { + "folke/todo-comments.nvim", + cmd = { "TodoTrouble", "TodoTelescope" }, + event = { "BufReadPost", "BufNewFile" }, + config = true, + -- stylua: ignore + keys = { + { "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" }, + { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..16ac55a --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,86 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + version = false, -- last release is way too old and doesn't work on Windows + build = ":TSUpdate", + event = { "BufReadPost", "BufNewFile" }, + dependencies = { + { + "nvim-treesitter/nvim-treesitter-textobjects", + init = function() + -- disable rtp plugin, as we only need its queries for mini.ai + -- In case other textobject modules are enabled, we will load them + -- once nvim-treesitter is loaded + require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects") + load_textobjects = true + end, + }, + }, + cmd = { "TSUpdateSync" }, + keys = { + { "", desc = "Increment selection" }, + { "", desc = "Decrement selection", mode = "x" }, + }, + opts = { + highlight = { enable = true }, + indent = { enable = true }, + ensure_installed = { + "bash", + "c", + "html", + "javascript", + "jsdoc", + "json", + "lua", + "luadoc", + "luap", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "vimdoc", + "yaml", + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + }, + config = function(_, opts) + if type(opts.ensure_installed) == "table" then + local added = {} + opts.ensure_installed = vim.tbl_filter(function(lang) + if added[lang] then + return false + end + added[lang] = true + return true + end, opts.ensure_installed) + end + require("nvim-treesitter.configs").setup(opts) + + if load_textobjects then + if opts.textobjects then + for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do + if opts.textobjects[mod] and opts.textobjects[mod].enable then + local Loader = require("lazy.core.loader") + Loader.disabled_rtp_plugins["nvim-treesitter-textobjects"] = nil + local plugin = require("lazy.core.config").plugins["nvim-treesitter-textobjects"] + require("lazy.core.loader").source_runtime(plugin.dir, "plugin") + break + end + end + end + end + end, + } +} diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..77dbdf6 --- /dev/null +++ b/.config/nvim/lua/plugins/trouble.lua @@ -0,0 +1,7 @@ +return { + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = {}, + }, +} diff --git a/.config/nvim/lua/plugins/ui.lua b/.config/nvim/lua/plugins/ui.lua new file mode 100644 index 0000000..52187bb --- /dev/null +++ b/.config/nvim/lua/plugins/ui.lua @@ -0,0 +1,324 @@ +return { + { + "rcarriga/nvim-notify", + keys = { + { + "un", + function() + require("notify").dismiss({ silent = true, pending = true }) + end, + desc = "Dismiss all Notifications", + }, + }, + opts = { + timeout = 3000, + max_height = function() + return math.floor(vim.o.lines * 0.75) + end, + max_width = function() + return math.floor(vim.o.columns * 0.75) + end, + }, + }, + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + options = { + theme = "auto", + globalstatus = true, + disabled_filetypes = { statusline = { "dashboard", "alpha" } }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch" }, + lualine_c = { + { + "diagnostics", + symbols = { + error = "", + warn = "", + info = "", + hint = "󰌵", + }, + }, + { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, + { "filename", path = 1, symbols = { modified = "  ", readonly = "", unnamed = "" } }, + { + function() return require("nvim-navic").get_location() end, + cond = function() return package.loaded["nvim-navic"] and require("nvim-navic").is_available() end, + }, + }, + lualine_x = { + { + function() return require("noice").api.status.command.get() end, + cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end, + }, + { + function() return require("noice").api.status.mode.get() end, + cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end, + }, + { + function() return " " .. require("dap").status() end, + cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end, + }, + { require("lazy.status").updates, cond = require("lazy.status").has_updates}, + { + "diff", + symbols = { + added = "", + modified = "󰄱", + removed = "✖", + }, + }, + }, + lualine_y = { + { "progress", separator = " ", padding = { left = 1, right = 0 } }, + { "location", padding = { left = 0, right = 1 } }, + }, + lualine_z = { + function() + return " " .. os.date("%R") + end, + }, + }, + extensions = { "neo-tree", "lazy" }, + } + end, + }, + { + "lukas-reineke/indent-blankline.nvim", + event = { "BufReadPost", "BufNewFile" }, + opts = { + -- char = "▏", + char = "│", + filetype_exclude = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + show_trailing_blankline_indent = false, + show_current_context = false, + }, + }, + { + "echasnovski/mini.indentscope", + version = false, -- wait till new 0.7.0 release to put it back on semver + event = { "BufReadPre", "BufNewFile" }, + opts = { + -- symbol = "▏", + symbol = "│", + options = { try_as_border = true }, + }, + init = function() + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + callback = function() + vim.b.miniindentscope_disable = true + end, + }) + end, + }, + { + "akinsho/bufferline.nvim", + event = "VeryLazy", + keys = { + { "bp", "BufferLineTogglePin", desc = "Toggle pin" }, + { "bP", "BufferLineGroupClose ungrouped", desc = "Delete non-pinned buffers" }, + }, + opts = { + options = { + -- stylua: ignore + close_command = function(n) require("mini.bufremove").delete(n, false) end, + -- stylua: ignore + right_mouse_command = function(n) require("mini.bufremove").delete(n, false) end, + diagnostics = "nvim_lsp", + always_show_bufferline = false, + diagnostics_indicator = function(_, _, diag) + local icons = require("lazyvim.config").icons.diagnostics + local ret = (diag.error and icons.Error .. diag.error .. " " or "") + .. (diag.warning and icons.Warn .. diag.warning or "") + return vim.trim(ret) + end, + offsets = { + { + filetype = "neo-tree", + text = "Neo-tree", + highlight = "Directory", + text_align = "left", + }, + }, + }, + }, + }, + { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + plugins = { spelling = true }, + defaults = { + mode = { "n", "v" }, + ["g"] = { name = "+goto" }, + ["gz"] = { name = "+surround" }, + ["]"] = { name = "+next" }, + ["["] = { name = "+prev" }, + [""] = { name = "+tabs" }, + ["b"] = { name = "+buffer" }, + ["c"] = { name = "+colors" }, + ["l"] = { name = "+lsp" }, + ["f"] = { name = "+file/find" }, + ["g"] = { name = "+goto" }, + ["u"] = { name = "+ui" }, + ["w"] = { name = "+windows" }, + ["x"] = { name = "+diagnostics/quickfix" }, + }, + }, + config = function(_, opts) + local wk = require("which-key") + wk.setup(opts) + wk.register(opts.defaults) + end, + }, + { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + lsp = { + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + hover = { enabled = false }, + signature = { enabled = false }, + }, + routes = { + { + filter = { + event = "msg_show", + any = { + { find = "%d+L, %d+B" }, + { find = "; after #%d+" }, + { find = "; before #%d+" }, + }, + }, + view = "mini", + }, + }, + presets = { + bottom_search = true, + command_palette = true, + long_message_to_split = true, + inc_rename = true, + }, + }, + -- stylua: ignore + keys = { + { + "", + function() require("noice").redirect(vim.fn.getcmdline()) end, + mode = "c", + desc = + "Redirect Cmdline" + }, + { + "snl", + function() require("noice").cmd("last") end, + desc = + "Noice Last Message" + }, + { + "snh", + function() require("noice").cmd("history") end, + desc = + "Noice History" + }, + { "sna", function() require("noice").cmd("all") end, desc = "Noice All" }, + { + "snd", + function() require("noice").cmd("dismiss") end, + desc = + "Dismiss All" + }, + { + "", + function() if not require("noice.lsp").scroll(4) then return "" end end, + silent = true, + expr = true, + desc = + "Scroll forward", + mode = { + "i", "n", "s" } + }, + { + "", + function() if not require("noice.lsp").scroll(-4) then return "" end end, + silent = true, + expr = true, + desc = + "Scroll backward", + mode = { + "i", "n", "s" } + }, + }, + }, + -- icons + { "nvim-tree/nvim-web-devicons", lazy = true }, + -- ui components + { "MunifTanjim/nui.nvim", lazy = true }, + { + "RRethy/vim-illuminate", + event = { "BufReadPost", "BufNewFile" }, + opts = { + delay = 200, + large_file_cutoff = 2000, + large_file_overrides = { + providers = { "lsp" }, + }, + }, + config = function(_, opts) + require("illuminate").configure(opts) + + local function map(key, dir, buffer) + vim.keymap.set("n", key, function() + require("illuminate")["goto_" .. dir .. "_reference"](false) + end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer }) + end + + map("]]", "next") + map("[[", "prev") + + -- also set it after loading ftplugins, since a lot overwrite [[ and ]] + vim.api.nvim_create_autocmd("FileType", { + callback = function() + local buffer = vim.api.nvim_get_current_buf() + map("]]", "next", buffer) + map("[[", "prev", buffer) + end, + }) + end, + keys = { + { "]]", desc = "Next Reference" }, + { "[[", desc = "Prev Reference" }, + }, + }, +} diff --git a/.config/nvim/spell/pl.utf-8.spl b/.config/nvim/spell/pl.utf-8.spl new file mode 100644 index 0000000..0ef7079 Binary files /dev/null and b/.config/nvim/spell/pl.utf-8.spl differ