Compare commits
3 commits
d9065b65f2
...
e2ce670384
Author | SHA1 | Date | |
---|---|---|---|
e2ce670384 | |||
e124d038bb | |||
b8b1fec194 |
10 changed files with 382 additions and 1 deletions
|
@ -3,6 +3,8 @@
|
||||||
.config/zsh/.zcompdump
|
.config/zsh/.zcompdump
|
||||||
.config/zsh/.zplugins.zsh
|
.config/zsh/.zplugins.zsh
|
||||||
|
|
||||||
|
*.zwc
|
||||||
|
|
||||||
{{- if (not .gui) }}
|
{{- if (not .gui) }}
|
||||||
bin/get-updates
|
bin/get-updates
|
||||||
bin/lock
|
bin/lock
|
||||||
|
|
93
home/private_dot_config/nvim/lua/plugins/language/go.lua
Normal file
93
home/private_dot_config/nvim/lua/plugins/language/go.lua
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
-- adapted from https://www.lazyvim.org/extras/lang/go
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
vim.list_extend(opts.ensure_installed, {
|
||||||
|
"go",
|
||||||
|
"gomod",
|
||||||
|
"gowork",
|
||||||
|
"gosum",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
gopls = {
|
||||||
|
keys = {
|
||||||
|
-- Workaround for the lack of a DAP strategy in neotest-go: https://github.com/nvim-neotest/neotest-go/issues/12
|
||||||
|
{ "<leader>td", "<cmd>lua require('dap-go').debug_test()<CR>", desc = "Debug Nearest (Go)" },
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
gopls = {
|
||||||
|
gofumpt = true,
|
||||||
|
codelenses = {
|
||||||
|
gc_details = false,
|
||||||
|
generate = true,
|
||||||
|
regenerate_cgo = true,
|
||||||
|
run_govulncheck = true,
|
||||||
|
test = true,
|
||||||
|
tidy = true,
|
||||||
|
upgrade_dependency = true,
|
||||||
|
vendor = true,
|
||||||
|
},
|
||||||
|
hints = {
|
||||||
|
assignVariableTypes = true,
|
||||||
|
compositeLiteralFields = true,
|
||||||
|
compositeLiteralTypes = true,
|
||||||
|
constantValues = true,
|
||||||
|
functionTypeParameters = true,
|
||||||
|
parameterNames = true,
|
||||||
|
rangeVariableTypes = true,
|
||||||
|
},
|
||||||
|
analyses = {
|
||||||
|
fieldalignment = true,
|
||||||
|
nilness = true,
|
||||||
|
unusedparams = true,
|
||||||
|
unusedwrite = true,
|
||||||
|
useany = true,
|
||||||
|
},
|
||||||
|
usePlaceholders = true,
|
||||||
|
completeUnimported = true,
|
||||||
|
staticcheck = true,
|
||||||
|
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
||||||
|
semanticTokens = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
gopls = function(_, opts)
|
||||||
|
-- workaround for gopls not supporting semanticTokensProvider
|
||||||
|
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
|
||||||
|
LazyVim.lsp.on_attach(function(client, _)
|
||||||
|
if client.name == "gopls" then
|
||||||
|
if not client.server_capabilities.semanticTokensProvider then
|
||||||
|
local semantic = client.config.capabilities.textDocument.semanticTokens
|
||||||
|
client.server_capabilities.semanticTokensProvider = {
|
||||||
|
full = true,
|
||||||
|
legend = {
|
||||||
|
tokenTypes = semantic.tokenTypes,
|
||||||
|
tokenModifiers = semantic.tokenModifiers,
|
||||||
|
},
|
||||||
|
range = true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
-- end workaround
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "goimports", "gofumpt", "gomodifytags", "impl", "delve" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
16
home/private_dot_config/nvim/lua/plugins/language/nix.lua
Normal file
16
home/private_dot_config/nvim/lua/plugins/language/nix.lua
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
return {
|
||||||
|
require("util").setup_lang({ treesitter = { "nix" } }),
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
nixd = {
|
||||||
|
mason = false,
|
||||||
|
},
|
||||||
|
-- nil_ls = {
|
||||||
|
-- mason = false,
|
||||||
|
-- },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
7
home/private_dot_config/nvim/lua/plugins/language/nu.lua
Normal file
7
home/private_dot_config/nvim/lua/plugins/language/nu.lua
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
return {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
dependencies = {
|
||||||
|
{ "nushell/tree-sitter-nu" },
|
||||||
|
},
|
||||||
|
build = ":TSUpdate",
|
||||||
|
}
|
30
home/private_dot_config/nvim/lua/plugins/language/roc.lua
Normal file
30
home/private_dot_config/nvim/lua/plugins/language/roc.lua
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
-- make .roc files have the correct filetype
|
||||||
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||||
|
pattern = { "*.roc" },
|
||||||
|
command = "set filetype=roc",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- -- add roc tree-sitter
|
||||||
|
-- local parsers = require("nvim-treesitter.parsers").get_parser_configs()
|
||||||
|
--
|
||||||
|
-- parsers.roc = {
|
||||||
|
-- install_info = {
|
||||||
|
-- url = "https://github.com/faldor20/tree-sitter-roc",
|
||||||
|
-- files = { "src/parser.c", "src/scanner.c" },
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
|
||||||
|
return {
|
||||||
|
{ "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = { "roc" } }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
roc_ls = {
|
||||||
|
mason = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
99
home/private_dot_config/nvim/lua/plugins/language/rust.lua
Normal file
99
home/private_dot_config/nvim/lua/plugins/language/rust.lua
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
-- adapted from https://www.lazyvim.org/extras/lang/rust
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.sources = opts.sources or {}
|
||||||
|
table.insert(opts.sources, { name = "crates" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Saecki/crates.nvim",
|
||||||
|
event = { "BufRead Cargo.toml" },
|
||||||
|
opts = {
|
||||||
|
completions = {
|
||||||
|
cmp = { enabled = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "ron", "rust", "toml" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mrcjkb/rustaceanvim",
|
||||||
|
version = "^4", -- Recommended
|
||||||
|
ft = { "rust" },
|
||||||
|
opts = {
|
||||||
|
server = {
|
||||||
|
on_attach = function(_, bufnr)
|
||||||
|
vim.keymap.set("n", "<leader>cR", function()
|
||||||
|
vim.cmd.RustLsp("codeAction")
|
||||||
|
end, { desc = "Code Action", buffer = bufnr })
|
||||||
|
vim.keymap.set("n", "<leader>dr", function()
|
||||||
|
vim.cmd.RustLsp("debuggables")
|
||||||
|
end, { desc = "Rust debuggables", buffer = bufnr })
|
||||||
|
end,
|
||||||
|
default_settings = {
|
||||||
|
-- rust-analyzer language server configuration
|
||||||
|
["rust-analyzer"] = {
|
||||||
|
cargo = {
|
||||||
|
allFeatures = true,
|
||||||
|
loadOutDirsFromCheck = true,
|
||||||
|
runBuildScripts = true,
|
||||||
|
},
|
||||||
|
-- Add clippy lints for Rust.
|
||||||
|
checkOnSave = {
|
||||||
|
allFeatures = true,
|
||||||
|
command = "clippy",
|
||||||
|
extraArgs = { "--no-deps" },
|
||||||
|
},
|
||||||
|
procMacro = {
|
||||||
|
enable = true,
|
||||||
|
ignored = {
|
||||||
|
["async-trait"] = { "async_trait" },
|
||||||
|
["napi-derive"] = { "napi" },
|
||||||
|
["async-recursion"] = { "async_recursion" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
rust_analyzer = {},
|
||||||
|
taplo = {
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"K",
|
||||||
|
function()
|
||||||
|
if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then
|
||||||
|
require("crates").show_popup()
|
||||||
|
else
|
||||||
|
vim.lsp.buf.hover()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = "Show Crate Documentation",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
rust_analyzer = function()
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
20
home/private_dot_config/nvim/lua/plugins/language/zig.lua
Normal file
20
home/private_dot_config/nvim/lua/plugins/language/zig.lua
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
-- adapted from https://www.lazyvim.org/extras/lang/rust
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "zig" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
zls = {
|
||||||
|
mason = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
# alias zbench='for i in {1..10}; do /usr/bin/time zsh -lic exit; done'
|
if (( $+commands[time] )); then
|
||||||
|
alias zbench='for i in {1..10}; do time zsh -lic exit; done'
|
||||||
|
fi
|
||||||
alias zdot='cd ${ZDOTDIR:-~}'
|
alias zdot='cd ${ZDOTDIR:-~}'
|
||||||
alias dots='cd ${DOTFILES_DIR:-~/.dotfiles}'
|
alias dots='cd ${DOTFILES_DIR:-~/.dotfiles}'
|
||||||
alias dots-drop='chezmoi forget --interactive $(chezmoi managed -p absolute | fzf -m)'
|
alias dots-drop='chezmoi forget --interactive $(chezmoi managed -p absolute | fzf -m)'
|
||||||
|
|
5
home/private_dot_config/zsh/conf.d/opts.zsh
Normal file
5
home/private_dot_config/zsh/conf.d/opts.zsh
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
setopt NO_BEEP # Be quiet!
|
||||||
|
setopt NO_HIST_BEEP # Be quiet!
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
# System clipboard integration
|
||||||
|
#
|
||||||
|
# This file has support for doing system clipboard copy and paste operations
|
||||||
|
# from the command line in a generic cross-platform fashion.
|
||||||
|
#
|
||||||
|
# This is uses essentially the same heuristic as neovim, with the additional
|
||||||
|
# special support for Cygwin.
|
||||||
|
# See: https://github.com/neovim/neovim/blob/e682d799fa3cf2e80a02d00c6ea874599d58f0e7/runtime/autoload/provider/clipboard.vim#L55-L121
|
||||||
|
#
|
||||||
|
# - pbcopy, pbpaste (macOS)
|
||||||
|
# - cygwin (Windows running Cygwin)
|
||||||
|
# - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
|
||||||
|
# - xsel (if $DISPLAY is set)
|
||||||
|
# - xclip (if $DISPLAY is set)
|
||||||
|
# - lemonade (for SSH) https://github.com/pocke/lemonade
|
||||||
|
# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
|
||||||
|
# - win32yank (Windows)
|
||||||
|
# - tmux (if $TMUX is set)
|
||||||
|
#
|
||||||
|
# Defines two functions, clipcopy and clippaste, based on the detected platform.
|
||||||
|
##
|
||||||
|
#
|
||||||
|
# clipcopy - Copy data to clipboard
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# <command> | clipcopy - copies stdin to clipboard
|
||||||
|
#
|
||||||
|
# clipcopy <file> - copies a file's contents to clipboard
|
||||||
|
#
|
||||||
|
##
|
||||||
|
#
|
||||||
|
# clippaste - "Paste" data from clipboard to stdout
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# clippaste - writes clipboard's contents to stdout
|
||||||
|
#
|
||||||
|
# clippaste | <command> - pastes contents and pipes it to another process
|
||||||
|
#
|
||||||
|
# clippaste > <file> - paste contents to a file
|
||||||
|
#
|
||||||
|
# Examples:
|
||||||
|
#
|
||||||
|
# # Pipe to another process
|
||||||
|
# clippaste | grep foo
|
||||||
|
#
|
||||||
|
# # Paste to a file
|
||||||
|
# clippaste > file.txt
|
||||||
|
#
|
||||||
|
function detect-clipboard() {
|
||||||
|
emulate -L zsh
|
||||||
|
|
||||||
|
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | pbcopy; }
|
||||||
|
function clippaste() { pbpaste; }
|
||||||
|
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
|
||||||
|
function clippaste() { cat /dev/clipboard; }
|
||||||
|
elif (( $+commands[clip.exe] )) && (( $+commands[powershell.exe] )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | clip.exe; }
|
||||||
|
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
|
||||||
|
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; }
|
||||||
|
function clippaste() { wl-paste --no-newline; }
|
||||||
|
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | xsel --clipboard --input; }
|
||||||
|
function clippaste() { xsel --clipboard --output; }
|
||||||
|
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | xclip -selection clipboard -in &>/dev/null &|; }
|
||||||
|
function clippaste() { xclip -out -selection clipboard; }
|
||||||
|
elif (( ${+commands[lemonade]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | lemonade copy; }
|
||||||
|
function clippaste() { lemonade paste; }
|
||||||
|
elif (( ${+commands[doitclient]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | doitclient wclip; }
|
||||||
|
function clippaste() { doitclient wclip -r; }
|
||||||
|
elif (( ${+commands[win32yank]} )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | win32yank -i; }
|
||||||
|
function clippaste() { win32yank -o; }
|
||||||
|
elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then
|
||||||
|
function clipcopy() { cat "${1:-/dev/stdin}" | termux-clipboard-set; }
|
||||||
|
function clippaste() { termux-clipboard-get; }
|
||||||
|
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
|
||||||
|
function clipcopy() { tmux load-buffer "${1:--}"; }
|
||||||
|
function clippaste() { tmux save-buffer -; }
|
||||||
|
else
|
||||||
|
function _retry_clipboard_detection_or_fail() {
|
||||||
|
local clipcmd="${1}"; shift
|
||||||
|
if detect-clipboard; then
|
||||||
|
"${clipcmd}" "$@"
|
||||||
|
else
|
||||||
|
print "${clipcmd}: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function clipcopy() { _retry_clipboard_detection_or_fail clipcopy "$@"; }
|
||||||
|
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function clipcopy clippaste {
|
||||||
|
unfunction clipcopy clippaste
|
||||||
|
detect-clipboard || true # let one retry
|
||||||
|
"$0" "$@"
|
||||||
|
}
|
Loading…
Reference in a new issue