chore: unstage incorrectly tracked submodule contents

Remove files that were committed as regular tracked files instead of
as git submodule references. Submodules will be re-added properly.
This commit is contained in:
Bryan Ramos 2026-04-15 21:11:55 -04:00
parent 864c69fe61
commit 2779aed365
24 changed files with 0 additions and 1596 deletions

View file

@ -1,25 +0,0 @@
# Navigation
alias cd='cd -L'
# Colors
eval "$(dircolors -b)"
alias ls='ls --color=auto'
# Search
alias grep='grep --color=auto'
# Tree (uses eza if available)
if command -v eza >/dev/null 2>&1; then
alias tree='eza --tree --icons=never'
fi
# Open (graphical environment only)
if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ]; then
alias open='xdg-open'
fi
if command -v nvim >/dev/null 2>&1; then
alias vim='nvim'
fi
alias cdg='cd "$(git rev-parse --show-toplevel 2>/dev/null)"'

View file

@ -1,21 +0,0 @@
# Use gpg-agent for SSH (YubiKey support)
if command -v gpgconf >/dev/null 2>&1; then
export SSH_AUTH_SOCK
SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
# Source prompt and aliases
BASH_CONFIG_DIR="${BASH_SOURCE%/*}"
. "$BASH_CONFIG_DIR/prompt"
. "$BASH_CONFIG_DIR/aliases"
# Vi mode
set -o vi
# Completion
bind 'set completion-ignore-case on'
bind 'set completion-map-case on'
if command -v direnv >/dev/null 2>&1; then
eval "$(direnv hook bash)"
fi

View file

@ -1,179 +0,0 @@
# Detect graphical environment once at source time
if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ]; then
_gfx=1
_py_sym=$'\ue73c'
_js_sym=$'\ue781'
_nix_sym=$'\ue843'
_proj_sym=$'\ueb45 '
_branch_sym=$'\uf418'
else
_gfx=""
_py_sym="py"
_js_sym="js"
_nix_sym="nix"
_proj_sym="../"
_branch_sym="git"
fi
# Pre-compute colored icons
_python_icon="\[\033[01;33m\]$_py_sym\[\033[00m\]"
_node_icon="\[\033[01;93m\]$_js_sym\[\033[00m\]"
_nix_icon="\[\033[01;34m\]$_nix_sym\[\033[00m\]"
# SSH check once at source time
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
_ssh_PS1="\n\[\033[01;37m\]\u@\h:\[\033[00m\]\n"
else
_ssh_PS1=""
fi
# Static prompt parts
_green_arrow="\[\033[01;32m\]>> "
_white_text="\[\033[00m\]"
# Cache: dir -> "git_root|superproject|" or "-" for non-git
declare -A _dir_cache
# Find git root by walking up (no git spawn)
_find_git_root() {
local dir="$PWD"
while [ -n "$dir" ]; do
if [ -e "$dir/.git" ]; then
_git_root="$dir"
return 0
fi
dir="${dir%/*}"
done
return 1
}
# Find superproject by walking up from git root
_find_superproject() {
local dir="${_git_root%/*}"
_superproject=""
while [ -n "$dir" ]; do
if [ -e "$dir/.git" ]; then
_superproject="$dir"
return 0
fi
dir="${dir%/*}"
done
return 1
}
# Read branch from .git/HEAD (no git spawn)
_read_branch() {
local git_dir="$_git_root/.git"
local head_file
# Submodule: .git is a file with "gitdir: <path>"
if [ -f "$git_dir" ]; then
read -r _ head_file < "$git_dir"
head_file="$head_file/HEAD"
else
head_file="$git_dir/HEAD"
fi
[ -f "$head_file" ] || return 1
local head
read -r head < "$head_file"
if [[ "$head" == "ref: refs/heads/"* ]]; then
_git_branch="${head#ref: refs/heads/}"
else
# Detached HEAD - short hash
_git_branch="${head:0:7}"
fi
}
# Build venv icons (must run every prompt - env can change)
_build_venv_icons() {
venv_icons=""
[ -n "$IN_NIX_SHELL" ] && venv_icons+="$_nix_icon "
[ -n "$VIRTUAL_ENV" ] && venv_icons+="$_python_icon "
[ -d "$_git_root/node_modules" ] && venv_icons+="$_node_icon "
}
# Main prompt logic
_set_prompt() {
local cached="${_dir_cache[$PWD]}"
# Check cache
if [ -z "$cached" ]; then
if _find_git_root; then
_find_superproject
_dir_cache[$PWD]="$_git_root|$_superproject|"
else
_dir_cache[$PWD]="-"
cached="-"
fi
fi
# Non-git directory
if [ "$cached" = "-" ] || [ "${_dir_cache[$PWD]}" = "-" ]; then
venv_icons=""
[ -n "$IN_NIX_SHELL" ] && venv_icons+="$_nix_icon "
[ -n "$VIRTUAL_ENV" ] && venv_icons+="$_python_icon "
PS1="$_ssh_PS1\n\[\033[01;34m\]\w\[\033[00m\]\n$venv_icons$_green_arrow$_white_text"
return
fi
# Parse cache
[ -z "$cached" ] && cached="${_dir_cache[$PWD]}"
IFS='|' read -r _git_root _superproject _ <<< "$cached"
# Get branch (can change without cd) - if fails, git root is gone
if ! _read_branch; then
unset "_dir_cache[$PWD]"
_set_prompt
return
fi
# Build paths using bash string ops (no readlink spawn)
local git_curr_dir="${PWD#$_git_root}"
local git_root_dir="${_git_root##*/}"
# Build working_dir
local working_dir
if [ -n "$_superproject" ]; then
local super_name="${_superproject##*/}"
working_dir="\[\033[01;34m\]$_proj_sym$super_name/$git_root_dir$git_curr_dir\[\033[00m\]"
elif [ -z "$git_curr_dir" ]; then
working_dir="\[\033[01;34m\]$_proj_sym$git_root_dir\[\033[00m\]"
else
working_dir="\[\033[01;34m\]$_proj_sym$git_root_dir$git_curr_dir\[\033[00m\]"
fi
# Build branch PS1
local git_branch_PS1
if [ -n "$_gfx" ]; then
git_branch_PS1="\[\033[01;31m\]$_git_branch $_branch_sym:\[\033[00m\]"
else
git_branch_PS1="\[\033[01;31m\]$_git_branch:\[\033[00m\]"
fi
# Build venv icons
_build_venv_icons
PS1="$_ssh_PS1\n$working_dir\n$venv_icons$_green_arrow$git_branch_PS1$_white_text"
}
# Invalidate cache for current directory
_prompt_cache_invalidate() {
unset "_dir_cache[$PWD]"
}
# Wrap git to invalidate cache on repo-creating commands
git() {
command git "$@"
local ret=$?
[[ "$1" =~ ^(init|clone)$ ]] && _prompt_cache_invalidate
return $ret
}
if [ -n "$PROMPT_COMMAND" ]; then
PROMPT_COMMAND="_set_prompt;$PROMPT_COMMAND"
else
PROMPT_COMMAND="_set_prompt"
fi

