From 7254145685a8e1479518b669f12e0d59bee3bf72 Mon Sep 17 00:00:00 2001 From: "C. Luke M. Bubar" Date: Sat, 12 Apr 2025 09:44:18 -0400 Subject: [PATCH 1/7] Replaced init.vim with init.lua --- .config/nvim/init.lua | 294 ++++++++++++++++++++++++++++++++++++++++++ .config/nvim/init.vim | 155 ---------------------- 2 files changed, 294 insertions(+), 155 deletions(-) create mode 100644 .config/nvim/init.lua delete mode 100644 .config/nvim/init.vim diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000000..7e6efd20dc --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,294 @@ +-- Set mapleader +vim.g.mapleader = "," + +-- Check and install vim-plug if not present +local plug_path = vim.fn.stdpath('config') .. '/autoload/plug.vim' +if vim.fn.filereadable(plug_path) == 0 then + print("Downloading junegunn/vim-plug to manage plugins...") + vim.fn.mkdir(vim.fn.stdpath('config') .. '/autoload', 'p') + vim.fn.system('curl -fLo ' .. plug_path .. ' --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim') + vim.api.nvim_create_autocmd("VimEnter", { + callback = function() vim.cmd("PlugInstall") end, + }) +end + +-- Mappings for ,, +vim.keymap.set("n", ",,", ":keepp /<++>ca<", { noremap = true }) +vim.keymap.set("i", ",,", ":keepp /<++>ca<", { noremap = true }) + +-- Plugin setup with vim-plug +vim.fn['plug#begin'](vim.fn.stdpath('config') .. '/plugged') +vim.fn['plug#']('tpope/vim-surround') +vim.fn['plug#']('preservim/nerdtree') +vim.fn['plug#']('junegunn/goyo.vim') +vim.fn['plug#']('jreybert/vimagit') +vim.fn['plug#']('vimwiki/vimwiki') +vim.fn['plug#']('vim-airline/vim-airline') +vim.fn['plug#']('nvim-tree/nvim-web-devicons') +vim.fn['plug#']('tpope/vim-commentary') +vim.fn['plug#']('ap/vim-css-color') +-- New Plugins for LSP Server +vim.fn['plug#']('neovim/nvim-lspconfig') +vim.fn['plug#']('hrsh7th/nvim-cmp') +vim.fn['plug#']('hrsh7th/cmp-nvim-lsp') +vim.fn['plug#']('hrsh7th/cmp-buffer') +vim.fn['plug#']('hrsh7th/cmp-path') +vim.fn['plug#end']() + +-- General settings +vim.opt.title = true +-- vim.opt.background = "light" +vim.opt.background = "dark" +vim.opt.mouse = "a" +vim.opt.hlsearch = false +vim.opt.clipboard:append("unnamedplus") +vim.opt.showmode = false +vim.opt.ruler = false +vim.opt.laststatus = 0 +vim.opt.showcmd = false +vim.cmd("colorscheme vim") + +-- Basic settings +vim.keymap.set("n", "c", '"_c', { noremap = true }) +vim.cmd("filetype plugin on") +vim.cmd("syntax on") +vim.opt.encoding = "utf-8" +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.wildmode = "longest,list,full" +vim.api.nvim_create_autocmd("FileType", { + callback = function() + vim.opt_local.formatoptions:remove({"c", "r", "o"}) + end, +}) +vim.keymap.set("v", ".", ":normal .", { noremap = true }) + +-- Goyo and spell-check mappings +--vim.keymap.set("n", "f", ":Goyo | set background=light | set linebreak", { noremap = true }) +vim.keymap.set("n", "f", ":Goyo | set background=dark | set linebreak", { noremap = true }) +vim.keymap.set("n", "o", ":setlocal spell! spelllang=en_us", { noremap = true }) + +-- Split settings +vim.opt.splitbelow = true +vim.opt.splitright = true + +-- NERDTree +vim.keymap.set("n", "n", ":NERDTreeToggle", { noremap = true }) +vim.api.nvim_create_autocmd("BufEnter", { + callback = function() + if vim.fn.winnr("$") == 1 and vim.b.NERDTree ~= nil and vim.b.NERDTree.isTabTree() then + vim.cmd("q") + end + end, +}) +vim.g.NERDTreeBookmarksFile = vim.fn.stdpath('data') .. '/NERDTreeBookmarks' + +-- vim-airline configuration +vim.cmd([[ +if !exists('g:airline_symbols') + let g:airline_symbols = {} + endif + let g:airline_symbols.colnr = ' C:' + let g:airline_symbols.linenr = ' L:' + let g:airline_symbols.maxlinenr = ' ' + let g:airline#extensions#whitespace#symbol = '!' +]]) + +-- Split navigation +vim.keymap.set("n", "", "h", { noremap = true }) +vim.keymap.set("n", "", "j", { noremap = true }) +vim.keymap.set("n", "", "k", { noremap = true }) +vim.keymap.set("n", "", "l", { noremap = true }) + +-- Replace ex mode with gq +vim.keymap.set("n", "Q", "gq", { noremap = true }) + +-- Shellcheck +vim.keymap.set("n", "s", ":!clear && shellcheck -x %", { noremap = true }) + +-- Bibliography and reference files +vim.keymap.set("n", "b", ":vsp $BIB", { noremap = true }) +vim.keymap.set("n", "r", ":vsp $REFER", { noremap = true }) + +-- Replace all +vim.keymap.set("n", "S", ":%s//g", { noremap = true }) + +-- Compile and preview +vim.keymap.set("n", "c", ":w! | !compiler %:p", { noremap = true }) +vim.keymap.set("n", "p", ":!opout %:p", { noremap = true }) + +-- Clean tex build files on exit +vim.api.nvim_create_autocmd("VimLeave", { + pattern = "*.tex", + command = "!latexmk -c %", +}) + +-- Filetype settings +vim.g.vimwiki_ext2syntax = { + ['.Rmd'] = 'markdown', + ['.rmd'] = 'markdown', + ['.md'] = 'markdown', + ['.markdown'] = 'markdown', + ['.mdown'] = 'markdown', +} +vim.keymap.set("n", "v", ":VimwikiIndex", { noremap = true }) +vim.g.vimwiki_list = {{path = '~/.local/share/nvim/vimwiki', syntax = 'markdown', ext = '.md'}} +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + pattern = {"/tmp/calcurse*", "~/.calcurse/notes/*"}, + command = "set filetype=markdown", +}) +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + pattern = {"*.ms", "*.me", "*.mom", "*.man"}, + command = "set filetype=groff", +}) +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + pattern = "*.tex", + command = "set filetype=tex", +}) + +-- Sudo write +vim.api.nvim_create_user_command("W", "silent! write !sudo tee % >/dev/null | edit!", {}) + +-- Goyo for mutt +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + pattern = "/tmp/neomutt*", + callback = function() + vim.cmd("Goyo 80") + vim.api.nvim_feedkeys("jk", "n", false) + end, +}) +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + pattern = "/tmp/neomutt*", + callback = function() + vim.keymap.set("n", "ZZ", ":Goyo!|x!", { buffer = true, noremap = true }) + vim.keymap.set("n", "ZQ", ":Goyo!|q!", { buffer = true, noremap = true }) + end, +}) + +-- Clean trailing whitespace and newlines on save +vim.api.nvim_create_autocmd("BufWritePre", { + callback = function() + local currPos = vim.fn.getpos(".") + vim.cmd("%s/\\s\\+$//e") + vim.cmd("%s/\\n\\+\\%$//e") + if vim.bo.filetype == "c" or vim.bo.filetype == "h" then + vim.cmd("%s/\\%$/\r/e") + end + if vim.fn.expand("%"):match("neomutt") then + vim.cmd("%s/^--$/-- /e") + end + vim.fn.setpos(".", currPos) + end, +}) + +-- Update shortcuts and configs +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = {"bm-files", "bm-dirs"}, + command = "!shortcuts", +}) +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + pattern = {"Xresources", "Xdefaults", "xresources", "xdefaults"}, + command = "set filetype=xdefaults", +}) +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = {"Xresources", "Xdefaults", "xresources", "xdefaults"}, + command = "!xrdb %", +}) +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = "~/.local/src/dwmblocks/config.h", + command = "!cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }", +}) + +-- Diff highlighting +if vim.opt.diff:get() then + vim.cmd("highlight! link DiffText MatchParen") +end + +-- Toggle statusbar +local hidden_all = 0 +local function toggle_hidden_all() + if hidden_all == 0 then + hidden_all = 1 + vim.opt.showmode = false + vim.opt.ruler = false + vim.opt.laststatus = 0 + vim.opt.showcmd = false + else + hidden_all = 0 + vim.opt.showmode = true + vim.opt.ruler = true + vim.opt.laststatus = 2 + vim.opt.showcmd = true + end +end +vim.keymap.set("n", "h", toggle_hidden_all, { noremap = true }) + +-- Load shortcuts +pcall(vim.cmd, "source ~/.config/nvim/shortcuts.vim") + +-- Syntax Highlighting - LSP setup +local lspconfig = require'lspconfig' +-- These language servers are in pacman or the AUR with the same name as given below, unless otherwise noted. +local servers = { +-- 'server_name', -- Language name -- Pacman/AUR name + 'pyright', -- Python -- pyright + 'ts_ls', -- TypeScript -- typescript-language-server + 'gopls', -- Go -- gopls + 'clangd', -- C -- clang + 'rust_analyzer', -- Rust -- rust_analyzer + 'texlab', -- LaTeX -- texlab + 'marksman', -- Markdown -- marksman + 'r_language_server', -- R -- Run `install.packages("languageserver")` inside R + 'csharp_ls', -- C# -- csharp-ls +-- 'omnisharp', -- C# (legacy) -- omnisharp-roslyn-bin + 'lua_ls', -- Lua -- lua-language-server + 'yamlls', -- YAML -- yaml-language-server + 'bashls', -- bash -- bash-language-server +} +-- Automatically set up each LSP server in the list +for _, server in ipairs(servers) do + lspconfig[server].setup {} +end + +local cmp = require'cmp' +cmp.setup({ + mapping = { + [''] = cmp.mapping.select_next_item(), -- Next suggestion + [''] = cmp.mapping.select_next_item(), -- Next suggestion (vim-style bind) + [''] = cmp.mapping.select_prev_item(), -- Previous suggestion + [''] = cmp.mapping.select_prev_item(), -- Previous suggestion (vim-style bind) + [''] = cmp.mapping.confirm({ select = true }), -- Confirm completion + [''] = cmp.mapping.confirm({ select = true }), -- Confirm completion + [''] = cmp.mapping.complete(), -- Trigger completion manually + }, + sources = { + { name = 'nvim_lsp' }, -- Use LSP as a completion source + { name = 'buffer' }, -- Suggest words from open buffers + { name = 'path' }, -- Suggest file paths + } +}) + +-- Diagnostic navigation mappings +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic" }) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic" }) + +local diagnostics_auto_enabled = true +local diagnostics_autocmd_id = nil + +vim.diagnostic.config({ + virtual_text = false, -- Disable virtual text to avoid clutter + signs = true, -- Show signs in the gutter + underline = true, -- Underline errors + update_in_insert = false, -- Don’t update diagnostics in insert mode + float = { + border = "rounded", -- Optional: nicer border for hover window + source = "always", -- Show error source + header = "", + prefix = "", + }, +}) +-- Keybinding to toggle diagnostic auto-display +vim.keymap.set('n', 'e', toggle_diagnostics_auto, { desc = "Toggle diagnostic auto-display" }) + +-- Optional: Manual trigger to show diagnostics immediately +vim.keymap.set('n', 'E', vim.diagnostic.open_float, { desc = "Show diagnostic under cursor" }) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim deleted file mode 100644 index a7523062c4..0000000000 --- a/.config/nvim/init.vim +++ /dev/null @@ -1,155 +0,0 @@ -let mapleader ="," - -if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"')) - echo "Downloading junegunn/vim-plug to manage plugins..." - silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/ - silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim - autocmd VimEnter * PlugInstall -endif - -map ,, :keepp /<++>ca< -imap ,, :keepp /<++>ca< - -call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"')) -Plug 'tpope/vim-surround' -Plug 'preservim/nerdtree' -Plug 'junegunn/goyo.vim' -Plug 'jreybert/vimagit' -Plug 'vimwiki/vimwiki' -Plug 'vim-airline/vim-airline' -Plug 'tpope/vim-commentary' -Plug 'ap/vim-css-color' -call plug#end() - -set title -set bg=light -set mouse=a -set nohlsearch -set clipboard+=unnamedplus -set noshowmode -set noruler -set laststatus=0 -set noshowcmd -colorscheme vim - -" Some basics: - nnoremap c "_c - filetype plugin on - syntax on - set encoding=utf-8 - set number relativenumber -" Enable autocompletion: - set wildmode=longest,list,full -" Disables automatic commenting on newline: - autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o -" Perform dot commands over visual blocks: - vnoremap . :normal . -" Goyo plugin makes text more readable when writing prose: - map f :Goyo \| set bg=light \| set linebreak -" Spell-check set to o, 'o' for 'orthography': - map o :setlocal spell! spelllang=en_us -" Splits open at the bottom and right, which is non-retarded, unlike vim defaults. - set splitbelow splitright - -" Nerd tree - map n :NERDTreeToggle - autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif - let NERDTreeBookmarksFile = stdpath('data') . '/NERDTreeBookmarks' - -" vim-airline - if !exists('g:airline_symbols') - let g:airline_symbols = {} - endif - let g:airline_symbols.colnr = ' C:' - let g:airline_symbols.linenr = ' L:' - let g:airline_symbols.maxlinenr = ' ' - let g:airline#extensions#whitespace#symbol = '!' - -" Shortcutting split navigation, saving a keypress: - map h - map j - map k - map l - -" Replace ex mode with gq - map Q gq - -" Check file in shellcheck: - map s :!clear && shellcheck -x % - -" Open my bibliography file in split - map b :vsp$BIB - map r :vsp$REFER - -" Replace all is aliased to S. - nnoremap S :%s//g - -" Compile document, be it groff/LaTeX/markdown/etc. - map c :w! \| !compiler "%:p" - -" Open corresponding .pdf/.html or preview - map p :!opout "%:p" - -" Runs a script that cleans out tex build files whenever I close out of a .tex file. - autocmd VimLeave *.tex !latexmk -c % - -" Ensure files are read as what I want: - let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'} - map v :VimwikiIndex - let g:vimwiki_list = [{'path': '~/.local/share/nvim/vimwiki', 'syntax': 'markdown', 'ext': '.md'}] - autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown - autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff - autocmd BufRead,BufNewFile *.tex set filetype=tex - -" Save file as sudo on files that require root permission - cabbrev w!! execute 'silent! write !sudo tee % >/dev/null' edit! - -" Enable Goyo by default for mutt writing - autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo 80 | call feedkeys("jk") - autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo!\|x! - autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo!\|q! - -" Automatically deletes all trailing whitespace and newlines at end of file on save. & reset cursor position - autocmd BufWritePre * let currPos = getpos(".") - autocmd BufWritePre * %s/\s\+$//e - autocmd BufWritePre * %s/\n\+\%$//e - autocmd BufWritePre *.[ch] %s/\%$/\r/e " add trailing newline for ANSI C standard - autocmd BufWritePre *neomutt* %s/^--$/-- /e " dash-dash-space signature delimiter in emails - autocmd BufWritePre * cal cursor(currPos[1], currPos[2]) - -" When shortcut files are updated, renew bash and ranger configs with new material: - autocmd BufWritePost bm-files,bm-dirs !shortcuts -" Run xrdb whenever Xdefaults or Xresources are updated. - autocmd BufRead,BufNewFile Xresources,Xdefaults,xresources,xdefaults set filetype=xdefaults - autocmd BufWritePost Xresources,Xdefaults,xresources,xdefaults !xrdb % -" Recompile dwmblocks on config edit. - autocmd BufWritePost ~/.local/src/dwmblocks/config.h !cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks } - -" Turns off highlighting on the bits of code that are changed, so the line that is changed is highlighted but the actual text that has changed stands out on the line and is readable. -if &diff - highlight! link DiffText MatchParen -endif - -" Function for toggling the bottom statusbar: -let s:hidden_all = 0 -function! ToggleHiddenAll() - if s:hidden_all == 0 - let s:hidden_all = 1 - set noshowmode - set noruler - set laststatus=0 - set noshowcmd - else - let s:hidden_all = 0 - set showmode - set ruler - set laststatus=2 - set showcmd - endif -endfunction -nnoremap h :call ToggleHiddenAll() -" Load command shortcuts generated from bm-dirs and bm-files via shortcuts script. -" Here leader is ";". -" So ":vs ;cfz" will expand into ":vs /home//.config/zsh/.zshrc" -" if typed fast without the timeout. -silent! source ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/shortcuts.vim From c908421662a6ba25ac8b762995293c692dfa12f3 Mon Sep 17 00:00:00 2001 From: "C. Luke M. Bubar" Date: Sat, 12 Apr 2025 10:07:42 -0400 Subject: [PATCH 2/7] fixed error boxes --- .config/nvim/init.lua | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 7e6efd20dc..52600f2e1f 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -272,23 +272,17 @@ cmp.setup({ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic" }) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic" }) -local diagnostics_auto_enabled = true -local diagnostics_autocmd_id = nil - vim.diagnostic.config({ virtual_text = false, -- Disable virtual text to avoid clutter signs = true, -- Show signs in the gutter underline = true, -- Underline errors update_in_insert = false, -- Don’t update diagnostics in insert mode - float = { - border = "rounded", -- Optional: nicer border for hover window - source = "always", -- Show error source - header = "", - prefix = "", - }, }) --- Keybinding to toggle diagnostic auto-display -vim.keymap.set('n', 'e', toggle_diagnostics_auto, { desc = "Toggle diagnostic auto-display" }) --- Optional: Manual trigger to show diagnostics immediately -vim.keymap.set('n', 'E', vim.diagnostic.open_float, { desc = "Show diagnostic under cursor" }) +-- Automatically show diagnostics on hover +vim.o.updatetime = 250 -- Adjust delay for hover (in milliseconds) +vim.api.nvim_create_autocmd("CursorHold", { + callback = function() + vim.diagnostic.open_float(nil, { focusable = false }) + end, +}) From 4232dab5b7c569279e8a9e2d33a776931b68894f Mon Sep 17 00:00:00 2001 From: "C. Luke M. Bubar" Date: Tue, 29 Jul 2025 16:26:20 -0400 Subject: [PATCH 3/7] Updated init.lua per aartoni's suggestions --- .config/nvim/init.lua | 136 +++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 67 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 52600f2e1f..5ec97d393d 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -7,9 +7,7 @@ if vim.fn.filereadable(plug_path) == 0 then print("Downloading junegunn/vim-plug to manage plugins...") vim.fn.mkdir(vim.fn.stdpath('config') .. '/autoload', 'p') vim.fn.system('curl -fLo ' .. plug_path .. ' --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim') - vim.api.nvim_create_autocmd("VimEnter", { - callback = function() vim.cmd("PlugInstall") end, - }) + vim.api.nvim_create_autocmd("VimEnter", { command = "PlugInstall" }) end -- Mappings for ,, @@ -17,28 +15,29 @@ vim.keymap.set("n", ",,", ":keepp /<++>ca<", { noremap = true }) vim.keymap.set("i", ",,", ":keepp /<++>ca<", { noremap = true }) -- Plugin setup with vim-plug +local Plug = vim.fn["plug#"] vim.fn['plug#begin'](vim.fn.stdpath('config') .. '/plugged') -vim.fn['plug#']('tpope/vim-surround') -vim.fn['plug#']('preservim/nerdtree') -vim.fn['plug#']('junegunn/goyo.vim') -vim.fn['plug#']('jreybert/vimagit') -vim.fn['plug#']('vimwiki/vimwiki') -vim.fn['plug#']('vim-airline/vim-airline') -vim.fn['plug#']('nvim-tree/nvim-web-devicons') -vim.fn['plug#']('tpope/vim-commentary') -vim.fn['plug#']('ap/vim-css-color') +Plug('tpope/vim-surround') +Plug('preservim/nerdtree') +Plug('junegunn/goyo.vim') +Plug('jreybert/vimagit') +Plug('vimwiki/vimwiki') +Plug('vim-airline/vim-airline') +Plug('nvim-tree/nvim-web-devicons') +Plug('tpope/vim-commentary') +Plug('ap/vim-css-color') -- New Plugins for LSP Server -vim.fn['plug#']('neovim/nvim-lspconfig') -vim.fn['plug#']('hrsh7th/nvim-cmp') -vim.fn['plug#']('hrsh7th/cmp-nvim-lsp') -vim.fn['plug#']('hrsh7th/cmp-buffer') -vim.fn['plug#']('hrsh7th/cmp-path') +Plug('neovim/nvim-lspconfig') +Plug('hrsh7th/nvim-cmp') +Plug('hrsh7th/cmp-nvim-lsp') +Plug('hrsh7th/cmp-buffer') +Plug('hrsh7th/cmp-path') vim.fn['plug#end']() -- General settings vim.opt.title = true --- vim.opt.background = "light" -vim.opt.background = "dark" +vim.opt.background = "light" +-- vim.opt.background = "dark" vim.opt.mouse = "a" vim.opt.hlsearch = false vim.opt.clipboard:append("unnamedplus") @@ -46,7 +45,7 @@ vim.opt.showmode = false vim.opt.ruler = false vim.opt.laststatus = 0 vim.opt.showcmd = false -vim.cmd("colorscheme vim") +vim.cmd.colorscheme("vim") -- Basic settings vim.keymap.set("n", "c", '"_c', { noremap = true }) @@ -64,8 +63,8 @@ vim.api.nvim_create_autocmd("FileType", { vim.keymap.set("v", ".", ":normal .", { noremap = true }) -- Goyo and spell-check mappings ---vim.keymap.set("n", "f", ":Goyo | set background=light | set linebreak", { noremap = true }) -vim.keymap.set("n", "f", ":Goyo | set background=dark | set linebreak", { noremap = true }) +vim.keymap.set("n", "f", ":Goyo | set background=light | set linebreak", { noremap = true }) +--vim.keymap.set("n", "f", ":Goyo | set background=dark | set linebreak", { noremap = true }) vim.keymap.set("n", "o", ":setlocal spell! spelllang=en_us", { noremap = true }) -- Split settings @@ -76,7 +75,7 @@ vim.opt.splitright = true vim.keymap.set("n", "n", ":NERDTreeToggle", { noremap = true }) vim.api.nvim_create_autocmd("BufEnter", { callback = function() - if vim.fn.winnr("$") == 1 and vim.b.NERDTree ~= nil and vim.b.NERDTree.isTabTree() then + if vim.fn.winnr("$") == 1 and vim.b.NERDTree and vim.b.NERDTree.isTabTree() then vim.cmd("q") end end, @@ -84,15 +83,13 @@ vim.api.nvim_create_autocmd("BufEnter", { vim.g.NERDTreeBookmarksFile = vim.fn.stdpath('data') .. '/NERDTreeBookmarks' -- vim-airline configuration -vim.cmd([[ -if !exists('g:airline_symbols') - let g:airline_symbols = {} - endif - let g:airline_symbols.colnr = ' C:' - let g:airline_symbols.linenr = ' L:' - let g:airline_symbols.maxlinenr = ' ' - let g:airline#extensions#whitespace#symbol = '!' -]]) + +local airline_conf = vim.g.airline_symbols or {} +airline_conf.colnr = " C:" +airline_conf.linenr = " L:" +airline_conf.maxlinenr = "☰ " +vim.g.airline_symbols = airline_conf +vim.g['airline#extensions#whitespace#symbol'] = '!' -- Split navigation vim.keymap.set("n", "", "h", { noremap = true }) @@ -147,7 +144,7 @@ vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { }) -- Sudo write -vim.api.nvim_create_user_command("W", "silent! write !sudo tee % >/dev/null | edit!", {}) +vim.keymap.set("ca", "w!!", "execute 'silent! write !sudo tee % >/dev/null' | edit!") -- Goyo for mutt vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { @@ -155,11 +152,6 @@ vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { callback = function() vim.cmd("Goyo 80") vim.api.nvim_feedkeys("jk", "n", false) - end, -}) -vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { - pattern = "/tmp/neomutt*", - callback = function() vim.keymap.set("n", "ZZ", ":Goyo!|x!", { buffer = true, noremap = true }) vim.keymap.set("n", "ZQ", ":Goyo!|q!", { buffer = true, noremap = true }) end, @@ -205,22 +197,16 @@ if vim.opt.diff:get() then end -- Toggle statusbar -local hidden_all = 0 + +local hidden_all = false local function toggle_hidden_all() - if hidden_all == 0 then - hidden_all = 1 - vim.opt.showmode = false - vim.opt.ruler = false - vim.opt.laststatus = 0 - vim.opt.showcmd = false - else - hidden_all = 0 - vim.opt.showmode = true - vim.opt.ruler = true - vim.opt.laststatus = 2 - vim.opt.showcmd = true - end + vim.opt.showmode = hidden_all + vim.opt.ruler = hidden_all + vim.opt.showcmd = hidden_all + vim.opt.laststatus = hidden_all and 2 or 0 + hidden_all = not hidden_all end + vim.keymap.set("n", "h", toggle_hidden_all, { noremap = true }) -- Load shortcuts @@ -230,7 +216,7 @@ pcall(vim.cmd, "source ~/.config/nvim/shortcuts.vim") local lspconfig = require'lspconfig' -- These language servers are in pacman or the AUR with the same name as given below, unless otherwise noted. local servers = { --- 'server_name', -- Language name -- Pacman/AUR name + -- 'server_name', -- Language name -- Pacman/AUR name 'pyright', -- Python -- pyright 'ts_ls', -- TypeScript -- typescript-language-server 'gopls', -- Go -- gopls @@ -240,7 +226,7 @@ local servers = { 'marksman', -- Markdown -- marksman 'r_language_server', -- R -- Run `install.packages("languageserver")` inside R 'csharp_ls', -- C# -- csharp-ls --- 'omnisharp', -- C# (legacy) -- omnisharp-roslyn-bin + -- 'omnisharp', -- C# (legacy) -- omnisharp-roslyn-bin 'lua_ls', -- Lua -- lua-language-server 'yamlls', -- YAML -- yaml-language-server 'bashls', -- bash -- bash-language-server @@ -272,17 +258,33 @@ cmp.setup({ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic" }) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic" }) -vim.diagnostic.config({ - virtual_text = false, -- Disable virtual text to avoid clutter - signs = true, -- Show signs in the gutter - underline = true, -- Underline errors - update_in_insert = false, -- Don’t update diagnostics in insert mode -}) +local diagnostics_auto_enabled = false +local diagnostics_autocmd_id = nil --- Automatically show diagnostics on hover -vim.o.updatetime = 250 -- Adjust delay for hover (in milliseconds) -vim.api.nvim_create_autocmd("CursorHold", { - callback = function() - vim.diagnostic.open_float(nil, { focusable = false }) - end, -}) +-- Function to toggle diagnostic auto-display +local function toggle_diagnostics_auto() + if diagnostics_auto_enabled then + -- Remove the autocommand if it exists + if diagnostics_autocmd_id then + vim.api.nvim_del_autocmd(diagnostics_autocmd_id) + diagnostics_autocmd_id = nil + end + diagnostics_auto_enabled = false + print("Diagnostic auto-display disabled") + else + -- Create the autocommand + diagnostics_autocmd_id = vim.api.nvim_create_autocmd("CursorHold", { + callback = function() + vim.diagnostic.open_float(nil, { focusable = false, scope = "cursor" }) + end, + }) + diagnostics_auto_enabled = true + print("Diagnostic auto-display enabled") + end +end + +-- Keybinding to toggle diagnostic auto-display +vim.keymap.set('n', 'e', toggle_diagnostics_auto, { desc = "Toggle diagnostic auto-display" }) + +-- Optional: Manual trigger to show diagnostics immediately +vim.keymap.set('n', 'E', vim.diagnostic.open_float, { desc = "Show diagnostic under cursor" }) From 78a4b560819cae662752b87b70a032c2194567ea Mon Sep 17 00:00:00 2001 From: Constantine Luke Matthew Bubar Date: Thu, 19 Feb 2026 18:42:58 -0500 Subject: [PATCH 4/7] added python icon --- .config/lf/icons | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/lf/icons b/.config/lf/icons index aad068cecc..6f4574442e 100644 --- a/.config/lf/icons +++ b/.config/lf/icons @@ -75,3 +75,4 @@ ex 🎯 *.torrent 🔽 *.jar ♨ *.java ♨ +*.py 🐍 From c8d4381210a5025bd604052f5e3486482cca32dd Mon Sep 17 00:00:00 2001 From: CLM Bubar Date: Tue, 17 Mar 2026 13:26:44 -0400 Subject: [PATCH 5/7] init.lua updates --- .config/nvim/init.lua | 152 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 145 insertions(+), 7 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 5ec97d393d..5fde62966c 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -32,12 +32,17 @@ Plug('hrsh7th/nvim-cmp') Plug('hrsh7th/cmp-nvim-lsp') Plug('hrsh7th/cmp-buffer') Plug('hrsh7th/cmp-path') +-- Plugins for Debugging with DAP +Plug('mfussenegger/nvim-dap') +Plug('nvim-neotest/nvim-nio') +Plug('rcarriga/nvim-dap-ui') +Plug('mfussenegger/nvim-dap-python') vim.fn['plug#end']() -- General settings vim.opt.title = true -vim.opt.background = "light" --- vim.opt.background = "dark" +-- vim.opt.background = "light" +vim.opt.background = "dark" vim.opt.mouse = "a" vim.opt.hlsearch = false vim.opt.clipboard:append("unnamedplus") @@ -62,9 +67,13 @@ vim.api.nvim_create_autocmd("FileType", { }) vim.keymap.set("v", ".", ":normal .", { noremap = true }) +-- Set light or dark theme -- + +vim.keymap.set("n", "l", ":set background=light", { noremap = true}) +vim.keymap.set("n", "d", ":set background=dark", { noremap = true}) + -- Goyo and spell-check mappings -vim.keymap.set("n", "f", ":Goyo | set background=light | set linebreak", { noremap = true }) ---vim.keymap.set("n", "f", ":Goyo | set background=dark | set linebreak", { noremap = true }) +vim.keymap.set("n", "f", ":Goyo | set linebreak", { noremap = true }) vim.keymap.set("n", "o", ":setlocal spell! spelllang=en_us", { noremap = true }) -- Split settings @@ -213,10 +222,20 @@ vim.keymap.set("n", "h", toggle_hidden_all, { noremap = true }) pcall(vim.cmd, "source ~/.config/nvim/shortcuts.vim") -- Syntax Highlighting - LSP setup -local lspconfig = require'lspconfig' + +-- local lspconfig = require'lspconfig' -- For Neovim versions before 0.11 + -- These language servers are in pacman or the AUR with the same name as given below, unless otherwise noted. + +vim.lsp.start({ + name = "openscad_lsp", + cmd = { "/usr/bin/openscad-lsp" }, + filetypes = { "scad" }, + root_dir = vim.fs.dirname(vim.fs.find({ ".git" }, { upward = true })[1] or vim.api.nvim_buf_get_name(0)), +}) + local servers = { - -- 'server_name', -- Language name -- Pacman/AUR name + --'server_name', -- Language name -- Pacman/AUR name 'pyright', -- Python -- pyright 'ts_ls', -- TypeScript -- typescript-language-server 'gopls', -- Go -- gopls @@ -230,10 +249,14 @@ local servers = { 'lua_ls', -- Lua -- lua-language-server 'yamlls', -- YAML -- yaml-language-server 'bashls', -- bash -- bash-language-server + 'cssls', -- CSS -- vscode-css-languageserver + 'openscad-lsp', -- OpenSCAD -- openscad-lsp } -- Automatically set up each LSP server in the list for _, server in ipairs(servers) do - lspconfig[server].setup {} + -- lspconfig[server].setup {} -- For Neovim versions before 0.11 + vim.lsp.config(server, {}) -- for Neovim versions including or after 0.11 + vim.lsp.enable(server) -- for Neovim versions including or after 0.11 end local cmp = require'cmp' @@ -283,8 +306,123 @@ local function toggle_diagnostics_auto() end end + -- Keybinding to toggle diagnostic auto-display vim.keymap.set('n', 'e', toggle_diagnostics_auto, { desc = "Toggle diagnostic auto-display" }) -- Optional: Manual trigger to show diagnostics immediately vim.keymap.set('n', 'E', vim.diagnostic.open_float, { desc = "Show diagnostic under cursor" }) + +-- Copy Diagnostics + +local function copy_diagnostics() + local bufnr = vim.api.nvim_get_current_buf() + local line = vim.api.nvim_win_get_cursor(0)[1] - 1 -- 0-indexed + local diags = vim.diagnostic.get(bufnr, { lnum = line }) + if #diags == 0 then + print("No diagnostics on this line") + return + end + + local messages = {} + for _, diag in ipairs(diags) do + table.insert(messages, diag.message) + end + + local all_msg = table.concat(messages, "\n") + vim.fn.setreg('+', all_msg) -- copy to system clipboard + print("Copied diagnostics to clipboard") +end + +-- Keybinding to copy diagnostics + +vim.keymap.set('n', 'y', copy_diagnostics, { desc = "Copy diagnostics under cursor" }) + +--- DAP --- + +-- Load nvim-dap and dap-ui +local dap = require('dap') +local dapui = require('dapui') + +-- dap-ui setup + +dapui.setup({ + icons = { expanded = "▾", collapsed = "▸"}, + mappings = { + expand = { "", "<2-LeftMouse" }, + open = 'o', + remove = 'd', + edit = "e", + repl = "r", + }, + layouts = { + { + elements = { + "scopes", + "breakpoints", + "stacks", + "watches", + }, + size = 40, -- width of the side panel + position = "left", + }, + { + elements = { + "repl", + }, + size = 10, -- height of the bottom panel + position = "bottom", + }, + }, + floating = { + max_height = nil, + max_width = nil, + border = "rounded", + mappings = { + close = { "q", "" }, + }, + }, +}) + +-- Open dap-ui automatically when debugging starts +dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() +end + +-- Close dap-ui automatically when debugging ends +dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() +end +dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() +end + +-- Configure Python adapter +dap.adapters.python = { + type = 'executable'; + command = 'python'; + args = { '-m', 'debugpy.adapter' }; +} + +-- Configure Python debug configurations +dap.configurations.python = { + { + type = 'python'; + request = 'launch'; + name = "Launch file"; + program = "${file}"; + pythonPath = function() + return '/usr/bin/python' -- change to your Python path + end; + }, +} + +-- Keybindings for DAP +vim.api.nvim_set_keymap('n', '', "lua require'dap'.continue()", { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', "lua require'dap'.step_over()", { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', "lua require'dap'.step_into()", { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', "lua require'dap'.step_out()", { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'b', "lua require'dap'.toggle_breakpoint()", { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'B', "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'dr', "lua require'dap'.repl.open()", { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'dl', "lua require'dap'.run_last()", { noremap = true, silent = true }) From f5ab2895ce7472369d5a5b069780db84549f6651 Mon Sep 17 00:00:00 2001 From: Constantine Luke Matthew Bubar Date: Wed, 18 Mar 2026 00:25:21 -0400 Subject: [PATCH 6/7] nvim config openscad --- .config/nvim/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 5fde62966c..06c192f623 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -225,15 +225,16 @@ pcall(vim.cmd, "source ~/.config/nvim/shortcuts.vim") -- local lspconfig = require'lspconfig' -- For Neovim versions before 0.11 --- These language servers are in pacman or the AUR with the same name as given below, unless otherwise noted. -vim.lsp.start({ +vim.lsp.start({ -- OpenSCAD LSP compatibility. Doesn't break anything but needs work. name = "openscad_lsp", cmd = { "/usr/bin/openscad-lsp" }, filetypes = { "scad" }, root_dir = vim.fs.dirname(vim.fs.find({ ".git" }, { upward = true })[1] or vim.api.nvim_buf_get_name(0)), }) +-- These language servers are in pacman or the AUR with the same name as given below, unless otherwise noted. + local servers = { --'server_name', -- Language name -- Pacman/AUR name 'pyright', -- Python -- pyright From 18f06a209f99b10ba9ba574949ae1226c5e2e087 Mon Sep 17 00:00:00 2001 From: Constantine Luke Matthew Bubar Date: Sat, 21 Mar 2026 12:20:50 -0400 Subject: [PATCH 7/7] added --embed-thumbnail to the yta command --- .config/shell/aliasrc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 35ceae821f..2fe9377857 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -4,9 +4,9 @@ [ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d" # Use $XINITRC variable if file exists. -[ -f "$XINITRC" ] && alias startx='startx $XINITRC' +[ -f "$XINITRC" ] && alias startx="startx $XINITRC" -[ -f "$MBSYNCRC" ] && alias mbsync='mbsync -c $MBSYNCRC' +[ -f "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" # sudo not required for some system commands for command in mount umount sv pacman updatedb su shutdown poweroff reboot ; do @@ -16,7 +16,7 @@ done; unset command se() { choice="$(find ~/.local/bin -mindepth 1 -printf '%P\n' | fzf)" [ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice" - } + ;} # Verbosity and settings that you pretty much just always are going to want. alias \ @@ -27,7 +27,7 @@ alias \ rsync="rsync -vrPlu" \ mkd="mkdir -pv" \ yt="yt-dlp --embed-metadata -i" \ - yta="yt -x -f bestaudio/best" \ + yta="yt -x -f bestaudio/best --embed-thumbnail" \ ytt="yt --skip-download --write-thumbnail" \ ffmpeg="ffmpeg -hide_banner" @@ -46,8 +46,8 @@ alias \ trem="transmission-remote" \ YT="youtube-viewer" \ sdn="shutdown -h now" \ - e='$EDITOR' \ - v='$EDITOR' \ + e="$EDITOR" \ + v="$EDITOR" \ p="pacman" \ xi="sudo xbps-install" \ xr="sudo xbps-remove -R" \ @@ -57,4 +57,5 @@ alias \ alias \ lf="lfub" \ magit="nvim -c MagitOnly" \ - ref='shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc' + ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \ + weath="less -S ${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" \