diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 7af8b01..6d4346c 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,27 +1,34 @@ { "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, + "auto-session": { "branch": "main", "commit": "af2219b9fa99c1d7ac409bd9eac094c459d3f52d" }, + "bufferline.nvim": { "branch": "main", "commit": "99337f63f0a3c3ab9519f3d1da7618ca4f91cffe" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "friendly-snippets": { "branch": "main", "commit": "700c4a25caacbb4648c9a27972c2fe203948e0c2" }, - "lazy.nvim": { "branch": "main", "commit": "eb4957442e3182f051b0ae11da32e06d22c190e3" }, + "lazy.nvim": { "branch": "main", "commit": "38d6b74b63dc410ac5d7f4bb4c62dfeec74e366a" }, "lazygit.nvim": { "branch": "main", "commit": "ad3e1ea592f9d13e86e0d4e850224d9d78069508" }, "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, + "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "37a336b653f8594df75c827ed589f1c91d91ff6c" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "0950b15060067f752fde13a779a994f59516ce3d" }, "neodev.nvim": { "branch": "main", "commit": "02893eeb9d6e8503817bd52385e111cba9a90500" }, "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, - "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" }, - "nvim-lspconfig": { "branch": "master", "commit": "4d38bece98300e3e5cd24a9aa0d0ebfea4951c16" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "92a673de7ecaa157dd230d0128def10beb56d103" }, + "nvim-lspconfig": { "branch": "master", "commit": "bd7c76375a511994c9ca8d69441f134dc10ae3bd" }, + "nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" }, + "nvim-treesitter": { "branch": "master", "commit": "71a8e8b4b6ebab39765615334d4241a18090a651" }, + "nvim-ts-autotag": { "branch": "main", "commit": "06fe07d7523ba8c755fac7c913fceba43b1720ee" }, "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "tagbar": { "branch": "master", "commit": "0815b5455c792a610d28ff3e7981642c9cf05d62" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "todo-comments.nvim": { "branch": "main", "commit": "51e10f838e84b4756c16311d0b1ef0972c6482d2" }, - "trouble.nvim": { "branch": "main", "commit": "60b0ac3772e991bc194207afc28368a5f15d913a" }, + "tokyonight.nvim": { "branch": "main", "commit": "81c867c5f638597a82c82094dcb90ed42444dabc" }, + "trouble.nvim": { "branch": "main", "commit": "58a3acfc6d8d819324dab4c87068596319032e64" }, "vim-commentary": { "branch": "master", "commit": "c4b8f52cbb7142ec239494e5a2c4a512f92c4d07" }, "vim-fugitive": { "branch": "master", "commit": "64d6cafb9dcbacce18c26d7daf617ebb96b273f3" }, "vim-tmux-navigator": { "branch": "master", "commit": "5b3c701686fb4e6629c100ed32e827edf8dad01e" } diff --git a/.config/nvim/lua/klowner/core.lua b/.config/nvim/lua/klowner/core.lua index 4969847..9511e69 100644 --- a/.config/nvim/lua/klowner/core.lua +++ b/.config/nvim/lua/klowner/core.lua @@ -1,4 +1,3 @@ -vim.g.netrw_liststyle = 3 vim.g.mapleader = " " vim.g.maplocalleader = " " @@ -9,6 +8,33 @@ opt.number = true opt.autoread = true -- automatically reload modified files opt.wildmenu = true -- handle autocompletion menu +opt.wrap = false +opt.list = true +--opt.listchars = { +-- { tab = '>' }, +-- { trail = '▂' }, +-- { extends = '»' }, +-- { precedes = '«' }, +--} + +opt.modelines = 5 +opt.matchtime = 1 +opt.tabstop = 2 +opt.shiftwidth = 2 +opt.autoindent = true +opt.scrolloff = 7 +opt.spell = true -- enable spellcheck + +opt.ignorecase = true -- ignore case while searching +opt.smartcase = true -- ...unless mixed case is used in search terms + +opt.backspace = "indent,eol,start" -- allow backspace on indent, eol, or insert mode start position +opt.cursorline = true +opt.swapfile = false -- disable swap file + +-- use system clipboard as default register +opt.clipboard:append("unnamedplus") + -- utility functions for key mappings function ToggleLineNumbering() vim.o.number = not vim.o.number @@ -18,8 +44,6 @@ end -- keymappings local keymap = vim.keymap -keymap.set('n', 'n', ':lua ToggleLineNumbering()', {desc="Toggle line numbering"}) - keymap.set('', '', ':bnext', {desc="Jump to next buffer"}) keymap.set('', '', ':bprev', {desc="Jump to previous buffer"}) @@ -28,11 +52,24 @@ keymap.set('', '', 'j', {desc="Focus window down"}) keymap.set('', '', 'k', {desc="Focus window up"}) keymap.set('', '', 'l', {desc="Focus window right"}) +keymap.set('v', '', ':sort', {desc="Sort selected lines alphanumerically"}) +keymap.set('n', '', 'mzgg=G`z', {desc="Auto-format entire document"}) + keymap.set('n', 'pu', ':Lazy update', {desc="Update plugins managed by Lazy"}) keymap.set('n', 'pi', ':Lazy install', {desc="Install missing plugins managed by Lazy"}) keymap.set('n', 'pc', ':Lazy clean', {desc="Clean plugins managed by Lazy"}) +keymap.set('n', 'zn', ']s', {desc="Jump to next misspelling"}) +keymap.set('n', 'zp', '[s', {desc="Jump to previous misspelling"}) +keymap.set('n', 'zf', '1z=', {desc="Replace misspelling with firest suggested from dictionary"}) + +keymap.set('n', 'n', ':lua ToggleLineNumbering()', {desc="Toggle line numbering"}) keymap.set('n', 'w', ':w!', {desc="Quicksave"}) -keymap.set('n', '', 'mzgg=G`z', {desc="Auto-format entire document"}) -keymap.set('v', '', ':sort', {desc="Sort selected lines alphanumerically"}) +-- prefer ripgrep if available +if vim.fn.executable('rg') == 1 then + vim.o.grepprg = 'rg --vimgrep' +end + +-- :W to save with sudo +-- vim.api.nvim_create_user_command('') diff --git a/.config/nvim/lua/klowner/plugins/auto-session.lua b/.config/nvim/lua/klowner/plugins/auto-session.lua new file mode 100644 index 0000000..2ba1033 --- /dev/null +++ b/.config/nvim/lua/klowner/plugins/auto-session.lua @@ -0,0 +1,11 @@ +return { + "rmagatti/auto-session", + config = function () + require('auto-session').setup({ + auto_restore_enabled = false, + }) + local keymap = vim.keymap + keymap.set('n', 'wr', 'SessionRestore', { desc = "Restore session for cwd" }) + keymap.set('n', 'ws', 'SessionSave', { desc = "Save session for cwd" }) + end +} diff --git a/.config/nvim/lua/klowner/plugins/bufferline.lua b/.config/nvim/lua/klowner/plugins/bufferline.lua new file mode 100644 index 0000000..d1541a9 --- /dev/null +++ b/.config/nvim/lua/klowner/plugins/bufferline.lua @@ -0,0 +1,11 @@ +return { + "akinsho/bufferline.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + version = "*", + opts = { + options = { + mode = "tabs", + separator_style = "slant", + }, + }, +} diff --git a/.config/nvim/lua/klowner/plugins/lualine.lua b/.config/nvim/lua/klowner/plugins/lualine.lua new file mode 100644 index 0000000..c6ea8ad --- /dev/null +++ b/.config/nvim/lua/klowner/plugins/lualine.lua @@ -0,0 +1,4 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, +} diff --git a/.config/nvim/lua/klowner/plugins/nvim-cmp.lua b/.config/nvim/lua/klowner/plugins/nvim-cmp.lua index 0947011..acde6c5 100644 --- a/.config/nvim/lua/klowner/plugins/nvim-cmp.lua +++ b/.config/nvim/lua/klowner/plugins/nvim-cmp.lua @@ -37,11 +37,17 @@ return { mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.select_prev_item(), -- previous suggestion [""] = cmp.mapping.select_next_item(), -- next suggestion - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), -- show completion suggestions [""] = cmp.mapping.abort(), -- close completion window - [""] = cmp.mapping.confirm({ select = false }), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + return cmp.complete_common_string() + end + fallback() + end, {'i','c'}), }), -- sources for autocompletion sources = cmp.config.sources({ diff --git a/.config/nvim/lua/klowner/plugins/style.lua b/.config/nvim/lua/klowner/plugins/style.lua new file mode 100644 index 0000000..f9cab4a --- /dev/null +++ b/.config/nvim/lua/klowner/plugins/style.lua @@ -0,0 +1,12 @@ +return { + 'folke/tokyonight.nvim', + priority = 1000, + config = function () + require('tokyonight').setup({ + style = 'night', + on_colors = function () end, + on_highlights = function () end, + }) + vim.cmd('colorscheme tokyonight') + end, +} diff --git a/.config/nvim/lua/klowner/plugins/telescope.lua b/.config/nvim/lua/klowner/plugins/telescope.lua index abbd32f..4fcb92e 100644 --- a/.config/nvim/lua/klowner/plugins/telescope.lua +++ b/.config/nvim/lua/klowner/plugins/telescope.lua @@ -30,6 +30,7 @@ return { [""] = actions.move_selection_next, -- move to next result [""] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist, [""] = require("trouble.sources.telescope").open, + [''] = actions.close, -- close immediately when escape is pressed }, }, }, @@ -40,6 +41,9 @@ return { -- set keymaps local keymap = vim.keymap -- for conciseness + -- TODO: something + keymap.set("n", ";", "Telescope find_files", { desc = "Fuzzy find files in cwd" }) + keymap.set("n", "/", "Telescope live_grep", { desc = "Find string in cwd" }) keymap.set("n", "ff", "Telescope find_files", { desc = "Fuzzy find files in cwd" }) keymap.set("n", "fr", "Telescope oldfiles", { desc = "Fuzzy find recent files" }) keymap.set("n", "fs", "Telescope live_grep", { desc = "Find string in cwd" }) diff --git a/.config/nvim/lua/klowner/plugins/todo-comments.lua b/.config/nvim/lua/klowner/plugins/todo-comments.lua new file mode 100644 index 0000000..f74baa9 --- /dev/null +++ b/.config/nvim/lua/klowner/plugins/todo-comments.lua @@ -0,0 +1,21 @@ +return { + "folke/todo-comments.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local todo_comments = require("todo-comments") + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + keymap.set("n", "]t", function() + todo_comments.jump_next() + end, { desc = "Next todo comment" }) + + keymap.set("n", "[t", function() + todo_comments.jump_prev() + end, { desc = "Previous todo comment" }) + + todo_comments.setup() + end, +} diff --git a/.config/nvim/lua/klowner/plugins/treesitter.lua b/.config/nvim/lua/klowner/plugins/treesitter.lua new file mode 100644 index 0000000..af5943b --- /dev/null +++ b/.config/nvim/lua/klowner/plugins/treesitter.lua @@ -0,0 +1,57 @@ +return { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + build = ":TSUpdate", + dependencies = { + "windwp/nvim-ts-autotag", + }, + config = function() + -- import nvim-treesitter plugin + local treesitter = require("nvim-treesitter.configs") + + -- configure treesitter + treesitter.setup({ -- enable syntax highlighting + highlight = { + enable = true, + }, + -- enable indentation + indent = { enable = true }, + -- enable autotagging (w/ nvim-ts-autotag plugin) + autotag = { + enable = true, + }, + -- ensure these language parsers are installed + ensure_installed = { + "json", + "javascript", + "typescript", + "tsx", + "yaml", + "html", + "css", + "prisma", + "markdown", + "markdown_inline", + "svelte", + "graphql", + "bash", + "lua", + "vim", + "dockerfile", + "gitignore", + "query", + "vimdoc", + "c", + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + }) + end, +} diff --git a/.config/nvim/lua/klowner/plugins/vim-tree.lua b/.config/nvim/lua/klowner/plugins/vim-tree.lua new file mode 100644 index 0000000..6d99f57 --- /dev/null +++ b/.config/nvim/lua/klowner/plugins/vim-tree.lua @@ -0,0 +1,35 @@ +return { + "nvim-tree/nvim-tree.lua", + dependencies = "nvim-tree/nvim-web-devicons", + config = function () + local nvimtree = require('nvim-tree') + + -- recommended settings from the nvim-tree documentation + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + nvimtree.setup({ + view = { + width = 35, + relativenumber = true, + }, + renderer = { + indent_markers = { + enable = true, + }, + }, + actions = { + open_file = { + window_picker = { + enable = false, + }, + }, + }, + git = { + ignore = false + }, + }) + + vim.keymap.set('n', '\\e', 'NvimTreeToggle', {desc = "Toggle file explorer" }) + end +} diff --git a/.config/zsh/config.d/00-zim b/.config/zsh/config.d/00-zim index 46bf7a8..c4aca7e 100644 --- a/.config/zsh/config.d/00-zim +++ b/.config/zsh/config.d/00-zim @@ -1,4 +1,4 @@ -#:vim set ft=zsh: +# vim:set ft=zsh: zstyle ':zim:zmodule' use 'degit' ZIM_HOME=${XDG_CACHE_DIR}/zim diff --git a/.config/zsh/config.d/alias-ls-to-eza b/.config/zsh/config.d/alias-ls-to-eza new file mode 100644 index 0000000..f793482 --- /dev/null +++ b/.config/zsh/config.d/alias-ls-to-eza @@ -0,0 +1,10 @@ +# vim: set ft=zsh: +if [[ -z $commands[eza] ]]; then + return 0; +fi + +alias ls='eza' # ls +alias l='eza -lbF --git' # List, size, type git +alias ll='eza -lbGF --git' # Long list +alias llm='eza -lbGF --git --sort=modified' # Long list +