View file

@ -1,9 +0,0 @@
# Git Config
My global git configuration.
## Install
```bash
git clone git@github.com:itme-brain/git.git ~/.config/git
```

View file

@ -1,28 +0,0 @@
[init]
defaultBranch = master
# Use vimdiff for diffs and merge conflicts
[diff]
tool = vimdiff
[merge]
tool = vimdiff
[mergetool]
keepBackup = false
[mergetool "vimdiff"]
trustExitCode = true
[user]
name = Bryan Ramos
email = bryan@ramos.codes
signingKey = F1F3466458452B2DF351F1E864D12BA95ACE1F2D
# Auto-set upstream on first push
[push]
autoSetupRemote = true
# Enable per-project with: git config --local commit.gpgSign true
[commit]
gpgSign = false

View file

@ -1,14 +0,0 @@
# JavaScript / Node
node_modules
# Nix
.direnv
result
# Haskell
dist-newstyle
# Nuxt
.nuxt/
.output/
dist

View file

@ -1,73 +0,0 @@
# Neovim Configuration
Portable Neovim configuration using lazy.nvim and native LSP (Neovim 0.11+, tested on 0.12.1).
## Installation
### Standalone (any system)
```bash
git clone git@github.com:itme-brain/nvim.git ~/.config/nvim
```
### As part of NixOS config
```bash
git clone --recurse-submodules git@github.com:itme-brain/nixos.git
```
## Features
- **Native LSP** (`vim.lsp.config` / `vim.lsp.enable`) - no manual server list needed
- **Smart LSP picker** (`<leader>css`) - auto-detects installed servers for current filetype
- **Neovim 0.12 compatible** - uses built-in `:lsp` commands and keeps legacy `:Lsp*` aliases working
- **Portable** - works on NixOS (LSPs via extraPackages) or any system (LSPs via Mason)
- **Mason** - auto-disabled on NixOS, auto-installs essentials elsewhere
## LSP Setup
On NixOS, LSPs come from:
- `neovim.extraPackages` (global essentials)
- Project `devShell` (project-specific)
On other systems, Mason auto-installs:
- `lua_ls` - Lua/Neovim
- `nil_ls` - Nix
- `bashls` - Bash/Shell
- `jsonls` - JSON
- `html` - HTML
- `cssls` - CSS
- `marksman` - Markdown
- `taplo` - TOML
- `yamlls` - YAML
The smart picker (`<leader>css`) scans all lspconfig servers and shows only those with binaries installed.
On Neovim 0.12+, start/stop/restart uses the built-in `:lsp` commands under the hood.
## Key Bindings
| Key | Action |
|-----|--------|
| `<leader>css` | Start LSP (smart picker) |
| `<leader>csx` | Stop LSP |
| `<leader>csr` | Restart LSP |
| `<leader>cf` | Format code |
| `<leader>ca` | Code action |
| `<leader>cr` | Rename symbol |
| `gd` | Go to definition |
| `<leader>gr` | Find references |
| `<leader>e` | Toggle file explorer |
| `<leader>bd` | Delete buffer |
| `<leader>/` | Live grep from git root |
| `<leader>ff` | Find files from git root |
## Plugins
- **lazy.nvim** - plugin manager
- **nvim-lspconfig** - LSP configurations
- **nvim-cmp** - completion
- **telescope.nvim** - fuzzy finder
- **nvim-treesitter** - syntax highlighting
- **neo-tree.nvim** - file explorer
- **gitsigns.nvim** - git integration
- **lualine.nvim** - statusline
- **bufferline.nvim** - buffer tabs
- **which-key.nvim** - keybinding hints

View file

@ -1,13 +0,0 @@
local function load_config_directory(directory)
local config_path = vim.fn.stdpath("config") .. "/lua/" .. directory
local files = vim.fn.readdir(config_path, function(name)
return name:sub(-4) == ".lua"
end)
for _, file in ipairs(files) do
local file_name = file:sub(1, -5)
require(directory .. "." .. file_name)
end
end
load_config_directory("config")

View file

