Compare commits
1
Commits
main
..
69d69b27c4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69d69b27c4 |
@@ -1,13 +1,10 @@
|
|||||||
# prefer this if stow is available
|
# prefer this if stow is available
|
||||||
.PHONY: stow unstow
|
.PHONY: stow unstow
|
||||||
stow:
|
stow:
|
||||||
stow nvim ghostty emacs
|
stow nvim ghostty
|
||||||
|
|
||||||
unstow:
|
unstow:
|
||||||
stow -D nvim ghostty emacs
|
stow -D nvim ghostty
|
||||||
|
|
||||||
# if stow is not available, symlink configs instead
|
|
||||||
# TODO: this is currently outdated
|
|
||||||
|
|
||||||
LN := ln -svf
|
LN := ln -svf
|
||||||
LNDIR := ln -sv
|
LNDIR := ln -sv
|
||||||
@@ -15,6 +12,8 @@ LNDIR := ln -sv
|
|||||||
DOTFILES_DIR := $(shell pwd)
|
DOTFILES_DIR := $(shell pwd)
|
||||||
TARGET_DIR := $(HOME)
|
TARGET_DIR := $(HOME)
|
||||||
|
|
||||||
|
# if stow is not available, symlink configs instead
|
||||||
|
# this is currently outdated
|
||||||
.PHONY: link unlink
|
.PHONY: link unlink
|
||||||
link: nvim
|
link: nvim
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,4 @@
|
|||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
Run `make stow`.
|
Run `make stow`
|
||||||
|
|
||||||
Add the `./scripts` contents to the path for ez codin
|
|
||||||
|
|
||||||
```sh
|
|
||||||
export PATH="$PATH:$HOME/dotfiles/scripts"
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
cc-clean(){
|
||||||
|
rm -rf ./**/*.out 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# compile and run a single C program. Useful for prototyping.
|
||||||
|
cc-run(){
|
||||||
|
local file
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Usage: cc-run <file> [args...]" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
file="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
gcc "${file}" -o "${file}.out" -Wall -Wextra -Werror -g3 -fsanitize=address $@ && \
|
||||||
|
"./${file}.out"
|
||||||
|
|
||||||
|
rm "${file}.out"
|
||||||
|
}
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
;; Use correct shell
|
|
||||||
(setenv "SHELL" "/bin/bash")
|
|
||||||
(setq shell-file-name "/bin/bash"
|
|
||||||
explicit-shell-file-name "/bin/bash"
|
|
||||||
shell-command-switch "-c")
|
|
||||||
|
|
||||||
;; Start the compile prompt with an empty command.
|
|
||||||
(setq-default compile-command "")
|
|
||||||
|
|
||||||
|
|
||||||
;; Disable auto-save files (#file#).
|
|
||||||
(setq auto-save-default nil)
|
|
||||||
|
|
||||||
;; Disable backup files (file~).
|
|
||||||
(setq make-backup-files nil)
|
|
||||||
|
|
||||||
;; Disable lockfiles (.#file)
|
|
||||||
(setq create-lockfiles nil)
|
|
||||||
|
|
||||||
;; Disable startup splash screen
|
|
||||||
(setq inhibit-startup-message t)
|
|
||||||
;; (setq initial-scratch-message nil)
|
|
||||||
|
|
||||||
;; Remove noisy UI
|
|
||||||
(menu-bar-mode 0)
|
|
||||||
(tool-bar-mode 0)
|
|
||||||
(scroll-bar-mode 0)
|
|
||||||
|
|
||||||
;; Line numbers
|
|
||||||
(global-display-line-numbers-mode 1)
|
|
||||||
(setq display-line-numbers 'relative)
|
|
||||||
|
|
||||||
(fido-mode 1)
|
|
||||||
|
|
||||||
;; Initialize the built-in package manager.
|
|
||||||
;; Add nongnu just in case
|
|
||||||
(require 'package)
|
|
||||||
(add-to-list 'package-archives
|
|
||||||
'("nongnu" . "https://elpa.nongnu.org/nongnu/") t)
|
|
||||||
(package-initialize)
|
|
||||||
|
|
||||||
;; Download Gruber Darker if it is not installed yet.
|
|
||||||
(unless (package-installed-p 'gruber-darker-theme)
|
|
||||||
(package-refresh-contents)
|
|
||||||
(package-install 'gruber-darker-theme))
|
|
||||||
|
|
||||||
;; Enable the theme without a confirmation prompt.
|
|
||||||
(load-theme 'gruber-darker t)
|
|
||||||
|
|
||||||
;; Python
|
|
||||||
|
|
||||||
(defun pycheck ()
|
|
||||||
"Run flake8 and mypy in the current directory."
|
|
||||||
(interactive)
|
|
||||||
(compile "flake8 --color=never . && echo 'Success: flake8' && mypy --strict ."))
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# Emacs config
|
|
||||||
|
|
||||||
- [Inspiration](https://github.com/rexim/dotfiles)
|
|
||||||
|
|
||||||
# Usage learning
|
|
||||||
|
|
||||||
- [Ido modes and stuff](https://karthinks.com/software/more-batteries-included-with-emacs/)
|
|
||||||
@@ -1,23 +1,15 @@
|
|||||||
# No confusing symbols
|
|
||||||
font-feature = -calt, -liga, -dlig
|
font-feature = -calt, -liga, -dlig
|
||||||
|
|
||||||
# Disable clipboard annoyances
|
# Allow terminal applications to read the clipboard without confirmation
|
||||||
clipboard-read = allow
|
clipboard-read = allow
|
||||||
clipboard-paste-protection = false
|
|
||||||
|
|
||||||
# fbnp supremacy
|
# Use Alt for multi-teriminal management
|
||||||
keybind = up=ignore
|
keybind = ctrl+shift+t=unbind
|
||||||
keybind = down=ignore
|
keybind = alt+t=new_tab
|
||||||
keybind = left=ignore
|
keybind = ctrl+shift+w=unbind
|
||||||
keybind = right=ignore
|
keybind = alt+w=close_tab:this
|
||||||
keybind = ctrl+up=ignore
|
keybind = ctrl+enter=unbind
|
||||||
keybind = ctrl+down=ignore
|
keybind = alt+enter=toggle_fullscreen
|
||||||
keybind = ctrl+left=ignore
|
|
||||||
keybind = ctrl+right=ignore
|
|
||||||
keybind = alt+up=ignore
|
|
||||||
keybind = alt+down=ignore
|
|
||||||
keybind = alt+left=ignore
|
|
||||||
keybind = alt+right=ignore
|
|
||||||
|
|
||||||
# Disable touchpad horizontal-swipe tab switching.
|
# Disable touchpad horizontal-swipe tab switching.
|
||||||
# Will come in next version
|
# Will come in next version
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Builds emacs from source.
|
|
||||||
# However, its better to use system package managers.
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
version="31.1"
|
|
||||||
archive="emacs-${version}.tar.gz"
|
|
||||||
prefix="/opt/emacs-${version}"
|
|
||||||
workdir=$(mktemp -d)
|
|
||||||
|
|
||||||
trap 'rm -rf "$workdir"' EXIT
|
|
||||||
|
|
||||||
sudo apt-get install build-essential libxpm-dev libjpeg-dev libgif-dev \
|
|
||||||
libtiff-dev libgnutls28-dev
|
|
||||||
|
|
||||||
curl -fL -o "$workdir/$archive" "https://ftp.gnu.org/gnu/emacs/$archive"
|
|
||||||
tar -xzf "$workdir/$archive" -C "$workdir"
|
|
||||||
|
|
||||||
cd "$workdir/emacs-$version"
|
|
||||||
./configure --prefix="$prefix"
|
|
||||||
make -j 4
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
Add this to your shell config (~/.bashrc, ~/.zshrc, ...):
|
|
||||||
|
|
||||||
export PATH="$prefix/bin:\$PATH"
|
|
||||||
EOF
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
fonts_dir="$HOME/.local/share/fonts"
|
|
||||||
mkdir -p "$fonts_dir"
|
|
||||||
|
|
||||||
# List of fonts to install
|
|
||||||
declare -a fonts=(FiraCode JetBrainsMono Hack)
|
|
||||||
|
|
||||||
for font in "${fonts[@]}"; do
|
|
||||||
echo "Installing $font..."
|
|
||||||
wget "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${font}.zip" -P "/tmp/"
|
|
||||||
unzip -o "/tmp/${font}.zip" -d "$fonts_dir"
|
|
||||||
rm "/tmp/${font}.zip"
|
|
||||||
done
|
|
||||||
|
|
||||||
fc-cache -fv
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": *"v\K[^"]*')
|
|
||||||
LAZYGIT_ARCH=$(uname -m | sed 's/aarch64/arm64/')
|
|
||||||
|
|
||||||
echo "Installing lazygit v${LAZYGIT_VERSION} (${LAZYGIT_ARCH})"
|
|
||||||
|
|
||||||
WORKDIR=$(mktemp -d /tmp/lazygit.XXXXXX)
|
|
||||||
trap 'rm -rf "$WORKDIR"' EXIT
|
|
||||||
|
|
||||||
curl -sLo "${WORKDIR}/lazygit.tar.gz" \
|
|
||||||
"https://github.com/jesseduffield/lazygit/releases/download/v${LAZYGIT_VERSION}/lazygit_${LAZYGIT_VERSION}_Linux_${LAZYGIT_ARCH}.tar.gz"
|
|
||||||
|
|
||||||
tar -xOf "${WORKDIR}/lazygit.tar.gz" lazygit > "${WORKDIR}/lazygit"
|
|
||||||
|
|
||||||
mkdir -p ~/.local/bin
|
|
||||||
install -m 755 "${WORKDIR}/lazygit" ~/.local/bin/lazygit
|
|
||||||
|
|
||||||
echo "Done: $(~/.local/bin/lazygit --version)"
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
STOW_VERSION="${STOW_VERSION:-2.4.1}"
|
|
||||||
|
|
||||||
# Create temp build directory
|
|
||||||
BUILD_DIR=$(mktemp -d)
|
|
||||||
trap 'rm -rf "$BUILD_DIR"' EXIT
|
|
||||||
|
|
||||||
# 1. Download and extract
|
|
||||||
cd "$BUILD_DIR"
|
|
||||||
curl -O "http://ftp.gnu.org/gnu/stow/stow-${STOW_VERSION}.tar.gz"
|
|
||||||
tar xf "stow-${STOW_VERSION}.tar.gz"
|
|
||||||
cd "stow-${STOW_VERSION}"
|
|
||||||
|
|
||||||
# 2. Configure installation to user directory
|
|
||||||
./configure --prefix="$HOME/.local"
|
|
||||||
|
|
||||||
# 3. Compile and install (no sudo needed)
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
|
|
||||||
# 4. Add to PATH (add this line to ~/.bashrc or ~/.zshrc)
|
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
|
||||||
|
|
||||||
# 5. Verify installation
|
|
||||||
stow --version
|
|
||||||
+11
-22
@@ -1,4 +1,4 @@
|
|||||||
# Neovim config
|
# romanzy neovim config
|
||||||
|
|
||||||
Inspirations:
|
Inspirations:
|
||||||
|
|
||||||
@@ -8,22 +8,12 @@ Inspirations:
|
|||||||
|
|
||||||
[Great guide on vim.pack](https://echasnovski.com/blog/2026-03-13-a-guide-to-vim-pack#delete)
|
[Great guide on vim.pack](https://echasnovski.com/blog/2026-03-13-a-guide-to-vim-pack#delete)
|
||||||
|
|
||||||
# Micro vim.pack tutorial
|
To remove a plugin run `:lua vim.pack.del({ "<plugin name>" })`.
|
||||||
|
|
||||||
- Remove a plugin `:lua vim.pack.del({ 'name' })`.
|
|
||||||
- Update a plugin `:lua vim.pack.update({ 'name' })`
|
|
||||||
- Update all `:lua vim.pack.update()`
|
|
||||||
|
|
||||||
# Neovim Notes
|
# Neovim Notes
|
||||||
|
|
||||||
See custom keymaps with short descriptions with `<leader><leader>h`.
|
See custom keymaps with short descriptions with `<leader><leader>h`.
|
||||||
|
|
||||||
General shortcuts:
|
|
||||||
|
|
||||||
- `<leader>e` opens the file browser
|
|
||||||
- `gx` opens an external viewer
|
|
||||||
- `gR`, `<F5>` refresh
|
|
||||||
|
|
||||||
Windowing shortcuts:
|
Windowing shortcuts:
|
||||||
|
|
||||||
- `<leader>sv` open a vertical split
|
- `<leader>sv` open a vertical split
|
||||||
@@ -58,18 +48,22 @@ Git shortcuts:
|
|||||||
- `[h`, `]h`, `[H`, `]H` jump to hunks
|
- `[h`, `]h`, `[H`, `]H` jump to hunks
|
||||||
- `<leader>th` — toggle the expanded hunk view
|
- `<leader>th` — toggle the expanded hunk view
|
||||||
|
|
||||||
Oil shortcuts:
|
Refresh shortcuts (oil and buffers):
|
||||||
|
|
||||||
- `gp` opens preview panel
|
- `gR` refresh the current buffer
|
||||||
|
- `<F5>` refresh the current buffer
|
||||||
|
|
||||||
|
Files usage:
|
||||||
|
|
||||||
|
- `<leader>e` opens the file browser
|
||||||
|
- `gx` opens the file in external viewer
|
||||||
|
|
||||||
Toggle shortcuts:
|
Toggle shortcuts:
|
||||||
|
|
||||||
- `<leader>tw` toggle soft wrap
|
- `<leader>tw` toggle soft wrap
|
||||||
- `<leader>ts` toggle spell checking
|
|
||||||
- `<leader>ti` toggle inline diagnostics
|
- `<leader>ti` toggle inline diagnostics
|
||||||
- `<leader>tv` toggle virtual diagnostics
|
- `<leader>tv` toggle virtual diagnostics
|
||||||
- `<leader>th` — toggle the expanded hunk view
|
- `<leader>th` — toggle the expanded hunk view
|
||||||
- `<leader>tf` — toggle auto formatting on save
|
|
||||||
|
|
||||||
## Terminal
|
## Terminal
|
||||||
|
|
||||||
@@ -93,7 +87,6 @@ Useful Mason commands:
|
|||||||
|
|
||||||
Useful LSP commands:
|
Useful LSP commands:
|
||||||
|
|
||||||
- `lsp restart` restart LSP clients attached to the current buffer
|
|
||||||
- `K` show the type and documentation for the symbol under the cursor
|
- `K` show the type and documentation for the symbol under the cursor
|
||||||
- `gd` go to definition
|
- `gd` go to definition
|
||||||
- `gD` go to declaration
|
- `gD` go to declaration
|
||||||
@@ -102,7 +95,6 @@ Useful LSP commands:
|
|||||||
- `<leader>ca` show code actions
|
- `<leader>ca` show code actions
|
||||||
- `<leader>cf` apply quick fixes
|
- `<leader>cf` apply quick fixes
|
||||||
- `<leader>cs` show source actions
|
- `<leader>cs` show source actions
|
||||||
- `<C-x><C-n>` manually word completion
|
|
||||||
|
|
||||||
Diagnostics:
|
Diagnostics:
|
||||||
|
|
||||||
@@ -112,10 +104,7 @@ Diagnostics:
|
|||||||
- `]g`, `[g` jump to warning or error
|
- `]g`, `[g` jump to warning or error
|
||||||
- `<leader>ti` toggle inline diagnostics
|
- `<leader>ti` toggle inline diagnostics
|
||||||
- `<leader>tv` toggle virtual diagnostics
|
- `<leader>tv` toggle virtual diagnostics
|
||||||
- `<leader>xx`, `:ProjectDiagnostics` check the current Dart or TypeScript
|
- `<leader>xx` toggle project warnings and errors
|
||||||
package and show warnings and errors in Trouble. Save modified package files
|
|
||||||
first. Other languages show available LSP diagnostics; project coverage
|
|
||||||
depends on the language server.
|
|
||||||
|
|
||||||
## Tree-sitter
|
## Tree-sitter
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
local o = vim.opt_local
|
local o = vim.opt_local
|
||||||
|
|
||||||
o.textwidth = 79
|
o.expandtab = false
|
||||||
o.expandtab = true
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ local ac = vim.api.nvim_create_autocmd
|
|||||||
local aug = vim.api.nvim_create_augroup
|
local aug = vim.api.nvim_create_augroup
|
||||||
|
|
||||||
uc("W", "w|e", { desc = "write file then refresh buffer" })
|
uc("W", "w|e", { desc = "write file then refresh buffer" })
|
||||||
uc("ProjectDiagnostics", require("romanzy.custom.project_diagnostics").run,
|
|
||||||
{ desc = "check project warnings and errors" })
|
|
||||||
|
|
||||||
ac("TextYankPost", {
|
ac("TextYankPost", {
|
||||||
desc = "Highlight when yanking text",
|
desc = "Highlight when yanking text",
|
||||||
@@ -13,17 +11,6 @@ ac("TextYankPost", {
|
|||||||
vim.highlight.on_yank()
|
vim.highlight.on_yank()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
uc("NormFormat", "!c_formatter_42 *.c *.h", { desc = "comply with the norm in C" })
|
|
||||||
|
|
||||||
vim.cmd("cnoreabbrev wn noautocmd write")
|
|
||||||
|
|
||||||
uc("GitBackup", function(opts)
|
|
||||||
vim.fn.system({ "git", "stash", "push", "-m", opts.args })
|
|
||||||
vim.fn.system({ "git", "stash", "apply", "--index", "stash@{0}" })
|
|
||||||
end, {
|
|
||||||
nargs = 1,
|
|
||||||
desc = "Stash changes without affecting the status",
|
|
||||||
})
|
|
||||||
|
|
||||||
-- ac("LspAttach", {
|
-- ac("LspAttach", {
|
||||||
-- desc = "Notify user about attached LSP clients",
|
-- desc = "Notify user about attached LSP clients",
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ local M = {}
|
|||||||
|
|
||||||
function M.close_hidden()
|
function M.close_hidden()
|
||||||
local visible_buffers = {}
|
local visible_buffers = {}
|
||||||
local closed_count = 0
|
|
||||||
|
|
||||||
for _, tabpage in ipairs(vim.api.nvim_list_tabpages()) do
|
for _, tabpage in ipairs(vim.api.nvim_list_tabpages()) do
|
||||||
for _, window in ipairs(vim.api.nvim_tabpage_list_wins(tabpage)) do
|
for _, window in ipairs(vim.api.nvim_tabpage_list_wins(tabpage)) do
|
||||||
@@ -13,17 +12,8 @@ function M.close_hidden()
|
|||||||
for _, buffer in ipairs(vim.api.nvim_list_bufs()) do
|
for _, buffer in ipairs(vim.api.nvim_list_bufs()) do
|
||||||
if vim.bo[buffer].buflisted and not visible_buffers[buffer] then
|
if vim.bo[buffer].buflisted and not visible_buffers[buffer] then
|
||||||
vim.api.nvim_buf_delete(buffer, { force = true })
|
vim.api.nvim_buf_delete(buffer, { force = true })
|
||||||
closed_count = closed_count + 1
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if closed_count == 0 then
|
|
||||||
vim.notify("No hidden buffers to close", vim.log.levels.INFO)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local buffer_label = closed_count == 1 and "buffer" or "buffers"
|
|
||||||
vim.notify(string.format("Closed %d hidden %s", closed_count, buffer_label), vim.log.levels.INFO)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -1,28 +1,10 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.root(path)
|
-- This function returns project local dart, or fallsback to global
|
||||||
local root = vim.fs.root(path, { "pubspec.yaml" })
|
function M.executable(path)
|
||||||
if not root then return nil end
|
local directory = vim.fn.isdirectory(path) == 1 and path or vim.fs.dirname(path)
|
||||||
|
local root = vim.fs.root(directory, { "pubspec.yaml" })
|
||||||
|
|
||||||
local pubspec = table.concat(vim.fn.readfile(root .. "/pubspec.yaml"), "\n")
|
|
||||||
if pubspec:match("\nresolution:%s*workspace%s*[^\n]*") or pubspec:match("^resolution:%s*workspace%s*[^\n]*") then
|
|
||||||
local parent = vim.fs.dirname(root)
|
|
||||||
while parent do
|
|
||||||
local candidate = vim.fs.root(parent, { "pubspec.yaml" })
|
|
||||||
if not candidate then break end
|
|
||||||
local contents = table.concat(vim.fn.readfile(candidate .. "/pubspec.yaml"), "\n")
|
|
||||||
if contents:match("\nworkspace:%s*[^\n]*") or contents:match("^workspace:%s*[^\n]*") then
|
|
||||||
return candidate
|
|
||||||
end
|
|
||||||
local next_parent = vim.fs.dirname(candidate)
|
|
||||||
if next_parent == candidate then break end
|
|
||||||
parent = next_parent
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return root
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.executable(root)
|
|
||||||
if root then
|
if root then
|
||||||
local fvm_dart = root .. "/.fvm/flutter_sdk/bin/dart"
|
local fvm_dart = root .. "/.fvm/flutter_sdk/bin/dart"
|
||||||
if vim.fn.executable(fvm_dart) == 1 then
|
if vim.fn.executable(fvm_dart) == 1 then
|
||||||
|
|||||||
@@ -0,0 +1,360 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
local uv = vim.uv or vim.loop
|
||||||
|
local cache_ttl_ms = 500
|
||||||
|
|
||||||
|
local status_cache = {}
|
||||||
|
local git_root_cache = {}
|
||||||
|
local known_git_roots = {}
|
||||||
|
|
||||||
|
local function is_path_inside(path, root)
|
||||||
|
return path == root or vim.startswith(path, root .. "/")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function new_status_node()
|
||||||
|
return {
|
||||||
|
children = {},
|
||||||
|
status = nil,
|
||||||
|
priority = 0,
|
||||||
|
is_dir_ignored = false,
|
||||||
|
is_dir_untracked = false,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_conflict(status)
|
||||||
|
if #status < 2 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local index_status = status:sub(1, 1)
|
||||||
|
local worktree_status = status:sub(2, 2)
|
||||||
|
return index_status == "U"
|
||||||
|
or worktree_status == "U"
|
||||||
|
or status == "AA"
|
||||||
|
or status == "DD"
|
||||||
|
end
|
||||||
|
|
||||||
|
local function status_priority(status)
|
||||||
|
if #status < 2 then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_conflict(status) then
|
||||||
|
return 8
|
||||||
|
end
|
||||||
|
if status == "!!" then
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
if status == "??" then
|
||||||
|
return 2
|
||||||
|
end
|
||||||
|
|
||||||
|
local index_status = status:sub(1, 1)
|
||||||
|
local worktree_status = status:sub(2, 2)
|
||||||
|
|
||||||
|
if index_status == "M" then
|
||||||
|
return 7
|
||||||
|
end
|
||||||
|
if index_status == "D" or worktree_status == "D" then
|
||||||
|
return 5
|
||||||
|
end
|
||||||
|
if index_status == "A" then
|
||||||
|
return 4
|
||||||
|
end
|
||||||
|
if index_status == "R" or index_status == "C" then
|
||||||
|
return 3
|
||||||
|
end
|
||||||
|
if worktree_status == "M" then
|
||||||
|
return 6
|
||||||
|
end
|
||||||
|
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
local function status_highlight(status)
|
||||||
|
if not status then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
if status == "!!" then
|
||||||
|
return "Comment"
|
||||||
|
end
|
||||||
|
if is_conflict(status) then
|
||||||
|
return "MiniDiffSignDelete"
|
||||||
|
end
|
||||||
|
if status == "??" or status:sub(1, 1) == "A" then
|
||||||
|
return "MiniDiffSignAdd"
|
||||||
|
end
|
||||||
|
if status:sub(1, 1) == "D" or status:sub(2, 2) == "D" then
|
||||||
|
return "MiniDiffSignDelete"
|
||||||
|
end
|
||||||
|
if status:sub(1, 1) == "M"
|
||||||
|
or status:sub(1, 1) == "R"
|
||||||
|
or status:sub(1, 1) == "C"
|
||||||
|
or status:sub(2, 2) == "M"
|
||||||
|
then
|
||||||
|
return "MiniDiffSignChange"
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local function insert_status(root, relative_path, status, is_directory)
|
||||||
|
local priority = status_priority(status)
|
||||||
|
if priority == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = root
|
||||||
|
local segments = vim.split(relative_path, "/", { plain = true, trimempty = true })
|
||||||
|
for index, segment in ipairs(segments) do
|
||||||
|
node.children[segment] = node.children[segment] or new_status_node()
|
||||||
|
node = node.children[segment]
|
||||||
|
|
||||||
|
if index == #segments then
|
||||||
|
if priority > node.priority then
|
||||||
|
node.status = status
|
||||||
|
node.priority = priority
|
||||||
|
end
|
||||||
|
if is_directory and status == "!!" then
|
||||||
|
node.is_dir_ignored = true
|
||||||
|
end
|
||||||
|
if is_directory and status == "??" then
|
||||||
|
node.is_dir_untracked = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function subtree_status(node)
|
||||||
|
local best_status = node.status
|
||||||
|
local best_priority = node.priority
|
||||||
|
|
||||||
|
for _, child in pairs(node.children) do
|
||||||
|
local child_status, child_priority = subtree_status(child)
|
||||||
|
if child_priority > best_priority then
|
||||||
|
best_status = child_status
|
||||||
|
best_priority = child_priority
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return best_status, best_priority
|
||||||
|
end
|
||||||
|
|
||||||
|
local function parse_status(output, root)
|
||||||
|
local data = {
|
||||||
|
root = root,
|
||||||
|
statuses = {},
|
||||||
|
trie = new_status_node(),
|
||||||
|
timestamp = uv.now(),
|
||||||
|
}
|
||||||
|
|
||||||
|
local records = vim.split(output, "\0", { plain = true, trimempty = true })
|
||||||
|
local record_index = 1
|
||||||
|
while record_index <= #records do
|
||||||
|
local record = records[record_index]
|
||||||
|
if #record >= 4 then
|
||||||
|
local status = record:sub(1, 2)
|
||||||
|
local relative_path = record:sub(4)
|
||||||
|
|
||||||
|
-- With -z, rename/copy output contains the new path followed by
|
||||||
|
-- the old path. Oil highlights the new path only.
|
||||||
|
if status:sub(1, 1) == "R" or status:sub(1, 1) == "C" then
|
||||||
|
record_index = record_index + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local is_directory = relative_path:sub(-1) == "/"
|
||||||
|
relative_path = relative_path:gsub("^%./", ""):gsub("/$", "")
|
||||||
|
if relative_path ~= "" then
|
||||||
|
local absolute_path = vim.fs.normalize(vim.fs.joinpath(root, relative_path))
|
||||||
|
data.statuses[absolute_path] = status
|
||||||
|
insert_status(data.trie, relative_path, status, is_directory)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
record_index = record_index + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
local function find_cached_root(path)
|
||||||
|
local result
|
||||||
|
for root in pairs(known_git_roots) do
|
||||||
|
if is_path_inside(path, root) and (result == nil or #root > #result) then
|
||||||
|
result = root
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
local function find_git_root(path)
|
||||||
|
local cached_root = find_cached_root(path)
|
||||||
|
if cached_root ~= nil then
|
||||||
|
return cached_root
|
||||||
|
end
|
||||||
|
|
||||||
|
local cached = git_root_cache[path]
|
||||||
|
if cached ~= nil then
|
||||||
|
return cached or nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local result = vim.system({ "git", "-C", path, "rev-parse", "--show-toplevel" }, { text = true }):wait()
|
||||||
|
if result.code ~= 0 then
|
||||||
|
git_root_cache[path] = false
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local root = vim.trim(result.stdout)
|
||||||
|
if root == "" then
|
||||||
|
git_root_cache[path] = false
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
root = vim.fs.normalize(root)
|
||||||
|
git_root_cache[path] = root
|
||||||
|
known_git_roots[root] = true
|
||||||
|
return root
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_status_data(fs_entry)
|
||||||
|
local path = fs_entry.path
|
||||||
|
if fs_entry.fs_type ~= "directory" then
|
||||||
|
path = vim.fs.dirname(path)
|
||||||
|
end
|
||||||
|
path = vim.fs.normalize(path)
|
||||||
|
|
||||||
|
local root = find_git_root(path)
|
||||||
|
if root == nil then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local cached = status_cache[root]
|
||||||
|
if cached ~= nil and uv.now() - cached.timestamp < cache_ttl_ms then
|
||||||
|
return cached
|
||||||
|
end
|
||||||
|
|
||||||
|
local result = vim.system({
|
||||||
|
"git",
|
||||||
|
"-C",
|
||||||
|
root,
|
||||||
|
"--no-optional-locks",
|
||||||
|
"status",
|
||||||
|
"--porcelain",
|
||||||
|
"--ignored",
|
||||||
|
"-z",
|
||||||
|
}, { text = true }):wait()
|
||||||
|
if result.code ~= 0 then
|
||||||
|
status_cache[root] = parse_status("", root)
|
||||||
|
return status_cache[root]
|
||||||
|
end
|
||||||
|
|
||||||
|
local data = parse_status(result.stdout, root)
|
||||||
|
status_cache[root] = data
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lookup_status(data, fs_entry)
|
||||||
|
local path = vim.fs.normalize(fs_entry.path)
|
||||||
|
local direct_status = data.statuses[path]
|
||||||
|
if fs_entry.fs_type ~= "directory" and direct_status ~= nil then
|
||||||
|
return direct_status
|
||||||
|
end
|
||||||
|
|
||||||
|
if not is_path_inside(path, data.root) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local relative_path = path:sub(#data.root + 2)
|
||||||
|
local node = data.trie
|
||||||
|
for _, segment in ipairs(vim.split(relative_path, "/", { plain = true, trimempty = true })) do
|
||||||
|
if node.is_dir_ignored then
|
||||||
|
return "!!"
|
||||||
|
end
|
||||||
|
if node.is_dir_untracked then
|
||||||
|
return "??"
|
||||||
|
end
|
||||||
|
|
||||||
|
node = node.children[segment]
|
||||||
|
if node == nil then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if node.is_dir_ignored then
|
||||||
|
return "!!"
|
||||||
|
end
|
||||||
|
if node.is_dir_untracked then
|
||||||
|
return "??"
|
||||||
|
end
|
||||||
|
if next(node.children) == nil then
|
||||||
|
return node.status
|
||||||
|
end
|
||||||
|
|
||||||
|
local status = subtree_status(node)
|
||||||
|
-- Match the Oil configuration: an ignored descendant does not grey its
|
||||||
|
-- parent directory unless Git reported that directory as ignored.
|
||||||
|
if fs_entry.fs_type == "directory" and status == "!!" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
return status
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.filter(fs_entry)
|
||||||
|
return fs_entry.name ~= ".git"
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.highlight(fs_entry)
|
||||||
|
local data = get_status_data(fs_entry)
|
||||||
|
local status = data == nil and nil or lookup_status(data, fs_entry)
|
||||||
|
return status_highlight(status)
|
||||||
|
or (fs_entry.fs_type == "directory" and "MiniFilesDirectory" or "MiniFilesFile")
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.invalidate()
|
||||||
|
status_cache = {}
|
||||||
|
git_root_cache = {}
|
||||||
|
known_git_roots = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function refresh()
|
||||||
|
M.invalidate()
|
||||||
|
if _G.MiniFiles == nil or MiniFiles.get_explorer_state() == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.schedule(function()
|
||||||
|
if MiniFiles.get_explorer_state() ~= nil then
|
||||||
|
MiniFiles.refresh()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
local group = vim.api.nvim_create_augroup("romanzy_mini_files_git", { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ "BufWritePost", "FocusGained", "TermClose" }, {
|
||||||
|
group = group,
|
||||||
|
callback = refresh,
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
group = group,
|
||||||
|
pattern = {
|
||||||
|
"GitSignsUpdate",
|
||||||
|
"LazyGitClosed",
|
||||||
|
"MiniFilesActionCreate",
|
||||||
|
"MiniFilesActionDelete",
|
||||||
|
"MiniFilesActionRename",
|
||||||
|
"MiniFilesActionCopy",
|
||||||
|
"MiniFilesActionMove",
|
||||||
|
},
|
||||||
|
callback = refresh,
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
content = {
|
||||||
|
filter = M.filter,
|
||||||
|
highlight = M.highlight,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -1,184 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
local run_id = 0
|
|
||||||
local severities = { error = "E", warning = "W" }
|
|
||||||
local extensions = {
|
|
||||||
dart = "dart",
|
|
||||||
ts = "typescript",
|
|
||||||
tsx = "typescript",
|
|
||||||
mts = "typescript",
|
|
||||||
cts = "typescript",
|
|
||||||
js = "typescript",
|
|
||||||
jsx = "typescript",
|
|
||||||
mjs = "typescript",
|
|
||||||
cjs = "typescript",
|
|
||||||
}
|
|
||||||
|
|
||||||
local function absolute_path(root, path)
|
|
||||||
if path:sub(1, 1) == "/" then
|
|
||||||
return vim.fs.normalize(path)
|
|
||||||
end
|
|
||||||
return vim.fs.normalize(vim.fs.joinpath(root, path))
|
|
||||||
end
|
|
||||||
|
|
||||||
local function parse_output(kind, output, root)
|
|
||||||
local items = {}
|
|
||||||
for line in output:gmatch("[^\r\n]+") do
|
|
||||||
local path, row, col, level, message, code
|
|
||||||
if kind == "dart" then
|
|
||||||
level, path, row, col, message, code = line:match("^%s*(%a+)%s+%-%s+(.+):(%d+):(%d+)%s+%-%s+(.+)%s+%-%s+([%w_]+)%s*$")
|
|
||||||
else
|
|
||||||
path, row, col, level, code, message = line:match("^(.+)%((%d+),(%d+)%)%:%s*(%a+)%s+TS(%d+):%s*(.+)$")
|
|
||||||
if not path then
|
|
||||||
level, code, message = line:match("^(%a+)%s+TS(%d+):%s*(.+)$")
|
|
||||||
if level then
|
|
||||||
path, row, col = "tsconfig.json", 1, 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if path and severities[level] then
|
|
||||||
table.insert(items, {
|
|
||||||
filename = absolute_path(root, path),
|
|
||||||
lnum = tonumber(row),
|
|
||||||
col = tonumber(col),
|
|
||||||
text = message,
|
|
||||||
type = severities[level],
|
|
||||||
nr = code and tonumber(code) or nil,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return items
|
|
||||||
end
|
|
||||||
|
|
||||||
local function add_lsp_diagnostics(items, root)
|
|
||||||
local seen = {}
|
|
||||||
for _, item in ipairs(items) do
|
|
||||||
seen[table.concat({ item.filename, item.lnum, item.col, item.type, item.text }, "\0")] = true
|
|
||||||
end
|
|
||||||
local prefix = root .. "/"
|
|
||||||
for _, diagnostic in ipairs(vim.diagnostic.get()) do
|
|
||||||
local path = vim.api.nvim_buf_get_name(diagnostic.bufnr)
|
|
||||||
local kind = diagnostic.severity == vim.diagnostic.severity.ERROR and "E"
|
|
||||||
or diagnostic.severity == vim.diagnostic.severity.WARN and "W"
|
|
||||||
if kind and path:sub(1, #prefix) == prefix then
|
|
||||||
local item = {
|
|
||||||
filename = path,
|
|
||||||
lnum = diagnostic.lnum + 1,
|
|
||||||
col = diagnostic.col + 1,
|
|
||||||
text = diagnostic.message,
|
|
||||||
type = kind,
|
|
||||||
}
|
|
||||||
local key = table.concat({ item.filename, item.lnum, item.col, item.type, item.text }, "\0")
|
|
||||||
if not seen[key] then
|
|
||||||
table.insert(items, item)
|
|
||||||
seen[key] = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function show_lsp_diagnostics(bufnr)
|
|
||||||
local clients = vim.lsp.get_clients({ bufnr = bufnr })
|
|
||||||
local supported = false
|
|
||||||
for _, client in ipairs(clients) do
|
|
||||||
if client:supports_method("workspace/diagnostic") then
|
|
||||||
supported = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if supported then
|
|
||||||
vim.lsp.buf.workspace_diagnostics()
|
|
||||||
elseif #clients == 0 then
|
|
||||||
vim.notify("Project diagnostics: no language server is attached; showing available diagnostics", vim.log.levels.WARN)
|
|
||||||
else
|
|
||||||
vim.notify("Project diagnostics: this language server may only report opened files", vim.log.levels.WARN)
|
|
||||||
end
|
|
||||||
require("trouble").close({ mode = "qflist" })
|
|
||||||
require("trouble").open({
|
|
||||||
mode = "diagnostics",
|
|
||||||
filter = { severity = { vim.diagnostic.severity.ERROR, vim.diagnostic.severity.WARN } },
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
local function has_modified_buffers(root)
|
|
||||||
local prefix = root .. "/"
|
|
||||||
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
|
|
||||||
local path = vim.api.nvim_buf_get_name(bufnr)
|
|
||||||
if vim.bo[bufnr].modified and path:sub(1, #prefix) == prefix then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local function checker_for(path)
|
|
||||||
local extension = path:match("%.([^./]+)$")
|
|
||||||
local kind = extensions[extension]
|
|
||||||
if not kind then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
local marker = kind == "dart" and "pubspec.yaml" or "tsconfig.json"
|
|
||||||
local found = vim.fs.find(marker, { path = vim.fs.dirname(path), upward = true })[1]
|
|
||||||
if not found then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
local root = vim.fs.dirname(found)
|
|
||||||
if kind == "dart" then
|
|
||||||
local dart = require("romanzy.custom.dart")
|
|
||||||
root = dart.root(path)
|
|
||||||
local executable = dart.executable(root)
|
|
||||||
return kind, root, executable, { executable, "analyze" }
|
|
||||||
end
|
|
||||||
local config = table.concat(vim.fn.readfile(found), "\n")
|
|
||||||
if config:find('"references"%s*:') then
|
|
||||||
return kind, root, "pnpm", { "pnpm", "exec", "tsc", "--build", "tsconfig.json", "--noEmit", "--pretty", "false" }
|
|
||||||
end
|
|
||||||
return kind, root, "pnpm", { "pnpm", "exec", "tsc", "--noEmit", "--pretty", "false", "--project", "tsconfig.json" }
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.run()
|
|
||||||
run_id = run_id + 1
|
|
||||||
local current_run = run_id
|
|
||||||
local bufnr = vim.api.nvim_get_current_buf()
|
|
||||||
local path = vim.api.nvim_buf_get_name(bufnr)
|
|
||||||
local kind, root, executable, command = checker_for(path)
|
|
||||||
if not kind then
|
|
||||||
show_lsp_diagnostics(bufnr)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
require("trouble").close({ mode = "qflist" })
|
|
||||||
if has_modified_buffers(root) then
|
|
||||||
vim.notify("Project diagnostics: save modified package files before checking", vim.log.levels.WARN)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if vim.fn.executable(executable) ~= 1 then
|
|
||||||
vim.notify("Project diagnostics: " .. executable .. " is unavailable", vim.log.levels.ERROR)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.notify("Checking " .. root .. "…", vim.log.levels.INFO)
|
|
||||||
vim.system(command, { cwd = root, text = true }, function(result)
|
|
||||||
vim.schedule(function()
|
|
||||||
if current_run ~= run_id then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local output = (result.stdout or "") .. "\n" .. (result.stderr or "")
|
|
||||||
local items = parse_output(kind, output, root)
|
|
||||||
if result.code ~= 0 and #items == 0 then
|
|
||||||
vim.notify("Project diagnostics failed:\n" .. vim.trim(output), vim.log.levels.ERROR)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if kind ~= "dart" then add_lsp_diagnostics(items, root) end
|
|
||||||
vim.fn.setqflist({}, "r", { title = "Project diagnostics: " .. root, items = items })
|
|
||||||
if #items == 0 then
|
|
||||||
require("trouble").close({ mode = "qflist" })
|
|
||||||
vim.notify("Project diagnostics: no warnings or errors", vim.log.levels.INFO)
|
|
||||||
else
|
|
||||||
require("trouble").close({ mode = "diagnostics" })
|
|
||||||
require("trouble").open({ mode = "qflist" })
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
--- Toggle spell checking for the current window.
|
|
||||||
function M.toggle()
|
|
||||||
if vim.bo.buftype == "terminal" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.opt_local.spell = not vim.wo.spell
|
|
||||||
vim.cmd("redrawstatus")
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
vim.opt.spelllang = { "en_us" }
|
|
||||||
vim.opt.spell = true
|
|
||||||
|
|
||||||
local group = vim.api.nvim_create_augroup("RomanzySpell", { clear = true })
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
|
||||||
group = group,
|
|
||||||
pattern = "terminal",
|
|
||||||
callback = function()
|
|
||||||
vim.opt_local.spell = false
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("TermOpen", {
|
|
||||||
group = group,
|
|
||||||
callback = function()
|
|
||||||
vim.cmd("setfiletype terminal")
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -20,7 +20,9 @@ end
|
|||||||
|
|
||||||
map("n", "<leader><leader>r", ":source ~/.config/nvim/init.lua<CR>", { desc = "reload init.lua" })
|
map("n", "<leader><leader>r", ":source ~/.config/nvim/init.lua<CR>", { desc = "reload init.lua" })
|
||||||
map("n", "<leader><leader>h", telescope_picker("keymaps"), { desc = "show keymaps" })
|
map("n", "<leader><leader>h", telescope_picker("keymaps"), { desc = "show keymaps" })
|
||||||
map("n", "<leader>e", "<Cmd>Oil<CR>", { desc = "open oil" })
|
map("n", "<leader>e", function()
|
||||||
|
MiniFiles.open()
|
||||||
|
end, { desc = "open mini.files" })
|
||||||
map("n", "<leader>ff", telescope_picker("find_files"), { desc = "find files" })
|
map("n", "<leader>ff", telescope_picker("find_files"), { desc = "find files" })
|
||||||
map("n", "<leader>fg", telescope_picker("live_grep"), { desc = "live grep" })
|
map("n", "<leader>fg", telescope_picker("live_grep"), { desc = "live grep" })
|
||||||
map("n", "<leader>fb", telescope_picker("buffers"), { desc = "find buffers" })
|
map("n", "<leader>fb", telescope_picker("buffers"), { desc = "find buffers" })
|
||||||
@@ -29,13 +31,9 @@ map("n", "<leader>lg", "<Cmd>LazyGit<CR>", { desc = "open lazygit" })
|
|||||||
map("n", "<leader>dv", "<Cmd>DiffviewOpen<CR>", { desc = "open diffview" })
|
map("n", "<leader>dv", "<Cmd>DiffviewOpen<CR>", { desc = "open diffview" })
|
||||||
map("n", "<leader>dc", "<Cmd>DiffviewClose<CR>", { desc = "close diffview" })
|
map("n", "<leader>dc", "<Cmd>DiffviewClose<CR>", { desc = "close diffview" })
|
||||||
map("n", "<leader>tw", require("romanzy.custom.wrap").toggle, { desc = "toggle soft wrap" })
|
map("n", "<leader>tw", require("romanzy.custom.wrap").toggle, { desc = "toggle soft wrap" })
|
||||||
map("n", "<leader>ts", require("romanzy.custom.spell").toggle, { desc = "toggle spell checking" })
|
|
||||||
map("n", "<leader>th", function()
|
map("n", "<leader>th", function()
|
||||||
MiniDiff.toggle_overlay()
|
MiniDiff.toggle_overlay()
|
||||||
end, { desc = "toggle hunk view" })
|
end, { desc = "toggle hunk view" })
|
||||||
map("n", "<leader>tf", function()
|
|
||||||
require("romanzy.plugins.conform").toggle_autoformat()
|
|
||||||
end, { desc = "toggle autoformatting" })
|
|
||||||
|
|
||||||
map("n", "<leader>sv", "<Cmd>vs<CR>", { desc = "split vertical" })
|
map("n", "<leader>sv", "<Cmd>vs<CR>", { desc = "split vertical" })
|
||||||
map("n", "<leader>sh", "<Cmd>sp<CR>", { desc = "split horizontal" })
|
map("n", "<leader>sh", "<Cmd>sp<CR>", { desc = "split horizontal" })
|
||||||
@@ -80,7 +78,7 @@ vim.api.nvim_create_autocmd("FileType", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- hjkl supremacy
|
-- hjkl supremacy
|
||||||
map({ "n", "v", "i", "t" }, { "<left>", "<right>", "<up>", "<down>" }, function()
|
map({ "n", "v", "i" }, { "<left>", "<right>", "<up>", "<down>" }, function()
|
||||||
vim.notify('hjkl supremacy', vim.log.levels.ERROR)
|
vim.notify('hjkl supremacy', vim.log.levels.ERROR)
|
||||||
end, { desc = "hjkl supremacy" })
|
end, { desc = "hjkl supremacy" })
|
||||||
|
|
||||||
@@ -132,7 +130,17 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- diagnostics
|
-- diagnostics
|
||||||
map("n", "<leader>xx", require("romanzy.custom.project_diagnostics").run, { desc = "check project warnings and errors" })
|
map("n", "<leader>xx", function()
|
||||||
|
require("trouble").toggle({
|
||||||
|
mode = "diagnostics",
|
||||||
|
filter = {
|
||||||
|
severity = {
|
||||||
|
vim.diagnostic.severity.ERROR,
|
||||||
|
vim.diagnostic.severity.WARN,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end, { desc = "toggle project warnings and errors" })
|
||||||
map("n", "g.", vim.diagnostic.open_float, { desc = "line diagnostics" })
|
map("n", "g.", vim.diagnostic.open_float, { desc = "line diagnostics" })
|
||||||
map("n", "gl", vim.diagnostic.setloclist, { desc = "diagnostic list" })
|
map("n", "gl", vim.diagnostic.setloclist, { desc = "diagnostic list" })
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ local g = vim.g
|
|||||||
local o = vim.opt
|
local o = vim.opt
|
||||||
g.mapleader = " " -- Uses space as the global leader key.
|
g.mapleader = " " -- Uses space as the global leader key.
|
||||||
g.maplocalleader = " " -- Uses space as the local leader key.
|
g.maplocalleader = " " -- Uses space as the local leader key.
|
||||||
|
g.clipboard = "osc52" -- Routes the + and * registers through OSC52 in terminal Neovim.
|
||||||
|
|
||||||
o.number = true -- Shows absolute line numbers.
|
o.number = true -- Shows absolute line numbers.
|
||||||
o.relativenumber = true -- Shows relative numbers for easier motion.
|
o.relativenumber = true -- Shows relative numbers for easier motion.
|
||||||
@@ -31,8 +32,8 @@ o.incsearch = true -- Updates search m
|
|||||||
o.completeopt = { "menuone", "noinsert", "fuzzy", "nosort" } -- Enables fuzzy completion matching.
|
o.completeopt = { "menuone", "noinsert", "fuzzy", "nosort" } -- Enables fuzzy completion matching.
|
||||||
o.pumheight = 8 -- Limits the completion popup menu size.
|
o.pumheight = 8 -- Limits the completion popup menu size.
|
||||||
o.updatetime = 50 -- Reduces idle delay for swap and CursorHold events.
|
o.updatetime = 50 -- Reduces idle delay for swap and CursorHold events.
|
||||||
|
o.spelllang = { "en_us" } -- Uses US English for spell checking.
|
||||||
o.shell = "bash" -- Runs shell commands through bash.
|
o.shell = "bash" -- Runs shell commands through bash.
|
||||||
g.c_syntax_for_h = true -- Unfuck header formatting
|
|
||||||
|
|
||||||
-- Only show the invisible characters inside the code editing buffers
|
-- Only show the invisible characters inside the code editing buffers
|
||||||
vim.cmd([[autocmd BufWinEnter * if &buftype != '' | setlocal nolist | endif]])
|
vim.cmd([[autocmd BufWinEnter * if &buftype != '' | setlocal nolist | endif]])
|
||||||
|
|||||||
@@ -8,6 +8,5 @@ require("romanzy.plugins.telescope")
|
|||||||
require("romanzy.plugins.nvim-treesitter")
|
require("romanzy.plugins.nvim-treesitter")
|
||||||
require("romanzy.plugins.conform")
|
require("romanzy.plugins.conform")
|
||||||
require("romanzy.plugins.lsp")
|
require("romanzy.plugins.lsp")
|
||||||
require("romanzy.plugins.codam-header")
|
require("romanzy.plugins.codamheader")
|
||||||
require("romanzy.custom.spell").setup()
|
require("romanzy.plugins.romanzy")
|
||||||
require("romanzy.custom.tabline").setup()
|
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
vim.pack.add({
|
|
||||||
{ src = "https://github.com/romanzy313/codam-header.nvim" },
|
|
||||||
})
|
|
||||||
|
|
||||||
require("codamheader").setup({
|
|
||||||
default_map = false,
|
|
||||||
auto_update = true,
|
|
||||||
user = "rvolovoy",
|
|
||||||
mail = "rvolovoy@student.codam.nl",
|
|
||||||
|
|
||||||
asciiart = {
|
|
||||||
{
|
|
||||||
" ::: :::::::: ",
|
|
||||||
" :+: :+: :+: ",
|
|
||||||
" +:+ +:+ +:+ ",
|
|
||||||
" +#+ +:+ +#+ ",
|
|
||||||
"+#++:++#+ +#+ ",
|
|
||||||
" #+# #+# ",
|
|
||||||
" ### ########## ",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
" ::: ###",
|
|
||||||
":::++++++ ###",
|
|
||||||
"::::::::: ###",
|
|
||||||
"::: ++++++ ###",
|
|
||||||
"::: ### ###",
|
|
||||||
"::: ++++++ ###",
|
|
||||||
"::: #########",
|
|
||||||
":::::: ++++++###",
|
|
||||||
":::+++ ######",
|
|
||||||
" ::: ###",
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" +++++++++######",
|
|
||||||
" ::::::###+++###",
|
|
||||||
"::: +++++++++######",
|
|
||||||
":::::: +++ ",
|
|
||||||
":::++++++ ::: ",
|
|
||||||
" ::::::++++++ ",
|
|
||||||
" +++###+++ ",
|
|
||||||
" +++### ",
|
|
||||||
" +++ ",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
" ",
|
|
||||||
" ⠊⢉⠆ ",
|
|
||||||
" ⠴⠥⠄ ",
|
|
||||||
" en ",
|
|
||||||
" ⡠⢺⠀⡎⠉⡆ ",
|
|
||||||
" ⠉⠹⠁⠣⠤⠃ ",
|
|
||||||
" ",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
vim.api.nvim_create_user_command("Header42", function()
|
|
||||||
require("codamheader.utils.header").stdheader()
|
|
||||||
end, {})
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
{ src = "https://github.com/BeerB34r/codam-header.nvim" },
|
||||||
|
})
|
||||||
|
|
||||||
|
require("codamheader").setup({
|
||||||
|
default_map = false,
|
||||||
|
auto_update = true,
|
||||||
|
user = "rvolovoy",
|
||||||
|
mail = "rvolovoy@student.codam.nl",
|
||||||
|
exascii = {},
|
||||||
|
-- exascii = {
|
||||||
|
-- "—————No norm compliance?——————",
|
||||||
|
-- "⠀⣞⢽⢪⢣⢣⢣⢫⡺⡵⣝⡮⣗⢷⢽⢽⢽⣮⡷⡽⣜⣜⢮⢺⣜⢷⢽⢝⡽⣝",
|
||||||
|
-- "⠸⡸⠜⠕⠕⠁⢁⢇⢏⢽⢺⣪⡳⡝⣎⣏⢯⢞⡿⣟⣷⣳⢯⡷⣽⢽⢯⣳⣫⠇",
|
||||||
|
-- "⠀⠀⢀⢀⢄⢬⢪⡪⡎⣆⡈⠚⠜⠕⠇⠗⠝⢕⢯⢫⣞⣯⣿⣻⡽⣏⢗⣗⠏⠀",
|
||||||
|
-- "⠀⠪⡪⡪⣪⢪⢺⢸⢢⢓⢆⢤⢀⠀⠀⠀⠀⠈⢊⢞⡾⣿⡯⣏⢮⠷⠁⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠈⠊⠆⡃⠕⢕⢇⢇⢇⢇⢇⢏⢎⢎⢆⢄⠀⢑⣽⣿⢝⠲⠉⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠀⠀⡿⠂⠠⠀⡇⢇⠕⢈⣀⠀⠁⠡⠣⡣⡫⣂⣿⠯⢪⠰⠂⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠀⡦⡙⡂⢀⢤⢣⠣⡈⣾⡃⠠⠄⠀⡄⢱⣌⣶⢏⢊⠂⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠀⢝⡲⣜⡮⡏⢎⢌⢂⠙⠢⠐⢀⢘⢵⣽⣿⡿⠁⠁⠀⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠀⠨⣺⡺⡕⡕⡱⡑⡆⡕⡅⡕⡜⡼⢽⡻⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠀⣼⣳⣫⣾⣵⣗⡵⡱⡡⢣⢑⢕⢜⢕⡝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⣴⣿⣾⣿⣿⣿⡿⡽⡑⢌⠪⡢⡣⣣⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⡟⡾⣿⢿⢿⢵⣽⣾⣼⣘⢸⢸⣞⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "⠀⠀⠀⠀⠁⠇⠡⠩⡫⢿⣝⡻⡮⣒⢽⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||||
|
-- "——————————————————————————————",
|
||||||
|
-- },
|
||||||
|
-- exascii_left = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command("Header42", function()
|
||||||
|
require("codamheader.utils.header").stdheader()
|
||||||
|
end, {})
|
||||||
@@ -6,7 +6,6 @@ vim.pack.add({
|
|||||||
})
|
})
|
||||||
|
|
||||||
local dart = require("romanzy.custom.dart")
|
local dart = require("romanzy.custom.dart")
|
||||||
local autoformat_enabled = true
|
|
||||||
|
|
||||||
require("conform").setup({
|
require("conform").setup({
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
@@ -35,21 +34,8 @@ require("conform").setup({
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
format_on_save = function()
|
format_on_save = {
|
||||||
if not autoformat_enabled then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
lsp_format = "fallback",
|
lsp_format = "fallback",
|
||||||
timeout_ms = 2000,
|
timeout_ms = 2000,
|
||||||
}
|
},
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
|
||||||
toggle_autoformat = function()
|
|
||||||
autoformat_enabled = not autoformat_enabled
|
|
||||||
vim.notify("Autoformatting " .. (autoformat_enabled and "enabled" or "disabled"))
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -34,9 +34,7 @@ configure_diagnostics()
|
|||||||
local capabilities = require("mini.completion").get_lsp_capabilities()
|
local capabilities = require("mini.completion").get_lsp_capabilities()
|
||||||
local dart = require("romanzy.custom.dart")
|
local dart = require("romanzy.custom.dart")
|
||||||
local managed_servers = {
|
local managed_servers = {
|
||||||
"astro",
|
|
||||||
"bashls",
|
"bashls",
|
||||||
"basedpyright",
|
|
||||||
"clangd",
|
"clangd",
|
||||||
"gopls",
|
"gopls",
|
||||||
"jsonls",
|
"jsonls",
|
||||||
@@ -48,23 +46,18 @@ local managed_servers = {
|
|||||||
"tailwindcss",
|
"tailwindcss",
|
||||||
"eslint",
|
"eslint",
|
||||||
"tinymist",
|
"tinymist",
|
||||||
"ruff",
|
|
||||||
}
|
}
|
||||||
local managed_tools = {
|
local managed_tools = {
|
||||||
"prettier",
|
"prettier",
|
||||||
}
|
}
|
||||||
local servers = {
|
local servers = {
|
||||||
-- General
|
|
||||||
bashls = {},
|
bashls = {},
|
||||||
marksman = {},
|
|
||||||
yamlls = {},
|
|
||||||
jsonls = {},
|
|
||||||
taplo = {},
|
|
||||||
-- C
|
|
||||||
clangd = {},
|
clangd = {},
|
||||||
-- Go
|
|
||||||
gopls = {},
|
gopls = {},
|
||||||
-- Lua
|
jsonls = {},
|
||||||
|
marksman = {},
|
||||||
|
taplo = {},
|
||||||
|
yamlls = {},
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
@@ -81,19 +74,11 @@ local servers = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- Web dev
|
|
||||||
ts_ls = {},
|
ts_ls = {},
|
||||||
tailwindcss = {},
|
tailwindcss = {},
|
||||||
eslint = {},
|
eslint = {},
|
||||||
astro = {},
|
|
||||||
-- Typst
|
|
||||||
tinymist = {},
|
tinymist = {},
|
||||||
-- Dart
|
|
||||||
dartls = {
|
dartls = {
|
||||||
root_dir = function(bufnr, on_dir)
|
|
||||||
local root = dart.root(vim.api.nvim_buf_get_name(bufnr))
|
|
||||||
if root then on_dir(root) end
|
|
||||||
end,
|
|
||||||
cmd = function(dispatchers, config)
|
cmd = function(dispatchers, config)
|
||||||
return vim.lsp.rpc.start({
|
return vim.lsp.rpc.start({
|
||||||
dart.executable(config.root_dir),
|
dart.executable(config.root_dir),
|
||||||
@@ -105,34 +90,6 @@ local servers = {
|
|||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- Python
|
|
||||||
basedpyright = {
|
|
||||||
settings = {
|
|
||||||
basedpyright = {
|
|
||||||
analysis = {
|
|
||||||
typeCheckingMode = "strict",
|
|
||||||
diagnosticSeverityOverrides = {
|
|
||||||
reportUnannotatedClassAttribute = "none",
|
|
||||||
reportAny = "none",
|
|
||||||
reportExplicitAny = "none",
|
|
||||||
reportUnknownVariableType = "none",
|
|
||||||
reportImplicitStringConcatenation = "none",
|
|
||||||
reportUnusedCallResult = "none"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
ruff = {
|
|
||||||
init_options = {
|
|
||||||
settings = {
|
|
||||||
lineLength = 79,
|
|
||||||
lint = {
|
|
||||||
extendSelect = { "ANN2" }, -- Missing return annotations.
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for server_name, config in pairs(servers) do
|
for server_name, config in pairs(servers) do
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ vim.pack.add({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local icons = require("mini.icons")
|
|
||||||
local input = require("mini.input")
|
|
||||||
local clue = require("mini.clue")
|
local clue = require("mini.clue")
|
||||||
local completion = require("mini.completion")
|
local completion = require("mini.completion")
|
||||||
|
local icons = require("mini.icons")
|
||||||
|
local files = require("mini.files")
|
||||||
local git = require("mini.git")
|
local git = require("mini.git")
|
||||||
local diff = require("mini.diff")
|
local diff = require("mini.diff")
|
||||||
local statusline = require("mini.statusline")
|
local statusline = require("mini.statusline")
|
||||||
@@ -20,20 +20,6 @@ local ai = require("mini.ai")
|
|||||||
local notify = require("mini.notify")
|
local notify = require("mini.notify")
|
||||||
local surround = require("mini.surround")
|
local surround = require("mini.surround")
|
||||||
|
|
||||||
icons.setup({})
|
|
||||||
|
|
||||||
local input_view = input.gen_view.floatwin({
|
|
||||||
-- other interesting symbols for the caret `▏` `⎕` `░` `▒` `▓`
|
|
||||||
to_chunks = function(state, max_width)
|
|
||||||
return input.state_to_chunks(state, max_width, {
|
|
||||||
include_prompt = false,
|
|
||||||
include_hint = false,
|
|
||||||
symbol_caret = "█",
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
input.setup({ handlers = { view = input_view } })
|
|
||||||
|
|
||||||
clue.setup({
|
clue.setup({
|
||||||
triggers = {
|
triggers = {
|
||||||
{ mode = "n", keys = "<leader>" },
|
{ mode = "n", keys = "<leader>" },
|
||||||
@@ -57,6 +43,8 @@ clue.setup({
|
|||||||
|
|
||||||
icons.setup({})
|
icons.setup({})
|
||||||
|
|
||||||
|
files.setup(require("romanzy.custom.mini_files").setup())
|
||||||
|
|
||||||
git.setup({})
|
git.setup({})
|
||||||
|
|
||||||
diff.setup({})
|
diff.setup({})
|
||||||
@@ -76,9 +64,7 @@ vim.api.nvim_create_autocmd("ColorScheme", {
|
|||||||
callback = set_mini_diff_highlights,
|
callback = set_mini_diff_highlights,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Custom de-cluttered status line output. The default was waaay to noisy
|
local function statusline_filetype()
|
||||||
local function statusline_active()
|
|
||||||
local function statusline_filetype()
|
|
||||||
local filetype = vim.bo.filetype
|
local filetype = vim.bo.filetype
|
||||||
if filetype == "" then
|
if filetype == "" then
|
||||||
return ""
|
return ""
|
||||||
@@ -86,19 +72,16 @@ local function statusline_active()
|
|||||||
|
|
||||||
local icon = MiniIcons.get("filetype", filetype)
|
local icon = MiniIcons.get("filetype", filetype)
|
||||||
return icon .. " " .. filetype
|
return icon .. " " .. filetype
|
||||||
end
|
end
|
||||||
|
|
||||||
local function statusline_spell()
|
|
||||||
return vim.wo.spell and "spell" or ""
|
|
||||||
end
|
|
||||||
|
|
||||||
|
-- Custom de-cluttered status line output. The default was waaay to noisy
|
||||||
|
local function statusline_active()
|
||||||
local mode, mode_hl = statusline.section_mode({ trunc_width = 120 })
|
local mode, mode_hl = statusline.section_mode({ trunc_width = 120 })
|
||||||
local git_info = statusline.section_git({ trunc_width = 40 })
|
local git_info = statusline.section_git({ trunc_width = 40 })
|
||||||
-- local diff_info = statusline.section_diff({ trunc_width = 75 })
|
-- local diff_info = statusline.section_diff({ trunc_width = 75 })
|
||||||
-- local diagnostics = statusline.section_diagnostics({ trunc_width = 75 })
|
-- local diagnostics = statusline.section_diagnostics({ trunc_width = 75 })
|
||||||
local lsp = statusline.section_lsp({ trunc_width = 75 })
|
local lsp = statusline.section_lsp({ trunc_width = 75 })
|
||||||
local filename = statusline.section_filename({ trunc_width = 140 })
|
local filename = statusline.section_filename({ trunc_width = 140 })
|
||||||
local spell = statusline_spell()
|
|
||||||
local fileinfo = statusline_filetype()
|
local fileinfo = statusline_filetype()
|
||||||
local search = statusline.section_searchcount({ trunc_width = 75 })
|
local search = statusline.section_searchcount({ trunc_width = 75 })
|
||||||
|
|
||||||
@@ -108,7 +91,7 @@ local function statusline_active()
|
|||||||
"%<",
|
"%<",
|
||||||
{ hl = "MiniStatuslineFilename", strings = { filename } },
|
{ hl = "MiniStatuslineFilename", strings = { filename } },
|
||||||
"%=",
|
"%=",
|
||||||
{ hl = "MiniStatuslineFileinfo", strings = { spell, fileinfo } },
|
{ hl = "MiniStatuslineFileinfo", strings = { fileinfo } },
|
||||||
{ hl = mode_hl, strings = { search } },
|
{ hl = mode_hl, strings = { search } },
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@@ -134,10 +117,7 @@ pairs.setup({
|
|||||||
modes = { insert = true, command = true, terminal = false },
|
modes = { insert = true, command = true, terminal = false },
|
||||||
})
|
})
|
||||||
|
|
||||||
completion.setup({
|
completion.setup({})
|
||||||
fallback_action = function() end,
|
|
||||||
mappings = { force_fallback = "" },
|
|
||||||
})
|
|
||||||
vim.keymap.set("i", "<CR>", function()
|
vim.keymap.set("i", "<CR>", function()
|
||||||
if vim.fn.complete_info({ "selected" }).selected ~= -1 then
|
if vim.fn.complete_info({ "selected" }).selected ~= -1 then
|
||||||
return "\25"
|
return "\25"
|
||||||
@@ -150,7 +130,9 @@ ai.setup({})
|
|||||||
|
|
||||||
notify.setup({
|
notify.setup({
|
||||||
lsp_progress = {
|
lsp_progress = {
|
||||||
enable = false,
|
-- the message "lua_ls: processing completion..." and
|
||||||
|
-- "lua_ls: Diagnosing" is very annoying
|
||||||
|
enable = true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
vim.notify = notify.make_notify()
|
vim.notify = notify.make_notify()
|
||||||
|
|||||||
@@ -1,90 +1,89 @@
|
|||||||
vim.pack.add({
|
-- vim.pack.add({
|
||||||
{
|
-- {
|
||||||
src = "https://github.com/stevearc/oil.nvim",
|
-- src = "https://github.com/stevearc/oil.nvim",
|
||||||
name = "oil.nvim",
|
-- name = "oil.nvim",
|
||||||
},
|
-- },
|
||||||
{
|
-- {
|
||||||
src = "https://github.com/malewicz1337/oil-git.nvim",
|
-- src = "https://github.com/malewicz1337/oil-git.nvim",
|
||||||
name = "oil-git.nvim",
|
-- name = "oil-git.nvim",
|
||||||
},
|
-- },
|
||||||
})
|
-- })
|
||||||
|
--
|
||||||
local function set_oil_git_highlights()
|
-- local function set_oil_git_highlights()
|
||||||
vim.api.nvim_set_hl(0, "OilGitAdded", { link = "MiniDiffSignAdd" })
|
-- vim.api.nvim_set_hl(0, "OilGitAdded", { link = "MiniDiffSignAdd" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitUntracked", { link = "MiniDiffSignAdd" })
|
-- vim.api.nvim_set_hl(0, "OilGitUntracked", { link = "MiniDiffSignAdd" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitModifiedStaged", { link = "MiniDiffSignChange" })
|
-- vim.api.nvim_set_hl(0, "OilGitModifiedStaged", { link = "MiniDiffSignChange" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitModifiedUnstaged", { link = "MiniDiffSignChange" })
|
-- vim.api.nvim_set_hl(0, "OilGitModifiedUnstaged", { link = "MiniDiffSignChange" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitRenamed", { link = "MiniDiffSignChange" })
|
-- vim.api.nvim_set_hl(0, "OilGitRenamed", { link = "MiniDiffSignChange" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitCopied", { link = "MiniDiffSignChange" })
|
-- vim.api.nvim_set_hl(0, "OilGitCopied", { link = "MiniDiffSignChange" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitDeleted", { link = "MiniDiffSignDelete" })
|
-- vim.api.nvim_set_hl(0, "OilGitDeleted", { link = "MiniDiffSignDelete" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitConflict", { link = "MiniDiffSignDelete" })
|
-- vim.api.nvim_set_hl(0, "OilGitConflict", { link = "MiniDiffSignDelete" })
|
||||||
vim.api.nvim_set_hl(0, "OilGitIgnored", { link = "Comment" })
|
-- vim.api.nvim_set_hl(0, "OilGitIgnored", { link = "Comment" })
|
||||||
end
|
-- end
|
||||||
|
--
|
||||||
require("oil").setup({
|
-- require("oil").setup({
|
||||||
keymaps = {
|
-- keymaps = {
|
||||||
["<C-h>"] = false,
|
-- ["<C-h>"] = false,
|
||||||
["<C-j>"] = false,
|
-- ["<C-j>"] = false,
|
||||||
["<C-k>"] = false,
|
-- ["<C-k>"] = false,
|
||||||
["<C-l>"] = false,
|
-- ["<C-l>"] = false,
|
||||||
["gR"] = "actions.refresh", -- replaces default <C-l> behavior
|
-- ["gR"] = "actions.refresh", -- replaces default <C-l> behavior
|
||||||
["<F5>"] = "actions.refresh",
|
-- ["<F5>"] = "actions.refresh",
|
||||||
["<C-s>"] = false,
|
-- ["<C-s>"] = false,
|
||||||
["<C-p>"] = false,
|
-- ["<C-p>"] = { "actions.preview", opts = { vertical = true, split = "belowright" } },
|
||||||
["gp"] = { "actions.preview", opts = { vertical = true, split = "belowright" } },
|
-- ["<BS>"] = { "actions.parent", mode = "n" },
|
||||||
["<BS>"] = { "actions.parent", mode = "n" },
|
-- },
|
||||||
},
|
-- view_options = {
|
||||||
view_options = {
|
-- show_hidden = true,
|
||||||
show_hidden = true,
|
-- is_hidden_file = function(_, _)
|
||||||
is_hidden_file = function(_, _)
|
-- return false
|
||||||
return false
|
-- end,
|
||||||
end,
|
-- is_always_hidden = function(name, _)
|
||||||
is_always_hidden = function(name, _)
|
-- return name == ".git"
|
||||||
return name == ".git"
|
-- end,
|
||||||
end,
|
-- },
|
||||||
},
|
-- })
|
||||||
})
|
--
|
||||||
|
-- local oil_git_trie = require("oil-git.trie")
|
||||||
local oil_git_trie = require("oil-git.trie")
|
-- local oil_git_lookup = oil_git_trie.lookup
|
||||||
local oil_git_lookup = oil_git_trie.lookup
|
--
|
||||||
|
-- -- ugly internal monkey patch to not show partially git-ignored foldres as grey
|
||||||
-- ugly internal monkey patch to not show partially git-ignored foldres as grey
|
-- rawset(oil_git_trie, "lookup", function(root, entry_path, git_root, exclude_ignored)
|
||||||
rawset(oil_git_trie, "lookup", function(root, entry_path, git_root, exclude_ignored)
|
-- local status = oil_git_lookup(root, entry_path, git_root, exclude_ignored)
|
||||||
local status = oil_git_lookup(root, entry_path, git_root, exclude_ignored)
|
-- if status ~= "!!" or exclude_ignored then
|
||||||
if status ~= "!!" or exclude_ignored then
|
-- return status
|
||||||
return status
|
-- end
|
||||||
end
|
--
|
||||||
|
-- local relative_path = entry_path:sub(#git_root + 2)
|
||||||
local relative_path = entry_path:sub(#git_root + 2)
|
-- local node = root
|
||||||
local node = root
|
-- for segment in relative_path:gmatch("[^/\\]+") do
|
||||||
for segment in relative_path:gmatch("[^/\\]+") do
|
-- node = node.children[segment]
|
||||||
node = node.children[segment]
|
-- if not node then
|
||||||
if not node then
|
-- return nil
|
||||||
return nil
|
-- end
|
||||||
end
|
-- end
|
||||||
end
|
--
|
||||||
|
-- -- oil-git normally propagates an ignored child's status to every parent.
|
||||||
-- oil-git normally propagates an ignored child's status to every parent.
|
-- -- Only grey a directory when Git reported that directory itself as ignored.
|
||||||
-- Only grey a directory when Git reported that directory itself as ignored.
|
-- if not node.is_dir_ignored then
|
||||||
if not node.is_dir_ignored then
|
-- return nil
|
||||||
return nil
|
-- end
|
||||||
end
|
--
|
||||||
|
-- return status
|
||||||
return status
|
-- end)
|
||||||
end)
|
--
|
||||||
|
-- require("oil-git").setup({
|
||||||
require("oil-git").setup({
|
-- show_file_highlights = true,
|
||||||
show_file_highlights = true,
|
-- show_directory_highlights = true,
|
||||||
show_directory_highlights = true,
|
-- show_ignored_files = true,
|
||||||
show_ignored_files = true,
|
-- show_ignored_directories = true,
|
||||||
show_ignored_directories = true,
|
-- show_file_symbols = true,
|
||||||
show_file_symbols = true,
|
-- show_directory_symbols = true,
|
||||||
show_directory_symbols = true,
|
-- symbol_position = "none",
|
||||||
symbol_position = "none",
|
-- })
|
||||||
})
|
--
|
||||||
|
-- set_oil_git_highlights()
|
||||||
set_oil_git_highlights()
|
-- vim.api.nvim_create_autocmd("ColorScheme", {
|
||||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
-- group = vim.api.nvim_create_augroup("romanzy_oil_git_highlights", { clear = true }),
|
||||||
group = vim.api.nvim_create_augroup("romanzy_oil_git_highlights", { clear = true }),
|
-- callback = set_oil_git_highlights,
|
||||||
callback = set_oil_git_highlights,
|
-- })
|
||||||
})
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
require("romanzy.custom.tabline").setup()
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"codam-header.nvim": {
|
"codam-header.nvim": {
|
||||||
"rev": "cca1626803d348ee1a68847ec89a1f570a21fe0b",
|
"rev": "a8fbd2a7003eecbf6e85693e85d7d4d464625193",
|
||||||
"src": "https://github.com/romanzy313/codam-header.nvim"
|
"src": "https://github.com/BeerB34r/codam-header.nvim"
|
||||||
},
|
},
|
||||||
"conform.nvim": {
|
"conform.nvim": {
|
||||||
"rev": "016802de402556da54c36bd7359b441266b01cdd",
|
"rev": "619363c30309d29ffa631e67c8183f2a72caa373",
|
||||||
"src": "https://github.com/stevearc/conform.nvim"
|
"src": "https://github.com/stevearc/conform.nvim"
|
||||||
},
|
},
|
||||||
"diffview.nvim": {
|
"diffview.nvim": {
|
||||||
@@ -13,11 +13,11 @@
|
|||||||
"src": "https://github.com/sindrets/diffview.nvim"
|
"src": "https://github.com/sindrets/diffview.nvim"
|
||||||
},
|
},
|
||||||
"lazygit.nvim": {
|
"lazygit.nvim": {
|
||||||
"rev": "9ffc6103926718f7070fb4017694543cd7dc9718",
|
"rev": "a04ad0dbc725134edbee3a5eea29290976695357",
|
||||||
"src": "https://github.com/kdheepak/lazygit.nvim"
|
"src": "https://github.com/kdheepak/lazygit.nvim"
|
||||||
},
|
},
|
||||||
"mason-lspconfig.nvim": {
|
"mason-lspconfig.nvim": {
|
||||||
"rev": "b3298993d55fa194279b5eb9dbfb3a43da65cadf",
|
"rev": "47059d71b42d74b0a1e9f61c1d99d301039c3b5b",
|
||||||
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
|
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
|
||||||
},
|
},
|
||||||
"mason.nvim": {
|
"mason.nvim": {
|
||||||
@@ -25,19 +25,19 @@
|
|||||||
"src": "https://github.com/mason-org/mason.nvim"
|
"src": "https://github.com/mason-org/mason.nvim"
|
||||||
},
|
},
|
||||||
"mini.nvim": {
|
"mini.nvim": {
|
||||||
"rev": "0513ad9ada655a07af321c129b69dafaf9e63d80",
|
"rev": "c5cdbadeb423ff724e27a42ab2d1c504d1d6fc5a",
|
||||||
"src": "https://github.com/echasnovski/mini.nvim"
|
"src": "https://github.com/echasnovski/mini.nvim"
|
||||||
},
|
},
|
||||||
"nvim-lspconfig": {
|
"nvim-lspconfig": {
|
||||||
"rev": "db68de3575fff9dd9bb78b34c8371759ed35fe34",
|
"rev": "292f44408498103c47996ff5c18fd366293840d8",
|
||||||
"src": "https://github.com/neovim/nvim-lspconfig"
|
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||||
},
|
},
|
||||||
"nvim-treesitter": {
|
"nvim-treesitter": {
|
||||||
"rev": "e289100ff98969e118c702199d88b764ce9e7fdf",
|
"rev": "4916d6592ede8c07973490d9322f187e07dfefac",
|
||||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
},
|
},
|
||||||
"oil-git.nvim": {
|
"oil-git.nvim": {
|
||||||
"rev": "8bab14df0b7db7a62fa75c8978d6181daed2f0a2",
|
"rev": "54de208323d00c519e26280f8b5b4b821d32f955",
|
||||||
"src": "https://github.com/malewicz1337/oil-git.nvim"
|
"src": "https://github.com/malewicz1337/oil-git.nvim"
|
||||||
},
|
},
|
||||||
"oil.nvim": {
|
"oil.nvim": {
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
"src": "https://github.com/rose-pine/neovim"
|
"src": "https://github.com/rose-pine/neovim"
|
||||||
},
|
},
|
||||||
"telescope.nvim": {
|
"telescope.nvim": {
|
||||||
"rev": "40aedd8a68c78a656a10a8d62d80c54af59420fb",
|
"rev": "427b576c16792edad01a92b89721d923c19ad60f",
|
||||||
"src": "https://github.com/nvim-telescope/telescope.nvim"
|
"src": "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
},
|
},
|
||||||
"trouble.nvim": {
|
"trouble.nvim": {
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
script_name=$(basename "$0")
|
|
||||||
|
|
||||||
if [ "$#" -eq 0 ]; then
|
|
||||||
echo "Usage: $script_name command [args ...]" >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v inotifywait >/dev/null; then
|
|
||||||
echo "$script_name: inotifywait was not found. Install inotify-tools." >&2
|
|
||||||
exit 127
|
|
||||||
fi
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
if [ -t 1 ]; then
|
|
||||||
clear 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
( "$@" ) || echo "$script_name: command exited with status $?" >&2
|
|
||||||
inotifywait --quiet --recursive --event close_write,move,create,delete . >/dev/null
|
|
||||||
sleep 0.2
|
|
||||||
done
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# https://pypi.org/project/c-formatter-42/
|
|
||||||
# install via
|
|
||||||
# pip3 install --user c-formatter-42
|
|
||||||
|
|
||||||
c_formatter_42 *.c *.h
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
flake8 --color=never . && echo "Success: flake8"
|
|
||||||
|
|
||||||
mypy --strict .
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# Run with `source pyvenv`
|
|
||||||
|
|
||||||
if [ -n "${VIRTUAL_ENV:-}" ]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f .venv/bin/activate ]; then
|
|
||||||
python3 -m venv .venv || return $?
|
|
||||||
if [ -f requirements.txt ]; then
|
|
||||||
.venv/bin/python -m pip install -r requirements.txt || return $?
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
. .venv/bin/activate
|
|
||||||
Reference in New Issue
Block a user