Compare commits
26 commits
neovim-wel
...
main
Author | SHA1 | Date | |
---|---|---|---|
bb9916703c | |||
7e5c97de78 | |||
ccc1ff6a21 | |||
e992db6c07 | |||
b49716c6f1 | |||
952d12d560 | |||
9a941cb6e3 | |||
6f83e32406 | |||
1f3249a316 | |||
9b360075c9 | |||
8e8ace0109 | |||
69bfb70de8 | |||
a978993d21 | |||
945556897f | |||
70defe1866 | |||
9d71ab4be4 | |||
938ff36c6b | |||
c3109dcf17 | |||
84a790c53f | |||
8ed7eab826 | |||
7153792ade | |||
5b85d400f0 | |||
a54e76ced0 | |||
5bed974dda | |||
f0c5df79b8 | |||
c520d3ec26 |
15 changed files with 1266 additions and 511 deletions
11
README.md
11
README.md
|
@ -1,5 +1,16 @@
|
|||
### dotfiles
|
||||
These are the messy dotfiles for my Arch Linux system. They're useful for
|
||||
- restoring my system after a catastrophe
|
||||
- almost nothing else :)
|
||||
|
||||
#### dracula/vim
|
||||
I am using my own fork of dracula/vim. Specifically, I changed the color of the virtual text so it doesn't conflict with the cursor line. When updates in upstream come through, we run the following:
|
||||
- `git switch master`
|
||||
- `git pull upstream`
|
||||
- `git switch adamc-main`
|
||||
- `git merge master`
|
||||
- `git add . && git commit`
|
||||
- `git push origin`
|
||||
|
||||
|
||||
Please feel free to contact me with any questions; I'll be glad to help.
|
||||
|
|
|
@ -7,10 +7,8 @@ run() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Currently not working
|
||||
# run "(pgrep alacritty && alacritty msg create-window --title bottom -e btm --battery || alacritty --title bottom -e btm --battery)"
|
||||
/usr/sbin/alacritty --title bottom --command btm --battery &
|
||||
/usr/sbin/alacritty --title awesome-startup &
|
||||
/usr/sbin/alacritty --socket "$XDG_RUNTIME_DIR/alacritty-main.sock" --title awesome-startup &
|
||||
/usr/sbin/alacritty --title bottom --option font.size=6.5 --command btm --battery &
|
||||
|
||||
run "cbatticon"
|
||||
run "blueman-applet"
|
||||
|
@ -21,4 +19,3 @@ run "xscreensaver -no-splash"
|
|||
run "sleep 4"
|
||||
run "wmctrl -r bottom -t 8"
|
||||
run "keepassxc"
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ local themes_path = gfs.get_themes_dir()
|
|||
|
||||
local theme = {}
|
||||
|
||||
theme.font = "Liberation Sans 8"
|
||||
theme.font = "Fantasque Sans Mono 8"
|
||||
|
||||
theme.bg_normal = "#222222"
|
||||
theme.bg_focus = "#535d6c"
|
||||
|
|
|
@ -14,6 +14,7 @@ local beautiful = require("beautiful")
|
|||
local naughty = require("naughty")
|
||||
local menubar = require("menubar")
|
||||
local lain = require("lain")
|
||||
-- local ruled = require("ruled")
|
||||
local hotkeys_popup = require("awful.hotkeys_popup")
|
||||
-- Enable hotkeys help widget for VIM and other apps
|
||||
-- when client with a matching name is opened:
|
||||
|
@ -54,9 +55,9 @@ beautiful.init(gears.filesystem.get_configuration_dir() .. "mytheme.lua")
|
|||
terminal = function()
|
||||
local is_running = os.execute("pgrep alacritty")
|
||||
if is_running == nil then
|
||||
return "/usr/sbin/alacritty"
|
||||
return "/usr/sbin/alacritty --socket /run/user/1000/alacritty-main.sock"
|
||||
else
|
||||
return "/usr/sbin/alacritty msg create-window"
|
||||
return "/usr/sbin/alacritty msg --socket /run/user/1000/alacritty-main.sock create-window"
|
||||
end
|
||||
end
|
||||
editor = os.getenv("EDITOR") or "nano"
|
||||
|
@ -164,7 +165,7 @@ local function set_wallpaper(s)
|
|||
-- Wallpaper
|
||||
if beautiful.wallpaper then
|
||||
-- local wallpaper = beautiful.wallpaper
|
||||
local wallpaper = "/home/adam/Pictures/wallpapers/shared/cemetery_sunray.jpeg"
|
||||
local wallpaper = "/home/adam/Pictures/wallpapers/shared/montauk-light-01.jpg"
|
||||
-- If wallpaper is a function, call it with the screen
|
||||
if type(wallpaper) == "function" then
|
||||
wallpaper = wallpaper(s)
|
||||
|
@ -173,18 +174,52 @@ local function set_wallpaper(s)
|
|||
end
|
||||
end
|
||||
|
||||
-- Notifications
|
||||
--[[
|
||||
ruled.notification.connect_signal("request::rules", function()
|
||||
-- Add a red background for urgent notifications.
|
||||
ruled.notification.append_rule {
|
||||
rule = { urgency = "critical" },
|
||||
properties = { bg = "#ff0000", fg = "#32cd32", timeout = 0 }
|
||||
}
|
||||
|
||||
-- Or green background for normal ones.
|
||||
ruled.notification.append_rule {
|
||||
rule = { urgency = "normal" },
|
||||
properties = { bg = "#32cd32", fg = "#800080"}
|
||||
}
|
||||
ruled.notification.append_rule {
|
||||
rule = { urgency = "low" },
|
||||
properties = { bg = "#bbccff", fg = "#191970"}
|
||||
}
|
||||
end)
|
||||
--]]
|
||||
|
||||
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
|
||||
screen.connect_signal("property::geometry", set_wallpaper)
|
||||
|
||||
local mymem = lain.widget.mem {
|
||||
settings = function()
|
||||
widget:set_markup(" mem " .. mem_now.perc .. " swp " .. math.floor((mem_now.swapused / mem_now.swap) * 100))
|
||||
local mem_spacer = ""
|
||||
local swp_spacer = ""
|
||||
local swp_display = math.floor((mem_now.swapused / mem_now.swap) * 100)
|
||||
if mem_now.perc < 10 then
|
||||
mem_spacer = " "
|
||||
end
|
||||
if swp_display < 10 then
|
||||
swp_spacer = " "
|
||||
end
|
||||
widget:set_markup(" mem " .. mem_spacer .. mem_now.perc .. " swp " .. swp_spacer .. swp_display .. " ")
|
||||
end
|
||||
}
|
||||
|
||||
local mycpu = lain.widget.cpu {
|
||||
settings = function()
|
||||
widget:set_markup(" cpu " .. cpu_now.usage)
|
||||
local cpu_spacer = ""
|
||||
if cpu_now.usage < 10 then
|
||||
cpu_spacer = " "
|
||||
end
|
||||
widget:set_markup(" cpu " .. cpu_spacer .. cpu_now.usage)
|
||||
end
|
||||
}
|
||||
|
||||
|
|
|
@ -4,55 +4,74 @@
|
|||
#
|
||||
# This script sends a canned email response to those who've errone-
|
||||
# ously emailed me at <amcooper@gmail.com>. Once I've manually
|
||||
# moved those emails into the `misdirected` folder, it iterates
|
||||
# over those emails and responds.
|
||||
# tagged those emails `misdirected`, it iterates over those emails and
|
||||
# responds.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
MISDIRECTED_DIR=/home/adam/Maildir/misdirected
|
||||
|
||||
if [[ -z "$(ls -A "$MISDIRECTED_DIR/cur")" ]] && [[ -z "$(ls -A "$MISDIRECTED_DIR/new")" ]]; then
|
||||
echo "[autoreply.sh] The misdirected folders are currently empty. Exiting..."
|
||||
if [[ -z "$(notmuch search tag:misdirected)" ]] ; then
|
||||
echo "[autoreply.sh] Currently no emails are tagged 'misdirected'. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Handle option(s)
|
||||
dry_run=
|
||||
while getopts n opt ; do
|
||||
printf "[debug] opt: %s\n\n" $opt
|
||||
case $opt in
|
||||
n) dry_run=1;;
|
||||
?) echo "Usage: /path/to/autoreply.sh/ [ -n ]"
|
||||
exit 2;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This weird feed-find-output-into-while-loop comes from
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC2044#correct-code
|
||||
while IFS= read -r -d '' file ; do
|
||||
while IFS= read -r -d '' thread ; do
|
||||
echo "[loop] Preparing the email..."
|
||||
|
||||
# Make a temporary file
|
||||
temporary_file=$(mktemp /tmp/autoreplyXXXXX)
|
||||
temporary_file=$(mktemp /tmp/autoreply-XXXXX)
|
||||
echo "[debug] Temporary file: $temporary_file"
|
||||
|
||||
# Pull sender (i.e. recipient of my email) and subject from email
|
||||
recipient="$(perl -lane 'print if /^From:/' "$file" | cut -d' ' -f2-)" ### "Frantz Fanon <ffanon@riseup.net>"
|
||||
subject="Re: $(perl -lane 'print if /^Subject:/' "$file" | cut -d' ' -f2-)" ### "Re: Lorem ipsum baby"
|
||||
# Parse out the thread-id
|
||||
thread_id=$(echo "$thread" | cut -f2 -d':')
|
||||
echo "[debug] thread_id: $thread_id"
|
||||
|
||||
# Parse out the reply headers and original message body
|
||||
temporary_reply=$(mktemp /tmp/notmuch-reply-XXXXX)
|
||||
echo "[debug] Temporary reply: $temporary_reply"
|
||||
notmuch reply --format=json thread:$thread_id > $temporary_reply
|
||||
subject="$(jq -r '."reply-headers".Subject' $temporary_reply)"
|
||||
sender="$(jq -r '."reply-headers".From' $temporary_reply)"
|
||||
recipient="$(jq -r '."reply-headers".To' $temporary_reply)"
|
||||
in_reply_to="$(jq -r '."reply-headers"."In-reply-to"' $temporary_reply)"
|
||||
references="$(jq -r '."reply-headers".References' $temporary_reply)"
|
||||
orig_sender="$(jq -r '.original.headers.From' $temporary_reply)"
|
||||
date="$(jq -r '.original.headers.Date' $temporary_reply)"
|
||||
orig_body="$(jq -r '.original.body[0].content[] | select(."content-type" == "text/plain") | .content' $temporary_reply)"
|
||||
|
||||
# Copy canned message to temporary file
|
||||
cp /home/adam/dotfiles/arch/bin/autoreply/misdirected_email_autoreply.txt "$temporary_file"
|
||||
printf "From: %s\nSubject: %s\nTo: %s\nDate: $(date +'%a, %d %b %Y %R %z')\nIn-Reply-To: %s\nReferences: %s\n\n" "$sender" "$subject" "$recipient" "$in_reply_to" "$references" >> "$temporary_file"
|
||||
cat /home/adam/dotfiles/bin/autoreply/misdirected_email_autoreply.txt >> "$temporary_file"
|
||||
printf "\n\nOn %s, %s wrote:\n" "$date" "$orig_sender" >> "$temporary_file"
|
||||
|
||||
# Append email body to temporary file
|
||||
discard="0"
|
||||
while IFS= read -r line ; do
|
||||
if [[ $discard = "1" ]]; then
|
||||
echo "$line" >> "$temporary_file"
|
||||
else
|
||||
if [[ -z "$line" ]]; then
|
||||
discard="1"
|
||||
fi
|
||||
fi
|
||||
done < "$file"
|
||||
printf "%s\n" "$orig_body" >> "$temporary_file"
|
||||
|
||||
# Send the email!
|
||||
printf "[debug] Outgoing mail:\n%s\n" "$(cat $temporary_file)"
|
||||
if [[ -z "$dry_run" ]] ; then
|
||||
echo "[loop] Sending reply to $recipient ... "
|
||||
neomutt -s "$subject" -c amcooper@gmail.com "$recipient" < "$temporary_file"
|
||||
msmtp --read-envelope-from --read-recipients <"$temporary_file"
|
||||
notmuch insert --folder=Sent -inbox -unread +sent +misdirected-reply <"$temporary_file"
|
||||
|
||||
# Move the misdirected email into `INBOX/cur`
|
||||
echo "[loop] Moving the emails..."
|
||||
mv "$file" /home/adam/Maildir/INBOX/cur
|
||||
# Remove the misdirected tag
|
||||
notmuch tag -misdirected -- thread:"$thread_id"
|
||||
fi
|
||||
|
||||
echo "[loop] Done."
|
||||
printf "%s\n\n" "[loop] Done."
|
||||
|
||||
done < <(find "$MISDIRECTED_DIR" -path "$MISDIRECTED_DIR/tmp" -prune -o -type f -print0)
|
||||
done < <(notmuch search --output=threads --format=text0 tag:misdirected)
|
||||
|
||||
echo "[autoreply.sh] All done!"
|
||||
|
|
9
bin/start-tuis.sh
Executable file
9
bin/start-tuis.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# start-tuis.sh
|
||||
#
|
||||
# Convenience script to start up my usual TUIs
|
||||
|
||||
alacritty msg create-window --title joplin --command /home/adam/.config/nvm/versions/node/v20.11.1/bin/joplin
|
||||
alacritty msg create-window --title newsboat --command newsboat
|
||||
alacritty msg create-window --title aerc --command aerc
|
2
bin/zoom-scaled.sh
Executable file
2
bin/zoom-scaled.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#! /bin/bash
|
||||
QT_SCALE_FACTOR=0.8 /usr/bin/zoom &
|
193
neovim/init-dap.lua
Normal file
193
neovim/init-dap.lua
Normal file
|
@ -0,0 +1,193 @@
|
|||
local js_based_languages = { "javascript", "typescript" }
|
||||
|
||||
-- lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
event = "VeryLazy",
|
||||
requires = "mfussenegger/nvim-dap"
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
|
||||
-- local Config = require("lazyvim.config")
|
||||
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
|
||||
|
||||
--[[
|
||||
for name, sign in pairs(Config.icons.dap) do
|
||||
sign = type(sign) == "table" and sign or { sign }
|
||||
vim.fn.sign_define(
|
||||
"Dap" .. name,
|
||||
{ text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] }
|
||||
)
|
||||
end
|
||||
--]]
|
||||
|
||||
for _, language in ipairs({ "javascript", "typescript" }) do
|
||||
dap.configurations[language] = {
|
||||
-- Debug single nodejs files
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = "${file}",
|
||||
cwd = vim.fn.getcwd(),
|
||||
sourceMaps = true,
|
||||
},
|
||||
-- Debug nodejs processes (make sure to add --inspect when you run the process)
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "attach",
|
||||
name = "Attach",
|
||||
processId = require("dap.utils").pick_process,
|
||||
cwd = vim.fn.getcwd(),
|
||||
sourceMaps = true,
|
||||
},
|
||||
-- Debug web applications (client side)
|
||||
{
|
||||
type = "pwa-chrome",
|
||||
request = "launch",
|
||||
name = "Launch & Debug Chrome",
|
||||
url = function()
|
||||
local co = coroutine.running()
|
||||
return coroutine.create(function()
|
||||
vim.ui.input({
|
||||
prompt = "Enter URL: ",
|
||||
default = "http://localhost:3000",
|
||||
}, function(url)
|
||||
if url == nil or url == "" then
|
||||
return
|
||||
else
|
||||
coroutine.resume(co, url)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end,
|
||||
webRoot = vim.fn.getcwd(),
|
||||
protocol = "inspector",
|
||||
sourceMaps = true,
|
||||
userDataDir = false,
|
||||
},
|
||||
-- Divider for the launch.json derived configs
|
||||
{
|
||||
name = "----- ↓ launch.json configs ↓ -----",
|
||||
type = "",
|
||||
request = "launch",
|
||||
},
|
||||
}
|
||||
end
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>da",
|
||||
function()
|
||||
if vim.fn.filereadable(".vscode/launch.json") then
|
||||
local dap_vscode = require("dap.ext.vscode")
|
||||
dap_vscode.load_launchjs(nil, {
|
||||
["pwa-node"] = js_based_languages,
|
||||
["chrome"] = js_based_languages,
|
||||
["pwa-chrome"] = js_based_languages,
|
||||
})
|
||||
end
|
||||
require("dap").continue()
|
||||
end,
|
||||
desc = "DAP: Run with Args",
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
-- Install the vscode-js-debug adapter
|
||||
{
|
||||
"microsoft/vscode-js-debug",
|
||||
-- After install, build it and rename the dist directory to out
|
||||
build = "npm install --legacy-peer-deps --no-save && npx gulp vsDebugServerBundle && rm -rf out && mv dist out",
|
||||
version = "1.*",
|
||||
},
|
||||
{
|
||||
"mxsdev/nvim-dap-vscode-js",
|
||||
config = function()
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require("dap-vscode-js").setup({
|
||||
-- Path of node executable. Defaults to $NODE_PATH, and then "node"
|
||||
-- node_path = "node",
|
||||
|
||||
-- Path to vscode-js-debug installation.
|
||||
debugger_path = vim.fn.resolve(vim.fn.stdpath("data") .. "/lazy/vscode-js-debug"),
|
||||
|
||||
-- Command to use to launch the debug server. Takes precedence over "node_path" and "debugger_path"
|
||||
-- debugger_cmd = { "js-debug-adapter" },
|
||||
|
||||
-- which adapters to register in nvim-dap
|
||||
adapters = {
|
||||
"chrome",
|
||||
"pwa-node",
|
||||
"pwa-chrome",
|
||||
"pwa-msedge",
|
||||
"pwa-extensionHost",
|
||||
"node-terminal",
|
||||
},
|
||||
|
||||
-- Path for file logging
|
||||
-- log_file_path = "(stdpath cache)/dap_vscode_js.log",
|
||||
|
||||
-- Logging level for output to file. Set to false to disable logging.
|
||||
-- log_file_level = false,
|
||||
|
||||
-- Logging level for output to console. Set to false to disable console output.
|
||||
-- log_console_level = vim.log.levels.ERROR,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"Joakker/lua-json5",
|
||||
build = "./install.sh",
|
||||
},
|
||||
},
|
||||
},
|
||||
{ "leoluz/nvim-dap-go", event = "VeryLazy" },
|
||||
{ "williamboman/mason.nvim", event = "VeryLazy" },
|
||||
{ "williamboman/mason-lspconfig.nvim", event = "VeryLazy" },
|
||||
})
|
||||
|
||||
--[[ mason
|
||||
Mason manages external editor plugins such as LSP servers, DAP servers,
|
||||
linters, and formatters. There are further recommended plugins for better
|
||||
integration.
|
||||
--]]
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup()
|
||||
|
||||
|
||||
require('dap-go').setup()
|
||||
|
||||
local dap, dapui = require("dap"), require("dapui")
|
||||
dapui.setup()
|
||||
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
-- Switch syntax highlighting on
|
||||
vim.cmd("syntax enable")
|
762
neovim/init.lua
762
neovim/init.lua
|
@ -6,8 +6,8 @@ vim.opt.clipboard = "unnamedplus,unnamed"
|
|||
|
||||
-- Spaces indentation
|
||||
vim.opt.expandtab = true -- converts tabs to spaces
|
||||
vim.opt.tabstop = 2 -- tab equals 2 spaces
|
||||
vim.opt.shiftwidth = 2 -- indent size in characters
|
||||
vim.opt.tabstop = 4 -- tab equals 4 spaces
|
||||
vim.opt.shiftwidth = 4 -- indent size in characters
|
||||
|
||||
-- Show whitespace (:list)
|
||||
vim.opt.listchars = "eol:¬,tab:>-,trail:~,extends:>,precedes:<,space:·"
|
||||
|
@ -22,34 +22,61 @@ vim.opt.splitright = true
|
|||
vim.opt.cursorline = true
|
||||
|
||||
-- Enable folding
|
||||
vim.opt.foldmethod = "indent"
|
||||
vim.opt.foldlevel = 99
|
||||
vim.opt.foldmethod = "syntax"
|
||||
vim.opt.foldlevel = 5
|
||||
|
||||
-- Terminal colors
|
||||
-- Enable 24-bit RGB color in the TUI
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
-- Cursor line context
|
||||
-- Minimal number of lines kept above and below the cursor
|
||||
vim.opt.scrolloff = 5
|
||||
|
||||
-- Turn off highlight search
|
||||
vim.opt.hlsearch = false
|
||||
|
||||
-- Temporary file locations
|
||||
vim.opt.backupdir = ".backup/," .. HOME .. "/.backup/,/tmp//"
|
||||
vim.opt.directory = ".swp/," .. HOME .. "/.swp/,/tmp//"
|
||||
|
||||
-- netrw
|
||||
-- This is the workspace file explorer
|
||||
vim.g.netrw_winsize = 25 -- width of the file explorer
|
||||
vim.g.netrw_liststyle = 3 -- tree style listing
|
||||
|
||||
-- Escape exits terminal mode
|
||||
vim.keymap.set("t", "<Esc>", "<c-\\><c-n>", { noremap = true })
|
||||
|
||||
-- Sane vim split naviagation (via Gaslight blog)
|
||||
vim.keymap.set("n", "<c-j>", "<c-w>j", { noremap = true })
|
||||
vim.keymap.set("n", "<c-k>", "<c-w>k", { noremap = true })
|
||||
vim.keymap.set("n", "<c-h>", "<c-w>h", { noremap = true })
|
||||
vim.keymap.set("n", "<c-l>", "<c-w>l", { noremap = true })
|
||||
vim.keymap.set("t", "<c-j>", "<c-\\><c-n><c-w>j", { noremap = true })
|
||||
vim.keymap.set("t", "<c-k>", "<c-\\><c-n><c-w>k", { noremap = true })
|
||||
vim.keymap.set("t", "<c-h>", "<c-\\><c-n><c-w>h", { noremap = true })
|
||||
vim.keymap.set("t", "<c-l>", "<c-\\><c-n><c-w>l", { noremap = true })
|
||||
vim.keymap.set("n", "<c-j>", "<c-w>j", { noremap = true, desc = 'Go to window below' })
|
||||
vim.keymap.set("n", "<c-k>", "<c-w>k", { noremap = true, desc = 'Go to window above' })
|
||||
vim.keymap.set("n", "<c-h>", "<c-w>h", { noremap = true, desc = 'Go to window to the left' })
|
||||
-- N.B. This conflicts with the NetRW directory refresh command. Use the alternative `:e .`.
|
||||
-- TODO: This seems not to work for netrw.
|
||||
vim.keymap.set("n", "<c-l>", "<c-w>l", { noremap = true, desc = 'Go to window to the right' })
|
||||
|
||||
vim.keymap.set({"i", "n", "t", "v"}, "<F10>", function () vim.cmd("nohlsearch") end)
|
||||
vim.keymap.set("t", "<c-j>", "<c-\\><c-n><c-w>j", { noremap = true, desc = 'Go to window below' })
|
||||
vim.keymap.set("t", "<c-k>", "<c-\\><c-n><c-w>k", { noremap = true, desc = 'Go to window above' })
|
||||
vim.keymap.set("t", "<c-h>", "<c-\\><c-n><c-w>h", { noremap = true, desc = 'Go to window to the left' })
|
||||
vim.keymap.set("t", "<c-l>", "<c-\\><c-n><c-w>l", { noremap = true, desc = 'Go to window to the right' })
|
||||
|
||||
vim.keymap.set(
|
||||
{ "n", "t" },
|
||||
"<leader>z",
|
||||
function()
|
||||
-- This restores the UI to the saved layout 'idelayout' (if it exists)
|
||||
if vim.fn.exists("idelayout") ~= 0 then
|
||||
vim.cmd("exec idelayout")
|
||||
end
|
||||
end,
|
||||
{ desc = "Revert window layout" }
|
||||
)
|
||||
|
||||
local terminalgroup = vim.api.nvim_create_augroup("TerminalGroup", { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "TermOpen", "TermEnter" },
|
||||
{
|
||||
group = terminalgroup,
|
||||
pattern = "*",
|
||||
command = "set nonumber"
|
||||
}
|
||||
)
|
||||
|
||||
-- lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
|
@ -65,151 +92,372 @@ if not vim.loop.fs_stat(lazypath) then
|
|||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
local js_based_languages = { "javascript", "typescript" }
|
||||
|
||||
require("lazy").setup({
|
||||
{
|
||||
"dracula/vim",
|
||||
url = "https://git.theadamcooper.com/adam/dracula-vim.git",
|
||||
branch = "adamc-main",
|
||||
name = "dracula",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.cmd([[colorscheme dracula]])
|
||||
vim.cmd.colorscheme("dracula")
|
||||
end,
|
||||
},
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
"nvimdev/lspsaga.nvim",
|
||||
"nvim-lualine/lualine.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"nvim-lua/plenary.nvim",
|
||||
{ "nvim-telescope/telescope.nvim", branch = "0.1.x" },
|
||||
{ "echasnovski/mini.nvim", version = false },
|
||||
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
|
||||
"neovim/nvim-lspconfig",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
"tpope/vim-fugitive",
|
||||
"lewis6991/gitsigns.nvim",
|
||||
"tpope/vim-surround",
|
||||
{
|
||||
"kylechui/nvim-surround",
|
||||
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-surround").setup({
|
||||
-- Configuration here, or leave empty to use defaults
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
-- N.B. Setting `timeoutlen` to 0 seems to break the plugin
|
||||
vim.o.timeoutlen = 300 -- 0? 500? 300?
|
||||
end,
|
||||
opts = {
|
||||
win = {
|
||||
border = "single",
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Local Keymaps (which-key)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"ray-x/lsp_signature.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
config = function(_, opts) require 'lsp_signature'.setup(opts) end
|
||||
},
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua", -- only load on lua files
|
||||
opts = {
|
||||
library = {
|
||||
-- See the configuration section for more details
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = "luvit-meta/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
{ "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings
|
||||
{ -- optional completion source for require statements and module annotations
|
||||
"hrsh7th/nvim-cmp",
|
||||
opts = function(_, opts)
|
||||
opts.sources = opts.sources or {}
|
||||
table.insert(opts.sources, {
|
||||
name = "lazydev",
|
||||
group_index = 0, -- set group index to 0 to skip loading LuaLS completions
|
||||
})
|
||||
end,
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
},
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
|
||||
-- local Config = require("lazyvim.config")
|
||||
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
|
||||
|
||||
--[[
|
||||
for name, sign in pairs(Config.icons.dap) do
|
||||
sign = type(sign) == "table" and sign or { sign }
|
||||
vim.fn.sign_define(
|
||||
"Dap" .. name,
|
||||
{ text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] }
|
||||
)
|
||||
end
|
||||
--]]
|
||||
|
||||
for _, language in ipairs({ "javascript", "typescript" }) do
|
||||
dap.configurations[language] = {
|
||||
-- Debug single nodejs files
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = "${file}",
|
||||
cwd = vim.fn.getcwd(),
|
||||
sourceMaps = true,
|
||||
},
|
||||
-- Debug nodejs processes (make sure to add --inspect when you run the process)
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "attach",
|
||||
name = "Attach",
|
||||
processId = require("dap.utils").pick_process,
|
||||
cwd = vim.fn.getcwd(),
|
||||
sourceMaps = true,
|
||||
},
|
||||
-- Debug web applications (client side)
|
||||
{
|
||||
type = "pwa-chrome",
|
||||
request = "launch",
|
||||
name = "Launch & Debug Chrome",
|
||||
url = function()
|
||||
local co = coroutine.running()
|
||||
return coroutine.create(function()
|
||||
vim.ui.input({
|
||||
prompt = "Enter URL: ",
|
||||
default = "http://localhost:3000",
|
||||
}, function(url)
|
||||
if url == nil or url == "" then
|
||||
return
|
||||
else
|
||||
coroutine.resume(co, url)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end,
|
||||
webRoot = vim.fn.getcwd(),
|
||||
protocol = "inspector",
|
||||
sourceMaps = true,
|
||||
userDataDir = false,
|
||||
},
|
||||
-- Divider for the launch.json derived configs
|
||||
{
|
||||
name = "----- ↓ launch.json configs ↓ -----",
|
||||
type = "",
|
||||
request = "launch",
|
||||
},
|
||||
}
|
||||
end
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>dO",
|
||||
function()
|
||||
require("dap").step_out()
|
||||
end,
|
||||
desc = "DAP: Step Out",
|
||||
},
|
||||
{
|
||||
"<leader>do",
|
||||
function()
|
||||
require("dap").step_over()
|
||||
end,
|
||||
desc = "DAP: Step Over",
|
||||
},
|
||||
{
|
||||
"<leader>db",
|
||||
function()
|
||||
require("dap").toggle_breakpoint()
|
||||
end,
|
||||
desc = "DAP: Toggle breakpoint",
|
||||
},
|
||||
{
|
||||
"<leader>dc",
|
||||
function()
|
||||
require("dap").continue()
|
||||
end,
|
||||
desc = "DAP: Continue",
|
||||
},
|
||||
{
|
||||
"<leader>di",
|
||||
function()
|
||||
require("dap").step_into()
|
||||
end,
|
||||
desc = "DAP: Step Into",
|
||||
},
|
||||
{
|
||||
"<leader>da",
|
||||
function()
|
||||
if vim.fn.filereadable(".vscode/launch.json") then
|
||||
local dap_vscode = require("dap.ext.vscode")
|
||||
dap_vscode.load_launchjs(nil, {
|
||||
["pwa-node"] = js_based_languages,
|
||||
["chrome"] = js_based_languages,
|
||||
["pwa-chrome"] = js_based_languages,
|
||||
})
|
||||
end
|
||||
require("dap").continue()
|
||||
end,
|
||||
desc = "DAP: Run with Args",
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
-- Install the vscode-js-debug adapter
|
||||
{
|
||||
"microsoft/vscode-js-debug",
|
||||
-- After install, build it and rename the dist directory to out
|
||||
build =
|
||||
"npm install --legacy-peer-deps --no-save && npx gulp vsDebugServerBundle && rm -rf out && mv dist out",
|
||||
version = "1.*",
|
||||
},
|
||||
{
|
||||
"mxsdev/nvim-dap-vscode-js",
|
||||
config = function()
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require("dap-vscode-js").setup({
|
||||
-- Path of node executable. Defaults to $NODE_PATH, and then "node"
|
||||
-- node_path = "node",
|
||||
|
||||
-- Path to vscode-js-debug installation.
|
||||
debugger_path = vim.fn.resolve(vim.fn.stdpath("data") .. "/lazy/vscode-js-debug"),
|
||||
|
||||
-- Command to use to launch the debug server. Takes precedence over "node_path" and "debugger_path"
|
||||
-- debugger_cmd = { "js-debug-adapter" },
|
||||
|
||||
-- which adapters to register in nvim-dap
|
||||
adapters = {
|
||||
"chrome",
|
||||
"pwa-node",
|
||||
"pwa-chrome",
|
||||
"pwa-msedge",
|
||||
"pwa-extensionHost",
|
||||
"node-terminal",
|
||||
},
|
||||
|
||||
-- Path for file logging
|
||||
-- log_file_path = "(stdpath cache)/dap_vscode_js.log",
|
||||
|
||||
-- Logging level for output to file. Set to false to disable logging.
|
||||
-- log_file_level = false,
|
||||
|
||||
-- Logging level for output to console. Set to false to disable console output.
|
||||
-- log_console_level = vim.log.levels.ERROR,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"Joakker/lua-json5",
|
||||
build = "./install.sh",
|
||||
},
|
||||
},
|
||||
},
|
||||
{ "leoluz/nvim-dap-go", event = "VeryLazy" },
|
||||
{ "williamboman/mason.nvim", event = "VeryLazy" },
|
||||
{ "williamboman/mason-lspconfig.nvim", event = "VeryLazy" },
|
||||
{ "nvimdev/lspsaga.nvim", event = "VeryLazy" },
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VeryLazy",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build =
|
||||
"cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
|
||||
},
|
||||
},
|
||||
},
|
||||
{ "tpope/vim-fugitive", event = "VeryLazy" },
|
||||
{ "lewis6991/gitsigns.nvim", event = "VeryLazy" },
|
||||
{
|
||||
"pwntester/octo.nvim",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
require("octo").setup()
|
||||
end,
|
||||
event = "VeryLazy",
|
||||
},
|
||||
{ "famiu/bufdelete.nvim", event = "VeryLazy" },
|
||||
-- { "vlime/vlime", config = function() rtp = 'vim/' end },
|
||||
--[[
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
event = "InsertEnter",
|
||||
config = true,
|
||||
-- use opts = {} for passing setup options
|
||||
-- this is equalent to setup({}) function
|
||||
},
|
||||
--]]
|
||||
--{ "bhurlow/vim-parinfer", event = "VeryLazy" },
|
||||
{ "kovisoft/paredit" },
|
||||
--{ "monkoose/parsley", event = "VeryLazy" },
|
||||
{ "monkoose/nvlime", ft = { "lisp" }, dependencies = { "monkoose/parsley" } },
|
||||
{
|
||||
'MeanderingProgrammer/markdown.nvim',
|
||||
-- name = 'render-markdown', -- Only needed if you have another plugin named markdown.nvim
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter', -- Mandatory
|
||||
'nvim-tree/nvim-web-devicons', -- Optional but recommended
|
||||
},
|
||||
config = function()
|
||||
require('render-markdown').setup({})
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
--[[ mason
|
||||
Mason manages external editor plugins such as LSP servers, DAP servers,
|
||||
linters, and formatters. There are further recommended plugins for better
|
||||
integration.
|
||||
--]]
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup()
|
||||
|
||||
--[[ lualine
|
||||
Lualine provides the status bar as well as the tabline.
|
||||
--]]
|
||||
require('lualine').setup {
|
||||
options = { theme = 'dracula' },
|
||||
tabline = {
|
||||
lualine_a = { 'buffers' },
|
||||
}
|
||||
lualine_a = {
|
||||
{
|
||||
'buffers',
|
||||
mode = 4,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
--[[ Telescope
|
||||
Telescope provides lists, pickers, etc. This section includes just the
|
||||
functions bound to keymaps.
|
||||
--]]
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope: find files' })
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope: live grep' })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope: buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope: help tags' })
|
||||
|
||||
--------------------
|
||||
-- nvim-lspconfig --
|
||||
--------------------
|
||||
require "lsp_signature".setup()
|
||||
|
||||
-- Setup language servers.
|
||||
local lua_ls_setup = {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
--[[ nvim-cmp
|
||||
nvim-cmp is a text completion engine.
|
||||
]]
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
local lspconfig = require('lspconfig')
|
||||
lspconfig.gopls.setup {capabilities = capabilities}
|
||||
lspconfig.lua_ls.setup(lua_ls_setup)
|
||||
lspconfig.pyright.setup {capabilities = capabilities}
|
||||
lspconfig.tsserver.setup {capabilities = capabilities}
|
||||
lspconfig.rust_analyzer.setup {
|
||||
-- Server-specific settings. See `:help lspconfig-setup`
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
['rust-analyzer'] = {},
|
||||
},
|
||||
}
|
||||
|
||||
-- Global mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, { desc = 'Diagnostic: open float' })
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Diagnostic: go to previous' })
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Diagnostic: go to next' })
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, { desc = 'Diagnostic: set loclist' })
|
||||
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = function(desc)
|
||||
return { buffer = ev.buf, desc = desc }
|
||||
end
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts('LSP: go to declaration'))
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts('LSP: go to definition'))
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts('LSP: hover'))
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts('LSP: go to implementation'))
|
||||
-- This setting steps on my split navigation setting, so I changed it
|
||||
-- to the probably harmless F9.
|
||||
-- vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts(''))
|
||||
vim.keymap.set('n', '<F9>', vim.lsp.buf.signature_help, opts('LSP: signature help'))
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts('LSP: add workspace folder'))
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts('LSP: remove workspace folder'))
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts('LSP: list workspace folder'))
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts('LSP: go to type definition'))
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts('LSP: rename token'))
|
||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts('LSP: code action'))
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts('LSP: go to references'))
|
||||
vim.keymap.set('n', '<space>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts('LSP: format'))
|
||||
end,
|
||||
})
|
||||
|
||||
-- Set up nvim-cmp.
|
||||
local cmp = require 'cmp'
|
||||
|
||||
cmp.setup({
|
||||
|
@ -271,6 +519,121 @@ cmp.setup.cmdline(':', {
|
|||
})
|
||||
})
|
||||
|
||||
--[[ nvim-lspconfig
|
||||
--]]
|
||||
|
||||
-- Setup language servers.
|
||||
local lua_ls_setup = {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
local lspconfig = require('lspconfig')
|
||||
lspconfig.gopls.setup { capabilities = capabilities }
|
||||
lspconfig.lua_ls.setup(lua_ls_setup)
|
||||
lspconfig.pyright.setup { capabilities = capabilities }
|
||||
lspconfig.tsserver.setup { capabilities = capabilities }
|
||||
lspconfig.rust_analyzer.setup {
|
||||
-- Server-specific settings. See `:help lspconfig-setup`
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
['rust-analyzer'] = {},
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable (broadcasting) snippet capability for completion
|
||||
local capabilities_html = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities_html.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
require 'lspconfig'.html.setup {
|
||||
capabilities = capabilities_html,
|
||||
}
|
||||
|
||||
-- Global mappings : Diagnostics
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, { desc = 'Diagnostic: open float' })
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Diagnostic: go to previous' })
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Diagnostic: go to next' })
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, { desc = 'Diagnostic: set loclist' })
|
||||
|
||||
-- Add a border to LSP windows
|
||||
local _border = "single"
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover, {
|
||||
border = _border
|
||||
}
|
||||
)
|
||||
|
||||
-- TODO: Is this necessary? Or is signature help being handled with LSPSaga?
|
||||
--[[
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
|
||||
vim.lsp.handlers.signature_help, {
|
||||
border = _border
|
||||
}
|
||||
)
|
||||
--]]
|
||||
|
||||
vim.diagnostic.config {
|
||||
float = { border = _border, max_width = 120 }
|
||||
}
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = function(desc)
|
||||
return { buffer = ev.buf, desc = desc }
|
||||
end
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts('LSP: go to declaration'))
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts('LSP: go to definition'))
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts('LSP: hover'))
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts('LSP: go to implementation'))
|
||||
-- This setting steps on my split navigation setting, so I changed it
|
||||
-- to the probably harmless F9.
|
||||
-- vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts(''))
|
||||
vim.keymap.set('n', '<F9>', vim.lsp.buf.signature_help, opts('LSP: signature help'))
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts('LSP: add workspace folder'))
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts('LSP: remove workspace folder'))
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts('LSP: list workspace folder'))
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts('LSP: go to type definition'))
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts('LSP: rename token'))
|
||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts('LSP: code action'))
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts('LSP: go to references'))
|
||||
vim.keymap.set('n', '<space>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts('LSP: format'))
|
||||
end,
|
||||
})
|
||||
|
||||
require('gitsigns').setup({
|
||||
signs = {
|
||||
add = { text = '│' },
|
||||
|
@ -325,19 +688,21 @@ require('gitsigns').setup({
|
|||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, {expr=true})
|
||||
end, { expr = true, desc = 'GitSigns: go to next hunk' })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, {expr=true})
|
||||
end, { expr = true, desc = 'GitSigns: go to previous hunk' })
|
||||
|
||||
-- Actions
|
||||
map('n', '<leader>hs', gs.stage_hunk, { desc = 'GitSigns: stage hunk' })
|
||||
map('n', '<leader>hr', gs.reset_hunk, { desc = 'GitSigns: reset hunk' })
|
||||
map('v', '<leader>hs', function() gs.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { desc = 'GitSigns: stage hunk' })
|
||||
map('v', '<leader>hr', function() gs.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { desc = 'GitSigns: reset hunk' })
|
||||
map('v', '<leader>hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end,
|
||||
{ desc = 'GitSigns: stage hunk' })
|
||||
map('v', '<leader>hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end,
|
||||
{ desc = 'GitSigns: reset hunk' })
|
||||
map('n', '<leader>hS', gs.stage_buffer, { desc = 'GitSigns: stage buffer' })
|
||||
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'GitSigns: undo stage hunk' })
|
||||
map('n', '<leader>hR', gs.reset_buffer, { desc = 'GitSigns: reset_buffer' })
|
||||
|
@ -347,18 +712,137 @@ require('gitsigns').setup({
|
|||
map('n', '<leader>hd', gs.diffthis, { desc = 'GitSigns: diff this' })
|
||||
map('n', '<leader>hD', function() gs.diffthis('~') end, { desc = 'GitSigns: diff this' })
|
||||
map('n', '<leader>td', gs.toggle_deleted, { desc = 'GitSigns: toggle deleted' })
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
require('lspsaga').setup()
|
||||
--[[
|
||||
-- LSPSaga : provides a diverse basket of utilities
|
||||
--]]
|
||||
require('lspsaga').setup({
|
||||
beacon = {
|
||||
enable = true,
|
||||
frequency = 7,
|
||||
}
|
||||
})
|
||||
vim.keymap.set('n', '<leader>si', '<cmd>Lspsaga incoming_calls<CR>')
|
||||
vim.keymap.set('n', '<leader>so', '<cmd>Lspsaga outgoing_calls<CR>')
|
||||
vim.keymap.set('n', '<leader>ca', '<cmd>Lspsaga code_action<CR>')
|
||||
vim.keymap.set('n', '<leader>sd', '<cmd>Lspsaga peek_definition<CR>')
|
||||
vim.keymap.set('n', '<leader>sp', '<cmd>Lspsaga peek_type_definition<CR>')
|
||||
vim.keymap.set('n', '<leader>sx', '<cmd>Lspsaga goto_definition<CR>')
|
||||
vim.keymap.set('n', '<leader>sg', '<cmd>Lspsaga goto_type_definition<CR>')
|
||||
vim.keymap.set('n', '[e', '<cmd>Lspsaga diagnostic_jump_prev<CR>')
|
||||
vim.keymap.set('n', ']e', '<cmd>Lspsaga diagnostic_jump_next<CR>')
|
||||
vim.keymap.set('n', '<leader>sK', '<cmd>Lspsaga hover_doc<CR>')
|
||||
vim.keymap.set('n', '<leader>sm', '<cmd>Lspsaga finder imp<CR>')
|
||||
vim.keymap.set('n', '<leader>sf', '<cmd>Lspsaga finder<CR>')
|
||||
vim.keymap.set('n', '<leader>sl', '<cmd>Lspsaga outline<CR>')
|
||||
vim.keymap.set('n', '<leader>rn', '<cmd>Lspsaga rename<CR>')
|
||||
vim.keymap.set('n', '<leader>st', '<cmd>Lspsaga term_toggle<CR>')
|
||||
|
||||
require('dap-go').setup()
|
||||
|
||||
local dap, dapui = require("dap"), require("dapui")
|
||||
dapui.setup()
|
||||
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
-- Handlebars: One way to get syntax highlighting in Handlebars files
|
||||
--[[
|
||||
local syntax_highlighting_tweaks = vim.api.nvim_create_augroup("SyntaxHighlightingTweaks", { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "BufRead", "BufNewFile" },
|
||||
{
|
||||
group = syntax_highlighting_tweaks,
|
||||
pattern = "*.hbs",
|
||||
command = "set filetype=html"
|
||||
}
|
||||
)
|
||||
--]]
|
||||
|
||||
-- Treesitter
|
||||
require('nvim-treesitter.configs').setup({
|
||||
modules = {},
|
||||
highlight = {
|
||||
enable = true,
|
||||
loaded = true,
|
||||
module_path = "nvim-treesitter.highlight",
|
||||
additional_vim_regex_highlighting = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
module_path = "nvim-treesitter.indent",
|
||||
},
|
||||
ensure_installed = { "bash", "comment", "html", "javascript", "json", "lua", "typescript", "yaml" },
|
||||
sync_install = false,
|
||||
auto_install = false,
|
||||
ignore_install = {},
|
||||
})
|
||||
|
||||
vim.treesitter.language.register("html", "handlebars")
|
||||
|
||||
require('mini.icons').setup()
|
||||
|
||||
-- Tweak GitSigns blame color
|
||||
-- This differentiates the cursorline from the git blame text
|
||||
vim.cmd("highlight GitSignsCurrentLineBlame gui=bold guifg=#339944")
|
||||
vim.cmd("highlight NonText gui=bold guifg=#999999")
|
||||
|
||||
--[[
|
||||
Resolve conflict between fugitive and LSPSaga, wherein the latter's
|
||||
breadcrumbs cause a mismatch between the buffer and fugitive's :Git blame
|
||||
window and :Gvdiffsplit window(s). To kill the winbar (the top line where
|
||||
the breadcrumbs and this blame title live), enter `:set winbar&`.
|
||||
--]]
|
||||
local blamegroup = vim.api.nvim_create_augroup("fugitiveSagaBlameConflict", { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
'FileType',
|
||||
{
|
||||
group = blamegroup,
|
||||
pattern = 'fugitiveblame',
|
||||
callback = function()
|
||||
vim.api.nvim_set_option_value('winbar', 'fugitive', { scope = 'local' })
|
||||
end,
|
||||
}
|
||||
)
|
||||
|
||||
local diffgroup = vim.api.nvim_create_augroup("fugitiveSagaDiffConflict", { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
'BufReadCmd',
|
||||
{
|
||||
group = diffgroup,
|
||||
pattern = "fugitive://*",
|
||||
callback = function()
|
||||
vim.api.nvim_set_option_value('winbar', 'fugitive', { scope = 'local' })
|
||||
end,
|
||||
}
|
||||
)
|
||||
|
||||
--[[
|
||||
let g:nvlime_cl_impl = "ros"
|
||||
function! NvlimeBuildServerCommandFor_ros(nvlime_loader, nvlime_eval)
|
||||
return ["ros", "run",
|
||||
\ "--load", a:nvlime_loader,
|
||||
\ "--eval", a:nvlime_eval]
|
||||
endfunction
|
||||
--]]
|
||||
-- Roswell
|
||||
vim.g.nvlime_cl_impl = "ros"
|
||||
vim.cmd([[
|
||||
function! NvlimeBuildServerCommandFor_ros(nvlime_loader, nvlime_eval)
|
||||
return ["ros", "run",
|
||||
\ "--load", a:nvlime_loader,
|
||||
\ "--eval", a:nvlime_eval]
|
||||
endfunction
|
||||
]])
|
||||
|
||||
-- Switch syntax highlighting on
|
||||
vim.cmd("syntax enable")
|
||||
|
||||
-- Set color scheme
|
||||
vim.cmd("colorscheme dracula")
|
||||
|
||||
-- Temporary file locations
|
||||
vim.opt.backupdir = ".backup/," .. HOME .. "/.backup/,/tmp//"
|
||||
vim.opt.directory = ".swp/," .. HOME .. "/.swp/,/tmp//"
|
||||
|
|
|
@ -28,7 +28,6 @@ color listfocus_unread color238 color47 standout
|
|||
color info color141 color236
|
||||
|
||||
confirm-exit yes
|
||||
define-filter "nitter feeds" "tags !# \"nitter_personal\" and tags !# \"nitter_institutional\" and tags !# \"nitter_noise\""
|
||||
feed-sort-order firsttag
|
||||
|
||||
# Dracula highlights
|
||||
|
@ -44,7 +43,7 @@ highlight article ":.*\\(image\\)$" blue default
|
|||
highlight article ":.*\\(embedded flash\\)$" magenta default
|
||||
|
||||
keep-articles-days 45
|
||||
macro c set browser "xterm -e mpv --vid=no -- %u &"; one; set browser qutebrowser
|
||||
macro p set browser "mpv --player-operation-mode=pseudo-gui -- %u &"; one; set browser w3m -- "Play media file in mpv"
|
||||
max-items 4096
|
||||
notify-program "/usr/bin/notify-send"
|
||||
urls-source "freshrss"
|
||||
|
|
|
@ -10,3 +10,4 @@ leak
|
|||
leak
|
||||
wolff
|
||||
baffler
|
||||
Assange
|
||||
|
|
1
newsboat/.newsboat/queue
Normal file
1
newsboat/.newsboat/queue
Normal file
|
@ -0,0 +1 @@
|
|||
https://s.france24.com/media/display/1b3b9962-45d6-11ef-856d-005056a90284/w:1024/p:16x9/2024-07-12T013153Z_1056985909_RC26T8AZ5PZ7_RTRMADP_3_NATO-SUMMIT-BIDEN.JPG "/home/adam/2024-07-12T013153Z_1056985909_RC26T8AZ5PZ7_RTRMADP_3_NATO-SUMMIT-BIDEN.JPG"
|
|
@ -1,7 +1,4 @@
|
|||
"query:miscellany Articles:tags # \"miscellany\""
|
||||
"query:nitter_personal Articles:tags # \"nitter_personal\""
|
||||
"query:nitter_institutional Articles:tags # \"nitter_institutional\""
|
||||
"query:nitter_noise Articles:tags # \"nitter_noise\""
|
||||
"query:nuggets Articles:tags # \"nuggets\""
|
||||
"query:podcasts Articles:tags # \"podcasts\""
|
||||
"query:release_notes Articles:tags # \"release_notes\""
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
export XDG_CONFIG_HOME="$HOME/.config"
|
||||
export XDG_DATA_HOME="$HOME/.config/local/share"
|
||||
export XDG_CACHE_HOME="$HOME/.config/cache"
|
||||
export XDG_STATE_HOME="$HOME/.config/local/state"
|
||||
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
|
||||
|
||||
export HISTSIZE=9998
|
||||
|
@ -42,5 +43,12 @@ export DDGR_COLORS="MBdexy"
|
|||
export NAVI_TAG_COLOR=6
|
||||
export NAVI_COMMENT_COLOR=3
|
||||
|
||||
# gomphotherium
|
||||
export GOMPHOTHERIUM_SERVER='https://toot.cat'
|
||||
export GOMPHOTHERIUM_ACCESS_TOKEN='qqscVpLBugWAv6cFUqu1vBm0QMbgsWTiafg7TwZsTec'
|
||||
|
||||
# roswell
|
||||
export ROSWELL_HOME="/home/adam/.config/roswell"
|
||||
|
||||
# Consolidate PATH
|
||||
# export PATH="$(consolidate-path "$PATH")"
|
||||
|
|
|
@ -140,9 +140,8 @@ source /home/adam/.config/broot/launcher/bash/br
|
|||
# tea
|
||||
PROG=tea _CLI_ZSH_AUTOCOMPLETE_HACK=1 source "/home/adam/.config/tea/autocomplete.zsh"
|
||||
|
||||
# gomphotherium
|
||||
export GOMPHOTHERIUM_SERVER='https://toot.cat'
|
||||
export GOMPHOTHERIUM_ACCESS_TOKEN='qqscVpLBugWAv6cFUqu1vBm0QMbgsWTiafg7TwZsTec'
|
||||
# leetcode
|
||||
eval "$(leetcode completions)"
|
||||
|
||||
# ripgrep-all
|
||||
rga-fzf() {
|
||||
|
|
Loading…
Reference in a new issue