@ -1,23 +0,0 @@
-- Keep cursor centered while navigating document
vim.keymap.set("n", "<C-U>", "<C-U>zz", { silent = true })
vim.keymap.set("n", "<C-D>", "<C-D>zz", { silent = true })
-- Remap Ctrl + J/K/H/L to navigate between windows
vim.keymap.set('n', '<C-j>', '<C-w>j', { noremap = true, silent = true })
vim.keymap.set('n', '<C-k>', '<C-w>k', { noremap = true, silent = true })
vim.keymap.set('n', '<C-h>', '<C-w>h', { noremap = true, silent = true })
vim.keymap.set('n', '<C-l>', '<C-w>l', { noremap = true, silent = true })
vim.keymap.set('n', '<C-Right>', ':vertical resize +10<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<C-Left>', ':vertical resize -10<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<C-Up>', ':horizontal resize +10<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<C-Down>', ':horizontal resize -10<CR>', { noremap = true, silent = true })
-- Remap Shift + H/L to switch between buffers
vim.keymap.set('n', '<S-h>', ':bprevious<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<S-l>', ':bnext<CR>', { noremap = true, silent = true })
vim.keymap.set("v", "<", "<gv")
vim.keymap.set("v", ">", ">gv")
vim.keymap.set("n", "<Esc>", ':nohlsearch<Bar>let @/=""<CR>', { noremap = true, silent = true})

View file

@ -1,35 +0,0 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "onedark" } },
-- automatically check for plugin updates
checker = { enabled = false },
})

View file

@ -1,48 +0,0 @@
vim.o.clipboard = "unnamedplus"
vim.g.autoformat = false
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.cursorline = true
-- Enable true color if terminal supports it (disabled in TTY/headless)
if vim.env.COLORTERM == "truecolor" or vim.env.COLORTERM == "24bit" then
vim.opt.termguicolors = true
end
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.incsearch = false
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undofile = true
vim.opt.guicursor = "n-v-c:block,i:block,r:block"
vim.opt.fillchars = { eob = " " }
local options_group = vim.api.nvim_create_augroup("config_options", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
group = options_group,
pattern = { "python", "haskell", "c", "cpp" },
callback = function()
local opt = vim.opt_local
opt.tabstop = 4
opt.shiftwidth = 4
opt.softtabstop = 4
end,
})
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
group = options_group,
pattern = "*.purs",
callback = function(event)
vim.bo[event.buf].filetype = "purescript"
end,
})

View file

@ -1,40 +0,0 @@
return {
{
"akinsho/bufferline.nvim",
version = "*",
dependencies = "nvim-tree/nvim-web-devicons",
config = function()
require("bufferline").setup{
options = {
separator_style = "thin",
show_buffer_close_buttons = false,
show_close_icon = false,
},
highlights = {
-- Force all icon backgrounds to transparent
buffer_selected = { bg = "NONE" },
buffer_visible = { bg = "NONE" },
background = { bg = "NONE" },
fill = { bg = "NONE" },
separator = { bg = "NONE" },
separator_selected = { bg = "NONE" },
separator_visible = { bg = "NONE" },
close_button = { bg = "NONE" },
close_button_selected = { bg = "NONE" },
close_button_visible = { bg = "NONE" },
modified = { bg = "NONE" },
modified_selected = { bg = "NONE" },
modified_visible = { bg = "NONE" },
duplicate = { bg = "NONE" },
duplicate_selected = { bg = "NONE" },
duplicate_visible = { bg = "NONE" },
indicator_selected = { bg = "NONE" },
indicator_visible = { bg = "NONE" },
pick = { bg = "NONE" },
pick_selected = { bg = "NONE" },
pick_visible = { bg = "NONE" },
},
}
end
}
}

View file

