From 150e21702e4a3257d06f603d3244c67c2a253090 Mon Sep 17 00:00:00 2001 From: agryphus Date: Mon, 25 Sep 2023 17:06:11 -0400 Subject: [PATCH 01/10] Org mode / quality of life stuff --- after/ftplugin/norg.lua | 4 ++ after/plugin/colors.lua | 105 +++++++++++++++++++++++++++++++++++++ after/plugin/dashboard.lua | 0 after/plugin/firenvim.lua | 7 ++- after/plugin/lf.lua | 8 +++ after/plugin/neorg.lua | 20 +++++++ after/plugin/nvimtree.lua | 2 +- after/plugin/telescope.lua | 2 + after/plugin/undotree.lua | 2 + after/plugin/zenmode.lua | 62 ++++++++++++++++++++++ lua/andrew/packer.lua | 27 ++++++++++ lua/andrew/set.lua | 2 +- 12 files changed, 238 insertions(+), 3 deletions(-) create mode 100644 after/ftplugin/norg.lua create mode 100644 after/plugin/dashboard.lua create mode 100644 after/plugin/lf.lua create mode 100644 after/plugin/neorg.lua create mode 100644 after/plugin/undotree.lua create mode 100644 after/plugin/zenmode.lua diff --git a/after/ftplugin/norg.lua b/after/ftplugin/norg.lua new file mode 100644 index 0000000..806b55a --- /dev/null +++ b/after/ftplugin/norg.lua @@ -0,0 +1,4 @@ +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 + diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua index 54c3930..8f9f871 100644 --- a/after/plugin/colors.lua +++ b/after/plugin/colors.lua @@ -38,6 +38,111 @@ require("no-clown-fiesta").setup({ transparent = true, }) +require('rose-pine').setup({ + --- @usage 'auto'|'main'|'moon'|'dawn' + variant = 'auto', + --- @usage 'main'|'moon'|'dawn' + dark_variant = 'main', + bold_vert_split = false, + dim_nc_background = false, + disable_background = true, + disable_float_background = false, + disable_italics = true, + + --- @usage string hex value or named color from rosepinetheme.com/palette + groups = { + background = 'base', + background_nc = '_experimental_nc', + panel = 'surface', + panel_nc = 'base', + border = 'highlight_med', + comment = 'muted', + link = 'iris', + punctuation = 'subtle', + + error = 'love', + hint = 'iris', + info = 'foam', + warn = 'gold', + + headings = { + h1 = 'iris', + h2 = 'foam', + h3 = 'rose', + h4 = 'gold', + h5 = 'pine', + h6 = 'foam', + } + -- or set all headings at once + -- headings = 'subtle' + }, + + -- Change specific vim highlight groups + -- https://github.com/rose-pine/neovim/wiki/Recipes + highlight_groups = { + ColorColumn = { bg = 'rose' }, + + -- Blend colours against the "base" background + CursorLine = { bg = 'foam', blend = 10 }, + StatusLine = { fg = 'love', bg = 'love', blend = 10 }, + + -- By default each group adds to the existing config. + -- If you only want to set what is written in this config exactly, + -- you can set the inherit option: + Search = { bg = 'gold', inherit = false }, + } +}) + +require("gruvbox").setup({ + undercurl = true, + underline = true, + bold = true, + italic = { + strings = true, + comments = true, + operators = false, + folds = true, + }, + strikethrough = true, + invert_selection = false, + invert_signs = false, + invert_tabline = false, + invert_intend_guides = false, + inverse = true, -- invert background for search, diffs, statuslines and errors + contrast = "", -- can be "hard", "soft" or empty string + palette_overrides = {}, + overrides = {}, + dim_inactive = false, + transparent_mode = true, +}) + +local c = require('vscode.colors').get_colors() +require('vscode').setup({ + -- Alternatively set style in setup + -- style = 'light' + + -- Enable transparent background + transparent = true, + + -- Enable italic comment + italic_comments = true, + + -- Disable nvim-tree background color + disable_nvimtree_bg = true, + + -- Override colors (see ./lua/vscode/colors.lua) + color_overrides = { + -- vscLineNumber = '#FFFFFF', + }, + + -- Override highlight groups (see ./lua/vscode/theme.lua) + group_overrides = { + -- this supports the same val table as vim.api.nvim_set_hl + -- use colors from this colorscheme by requiring vscode.colors! + Cursor = { fg=c.vscDarkBlue, bg=c.vscLightGreen, bold=true }, + } +}) + vim.cmd[[ let s:base03 = [ '#151513', 233 ] let s:base02 = [ '#202020', 236 ] diff --git a/after/plugin/dashboard.lua b/after/plugin/dashboard.lua new file mode 100644 index 0000000..e69de29 diff --git a/after/plugin/firenvim.lua b/after/plugin/firenvim.lua index d937c09..fb14f4b 100644 --- a/after/plugin/firenvim.lua +++ b/after/plugin/firenvim.lua @@ -7,7 +7,7 @@ vim.g.firenvim_config = { priority = 0, selector = "textarea", takeover = "never" - } + }, } } @@ -16,3 +16,8 @@ if vim.g.started_by_firenvim == true then vim.opt.scrolloff = 0 end +vim.api.nvim_create_autocmd({'BufEnter'}, { + pattern = "localhost_*.txt", + command = "set filetype=python" +}) + diff --git a/after/plugin/lf.lua b/after/plugin/lf.lua new file mode 100644 index 0000000..cef1309 --- /dev/null +++ b/after/plugin/lf.lua @@ -0,0 +1,8 @@ +vim.keymap.set("n", "e", function () + vim.g.lf_command_override = string.format('LF_OVERRIDE_X=%d LF_OVERRIDE_Y=%d lf', + math.floor(vim.go.columns * 0.5), + math.ceil(vim.go.lines * 0.25) + ) + vim.cmd("Lf") +end) + diff --git a/after/plugin/neorg.lua b/after/plugin/neorg.lua new file mode 100644 index 0000000..2d92488 --- /dev/null +++ b/after/plugin/neorg.lua @@ -0,0 +1,20 @@ +require('neorg').setup { + load = { + ["core.defaults"] = {}, + ["core.concealer"] = {}, + ["core.dirman"] = { + config = { + workspaces = { + notes = "~/dox/norg/notes", + school = "~/school/", + }, + }, + }, + }, +} + +vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { + pattern = {"*.norg"}, + command = "set conceallevel=3" +}) + diff --git a/after/plugin/nvimtree.lua b/after/plugin/nvimtree.lua index c015d85..4643fac 100644 --- a/after/plugin/nvimtree.lua +++ b/after/plugin/nvimtree.lua @@ -3,7 +3,7 @@ vim.opt.termguicolors = true require("nvim-tree").setup() -vim.keymap.set("n", "pt", ":NvimTreeToggle") +vim.keymap.set("n", "pt", vim.cmd.NvimTreeToggle) -- sets transparent background vim.cmd[[hi NvimTreeNormal guibg=NONE ctermbg=NONE]] diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index 2616dc6..a28bf87 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -1,8 +1,10 @@ local builtin = require("telescope.builtin") + vim.keymap.set("n", "pf", builtin.find_files, {}) vim.keymap.set("n", "ps", function() builtin.grep_string({ search = vim.fn.input("Grep > ") }) end) +vim.keymap.set("n", "ht", builtin.colorscheme, {}) require("telescope").setup{ defaults = { diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua new file mode 100644 index 0000000..48822a4 --- /dev/null +++ b/after/plugin/undotree.lua @@ -0,0 +1,2 @@ +vim.keymap.set("n", "ut", vim.cmd.UndotreeToggle) + diff --git a/after/plugin/zenmode.lua b/after/plugin/zenmode.lua new file mode 100644 index 0000000..5459116 --- /dev/null +++ b/after/plugin/zenmode.lua @@ -0,0 +1,62 @@ +require('zen-mode').setup { + window = { + backdrop = 0.95, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal + -- height and width can be: + -- * an absolute number of cells when > 1 + -- * a percentage of the width / height of the editor when <= 1 + -- * a function that returns the width or the height + width = 120, -- width of the Zen window + height = 1, -- height of the Zen window + -- by default, no options are changed for the Zen window + -- uncomment any of the options below, or add other vim.wo options you want to apply + options = { + signcolumn = "no", -- disable signcolumn + number = false, -- disable number column + relativenumber = false, -- disable relative numbers + cursorline = false, -- disable cursorline + cursorcolumn = false, -- disable cursor column + foldcolumn = "0", -- disable fold column + -- list = false, -- disable whitespace characters + }, + }, + plugins = { + -- disable some global vim options (vim.o...) + -- comment the lines to not apply the options + options = { + enabled = true, + ruler = false, -- disables the ruler text in the cmd line area + showcmd = false, -- disables the command in the last line of the screen + }, + twilight = { enabled = true }, -- enable to start Twilight when zen mode opens + gitsigns = { enabled = false }, -- disables git signs + tmux = { enabled = false }, -- disables the tmux statusline + -- this will change the font size on kitty when in zen mode + -- to make this work, you need to set the following kitty options: + -- - allow_remote_control socket-only + -- - listen_on unix:/tmp/kitty + kitty = { + enabled = false, + font = "+4", -- font size increment + }, + -- this will change the font size on alacritty when in zen mode + -- requires Alacritty Version 0.10.0 or higher + -- uses `alacritty msg` subcommand to change font size + alacritty = { + enabled = false, + font = "14", -- font size + }, + -- this will change the font size on wezterm when in zen mode + -- See alse also the Plugins/Wezterm section in this projects README + wezterm = { + enabled = false, + -- can be either an absolute font size or the number of incremental steps + font = "+4", -- (10% increase per step) + }, + }, + -- callback where you can add custom code when the Zen window opens + on_open = function(win) + end, + -- callback where you can add custom code when the Zen window closes + on_close = function() + end, +} diff --git a/lua/andrew/packer.lua b/lua/andrew/packer.lua index 57ec3f1..e30cfca 100644 --- a/lua/andrew/packer.lua +++ b/lua/andrew/packer.lua @@ -9,6 +9,27 @@ return require("packer").startup(function(use) run = ":Neorg sync-parsers", } + -- Dashboard + use { + 'glepnir/dashboard-nvim', + event = 'VimEnter', + requires = {'nvim-tree/nvim-web-devicons'}, + config = function() + require('dashboard').setup { + -- config + } + end, + } + + -- File manager in nvim + use { + "ptzz/lf.vim", + requires = { {"voldikss/vim-floaterm"} }, + } + + -- Zen mode + use "folke/zen-mode.nvim" + -- Find files and strings use { "nvim-telescope/telescope.nvim", tag = "0.1.0", @@ -20,6 +41,9 @@ return require("packer").startup(function(use) -- Themes use "aktersnurra/no-clown-fiesta.nvim" + use "ellisonleao/gruvbox.nvim" + use { 'rose-pine/neovim', as = 'rose-pine' } + use 'Mofiqul/vscode.nvim' -- Referencing a hex code highlights it in that color use "lilydjwg/colorizer" @@ -27,6 +51,9 @@ return require("packer").startup(function(use) -- Relative line numbers disappear when not actively in buffer use "jeffkreeftmeijer/vim-numbertoggle" + -- History visualizer + use "mbbill/undotree" + -- See function signatures when typing them use "ray-x/lsp_signature.nvim" require "lsp_signature".setup({}) diff --git a/lua/andrew/set.lua b/lua/andrew/set.lua index 75ca996..300ab88 100644 --- a/lua/andrew/set.lua +++ b/lua/andrew/set.lua @@ -1,4 +1,4 @@ -vim.opt.guicursor = "" +-- vim.opt.guicursor = "" vim.opt.nu = true vim.opt.relativenumber = true From 6aa535a54b27336baa016d45e8e5ab1c23e200e2 Mon Sep 17 00:00:00 2001 From: agryphus Date: Mon, 25 Sep 2023 19:54:34 -0400 Subject: [PATCH 02/10] Case insensitive search keybind --- lua/andrew/remap.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/andrew/remap.lua b/lua/andrew/remap.lua index fc482d8..3f386b9 100644 --- a/lua/andrew/remap.lua +++ b/lua/andrew/remap.lua @@ -35,3 +35,7 @@ vim.keymap.set("n", "y", "\"+y") vim.keymap.set("n", "d", "\"_d") vim.keymap.set("v", "d", "\"_d") +-- case insensitive search +vim.keymap.set("n", "/", "/\\c") +vim.keymap.set("n", "?", "?\\c") + From 91f7e6f47f94d7cdc0a63a1518aa25c61f8cd4e9 Mon Sep 17 00:00:00 2001 From: agryphus Date: Fri, 13 Oct 2023 03:16:06 -0400 Subject: [PATCH 03/10] removed absolute shell path --- lua/andrew/set.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/andrew/set.lua b/lua/andrew/set.lua index 300ab88..63fc9c0 100644 --- a/lua/andrew/set.lua +++ b/lua/andrew/set.lua @@ -15,7 +15,7 @@ vim.opt.wrap = true vim.opt.scrolloff = 8 vim.opt.signcolumn = "auto" -vim.o.shell = "/usr/bin/zsh" +vim.o.shell = "zsh" -- Local settings for when in :terminal mode -- I don't believe this functionality has been ported to lua. From 5519206fdde7ce3ff7e35eb9f0621a41efb9d7e6 Mon Sep 17 00:00:00 2001 From: agryphus Date: Fri, 13 Oct 2023 03:18:10 -0400 Subject: [PATCH 04/10] Source packer automatically if not installed --- lua/andrew/packer.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lua/andrew/packer.lua b/lua/andrew/packer.lua index e30cfca..81ead8c 100644 --- a/lua/andrew/packer.lua +++ b/lua/andrew/packer.lua @@ -1,4 +1,15 @@ -vim.cmd.packadd("packer.nvim") +local ensure_packer = function() + local fn = vim.fn + local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' + if fn.empty(fn.glob(install_path)) > 0 then + fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + vim.cmd [[packadd packer.nvim]] + return true + end + return false +end + +local packer_bootstrap = ensure_packer() return require("packer").startup(function(use) use "wbthomason/packer.nvim" @@ -117,5 +128,9 @@ return require("packer").startup(function(use) "glacambre/firenvim", run = function() vim.fn["firenvim#install"](0) end } + + if packer_bootstrap then + require('packer').sync() + end end) From d9ac8b2bd1611382fa31188ed8b9cb0bee3b03f5 Mon Sep 17 00:00:00 2001 From: agryphus Date: Tue, 5 Dec 2023 23:56:09 -0500 Subject: [PATCH 05/10] LSP Rewrite --- after/plugin/lf.lua | 4 -- after/plugin/lsp.lua | 101 +++++++++++++++++++---------------------- after/plugin/neorg.lua | 20 -------- lua/andrew/packer.lua | 50 +++++++++----------- lua/andrew/set.lua | 3 ++ 5 files changed, 70 insertions(+), 108 deletions(-) delete mode 100644 after/plugin/neorg.lua diff --git a/after/plugin/lf.lua b/after/plugin/lf.lua index cef1309..7ff58e9 100644 --- a/after/plugin/lf.lua +++ b/after/plugin/lf.lua @@ -1,8 +1,4 @@ vim.keymap.set("n", "e", function () - vim.g.lf_command_override = string.format('LF_OVERRIDE_X=%d LF_OVERRIDE_Y=%d lf', - math.floor(vim.go.columns * 0.5), - math.ceil(vim.go.lines * 0.25) - ) vim.cmd("Lf") end) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 9ec1ef8..7419405 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -1,64 +1,55 @@ -local lsp = require('lsp-zero') -lsp.preset('recommended') +-- LANGUAGE SERVERS +local lsp_zero = require('lsp-zero') +local lspconfig = require("lspconfig") +local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities() -lsp.ensure_installed({ - "lua_ls", -- Lua - "rust_analyzer", -- Rust - "pyright", -- Python - "texlab", -- Latex - "clangd", -- C - "jdtls", -- Java - "html", -- Html - "bashls", -- Bash -}) +lsp_zero.on_attach(function(client, bufnr) + -- see :help lsp-zero-keybindings + -- to learn the available actions + lsp_zero.default_keymaps({buffer = bufnr}) +end) -local ensure_installed_extras = { -} - -local cmp = require("cmp") -local cmp_select = {behavior = cmp.SelectBehavior.Select} -local cmp_mappings = lsp.defaults.cmp_mappings({ - [""] = cmp.mapping.select_prev_item(cmp_select), - [""] = cmp.mapping.select_next_item(cmp_select), - [""] = cmp.mapping.confirm({ select = true }), -}) - -lsp.set_preferences({ - sign_icons = { } -}) - -lsp.setup_nvim_cmp({ - mapping = cmp_mappings -}) - -lsp.configure('lua_ls', { - settings = { - Lua = { - diagnostics = { - -- Making sure that lua recognizes the global variable 'vim' - globals = { 'vim' }, - }, - }, +lspconfig.lua_ls.setup({ + settings = { + Lua = { + diagnostics = { + -- Making sure that lua recognizes the global variable 'vim' + globals = { 'vim' }, + }, }, + }, }) -lsp.configure('pyright', { - settings = { - python = { - analysis = { - typeCheckingMode = "off", - }, - }, - }, +lspconfig.clangd.setup({ + capabilities = lsp_capabilities, }) -lsp.setup() +-- AUTOCOMPLETION --- Install extra packages (linters, formatters, et c) -local registry = require("mason-registry") -for _, extra in ipairs(ensure_installed_extras) do - if not registry.is_installed(extra) then - vim.cmd(string.format("MasonInstall %s", extra)) - end -end +local cmp = require('cmp') +local cmp_action = require('lsp-zero').cmp_action() + +cmp.setup({ + sources = { + { name = "luasnip", option = { show_autosnippets = true } }, + { name = "nvim_lua" }, + { name = "nvim_lsp" }, + { name = "path" }, -- Auto complete paths + }, + mapping = { + -- Navigate between completion item + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.select_next_item(), + + -- toggle completion + [''] = cmp_action.toggle_completion(), + + -- navigate between snippet placeholder + [''] = cmp_action.luasnip_jump_backward(), + [''] = cmp_action.luasnip_jump_forward(), + + -- Confirm item + [''] = cmp.mapping.confirm({select = true}), + } +}) diff --git a/after/plugin/neorg.lua b/after/plugin/neorg.lua deleted file mode 100644 index 2d92488..0000000 --- a/after/plugin/neorg.lua +++ /dev/null @@ -1,20 +0,0 @@ -require('neorg').setup { - load = { - ["core.defaults"] = {}, - ["core.concealer"] = {}, - ["core.dirman"] = { - config = { - workspaces = { - notes = "~/dox/norg/notes", - school = "~/school/", - }, - }, - }, - }, -} - -vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { - pattern = {"*.norg"}, - command = "set conceallevel=3" -}) - diff --git a/lua/andrew/packer.lua b/lua/andrew/packer.lua index 81ead8c..be78e50 100644 --- a/lua/andrew/packer.lua +++ b/lua/andrew/packer.lua @@ -14,23 +14,17 @@ local packer_bootstrap = ensure_packer() return require("packer").startup(function(use) use "wbthomason/packer.nvim" - -- Org mode - use { - "nvim-neorg/neorg", - run = ":Neorg sync-parsers", - } - - -- Dashboard - use { - 'glepnir/dashboard-nvim', - event = 'VimEnter', - requires = {'nvim-tree/nvim-web-devicons'}, - config = function() - require('dashboard').setup { - -- config - } - end, - } + -- -- Dashboard + -- use { + -- 'glepnir/dashboard-nvim', + -- event = 'VimEnter', + -- requires = {'nvim-tree/nvim-web-devicons'}, + -- config = function() + -- require('dashboard').setup { + -- -- config + -- } + -- end, + -- } -- File manager in nvim use { @@ -43,7 +37,7 @@ return require("packer").startup(function(use) -- Find files and strings use { - "nvim-telescope/telescope.nvim", tag = "0.1.0", + "nvim-telescope/telescope.nvim", tag = "0.1.4", requires = { {"nvim-lua/plenary.nvim"} } } @@ -57,7 +51,7 @@ return require("packer").startup(function(use) use 'Mofiqul/vscode.nvim' -- Referencing a hex code highlights it in that color - use "lilydjwg/colorizer" + use "norcalli/nvim-colorizer.lua" -- Relative line numbers disappear when not actively in buffer use "jeffkreeftmeijer/vim-numbertoggle" @@ -84,20 +78,18 @@ return require("packer").startup(function(use) -- LSP use { 'VonHeikemen/lsp-zero.nvim', - branch = 'v1.x', + branch = 'v3.x', requires = { -- LSP Support - {'neovim/nvim-lspconfig'}, -- Required - {'williamboman/mason.nvim'}, -- Optional - {'williamboman/mason-lspconfig.nvim'}, -- Optional + {'neovim/nvim-lspconfig'}, -- Required -- Autocompletion - {'hrsh7th/nvim-cmp'}, -- Required - {'hrsh7th/cmp-nvim-lsp'}, -- Required - {'hrsh7th/cmp-buffer'}, -- Optional - {'hrsh7th/cmp-path'}, -- Optional - {'saadparwaiz1/cmp_luasnip'}, -- Optional - {'hrsh7th/cmp-nvim-lua'}, -- Optional + {'hrsh7th/nvim-cmp'}, -- Required + {'hrsh7th/cmp-nvim-lsp'}, -- Required + {'hrsh7th/cmp-buffer'}, -- Optional + {'hrsh7th/cmp-path'}, -- Optional + {'saadparwaiz1/cmp_luasnip'}, -- Optional + {'hrsh7th/cmp-nvim-lua'}, -- Optional -- Snippets {'L3MON4D3/LuaSnip'}, -- Required diff --git a/lua/andrew/set.lua b/lua/andrew/set.lua index 63fc9c0..f8c3f48 100644 --- a/lua/andrew/set.lua +++ b/lua/andrew/set.lua @@ -17,6 +17,9 @@ vim.opt.signcolumn = "auto" vim.o.shell = "zsh" +-- Do not map q to :q in man mode +vim.g.no_man_maps = true; + -- Local settings for when in :terminal mode -- I don't believe this functionality has been ported to lua. vim.cmd([[ From 92bd99d8ea9e924868905154c58ed1839c8b6c27 Mon Sep 17 00:00:00 2001 From: agryphus Date: Tue, 20 Feb 2024 21:15:43 -0500 Subject: [PATCH 06/10] Whichkey rework, dashboard, yazi --- after/plugin/colors.lua | 20 ++++++----- after/plugin/dashboard.lua | 58 ++++++++++++++++++++++++++++++++ after/plugin/fugative.lua | 4 ++- after/plugin/lf.lua | 6 ++-- after/plugin/lsp.lua | 16 ++++++++- after/plugin/markdownpreview.lua | 5 +-- after/plugin/telescope.lua | 27 +++++++++++---- after/plugin/whichkey.lua | 16 +++++++++ after/plugin/yazi.lua | 4 +++ init.lua | 0 lua/andrew/packer.lua | 39 ++++++++++++--------- lua/andrew/remap.lua | 21 +++++++++++- lua/andrew/set.lua | 20 +++++++++-- 13 files changed, 197 insertions(+), 39 deletions(-) create mode 100644 after/plugin/whichkey.lua create mode 100644 after/plugin/yazi.lua mode change 100755 => 100644 init.lua diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua index 8f9f871..4f38b16 100644 --- a/after/plugin/colors.lua +++ b/after/plugin/colors.lua @@ -191,13 +191,17 @@ vim.cmd[[colorscheme no-clown-fiesta]] -- My own color overrides local hl = vim.api.nvim_set_hl -hl(0, 'TSConstant', { fg = palette.yellow }) -hl(0, 'EndOfBuffer', { fg = palette.medium_gray }) -hl(0, 'ErrorMsg', { fg = palette.yellow }) -hl(0, 'LineNr', { fg = palette.medium_gray }) -hl(0, 'MasonNormal', { bg = palette.gray }) -hl(0, 'NvimTreeCursorLine', { fg = palette.yellow }) -hl(0, 'NvimTreeEndOfBuffer', { fg = palette.medium_gray }) +hl(0, 'TSConstant', { fg = palette.yellow }) +hl(0, 'EndOfBuffer', { fg = palette.medium_gray }) +hl(0, 'ErrorMsg', { fg = palette.yellow }) +hl(0, 'LineNr', { fg = palette.medium_gray }) +hl(0, 'MasonNormal', { bg = palette.gray }) +hl(0, 'NvimTreeCursorLine', { fg = palette.yellow }) +hl(0, 'NvimTreeEndOfBuffer', { fg = palette.medium_gray }) hl(0, 'NvimTreeIndentMarker', { fg = palette.medium_gray }) -hl(0, 'NvimTreeFolderIcon', { fg = palette.yellow }) +hl(0, 'NvimTreeFolderIcon', { fg = palette.yellow }) +hl(0, 'WhichKeyFloat', { bg = nil }) +hl(0, 'WhichKeyDesc', { link = "function" }) +hl(0, 'WhichKey', { fg = palette.medium_gray_blue }) +hl(0, 'WhichKeyGroup', { fg = palette.gray_blue, bold = true }) diff --git a/after/plugin/dashboard.lua b/after/plugin/dashboard.lua index e69de29..711ee35 100644 --- a/after/plugin/dashboard.lua +++ b/after/plugin/dashboard.lua @@ -0,0 +1,58 @@ +local alpha = require("alpha") +local dashboard = require("alpha.themes.dashboard") + +math.randomseed(os.time()) + +local function pick_color() + local colors = {"String", "Identifier", "Keyword", "Number"} + return colors[math.random(#colors)] +end + +local function footer() + local total_plugins = #vim.tbl_keys(packer_plugins) + local version = vim.version() + local nvim_version_info = " NVIM v" .. version.major .. "." .. version.minor .. "." .. version.patch + + return nvim_version_info .. " 󰏖 " .. total_plugins .. " plugins" +end + +-- Set header +dashboard.section.header.val = { + " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣭⣿⣶⣿⣦⣼⣆ ", + " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ", + " ⠈ ⠈⢿⣿⣟⠦⠄⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ", + " ⣸⣿⣿⢧⠄⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ", + " ⢠⣿⣿⣿⠈ ⠡⠌⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ", + " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿ ", + " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷⠄ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ", + "⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ", + "⠙⠃ ⣼⣿⡟⠌ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿⠐⣿⣿⡇ ⠛⠻⢷⣄", + " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ⠁", + " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣀⣤⣾⡿⠃ ", + "⢀⣀⠀⣠⣀⣠⣾⣿⣿⡿⠛⠋⠉⠉⠉ ⠉⠉⠉⠉⠛⠻⣿⣿⣷⣄⣀⢿⡽⢻⣦", + "⠻⠶⠾⠿⠿⠿⠋⠉ N E O V I M ⠉⠻⠿⠿⠿⠿⠿⠋", +} + +-- Set menu +dashboard.section.buttons.val = { + dashboard.button( "e", " New file" , ":ene startinsert "), + dashboard.button( "q", "󰩈 Quit NVIM", ":qa"), +} + +vim.api.nvim_create_autocmd("VimEnter", { + once = true, + callback = function() + math.randomseed(os.time()) + local fg_color = tostring(math.random(0, 12)) + local hi_setter = "hi AlphaHeader ctermfg=" + vim.cmd(hi_setter .. fg_color) + end +}) + +dashboard.section.footer.val = footer() + +dashboard.section.header.opts.hl = "Include" +dashboard.section.footer.opts.hl = "String" + +alpha.setup(dashboard.opts) + diff --git a/after/plugin/fugative.lua b/after/plugin/fugative.lua index 435d82a..12b6d67 100644 --- a/after/plugin/fugative.lua +++ b/after/plugin/fugative.lua @@ -1,2 +1,4 @@ -vim.keymap.set("n", "gs", vim.cmd.Git) +local wk = require("which-key") +wk.register({g = { name = "git" }, prefix = ""}) +vim.keymap.set("n", "gs", vim.cmd.Git, { desc = "Git status" }) diff --git a/after/plugin/lf.lua b/after/plugin/lf.lua index 7ff58e9..58a2922 100644 --- a/after/plugin/lf.lua +++ b/after/plugin/lf.lua @@ -1,4 +1,4 @@ -vim.keymap.set("n", "e", function () - vim.cmd("Lf") -end) +-- vim.keymap.set("n", "e", function () +-- vim.cmd("Lf") +-- end) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 7419405..541b066 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -9,17 +9,23 @@ lsp_zero.on_attach(function(client, bufnr) lsp_zero.default_keymaps({buffer = bufnr}) end) +-- LUA lspconfig.lua_ls.setup({ settings = { Lua = { diagnostics = { -- Making sure that lua recognizes the global variable 'vim' - globals = { 'vim' }, + globals = { 'vim', 'xplr' }, }, }, }, }) +-- RUST +-- Must run `rustup default stable` and then `rustup component add rust-analyzer` +-- upon first install +lspconfig.rust_analyzer.setup({}) + lspconfig.clangd.setup({ capabilities = lsp_capabilities, }) @@ -53,3 +59,11 @@ cmp.setup({ } }) +-- DIAGNOSTICS + +-- Show all diagnostics on current line in floating window +vim.api.nvim_set_keymap( + 'n', 'gl', ':lua vim.diagnostic.open_float()', + { noremap = true, silent = true } +) + diff --git a/after/plugin/markdownpreview.lua b/after/plugin/markdownpreview.lua index 26edc76..a6f9c75 100644 --- a/after/plugin/markdownpreview.lua +++ b/after/plugin/markdownpreview.lua @@ -1,6 +1,7 @@ -vim.cmd([[ +vim.keymap.set("n", "mp", "MarkdownPreview", + { desc = "Markdown prewview" }) -nmap mp MarkdownPreview +vim.cmd([[ " set to 1, nvim will open the preview window after entering the markdown buffer " default: 0 diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index a28bf87..76b1ba8 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -1,14 +1,29 @@ local builtin = require("telescope.builtin") -vim.keymap.set("n", "pf", builtin.find_files, {}) -vim.keymap.set("n", "ps", function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }) -end) -vim.keymap.set("n", "ht", builtin.colorscheme, {}) - require("telescope").setup{ defaults = { file_ignore_patterns = { ".git\\", ".pyc", ".mypy_cache\\", "node_modules\\", ".svg" } } } +local wk = require("which-key") + +-- p +wk.register({p = { name = "project" }, prefix = ""}) +vim.keymap.set("n", "pf", builtin.find_files, {desc = "Project find"}) +vim.keymap.set("n", "ps", function () + builtin.grep_string({ search = vim.fn.input("Grep > ") }) + end , {desc = "Project search"}) + +-- f +wk.register({f = { name = "find" }, prefix = ""}) +vim.keymap.set("n", "fr", builtin.oldfiles, { desc = "Find recent" }) + +-- h +wk.register({h = { name = "help" }, prefix = ""}) +vim.keymap.set("n", "ht", builtin.colorscheme, { desc = "Load theme" }) +vim.keymap.set("n", "hf", builtin.commands , { desc = "Describe function" }) +vim.keymap.set("n", "hk", builtin.keymaps , { desc = "Describe key" }) +vim.keymap.set("n", "hv", builtin.vim_options, { desc = "Describe key" }) +vim.keymap.set("n", "hh", builtin.help_tags , { desc = "Search local wiki" }) + diff --git a/after/plugin/whichkey.lua b/after/plugin/whichkey.lua new file mode 100644 index 0000000..f1fd478 --- /dev/null +++ b/after/plugin/whichkey.lua @@ -0,0 +1,16 @@ +require("which-key").setup({ + window = { + border = "single", -- none, single, double, shadow + position = "bottom", -- bottom, top + margin = { 0, 0, 0, 0 }, -- extra window margin [top, right, bottom, left]. When between 0 and 1, will be treated as a percentage of the screen size. + padding = { 0, 2, 0, 2 }, -- extra window padding [top, right, bottom, left] + winblend = 0, -- value between 0-100 0 for fully opaque and 100 for fully transparent + zindex = 1000, -- positive value to position WhichKey above other floating windows. + }, + layout = { + height = { min = 4, max = 25 }, -- min and max height of the columns + width = { min = 20, max = 50 }, -- min and max width of the columns + spacing = 3, -- spacing between columns + align = "left", -- align columns left, center or right + }, +}) diff --git a/after/plugin/yazi.lua b/after/plugin/yazi.lua new file mode 100644 index 0000000..2fdf5ca --- /dev/null +++ b/after/plugin/yazi.lua @@ -0,0 +1,4 @@ +vim.keymap.set("n", "e", function () + vim.cmd("Yazi") +end) + diff --git a/init.lua b/init.lua old mode 100755 new mode 100644 diff --git a/lua/andrew/packer.lua b/lua/andrew/packer.lua index be78e50..82aa4e1 100644 --- a/lua/andrew/packer.lua +++ b/lua/andrew/packer.lua @@ -12,25 +12,28 @@ end local packer_bootstrap = ensure_packer() return require("packer").startup(function(use) + use "goolord/alpha-nvim" + use "wbthomason/packer.nvim" - -- -- Dashboard - -- use { - -- 'glepnir/dashboard-nvim', - -- event = 'VimEnter', - -- requires = {'nvim-tree/nvim-web-devicons'}, - -- config = function() - -- require('dashboard').setup { - -- -- config - -- } - -- end, - -- } + use "DreamMaoMao/yazi.nvim" + + use "whonore/Coqtail" + + use { + "folke/which-key.nvim", + config = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end + } -- File manager in nvim use { "ptzz/lf.vim", requires = { {"voldikss/vim-floaterm"} }, } + vim.cmd("let g:lf_map_keys = 0") -- Need to put here or else doesn't work -- Zen mode use "folke/zen-mode.nvim" @@ -97,6 +100,12 @@ return require("packer").startup(function(use) } } + -- Better diagnostics + use { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + } + -- Linting use "jose-elias-alvarez/null-ls.nvim" @@ -116,10 +125,10 @@ return require("packer").startup(function(use) }) -- Jupyter notebook integration - use { - "glacambre/firenvim", - run = function() vim.fn["firenvim#install"](0) end - } + -- use { + -- "glacambre/firenvim", + -- run = function() vim.fn["firenvim#install"](0) end + -- } if packer_bootstrap then require('packer').sync() diff --git a/lua/andrew/remap.lua b/lua/andrew/remap.lua index 3f386b9..c620ac3 100644 --- a/lua/andrew/remap.lua +++ b/lua/andrew/remap.lua @@ -13,7 +13,6 @@ vim.keymap.set("n", "N", "Nzzzv") -- easier escape back to normal mode vim.keymap.set("i", "", "") --- lol vim.keymap.set("n", "Q", "") -- universal find and replace @@ -35,7 +34,27 @@ vim.keymap.set("n", "y", "\"+y") vim.keymap.set("n", "d", "\"_d") vim.keymap.set("v", "d", "\"_d") +vim.keymap.set("n", "tc", + function () + local col = "78" + print(vim.o.cc) + if vim.o.cc == col then + vim.o.cc = "" + else + vim.o.cc = col + end + end, + {desc = "Toggle color column"}) + -- case insensitive search vim.keymap.set("n", "/", "/\\c") vim.keymap.set("n", "?", "?\\c") +vim.keymap.set("n", "hF", + function() + local result = vim.treesitter.get_captures_at_cursor(0) + print(vim.inspect(result)) + end, + { noremap = true, silent = false, desc = "Describe face" } +) + diff --git a/lua/andrew/set.lua b/lua/andrew/set.lua index f8c3f48..32b7a34 100644 --- a/lua/andrew/set.lua +++ b/lua/andrew/set.lua @@ -1,5 +1,3 @@ --- vim.opt.guicursor = "" - vim.opt.nu = true vim.opt.relativenumber = true @@ -9,9 +7,27 @@ vim.opt.shiftwidth = 4 vim.opt.expandtab = true vim.opt.smartindent = true +vim.opt.linebreak = true +local autocmd = vim.api.nvim_create_autocmd +autocmd("bufenter", { + pattern = "*", + callback = function() + if vim.bo.ft ~= "terminal" then + vim.opt.laststatus = 2 + else + vim.opt.laststatus = 0 + end + end, +}) + +-- Only search with case if capital letter is typed +vim.opt.ignorecase = true +vim.opt.smartcase = true vim.opt.wrap = true +vim.opt.splitbelow = true + vim.opt.scrolloff = 8 vim.opt.signcolumn = "auto" From cc99d551251719fe3d64810febf74971d87357ed Mon Sep 17 00:00:00 2001 From: agryphus Date: Mon, 2 Sep 2024 16:38:13 -0400 Subject: [PATCH 07/10] chore: latest vimming --- after/plugin/telescope.lua | 2 +- after/plugin/treesitter.lua | 17 ++++++++++++++++- lua/andrew/packer.lua | 17 +++++++++-------- lua/andrew/set.lua | 6 ++++++ 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index 76b1ba8..c9edaeb 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -24,6 +24,6 @@ wk.register({h = { name = "help" }, prefix = ""}) vim.keymap.set("n", "ht", builtin.colorscheme, { desc = "Load theme" }) vim.keymap.set("n", "hf", builtin.commands , { desc = "Describe function" }) vim.keymap.set("n", "hk", builtin.keymaps , { desc = "Describe key" }) -vim.keymap.set("n", "hv", builtin.vim_options, { desc = "Describe key" }) +vim.keymap.set("n", "hv", builtin.vim_options, { desc = "Describe variable" }) vim.keymap.set("n", "hh", builtin.help_tags , { desc = "Search local wiki" }) diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua index a4881fb..4bd5213 100644 --- a/after/plugin/treesitter.lua +++ b/after/plugin/treesitter.lua @@ -1,5 +1,20 @@ require'nvim-treesitter.configs'.setup { - ensure_installed = { "rust", "vim", "javascript", "html", "css", "python", "java", "lua", "perl", "php", "c", "json" }, + ensure_installed = { + "c", + "css", + "html", + "java", + "javascript", + "json", + "lua", + "perl", + "php", + "python", + "rust", + "typst", + "vim", + "vimdoc", + }, ignore_install = { "latex", "markdown", "htmldjango" }, diff --git a/lua/andrew/packer.lua b/lua/andrew/packer.lua index 82aa4e1..cee7773 100644 --- a/lua/andrew/packer.lua +++ b/lua/andrew/packer.lua @@ -12,14 +12,21 @@ end local packer_bootstrap = ensure_packer() return require("packer").startup(function(use) - use "goolord/alpha-nvim" - use "wbthomason/packer.nvim" + -- QML syntax highlighting + use "peterhoeg/vim-qml" + + -- Terminal file manager support use "DreamMaoMao/yazi.nvim" + -- Coq support use "whonore/Coqtail" + -- Dashboard buffer + use "goolord/alpha-nvim" + + -- Show valid keys mid key chord use { "folke/which-key.nvim", config = function() @@ -118,12 +125,6 @@ return require("packer").startup(function(use) -- Auto comment use "numToStr/Comment.nvim" - -- Markdown - use({ - "agryphus/markdown-preview.nvim", - run = function() vim.fn["mkdp#util#install"]() end, - }) - -- Jupyter notebook integration -- use { -- "glacambre/firenvim", diff --git a/lua/andrew/set.lua b/lua/andrew/set.lua index 32b7a34..92f8bdb 100644 --- a/lua/andrew/set.lua +++ b/lua/andrew/set.lua @@ -21,6 +21,12 @@ autocmd("bufenter", { end, }) +vim.filetype.add({ + extension = { + typ = 'typst' + } +}) + -- Only search with case if capital letter is typed vim.opt.ignorecase = true vim.opt.smartcase = true From c28dd3e9a97ba723aafc2f5e360291a2360e7739 Mon Sep 17 00:00:00 2001 From: agryphus Date: Wed, 11 Dec 2024 14:54:20 -0500 Subject: [PATCH 08/10] nvim bump + switch from packer -> lazy --- .gitignore | 2 +- after/plugin/colors.lua | 2 +- after/plugin/dashboard.lua | 60 +++++++--------- after/plugin/fugative.lua | 2 +- after/plugin/lsp.lua | 14 ++-- after/plugin/nvimtree.lua | 20 +++--- after/plugin/telescope.lua | 13 ++-- after/plugin/whichkey.lua | 11 +-- lua/andrew/init.lua | 2 +- lua/andrew/lazy.lua | 119 ++++++++++++++++++++++++++++++++ lua/andrew/packer.lua | 138 ------------------------------------- lua/andrew/remap.lua | 29 ++++++++ 12 files changed, 209 insertions(+), 203 deletions(-) create mode 100644 lua/andrew/lazy.lua delete mode 100644 lua/andrew/packer.lua diff --git a/.gitignore b/.gitignore index ef02d0c..8b55343 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -/plugin/ +lazy-lock.json diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua index 4f38b16..64bc395 100644 --- a/after/plugin/colors.lua +++ b/after/plugin/colors.lua @@ -200,7 +200,7 @@ hl(0, 'NvimTreeCursorLine', { fg = palette.yellow }) hl(0, 'NvimTreeEndOfBuffer', { fg = palette.medium_gray }) hl(0, 'NvimTreeIndentMarker', { fg = palette.medium_gray }) hl(0, 'NvimTreeFolderIcon', { fg = palette.yellow }) -hl(0, 'WhichKeyFloat', { bg = nil }) +hl(0, 'WhichKeyBorder', { fg = palette.medium_gray, bg = palette.accent }) hl(0, 'WhichKeyDesc', { link = "function" }) hl(0, 'WhichKey', { fg = palette.medium_gray_blue }) hl(0, 'WhichKeyGroup', { fg = palette.gray_blue, bold = true }) diff --git a/after/plugin/dashboard.lua b/after/plugin/dashboard.lua index 711ee35..dcf4114 100644 --- a/after/plugin/dashboard.lua +++ b/after/plugin/dashboard.lua @@ -1,52 +1,44 @@ local alpha = require("alpha") local dashboard = require("alpha.themes.dashboard") -math.randomseed(os.time()) - -local function pick_color() - local colors = {"String", "Identifier", "Keyword", "Number"} - return colors[math.random(#colors)] -end - local function footer() - local total_plugins = #vim.tbl_keys(packer_plugins) - local version = vim.version() - local nvim_version_info = " NVIM v" .. version.major .. "." .. version.minor .. "." .. version.patch - - return nvim_version_info .. " 󰏖 " .. total_plugins .. " plugins" + local total_plugins = #require("lazy").plugins() + local version = vim.version() + local nvim_version_info = " NVIM v" .. version.major .. "." .. version.minor .. "." .. version.patch + return nvim_version_info .. " 󰏖 " .. total_plugins .. " plugins" end -- Set header dashboard.section.header.val = { - " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣭⣿⣶⣿⣦⣼⣆ ", - " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ", - " ⠈ ⠈⢿⣿⣟⠦⠄⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ", - " ⣸⣿⣿⢧⠄⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ", - " ⢠⣿⣿⣿⠈ ⠡⠌⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ", - " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿ ", - " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷⠄ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ", - "⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ", - "⠙⠃ ⣼⣿⡟⠌ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿⠐⣿⣿⡇ ⠛⠻⢷⣄", - " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ⠁", - " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣀⣤⣾⡿⠃ ", - "⢀⣀⠀⣠⣀⣠⣾⣿⣿⡿⠛⠋⠉⠉⠉ ⠉⠉⠉⠉⠛⠻⣿⣿⣷⣄⣀⢿⡽⢻⣦", - "⠻⠶⠾⠿⠿⠿⠋⠉ N E O V I M ⠉⠻⠿⠿⠿⠿⠿⠋", + " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣭⣿⣶⣿⣦⣼⣆ ", + " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ", + " ⠈ ⠈⢿⣿⣟⠦⠄⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ", + " ⣸⣿⣿⢧⠄⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ", + " ⢠⣿⣿⣿⠈ ⠡⠌⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ", + " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿ ", + " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷⠄ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ", + "⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ", + "⠙⠃ ⣼⣿⡟⠌ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿⠐⣿⣿⡇ ⠛⠻⢷⣄", + " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ⠁", + " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣀⣤⣾⡿⠃ ", + "⢀⣀⠀⣠⣀⣠⣾⣿⣿⡿⠛⠋⠉⠉⠉ ⠉⠉⠉⠉⠛⠻⣿⣿⣷⣄⣀⢿⡽⢻⣦", + "⠻⠶⠾⠿⠿⠿⠋⠉ N E O V I M ⠉⠻⠿⠿⠿⠿⠿⠋", } -- Set menu dashboard.section.buttons.val = { - dashboard.button( "e", " New file" , ":ene startinsert "), - dashboard.button( "q", "󰩈 Quit NVIM", ":qa"), + dashboard.button( "e", " New file" , ":ene startinsert "), + dashboard.button( "q", "󰩈 Quit NVIM", ":qa"), } vim.api.nvim_create_autocmd("VimEnter", { - once = true, - callback = function() - math.randomseed(os.time()) - local fg_color = tostring(math.random(0, 12)) - local hi_setter = "hi AlphaHeader ctermfg=" - vim.cmd(hi_setter .. fg_color) - end + once = true, + callback = function() + math.randomseed(os.time()) + local fg_color = tostring(math.random(0, 12)) + local hi_setter = "hi AlphaHeader ctermfg=" + vim.cmd(hi_setter .. fg_color) + end }) dashboard.section.footer.val = footer() diff --git a/after/plugin/fugative.lua b/after/plugin/fugative.lua index 12b6d67..9aa8d81 100644 --- a/after/plugin/fugative.lua +++ b/after/plugin/fugative.lua @@ -1,4 +1,4 @@ local wk = require("which-key") -wk.register({g = { name = "git" }, prefix = ""}) +-- wk.add({g = { name = "git" }, prefix = ""}) vim.keymap.set("n", "gs", vim.cmd.Git, { desc = "Git status" }) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 541b066..3c075d2 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -59,11 +59,13 @@ cmp.setup({ } }) --- DIAGNOSTICS - -- Show all diagnostics on current line in floating window -vim.api.nvim_set_keymap( - 'n', 'gl', ':lua vim.diagnostic.open_float()', - { noremap = true, silent = true } -) +vim.keymap.set("n", "gl", ":lua vim.diagnostic.open_float()", + { noremap = true, silent = true }) + +vim.keymap.set("n", "le", ":LspStop", + { desc = "LSP Stop" }) + +vim.keymap.set("n", "ls", ":LspStart", + { desc = "LSP Start" }) diff --git a/after/plugin/nvimtree.lua b/after/plugin/nvimtree.lua index 4643fac..c7fb634 100644 --- a/after/plugin/nvimtree.lua +++ b/after/plugin/nvimtree.lua @@ -1,10 +1,10 @@ --- set termguicolors to enable highlight groups -vim.opt.termguicolors = true - -require("nvim-tree").setup() - -vim.keymap.set("n", "pt", vim.cmd.NvimTreeToggle) - --- sets transparent background -vim.cmd[[hi NvimTreeNormal guibg=NONE ctermbg=NONE]] - +-- -- set termguicolors to enable highlight groups +-- vim.opt.termguicolors = true +-- +-- require("nvim-tree").setup() +-- +-- vim.keymap.set("n", "pt", vim.cmd.NvimTreeToggle) +-- +-- -- sets transparent background +-- vim.cmd[[hi NvimTreeNormal guibg=NONE ctermbg=NONE]] +-- diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index c9edaeb..4f6234d 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -8,19 +8,20 @@ require("telescope").setup{ local wk = require("which-key") --- p -wk.register({p = { name = "project" }, prefix = ""}) +vim.keymap.set("n", "p", "", {desc = "Project"}) vim.keymap.set("n", "pf", builtin.find_files, {desc = "Project find"}) -vim.keymap.set("n", "ps", function () +vim.keymap.set("n", "ps", + function () builtin.grep_string({ search = vim.fn.input("Grep > ") }) - end , {desc = "Project search"}) + end, + { desc = "Project search" }) -- f -wk.register({f = { name = "find" }, prefix = ""}) +-- wk.add({f = { name = "find" }, prefix = ""}) vim.keymap.set("n", "fr", builtin.oldfiles, { desc = "Find recent" }) -- h -wk.register({h = { name = "help" }, prefix = ""}) +-- wk.add({h = { name = "help" }, prefix = ""}) vim.keymap.set("n", "ht", builtin.colorscheme, { desc = "Load theme" }) vim.keymap.set("n", "hf", builtin.commands , { desc = "Describe function" }) vim.keymap.set("n", "hk", builtin.keymaps , { desc = "Describe key" }) diff --git a/after/plugin/whichkey.lua b/after/plugin/whichkey.lua index f1fd478..07541e0 100644 --- a/after/plugin/whichkey.lua +++ b/after/plugin/whichkey.lua @@ -1,11 +1,11 @@ require("which-key").setup({ - window = { + win = { border = "single", -- none, single, double, shadow - position = "bottom", -- bottom, top - margin = { 0, 0, 0, 0 }, -- extra window margin [top, right, bottom, left]. When between 0 and 1, will be treated as a percentage of the screen size. - padding = { 0, 2, 0, 2 }, -- extra window padding [top, right, bottom, left] - winblend = 0, -- value between 0-100 0 for fully opaque and 100 for fully transparent + padding = { 0, 0, 0, 0 }, -- extra window padding [top, right, bottom, left] zindex = 1000, -- positive value to position WhichKey above other floating windows. + wo = { + winblend = 0, -- value between 0-100 0 for fully opaque and 100 for fully transparent + }, }, layout = { height = { min = 4, max = 25 }, -- min and max height of the columns @@ -14,3 +14,4 @@ require("which-key").setup({ align = "left", -- align columns left, center or right }, }) + diff --git a/lua/andrew/init.lua b/lua/andrew/init.lua index 180a9a4..375ca3c 100644 --- a/lua/andrew/init.lua +++ b/lua/andrew/init.lua @@ -1,4 +1,4 @@ require("andrew.remap") -require("andrew.packer") +require("andrew.lazy") require("andrew.set") diff --git a/lua/andrew/lazy.lua b/lua/andrew/lazy.lua new file mode 100644 index 0000000..d31952f --- /dev/null +++ b/lua/andrew/lazy.lua @@ -0,0 +1,119 @@ +-- 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) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + -- Terminal file manager support + -- "DreamMaoMao/yazi.nvim", + { + "mikavilpas/yazi.nvim", + event = "VeryLazy", + }, + + -- Dashboard buffer + { + "goolord/alpha-nvim", + -- dependencies = { 'echasnovski/mini.icons' }, + dependencies = { 'nvim-tree/nvim-web-devicons' }, + }, + + -- Zen mode + "folke/zen-mode.nvim", + + -- Show valid keys mid key chord + "folke/which-key.nvim", + -- config = function() + -- vim.o.timeout = true + -- vim.o.timeoutlen = 300 + -- end + + -- Find files and strings + { + 'nvim-telescope/telescope.nvim', tag = '0.1.8', + dependencies = { 'nvim-lua/plenary.nvim' }, + }, + + { + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate" + }, + + -- Themes + "aktersnurra/no-clown-fiesta.nvim", + "ellisonleao/gruvbox.nvim", + { 'rose-pine/neovim', as = 'rose-pine' }, + 'Mofiqul/vscode.nvim', + + -- Referencing a hex code highlights it in that color + "norcalli/nvim-colorizer.lua", + + -- Relative line numbers disappear when not actively in buffer + "jeffkreeftmeijer/vim-numbertoggle", + + -- History visualizer + "mbbill/undotree", + + -- See function signatures when typing them + { + "ray-x/lsp_signature.nvim", + event = "VeryLazy", + opts = {}, + config = function(_, opts) require'lsp_signature'.setup(opts) end + }, + + -- Left-side file tree dispaly + { + "nvim-tree/nvim-tree.lua", + requires = { + "nvim-tree/nvim-web-devicons", -- for file icons + }, + }, + + -- Shows current mode on bottom of screen + "itchyny/lightline.vim", + + -- LSP + {'VonHeikemen/lsp-zero.nvim', branch = 'v4.x'}, + {'neovim/nvim-lspconfig'}, + {'hrsh7th/cmp-nvim-lsp'}, + {'hrsh7th/nvim-cmp'}, + + -- Better diagnostics + { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + }, + + -- Linting + "jose-elias-alvarez/null-ls.nvim", + + -- Git wrapper + "tpope/vim-fugitive", + + -- Latex editing in vim + "lervag/vimtex", + + -- Auto comment + "numToStr/Comment.nvim", +}) + diff --git a/lua/andrew/packer.lua b/lua/andrew/packer.lua deleted file mode 100644 index cee7773..0000000 --- a/lua/andrew/packer.lua +++ /dev/null @@ -1,138 +0,0 @@ -local ensure_packer = function() - local fn = vim.fn - local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' - if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) - vim.cmd [[packadd packer.nvim]] - return true - end - return false -end - -local packer_bootstrap = ensure_packer() - -return require("packer").startup(function(use) - use "wbthomason/packer.nvim" - - -- QML syntax highlighting - use "peterhoeg/vim-qml" - - -- Terminal file manager support - use "DreamMaoMao/yazi.nvim" - - -- Coq support - use "whonore/Coqtail" - - -- Dashboard buffer - use "goolord/alpha-nvim" - - -- Show valid keys mid key chord - use { - "folke/which-key.nvim", - config = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 - end - } - - -- File manager in nvim - use { - "ptzz/lf.vim", - requires = { {"voldikss/vim-floaterm"} }, - } - vim.cmd("let g:lf_map_keys = 0") -- Need to put here or else doesn't work - - -- Zen mode - use "folke/zen-mode.nvim" - - -- Find files and strings - use { - "nvim-telescope/telescope.nvim", tag = "0.1.4", - requires = { {"nvim-lua/plenary.nvim"} } - } - - -- Treesitter - use({"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}) - - -- Themes - use "aktersnurra/no-clown-fiesta.nvim" - use "ellisonleao/gruvbox.nvim" - use { 'rose-pine/neovim', as = 'rose-pine' } - use 'Mofiqul/vscode.nvim' - - -- Referencing a hex code highlights it in that color - use "norcalli/nvim-colorizer.lua" - - -- Relative line numbers disappear when not actively in buffer - use "jeffkreeftmeijer/vim-numbertoggle" - - -- History visualizer - use "mbbill/undotree" - - -- See function signatures when typing them - use "ray-x/lsp_signature.nvim" - require "lsp_signature".setup({}) - - -- Left-side file tree dispaly - use { - "nvim-tree/nvim-tree.lua", - requires = { - "nvim-tree/nvim-web-devicons", -- for file icons - }, - tag = "nightly" -- optional, updated every week - } - - -- Shows current mode on bottom of screen - use "itchyny/lightline.vim" - - -- LSP - use { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v3.x', - requires = { - -- LSP Support - {'neovim/nvim-lspconfig'}, -- Required - - -- Autocompletion - {'hrsh7th/nvim-cmp'}, -- Required - {'hrsh7th/cmp-nvim-lsp'}, -- Required - {'hrsh7th/cmp-buffer'}, -- Optional - {'hrsh7th/cmp-path'}, -- Optional - {'saadparwaiz1/cmp_luasnip'}, -- Optional - {'hrsh7th/cmp-nvim-lua'}, -- Optional - - -- Snippets - {'L3MON4D3/LuaSnip'}, -- Required - {'rafamadriz/friendly-snippets'}, -- Optional - } - } - - -- Better diagnostics - use { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - } - - -- Linting - use "jose-elias-alvarez/null-ls.nvim" - - -- Git wrapper - use("tpope/vim-fugitive") - - -- Latex editing in vim - use "lervag/vimtex" - - -- Auto comment - use "numToStr/Comment.nvim" - - -- Jupyter notebook integration - -- use { - -- "glacambre/firenvim", - -- run = function() vim.fn["firenvim#install"](0) end - -- } - - if packer_bootstrap then - require('packer').sync() - end -end) - diff --git a/lua/andrew/remap.lua b/lua/andrew/remap.lua index c620ac3..9185372 100644 --- a/lua/andrew/remap.lua +++ b/lua/andrew/remap.lua @@ -46,6 +46,35 @@ vim.keymap.set("n", "tc", end, {desc = "Toggle color column"}) +vim.keymap.set("n", "t", "", {desc = "Toggle"}) +vim.keymap.set("n", "tl", + function () + if vim.wo.number == false and vim.wo.relativenumber == false then + vim.wo.number = true + print("absolute numbers") + elseif vim.wo.number == true and vim.wo.relativenumber == false then + vim.wo.relativenumber = true + print("relative line numbers") + else + vim.wo.number = false + vim.wo.relativenumber = false + print("no line numbers") + end + end, + {desc = "Toggle line numbers"}) + +vim.keymap.set("n", "tw", + function () + if vim.wo.wrap then + vim.wo.wrap = false + print("nowrap") + else + vim.wo.wrap = true + print("wrap") + end + end, + {desc = "Toggle line wrapping"}) + -- case insensitive search vim.keymap.set("n", "/", "/\\c") vim.keymap.set("n", "?", "?\\c") From bb94a399de1491b6b9e3e25131473a8c2eb170d1 Mon Sep 17 00:00:00 2001 From: agryphus Date: Wed, 3 Sep 2025 19:06:21 -0400 Subject: [PATCH 09/10] Simplify statusline, support tabs, add more languages --- after/plugin/colors.lua | 97 -------------------------------- after/plugin/compile-mode.lua | 10 ++++ after/plugin/lsp.lua | 26 +++++++++ after/plugin/lualine.lua | 14 +++++ after/plugin/markdownpreview.lua | 2 +- after/plugin/possession.lua | 9 +++ after/plugin/telescope.lua | 7 +-- after/plugin/treesitter.lua | 9 +++ lua/andrew/lazy.lua | 49 ++++++++++++++-- lua/andrew/remap.lua | 43 +++++++++++++- lua/andrew/set.lua | 9 +++ 11 files changed, 166 insertions(+), 109 deletions(-) create mode 100644 after/plugin/compile-mode.lua create mode 100644 after/plugin/lualine.lua create mode 100644 after/plugin/possession.lua diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua index 64bc395..eccafd9 100644 --- a/after/plugin/colors.lua +++ b/after/plugin/colors.lua @@ -1,39 +1,3 @@ -local palette = { - none = "NONE", - fg = "#E1E1E1", - bg = "#151515", - alt_bg = "#171717", - accent = "#202020", - white = "#E1E1E1", - gray = "#373737", - medium_gray = "#727272", - light_gray = "#AFAFAF", - blue = "#BAD7FF", - gray_blue = "#7E97AB", - medium_gray_blue = "#A2B5C1", - cyan = "#88afa2", - red = "#b46958", - green = "#90A959", - yellow = "#F4BF75", - orange = "#FFA557", - purple = "#AA749F", - magenta = "#AA759F", - cursor_fg = "#151515", - cursor_bg = "#D0D0D0", - sign_add = "#586935", - sign_change = "#51657B", - sign_delete = "#984936", - error = "#984936", - warning = "#ab8550", - info = "#ab8550", - hint = "#576f82", - neogit_light_green = "#2A2E19", - neogit_blue = "#1B1F27", - neogit_green = "#212513", - neogit_light_red = "#402020", - neogit_red = "#351D1D", -} - require("no-clown-fiesta").setup({ transparent = true, }) @@ -143,65 +107,4 @@ require('vscode').setup({ } }) -vim.cmd[[ -let s:base03 = [ '#151513', 233 ] -let s:base02 = [ '#202020', 236 ] -let s:base01 = [ '#373737', 239 ] -let s:base00 = [ '#727272', 242 ] -let s:base0 = [ '#808070', 244 ] -let s:base1 = [ '#949484', 246 ] -let s:base2 = [ '#a8a897', 248 ] -let s:base3 = [ '#E1E1E1', 253 ] -let s:yellow = [ '#F4BF75', 3 ] -let s:orange = [ '#FFA557', 216 ] -let s:red = [ '#B46958', 131 ] -let s:purple = [ '#AA749F', 181 ] -let s:blue = [ '#7E97AB', 109 ] -let s:cyan = [ '#BAD7FF', 23 ] -let s:green = [ '#90A959', 108 ] -let s:white = [ '#AFAFAF', 252 ] - -let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} -let s:p.normal.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ] -let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ] -let s:p.inactive.right = [ [ s:base02, s:base00 ], [ s:base0, s:base02 ] ] -let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ] -let s:p.insert.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ] -let s:p.replace.left = [ [ s:base02, s:purple ], [ s:base3, s:base01 ] ] -let s:p.visual.left = [ [ s:base02, s:red ], [ s:base3, s:base01 ] ] -let s:p.normal.middle = [ [ s:base0, s:base02 ] ] -let s:p.inactive.middle = [ [ s:base00, s:base02 ] ] -let s:p.tabline.left = [ [ s:base3, s:base00 ] ] -let s:p.tabline.tabsel = [ [ s:base3, s:base02 ] ] -let s:p.tabline.middle = [ [ s:base01, s:base1 ] ] -let s:p.tabline.right = copy(s:p.normal.right) -let s:p.normal.error = [ [ s:red, s:base02 ] ] -let s:p.normal.warning = [ [ s:yellow, s:base01 ] ] - -let g:lightline#colorscheme#mycolors#palette = lightline#colorscheme#flatten(s:p) -let g:lightline = { - \ 'colorscheme': 'mycolors', - \ } - -" Don't need to see mode if lightline is installed -set noshowmode -]] - vim.cmd[[colorscheme no-clown-fiesta]] - --- My own color overrides -local hl = vim.api.nvim_set_hl -hl(0, 'TSConstant', { fg = palette.yellow }) -hl(0, 'EndOfBuffer', { fg = palette.medium_gray }) -hl(0, 'ErrorMsg', { fg = palette.yellow }) -hl(0, 'LineNr', { fg = palette.medium_gray }) -hl(0, 'MasonNormal', { bg = palette.gray }) -hl(0, 'NvimTreeCursorLine', { fg = palette.yellow }) -hl(0, 'NvimTreeEndOfBuffer', { fg = palette.medium_gray }) -hl(0, 'NvimTreeIndentMarker', { fg = palette.medium_gray }) -hl(0, 'NvimTreeFolderIcon', { fg = palette.yellow }) -hl(0, 'WhichKeyBorder', { fg = palette.medium_gray, bg = palette.accent }) -hl(0, 'WhichKeyDesc', { link = "function" }) -hl(0, 'WhichKey', { fg = palette.medium_gray_blue }) -hl(0, 'WhichKeyGroup', { fg = palette.gray_blue, bold = true }) - diff --git a/after/plugin/compile-mode.lua b/after/plugin/compile-mode.lua new file mode 100644 index 0000000..7eea44a --- /dev/null +++ b/after/plugin/compile-mode.lua @@ -0,0 +1,10 @@ +require("compile-mode") + +vim.g.compile_mode = { + beleia_setup = true +} + +vim.keymap.set("n", "cC", vim.cmd.Compile, {desc = "Compile"}) +vim.keymap.set("n", "cc", vim.cmd.Recompile, {desc = "Recompile"}) + + diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 3c075d2..55a5413 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -21,6 +21,8 @@ lspconfig.lua_ls.setup({ }, }) +vim.g.zig_fmt_autosave = 0 + -- RUST -- Must run `rustup default stable` and then `rustup component add rust-analyzer` -- upon first install @@ -30,6 +32,30 @@ lspconfig.clangd.setup({ capabilities = lsp_capabilities, }) +lspconfig.gopls.setup({ + settings = { + gopls = { + analyses = { + unusedparams = true, + }, + staticcheck = true, + gofumpt = true, + }, + }, +}) + +lspconfig.pylsp.setup({ + settings = { + pylsp = { + pylint = { enabled = true, executable = "pylint" }, + }, + }, +}) + +vim.keymap.set("n", "gf", ":GoFmt", + { noremap = true, silent = true, desc = "Go Format" } +) + -- AUTOCOMPLETION local cmp = require('cmp') diff --git a/after/plugin/lualine.lua b/after/plugin/lualine.lua new file mode 100644 index 0000000..7c57699 --- /dev/null +++ b/after/plugin/lualine.lua @@ -0,0 +1,14 @@ +require("lualine").setup({ + sections = { + lualine_a = {'mode'}, + lualine_b = {'tabs', 'filename'}, + lualine_c = {'branch', 'diff', 'diagnostics'}, + lualine_x = {'encoding', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, +}) + +vim.cmd[[set showtabline=0]] +vim.cmd[[set noshowmode]] + diff --git a/after/plugin/markdownpreview.lua b/after/plugin/markdownpreview.lua index a6f9c75..4b25bcb 100644 --- a/after/plugin/markdownpreview.lua +++ b/after/plugin/markdownpreview.lua @@ -39,7 +39,7 @@ let g:mkdp_open_ip = '' " valid: `/path/with\ space/xxx` " invalid: `/path/with\\ space/xxx` " default: '' -let g:mkdp_browser = 'thorium-browser' +let g:mkdp_browser = 'zen' " set to 1, echo preview page url in command line when open preview page " default is 0 diff --git a/after/plugin/possession.lua b/after/plugin/possession.lua new file mode 100644 index 0000000..e682788 --- /dev/null +++ b/after/plugin/possession.lua @@ -0,0 +1,9 @@ +require("possession").setup({}) + +require('telescope').load_extension('possession') +vim.keymap.set("n", "pp", ":Telescope possession list", + { desc = "List neovim sessions" }) + +vim.keymap.set("n", "ss", ":PossessionSave", + { desc = "List neovim sessions" }) + diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index 4f6234d..62cdf66 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -6,13 +6,12 @@ require("telescope").setup{ } } -local wk = require("which-key") - vim.keymap.set("n", "p", "", {desc = "Project"}) -vim.keymap.set("n", "pf", builtin.find_files, {desc = "Project find"}) +vim.keymap.set("n", "pf", ":Telescope find_files no_ignore=true ", {desc = "Project find"}) +vim.keymap.set("n", ".", builtin.find_files, {desc = "Project find (.gitignore)"}) vim.keymap.set("n", "ps", function () - builtin.grep_string({ search = vim.fn.input("Grep > ") }) + builtin.grep_string({ search = vim.fn.input("Grep > "), no_ignore = true }) end, { desc = "Project search" }) diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua index 4bd5213..2dbaa74 100644 --- a/after/plugin/treesitter.lua +++ b/after/plugin/treesitter.lua @@ -2,6 +2,8 @@ require'nvim-treesitter.configs'.setup { ensure_installed = { "c", "css", + "glsl", + "go", "html", "java", "javascript", @@ -29,3 +31,10 @@ require'nvim-treesitter.configs'.setup { }, } +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + pattern = {"*.vert", "*.frag"}, + callback = function() + vim.bo.filetype = "glsl" + end, +}) + diff --git a/lua/andrew/lazy.lua b/lua/andrew/lazy.lua index d31952f..520a1b3 100644 --- a/lua/andrew/lazy.lua +++ b/lua/andrew/lazy.lua @@ -30,6 +30,17 @@ require("lazy").setup({ event = "VeryLazy", }, + -- Markdown preview + { + "iamcco/markdown-preview.nvim", + cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', 'MarkdownPreviewStop' }, + ft = { 'markdown' }, + build = function() + vim.cmd [[Lazy load markdown-preview.nvim]] + vim.fn['mkdp#util#install']() + end, + }, + -- Dashboard buffer { "goolord/alpha-nvim", @@ -37,6 +48,25 @@ require("lazy").setup({ dependencies = { 'nvim-tree/nvim-web-devicons' }, }, + -- Compile mode + { + "ej-shafran/compile-mode.nvim", + -- tag = "v5.*", + -- you can just use the latest version: + branch = "latest", + -- or the most up-to-date updates: + -- branch = "nightly", + dependencies = { + "nvim-lua/plenary.nvim", + { "m00qek/baleia.nvim", tag = "v1.3.0" }, + }, + config = function() + vim.g.compile_mode = { + baleia_setup = true, + } + end + }; + -- Zen mode "folke/zen-mode.nvim", @@ -75,10 +105,10 @@ require("lazy").setup({ -- See function signatures when typing them { - "ray-x/lsp_signature.nvim", - event = "VeryLazy", - opts = {}, - config = function(_, opts) require'lsp_signature'.setup(opts) end + -- "ray-x/lsp_signature.nvim", + -- event = "VeryLazy", + -- opts = {}, + -- config = function(_, opts) require'lsp_signature'.setup(opts) end }, -- Left-side file tree dispaly @@ -89,8 +119,15 @@ require("lazy").setup({ }, }, - -- Shows current mode on bottom of screen - "itchyny/lightline.vim", + { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + }, + + { + 'jedrzejboczar/possession.nvim', + requires = { 'nvim-lua/plenary.nvim' }, + }, -- LSP {'VonHeikemen/lsp-zero.nvim', branch = 'v4.x'}, diff --git a/lua/andrew/remap.lua b/lua/andrew/remap.lua index 9185372..2d9445f 100644 --- a/lua/andrew/remap.lua +++ b/lua/andrew/remap.lua @@ -10,13 +10,23 @@ vim.keymap.set("n", "J", "mzJ`z") vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "N", "Nzzzv") +-- step through visual lines by default +vim.keymap.set("n", "j", "gj") +vim.keymap.set("n", "gj", "j") +vim.keymap.set("n", "k", "gk") +vim.keymap.set("n", "gk", "k") +vim.keymap.set("v", "j", "gj") +vim.keymap.set("v", "gj", "j") +vim.keymap.set("v", "k", "gk") +vim.keymap.set("v", "gk", "k") + -- easier escape back to normal mode vim.keymap.set("i", "", "") vim.keymap.set("n", "Q", "") -- universal find and replace -vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) +vim.keymap.set("n", "r", [[:%s/\<\>//gI]]) -- moving highlighted text vim.keymap.set("v", "J", ":m '>+1gv=gv") @@ -87,3 +97,34 @@ vim.keymap.set("n", "hF", { noremap = true, silent = false, desc = "Describe face" } ) +local str = string.format + +for i = 1, 9 do + vim.keymap.set("n", str("", i), str("%sgt", i), { desc = str("Goto tab %s", i) }) + vim.keymap.set("t", str("", i), str("%sgt", i), { desc = str("Goto tab %s", i) }) +end + +vim.keymap.set("n", "", "tabnew", { desc = "Create a new tab" }) +vim.keymap.set("n", "", "tabnewtermi", { desc = "Create a new tab with a terminal" }) +vim.keymap.set("n", "", "tabclose", { desc = "Close current tab" }) +vim.keymap.set("n", "", "tablast", { desc = "Goto last tab" }) +vim.keymap.set("n", "", "tabnext", { desc = "Goto next tab" }) +vim.keymap.set("n", "", "tabprevious", { desc = "Goto prev tab" }) +vim.keymap.set("n", "", "tabm-", { desc = "Move tab to the left" }) +vim.keymap.set("n", "", "tabm+", { desc = "Move tab to the right" }) +vim.keymap.set("n", "", "tab split", { desc = "Clone window in new tab" }) + +vim.keymap.set("n", "", "termi", { desc = "Terminal" }) + +vim.api.nvim_create_autocmd("TabEnter", { + callback = function() + local bufnr = vim.api.nvim_get_current_buf() + local buftype = vim.api.nvim_buf_get_option(bufnr, "buftype") + + if buftype == "terminal" then + -- Enter Terminal-Job mode + vim.api.nvim_feedkeys("i", "n", false) + end + end, +}) + diff --git a/lua/andrew/set.lua b/lua/andrew/set.lua index 92f8bdb..4923e9f 100644 --- a/lua/andrew/set.lua +++ b/lua/andrew/set.lua @@ -21,6 +21,13 @@ autocmd("bufenter", { end, }) +-- You can then map it to a key or create a command: +vim.api.nvim_create_user_command('GoFmt', function() + local filename = vim.fn.expand('%') + vim.fn.system('gofmt -e -w ' .. filename) + vim.cmd('edit!') +end, {}) + vim.filetype.add({ extension = { typ = 'typst' @@ -39,6 +46,8 @@ vim.opt.signcolumn = "auto" vim.o.shell = "zsh" +vim.o.title = true + -- Do not map q to :q in man mode vim.g.no_man_maps = true; From 0beaaf14b798393a1a6847f57c2eda37c3c3c734 Mon Sep 17 00:00:00 2001 From: agryphus Date: Mon, 5 Jan 2026 11:34:39 -0500 Subject: [PATCH 10/10] Bump nvim config --- after/plugin/lsp.lua | 23 +++++++++++++++++------ after/plugin/possession.lua | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 55a5413..3f81649 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -1,6 +1,5 @@ -- LANGUAGE SERVERS local lsp_zero = require('lsp-zero') -local lspconfig = require("lspconfig") local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities() lsp_zero.on_attach(function(client, bufnr) @@ -10,7 +9,7 @@ lsp_zero.on_attach(function(client, bufnr) end) -- LUA -lspconfig.lua_ls.setup({ +vim.lsp.config('lua_ls', { settings = { Lua = { diagnostics = { @@ -20,19 +19,22 @@ lspconfig.lua_ls.setup({ }, }, }) +vim.lsp.enable('lua_ls') vim.g.zig_fmt_autosave = 0 -- RUST -- Must run `rustup default stable` and then `rustup component add rust-analyzer` -- upon first install -lspconfig.rust_analyzer.setup({}) +vim.lsp.config('rust_analyzer', {}) +vim.lsp.enable('rust_analyzer') -lspconfig.clangd.setup({ +vim.lsp.config('clangd', { capabilities = lsp_capabilities, }) +vim.lsp.enable('clangd') -lspconfig.gopls.setup({ +vim.lsp.config('gopls', { settings = { gopls = { analyses = { @@ -43,14 +45,16 @@ lspconfig.gopls.setup({ }, }, }) +vim.lsp.enable('gopls') -lspconfig.pylsp.setup({ +vim.lsp.config('pylsp', { settings = { pylsp = { pylint = { enabled = true, executable = "pylint" }, }, }, }) +vim.lsp.enable('pylsp') vim.keymap.set("n", "gf", ":GoFmt", { noremap = true, silent = true, desc = "Go Format" } @@ -95,3 +99,10 @@ vim.keymap.set("n", "le", ":LspStop", vim.keymap.set("n", "ls", ":LspStart", { desc = "LSP Start" }) +vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, + { desc = "Jump to definition" }) +vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, + { desc = "Jump to declaration" }) +vim.keymap.set("n", "gt", function() vim.lsp.buf.type_definition() end, + { desc = "Jump to type definition" }) + diff --git a/after/plugin/possession.lua b/after/plugin/possession.lua index e682788..073d642 100644 --- a/after/plugin/possession.lua +++ b/after/plugin/possession.lua @@ -5,5 +5,5 @@ vim.keymap.set("n", "pp", ":Telescope possession list", { desc = "List neovim sessions" }) vim.keymap.set("n", "ss", ":PossessionSave", - { desc = "List neovim sessions" }) + { desc = "Save session" })