@ -1,109 +0,0 @@
return {
{
"chriskempson/base16-vim",
config = function()
local color_group = vim.api.nvim_create_augroup("config_colorscheme", { clear = true })
local highlights = {
Normal = { bg = "NONE", fg = "#FFFFFF" },
Visual = { bg = "Gray", fg = "Black" },
NonText = { bg = "NONE" },
LineNr = { bg = "NONE" },
CursorLine = { bg = "NONE" },
CursorLineNr = { bg = "NONE", fg = "#E5C07B", bold = true },
Search = { bg = "#FFCC66", fg = "#000000" },
Pmenu = { bg = "Black", fg = "White" },
PmenuSel = { bg = "Green", fg = "Black" },
PmenuThumb = { bg = "Green" },
PmenuSbar = { bg = "Black" },
WinSeparator = { bg = "NONE" },
GitGutterChange = { bg = "NONE" },
GitGutterAdd = { bg = "NONE" },
GitGutterDelete = { bg = "NONE" },
GitSignsAddNr = { bg = "NONE", fg = "#98c379" },
GitSignsChangeNr = { bg = "NONE", fg = "#61afef" },
GitSignsDeleteNr = { bg = "NONE", fg = "#e06c75" },
SignColumn = { bg = "NONE" },
NeoTreeGitAdded = { bg = "NONE", fg = "#98c379" },
NeoTreeGitModified = { bg = "NONE", fg = "#e5c07b" },
NeoTreeGitDeleted = { bg = "NONE", fg = "#e06c75" },
NeoTreeGitConflict = { bg = "NONE", fg = "#e06c75" },
NeoTreeGitUntracked = { bg = "NONE", fg = "#61afef" },
TelescopeSelection = { bg = "Gray", fg = "Green", bold = true },
TelescopePreviewMatch = { bg = "Yellow", fg = "Black" },
TreesitterContext = { bg = "NONE" },
LazyH1 = { bg = "Black", fg = "Green" },
IblScope = { bg = "NONE", fg = "Yellow" },
ConflictMarker = { fg = "red" },
DiffAdd = { bg = "NONE" },
DiffChange = { bg = "NONE" },
DiffDelete = { bg = "NONE" },
DiffText = { bg = "NONE" },
BufferLineFill = { bg = "NONE" },
BufferLineBackground = { bg = "NONE", fg = "#5c6370" },
BufferLineBuffer = { bg = "NONE", fg = "#5c6370" },
BufferLineBufferSelected = { bg = "NONE", fg = "#FFFFFF", bold = true },
BufferLineBufferVisible = { bg = "NONE", fg = "#abb2bf" },
BufferLineCloseButton = { bg = "NONE", fg = "#5c6370" },
BufferLineCloseButtonSelected = { bg = "NONE", fg = "#e06c75" },
BufferLineCloseButtonVisible = { bg = "NONE", fg = "#5c6370" },
BufferLineModified = { bg = "NONE", fg = "#e5c07b" },
BufferLineModifiedSelected = { bg = "NONE", fg = "#e5c07b" },
BufferLineModifiedVisible = { bg = "NONE", fg = "#e5c07b" },
BufferLineSeparator = { bg = "NONE", fg = "#3e4452" },
BufferLineSeparatorSelected = { bg = "NONE", fg = "#3e4452" },
BufferLineSeparatorVisible = { bg = "NONE", fg = "#3e4452" },
BufferLineIndicatorSelected = { bg = "NONE", fg = "#61afef" },
YankHighlight = { bg = "yellow", fg = "black" },
}
local function apply_highlights()
for group, spec in pairs(highlights) do
vim.api.nvim_set_hl(0, group, spec)
end
end
local conflict_pattern = [[<<<<<<< HEAD\|=======\|>>>>>>> .\+]]
local function apply_conflict_match(win)
if vim.w[win].conflict_marker_match_id then
pcall(vim.fn.matchdelete, vim.w[win].conflict_marker_match_id, win)
end
vim.w[win].conflict_marker_match_id = vim.fn.matchadd("ConflictMarker", conflict_pattern, 10, -1, {
window = win,
})
end
vim.cmd.colorscheme("base16-onedark")
apply_highlights()
vim.api.nvim_create_autocmd("ColorScheme", {
group = color_group,
callback = apply_highlights,
})
vim.api.nvim_create_autocmd({ "BufWinEnter", "WinEnter" }, {
group = color_group,
callback = function(event)
apply_conflict_match(vim.api.nvim_get_current_win())
end,
})
vim.api.nvim_create_autocmd("TextYankPost", {
group = color_group,
callback = function()
vim.highlight.on_yank({ higroup = "YankHighlight", timeout = 150 })
end,
})
end,
},
{
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
{
"fei6409/log-highlight.nvim"
}
}

View file

@ -1,5 +0,0 @@
return {
{ "williamboman/mason.nvim", enabled = false },
{ "williamboman/mason-lspconfig.nvim", enabled = false },
{ "jay-babu/mason-nvim-dap.nvim", enabled = false },
}

View file

@ -1,59 +0,0 @@
return {
{
"lewis6991/gitsigns.nvim",
config = function()
require('gitsigns').setup {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '-' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signs_staged = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '-' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signs_staged_enable = true,
signcolumn = false, -- Toggle with `:Gitsigns toggle_signs`
numhl = true, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
follow_files = true
},
auto_attach = true,
attach_to_untracked = false,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 0,
ignore_whitespace = false,
virt_text_priority = 100,
},
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
},
}
require("which-key").add({
{ "<leader>Gb", ":Gitsigns toggle_current_line_blame<CR>", desc = "Git blame" }
})
end
}
}

View file

@ -1,22 +0,0 @@
return {
{
"lukas-reineke/indent-blankline.nvim",
config = function()
local hooks = require("ibl.hooks")
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "IblIndent", { link = "Comment" })
end)
require("ibl").setup({
indent = {
char = "|",
highlight = "IblIndent",
},
scope = {
enabled = false
},
})
end,
}
}

View file

@ -1,310 +0,0 @@
-- Neovim 0.11+ LSP configuration
-- Uses nvim-lspconfig for server definitions + vim.lsp.enable() API
-- Detect NixOS (Mason doesn't work on NixOS due to FHS issues)
local is_nixos = vim.fn.filereadable("/etc/NIXOS") == 1
-- Servers to ensure are installed via Mason (non-NixOS only)
-- On NixOS, install these via extraPackages or per-project devShells
local mason_ensure_installed = {
"lua_ls", -- Neovim config
"nil_ls", -- Nix (nixd not available in Mason)
"bashls", -- Shell scripts
"jsonls", -- JSON configs
"html", -- HTML
"cssls", -- CSS
"marksman", -- Markdown
"taplo", -- TOML
"yamlls", -- YAML
}
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require('nvim-treesitter.configs').setup({
ensure_installed = {
"lua",
"c",
"cpp",
"python",
"nix",
"rust",
"bash",
"markdown",
"html",
"javascript",
"css",
"vim",
"git_config",
"git_rebase",
"gitattributes",
"gitcommit",
"gitignore"
},
auto_install = true,
sync_install = true,
highlight = {
enable = true,
}
})
end
},
{
"m4xshen/autoclose.nvim",
config = function()
require("autoclose").setup()
end
},
{
"hrsh7th/nvim-cmp",
dependencies = {
{
"L3MON4D3/LuaSnip",
version = "v2.*",
build = "make install_jsregexp",
},
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lsp"
},
config = function()
local cmp = require("cmp")
cmp.setup({
enabled = function()
local context = require("cmp.config.context")
if vim.api.nvim_get_mode().mode == "c" then
return true
else
return not context.in_treesitter_capture("comment") and not context.in_syntax_group("comment")
end
end,
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end
},
mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping.abort(),
["<C-y>"] = cmp.mapping.confirm(),
["<CR>"] = cmp.mapping(function(fallback)
fallback()
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
}, {
{ name = 'buffer' }
}),
})
end
},
-- Mason: portable LSP installer (disabled on NixOS where it doesn't work)
{
"williamboman/mason.nvim",
enabled = not is_nixos,
config = function()
require("mason").setup()
end
},
{
"williamboman/mason-lspconfig.nvim",
enabled = not is_nixos,
dependencies = { "williamboman/mason.nvim" },
config = function()
require("mason-lspconfig").setup({
ensure_installed = mason_ensure_installed,
automatic_installation = false, -- Only install what's in ensure_installed
})
end
},
{
"neovim/nvim-lspconfig",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
},
config = function()
local lspconfig = require('lspconfig')
-- Neovim 0.12 exposes built-in :lsp commands and skips lspconfig's legacy
-- :Lsp* aliases. Recreate the old names so existing mappings keep working.
if vim.fn.exists(':lsp') == 2 and vim.fn.exists(':LspStart') == 0 then
vim.api.nvim_create_user_command('LspStart', function(info)
vim.cmd('lsp enable ' .. table.concat(info.fargs, ' '))
end, { nargs = '*' })
vim.api.nvim_create_user_command('LspRestart', function(info)
vim.cmd('lsp restart ' .. table.concat(info.fargs, ' '))
end, { nargs = '*', bang = true })
vim.api.nvim_create_user_command('LspStop', function(info)
local suffix = info.bang and '!' or ''
vim.cmd('lsp stop' .. suffix .. ' ' .. table.concat(info.fargs, ' '))
end, { nargs = '*', bang = true })
end
-- Diagnostic display configuration
vim.diagnostic.config({
virtual_text = {
prefix = '',
spacing = 2,
current_line = true;
},
float = {
border = 'rounded',
source = true,
},
signs = {
text = {
[vim.diagnostic.severity.ERROR] = '',
[vim.diagnostic.severity.WARN] = '',
[vim.diagnostic.severity.INFO] = '',
[vim.diagnostic.severity.HINT] = '',
},
},
underline = true,
update_in_insert = false,
severity_sort = true,
})
-- Add border to hover and signature help windows.
local hover_handler = vim.lsp.handlers.hover
vim.lsp.handlers['textDocument/hover'] = function(err, result, ctx, config)
return hover_handler(err, result, ctx, vim.tbl_extend('force', config or {}, {
border = 'rounded',
}))
end
local signature_help_handler = vim.lsp.handlers.signature_help
vim.lsp.handlers['textDocument/signatureHelp'] = function(err, result, ctx, config)
return signature_help_handler(err, result, ctx, vim.tbl_extend('force', config or {}, {
border = 'rounded',
}))
end
-- Get all known server names by scanning lspconfig's lsp directory
local function get_all_servers()
local servers = {}
local lsp_path = vim.fn.stdpath('data') .. '/lazy/nvim-lspconfig/lsp'
local files = vim.fn.readdir(lsp_path, function(name)
return name:sub(-4) == '.lua'
end)
for _, file in ipairs(files) do
local server = file:sub(1, -5)
table.insert(servers, server)
end
return servers
end
local all_servers = get_all_servers()
-- local navic = require('nvim-navic')
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- Global config applied to all servers
vim.lsp.config('*', {
autostart = false, -- Don't auto-attach, use <leader>css to start manually
capabilities = capabilities,
-- on_attach = function(client, bufnr)
-- if client.server_capabilities.documentSymbolProvider then
-- navic.attach(client, bufnr)
-- end
-- end,
})
-- Server-specific settings (merged with lspconfig defaults)
vim.lsp.config.lua_ls = {
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
}
}
-- Check if server binary is available
local function is_server_installed(config)
if config.default_config and config.default_config.cmd then
local cmd = config.default_config.cmd[1]
return vim.fn.executable(cmd) == 1
end
return false
end
-- Find and start LSP server(s) for current filetype
local function lsp_start_smart()
local ft = vim.bo.filetype
if ft == '' then
vim.notify("No filetype detected", vim.log.levels.WARN)
return
end
-- Find all matching servers (filetype match + binary installed)
local matching = {}
for _, server in ipairs(all_servers) do
local ok, config = pcall(require, 'lspconfig.configs.' .. server)
if ok and config.default_config and config.default_config.filetypes then
if vim.tbl_contains(config.default_config.filetypes, ft) and is_server_installed(config) then
table.insert(matching, server)
end
end
end
-- Sort for consistent ordering
table.sort(matching)
local function start_server(server)
vim.lsp.enable(server)
end
if #matching == 0 then
vim.notify("No LSP server installed for filetype: " .. ft, vim.log.levels.WARN)
elseif #matching == 1 then
start_server(matching[1])
else
vim.ui.select(matching, {
prompt = "Select LSP server:",
}, function(choice)
if choice then
start_server(choice)
end
end)
end
end
-- LSP keybindings
require("which-key").add({
{ "<leader>cs", group = "LSP Commands" },
{ "<leader>cf", function() vim.lsp.buf.format() end, desc = "Code Format" },
{ "<leader>csi", ":checkhealth vim.lsp<CR>", desc = "LSP Info" },
{ "<leader>csr", ":lsp restart<CR>", desc = "LSP Restart" },
{ "<leader>css", lsp_start_smart, desc = "LSP Start" },
{ "<leader>csx", ":lsp stop<CR>", desc = "LSP Stop" },
})
end
},
{
"taproot-wizards/bitcoin-script-hints.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
config = function()
require("bitcoin-script-hints").setup()
end
}
}

View file

@ -1,60 +0,0 @@
return {
{
"nvim-lualine/lualine.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
"SmiteshP/nvim-navic"
},
config = function()
require("lualine").setup ({
options = {
icons_enabled = true,
theme = 'material',
component_separators = { left = '>', right = '|'},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = true,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {
{'filename'},
{ function() return require("nvim-navic").get_location() end, cond = function()
return require("nvim-navic").is_available()
end,
},
},
lualine_x = {'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {
'lazy',
'neo-tree',
}
})
end
}
}

View file

@ -1,102 +0,0 @@
return {
{
"nvim-neo-tree/neo-tree.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
},
config = function()
require("neo-tree").setup({
enable_diagnostics = false,
default_component_configs = {
git_status = {
symbols = {
added = "+",
modified = "~",
deleted = "-",
renamed = ">",
untracked = "?",
ignored = "!",
unstaged = "U",
staged = "S",
conflict = "C",
},
},
},
window = {
position = "left",
width = 20,
},
event_handlers = {
{
event = "neo_tree_window_after_open",
handler = function()
local win = vim.api.nvim_get_current_win()
vim.wo[win].winfixwidth = true
vim.wo[win].winfixbuf = true
vim.wo[win].cursorline = true
end
},
},
})
-- Keep the selected entry readable without a solid row background.
vim.api.nvim_set_hl(0, "NeoTreeCursorLine", { bg = "NONE", fg = "#a6e3a1" })
-- Apply highlight and re-apply on colorscheme change
vim.api.nvim_create_autocmd({ "FileType", "ColorScheme" }, {
pattern = { "neo-tree", "*" },
callback = function(ev)
if ev.event == "ColorScheme" then
vim.api.nvim_set_hl(0, "NeoTreeCursorLine", { bg = "NONE", fg = "#a6e3a1" })
end
local win = vim.api.nvim_get_current_win()
local buf = vim.api.nvim_win_get_buf(win)
if vim.bo[buf].filetype == "neo-tree" then
vim.wo[win].winhighlight = "CursorLine:NeoTreeCursorLine"
end
end,
})
-- Lock cursor to leftmost column in neo-tree
vim.api.nvim_create_autocmd("CursorMoved", {
pattern = "neo-tree*",
callback = function()
local col = vim.api.nvim_win_get_cursor(0)[2]
if col ~= 0 then
vim.api.nvim_win_set_cursor(0, { vim.api.nvim_win_get_cursor(0)[1], 0 })
end
end,
})
local function toggle_neotree()
local api = vim.api
local bufs = api.nvim_list_bufs()
for _, buf in ipairs(bufs) do
local name = api.nvim_buf_get_name(buf)
if name:match("neo%-tree filesystem") then
vim.cmd("Neotree close")
return
end
end
vim.cmd("Neotree")
end
require("which-key").add({
{ "<leader>e", toggle_neotree, desc = "File Explorer" }
})
--vim.fn.sign_define("DiagnosticSignError",
-- {text = " ", texthl = "DiagnosticSignError"})
--vim.fn.sign_define("DiagnosticSignWarn",
-- {text = " ", texthl = "DiagnosticSignWarn"})
--vim.fn.sign_define("DiagnosticSignInfo",
-- {text = " ", texthl = "DiagnosticSignInfo"})
--vim.fn.sign_define("DiagnosticSignHint",
-- {text = "󰌵", texthl = "DiagnosticSignHint"})
end,
},
}

View file

@ -1,62 +0,0 @@
local function get_root()
local result = vim.system({ "git", "rev-parse", "--show-toplevel" }, { text = true }):wait()
if result.code == 0 and result.stdout then
local git_dir = vim.trim(result.stdout)
if git_dir ~= "" then
return git_dir
end
end
return vim.fn.getcwd()
end
return {
{
"nvim-telescope/telescope.nvim",
branch = '0.1.x',
dependencies = {
{ 'nvim-lua/plenary.nvim' },
{ 'nvim-tree/nvim-web-devicons' }
},
config = function()
-- Custom Telescope command to grep from Git root
require("which-key").add({
{ "<leader>/", function()
require('telescope.builtin').live_grep({ cwd = get_root() })
end,
desc = "grep" },
{ "<leader>ff", function()
require('telescope.builtin').find_files({ cwd = get_root() })
end,
desc = "Search for Files" },
{ "<leader>fp", ":Telescope oldfiles<CR>", desc = "Oldfiles" },
{ "<leader>?", ":Telescope command_history<CR>", desc = "Command History" },
{ "<leader>cm", ":Telescope man_pages<CR>", desc = "Manpages" },
-- Code
{ "gd",
function()
local attached = vim.lsp.get_clients({ bufnr = 0 })
if next(attached) ~= nil then
require('telescope.builtin').lsp_definitions()
else
vim.api.nvim_feedkeys("gd", "n", false)
end
end,
mode = "n",
desc = "Go to Definition"
},
{ "<leader>gd", ":Telescope lsp_definitions<CR>", desc = "Go to Definition" },
{ "<leader>gr", ":Telescope lsp_references<CR>", desc = "Goto References" },
{ "<leader>gi", ":Telescope lsp_implementations<CR>", desc = "Go to Implementations" },
{ "<leader>gt", ":Telescope lsp_type_definitions<CR>", desc = "Go to Type Definition" },
{ "<leader>cv", ":Telescope treesitter<CR>", desc = "Function Names & Variables" },
{ "<leader>cd", ":Telescope diagnostics<CR>", desc = "Code Diagnostics" },
-- Git
{ "<leader>Gt", ":Telescope git_branches<CR>", desc = "Git Branches" },
{ "<leader>Gc", ":Telescope git_commits<CR>", desc = "Git Commits" },
})
end
}
}

View file

@ -1,89 +0,0 @@
return {
{
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
spec = {
{ "<leader>l", ":Lazy<CR>", desc = "Lazy" },
{ "<leader>t",
function()
vim.cmd.botright("new")
vim.opt_local.number = false
vim.opt_local.relativenumber = false
vim.cmd.resize(10)
vim.cmd.terminal()
vim.cmd.startinsert()
end,
mode = "n",
desc = "Open Terminal"
},
--{ "<leader>wd", "<cmd>execute 'bd' | execute 'close'<CR>", desc = "Delete window & buffer" },
-- Window & Buffer Management
{ "<leader>w", group = "Windows"},
{ "<leader>wc", ":close<CR>", desc = "Close Window" },
{ "<leader>ws", ":split<CR>", desc = "Horizontal Window Split" },
{ "<leader>wv", ":vsplit<CR>", desc = "Vertial Window Split" },
{ "<leader>wm", "<C-w>_", desc = "Maximize Window" },
{ "<leader>b", group = "Buffers"},
{ "<leader>bd", function()
local function is_neotree(bufnr)
return vim.bo[bufnr].filetype == "neo-tree"
end
local current_buf = vim.api.nvim_get_current_buf()
-- Skip if in neo-tree
if is_neotree(current_buf) then
vim.notify("Cannot delete buffer from neo-tree", vim.log.levels.WARN)
return
end
local buflisted = vim.fn.getbufinfo({ buflisted = 1 })
-- Prevent deleting last buffer
if #buflisted <= 1 then
vim.notify("Cannot delete last buffer", vim.log.levels.WARN)
return
end
vim.cmd.bprevious()
vim.cmd.bdelete({ args = { tostring(current_buf) } })
-- If we ended up in neo-tree, move back to a regular window
local new_buf = vim.api.nvim_get_current_buf()
if is_neotree(new_buf) then
vim.cmd.wincmd("l")
end
end, desc = "Delete Buffer" },
{ "<leader>bD", function()
local current_buf = vim.api.nvim_get_current_buf()
local current_win = vim.api.nvim_get_current_win()
if vim.bo[current_buf].filetype == "neo-tree" then
vim.notify("Cannot delete neo-tree buffer", vim.log.levels.WARN)
return
end
local wins = vim.fn.win_findbuf(current_buf)
if #wins > 1 then
vim.api.nvim_win_close(current_win, false)
end
if vim.api.nvim_buf_is_valid(current_buf) then
vim.cmd('bdelete! ' .. current_buf)
end
end, desc = "Delete Window & Buffer" },
{ "<leader>ca", vim.lsp.buf.code_action, desc = "Code Action" },
{ "<leader>cr", vim.lsp.buf.rename, desc = "Rename Variable" },
{ "<leader>ch", vim.lsp.buf.hover, desc = "Hover Info" },
{ "<leader>ce", vim.diagnostic.open_float, desc = "Show Diagnostic" },
{ "]d", vim.diagnostic.goto_next, desc = "Next Diagnostic" },
{ "[d", vim.diagnostic.goto_prev, desc = "Prev Diagnostic" },
{ "<leader>G", group = "Git"},
{ "<leader>f", group = "Files"},
{ "<leader>c", group = "Code"},
{ "<leader>g", group = "Goto"},
},
},
}
}

View file

@ -1,3 +0,0 @@
autoload
plugged
.netrwhist

View file

@ -1,74 +0,0 @@
# Vim Config
Lightweight Vim config that mirrors the core editing feel of the Neovim setup without the IDE stack.
## Install
```bash
git clone git@github.com:itme-brain/vim.git ~/.vim
vim # plugins auto-install on first run
```
Requires `curl` and `git` for vim-plug bootstrap. On NixOS this is managed via home-manager instead.
## How it works
- Vim auto-loads `~/.vim/vimrc` — no symlinks needed
- [vim-plug](https://github.com/junegunn/vim-plug) auto-downloads itself via curl on first run if missing
- Missing plugins are installed with `PlugInstall --sync` on `VimEnter`, then the vimrc is re-sourced
- `silent! colorscheme` suppresses errors if the colorscheme hasn't been fetched yet (e.g. offline first run)
- Undo history persists to `~/.vim/undodir` across sessions (`undofile`)
## Plugins
| Plugin | What it does |
|--------|-------------|
| base16-vim | Colorscheme (onedark) |
| vim-surround | Surround text objects (`cs"'`, `ysiw]`) |
| auto-pairs | Auto-close brackets/quotes |
| fzf + fzf.vim | Fuzzy finder (files, buffers, grep) |
| vim-log-highlighting | Syntax highlighting for log files |
| vim-highlightedyank | Flash feedback on yank |
| lightline.vim | Statusline |
| vim-anzu | Search match count in statusline |
## Keybinds
Leader is `Space`.
### File explorer & search
| Key | Action |
|-----|--------|
| `<leader>e` | Toggle netrw sidebar |
| `<leader>/` | Ripgrep search from git root |
| `<leader>ff` | Find files from git root (fzf) |
| `<leader>fp` | Recent files (fzf) |
| `<leader>fb` | Open buffers (fzf) |
| `<leader>?` | Command history (fzf) |
### Buffers
| Key | Action |
|-----|--------|
| `H` / `L` | Previous / next buffer |
| `<leader>bd` | Delete buffer safely |
### Windows
| Key | Action |
|-----|--------|
| `<C-h/j/k/l>` | Navigate windows (skips netrw) |
| `<C-Arrow>` | Resize windows |
| `<leader>wc` | Close window |
| `<leader>ws` | Horizontal split |
| `<leader>wv` | Vertical split |
| `<leader>wm` | Maximize window |
### Other
| Key | Action |
|-----|--------|
| `<Esc>` | Clear search highlight |
| `<C-U>` / `<C-D>` | Scroll half-page (centered) |
| `<` / `>` (visual) | Indent and keep selection |
| `<leader>t` | Terminal (bottom split) |
| `<leader>ts` | Insert timestamp |
| `<leader>pu` | PlugUpdate |
| `<leader>pi` | PlugInstall |

View file

@ -1,193 +0,0 @@
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
endif
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
call plug#begin('~/.vim/plugged')
Plug 'chriskempson/base16-vim'
Plug 'tpope/vim-surround'
Plug 'jiangmiao/auto-pairs'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'mtdl9/vim-log-highlighting'
Plug 'machakann/vim-highlightedyank'
Plug 'itchyny/lightline.vim'
Plug 'osyo-manga/vim-anzu'
call plug#end()
let mapleader = "\<Space>"
set background=dark
if has('termguicolors')
set termguicolors
endif
silent! colorscheme base16-onedark
highlight Normal ctermbg=NONE guibg=NONE ctermfg=White guifg=#FFFFFF
highlight NonText ctermbg=NONE guibg=NONE
highlight CursorLine ctermbg=NONE guibg=NONE
highlight CursorLineNr ctermfg=Yellow guifg=#E5C07B ctermbg=NONE guibg=NONE cterm=bold gui=bold
highlight HighlightedyankRegion ctermfg=Black guifg=#000000 ctermbg=Yellow guibg=yellow
highlight NormalNC ctermbg=NONE guibg=NONE
highlight Search ctermfg=Black guifg=#000000 ctermbg=Yellow guibg=#FFCC66
highlight LineNr ctermbg=NONE guibg=NONE
highlight Visual ctermbg=Gray guibg=Gray ctermfg=Black guifg=Black
let g:highlightedyank_highlight_duration = 140
let g:lightline = { 'colorscheme': 'deus', }
let $FZF_DEFAULT_OPTS = '--bind=tab:up,shift-tab:down'
let g:fzf_layout = { 'window': 'enew' }
" netrw settings
let g:netrw_banner = 0
let g:netrw_winsize = 20
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
let g:netrw_altv = 1
autocmd FileType netrw nnoremap <buffer> <C-l> :wincmd l<CR>
autocmd FileType netrw nnoremap <buffer> <C-h> :wincmd h<CR>
autocmd FileType netrw nnoremap <buffer> <C-j> :wincmd j<CR>
autocmd FileType netrw nnoremap <buffer> <C-k> :wincmd k<CR>
set laststatus=2
set number
set relativenumber
set cursorline
set scrolloff=8
set noincsearch
set ignorecase
set smartcase
set clipboard=unnamedplus
set noswapfile
set nobackup
set undofile
set undodir=~/.vim/undodir
set hidden
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set smartindent
set fillchars=eob:\
set statusline=%{exists('*anzu#search_status')?anzu#search_status():''}
" --- Netrw toggle (like neo-tree) ---
function! NetrwToggle()
for i in range(1, winnr('$'))
if getbufvar(winbufnr(i), '&filetype') ==# 'netrw'
execute i . 'wincmd w'
close
return
endif
endfor
let g:netrw_return_win = winnr()
Lexplore
endfunction
function! SafeWincmd(dir)
let target = winnr(a:dir)
if target == winnr()
return
endif
if getbufvar(winbufnr(target), '&filetype') ==# 'netrw'
return
endif
execute 'wincmd ' . a:dir
endfunction
function! GitRoot()
let l:root = systemlist('git rev-parse --show-toplevel')
if v:shell_error == 0 && !empty(l:root) && !empty(l:root[0])
return l:root[0]
endif
return getcwd()
endfunction
function! SafeBdelete()
if &filetype ==# 'netrw'
echohl WarningMsg | echom 'Cannot delete buffer from netrw' | echohl None
return
endif
let l:buflisted = getbufinfo({'buflisted': 1})
if len(l:buflisted) <= 1
echohl WarningMsg | echom 'Cannot delete last buffer' | echohl None
return
endif
let l:buf = bufnr('%')
bprevious
execute 'bdelete ' . l:buf
endfunction
" --- Plugin management ---
nnoremap <leader>pu :PlugUpdate<CR>
nnoremap <leader>pd :PlugUpgrade<CR>
nnoremap <leader>ps :PlugStatus<CR>
nnoremap <leader>pi :PlugInstall<CR>
" --- Search (anzu) ---
nmap n <Plug>(anzu-n-with-echo)
nmap N <Plug>(anzu-N-with-echo)
nmap * <Plug>(anzu-star-with-echo)
nmap # <Plug>(anzu-sharp-with-echo)
nmap <Esc><Esc> <Plug>(anzu-clear-search-status)
nnoremap <Esc> :noh<Bar>let @/=""<CR>
" --- Visual indentation ---
vnoremap < <gv
vnoremap > >gv
" --- Scrolling (centered) ---
nnoremap <C-U> <C-U>zz
nnoremap <C-D> <C-D>zz
" --- Window navigation (matches nvim <C-h/j/k/l>, skips netrw) ---
nnoremap <C-h> :call SafeWincmd('h')<CR>
nnoremap <C-j> :call SafeWincmd('j')<CR>
nnoremap <C-k> :call SafeWincmd('k')<CR>
nnoremap <C-l> :call SafeWincmd('l')<CR>
" --- Window resize (matches nvim <C-Arrow>) ---
nnoremap <C-Right> :vertical resize +10<CR>
nnoremap <C-Left> :vertical resize -10<CR>
nnoremap <C-Up> :resize +10<CR>
nnoremap <C-Down> :resize -10<CR>
" --- Window management ---
nnoremap <leader>wc :close<CR>
nnoremap <leader>ws :split<CR>
nnoremap <leader>wv :vsplit<CR>
nnoremap <leader>wm <C-w>_
nnoremap <leader>ww :wincmd w<CR>
nnoremap <leader>wW :wincmd W<CR>
" --- File explorer & search ---
nnoremap <leader>e :call NetrwToggle()<CR>
nnoremap <leader>/ :execute 'lcd ' . fnameescape(GitRoot()) <Bar> Rg<Space>
nnoremap <leader>ff :execute 'lcd ' . fnameescape(GitRoot()) <Bar> Files<CR>
nnoremap <leader>fp :History<CR>
nnoremap <leader>fb :Buffers<CR>
nnoremap <leader>? :History:<CR>
" --- Buffers ---
nnoremap <leader>bd :call SafeBdelete()<CR>
nnoremap H :bprevious<CR>
nnoremap L :bnext<CR>
" --- Terminal ---
nnoremap <leader>t :below terminal ++rows=10<CR>
" --- Misc ---
nnoremap <Leader>ts :execute "normal! a" . strftime('[%b %d %H:%M:%S - BR]')<CR>