Changed tab binding to <F#> where # is Number + Do not expand tabs

This commit is contained in:
alejo committed 2026-08-19 01:45:41 -03:00
1 parent 763da808f7
commit b52db80954
2 files changed
+67 -11

No files matched your search

+8 -6
View File
@@ -28,7 +28,7 @@ First launch will take a minute or two: `lazy.nvim` bootstraps itself and instal
## Editor basics
- Relative + absolute line numbers, system clipboard integration (`unnamedplus`), persistent undo, smart-case search, always-on sign column.
- Tab width: **4 spaces**, expanded (matches `~/.clang-format`'s `IndentWidth: 4`).
- Tab width: **4**, using real tab characters — not expanded to spaces.
- True color, rounded borders on floating windows (hover, LspInfo, Mason, etc. — Neovim 0.11+), styled window separators.
- OSC 52 clipboard support, so yank/paste works correctly over SSH.
- `c`/`cpp` indentation uses Vim's native `cindent` rather than treesitter's indent module — treesitter's C/C++ indent is known to be unreliable (inconsistent brace placement); `cindent` is far more predictable for brace-heavy code.
@@ -64,13 +64,15 @@ Each buffer tab shows its ordinal position number. Pinned buffers are always kep
| Key | Action |
|---|---|
| `<S-h>` / `<S-l>` | Previous / next buffer (follows the order shown on screen, including any reordering) |
| `<A-1>` … `<A-9>` | Jump directly to the buffer at that position |
| `<A-0>` | Jump to the last buffer |
| `<A-1>` … `<A-9>` / `<F1>`–`<F9>` | Jump directly to the buffer at that position. `<F5>` and `<F10>` each pull double duty with the debugger (see [Debugging](#debugging-nvim-dap)) — they act as buffer jumps at rest, and hand themselves over to DAP for the duration of an active debug session. |
| `<A-0>` / `<F10>` | Jump to the last buffer. |
| `<A-,>` / `<A-.>` | Move current buffer left / right (blocked from crossing into the pinned block — wraps to the other end instead) |
| `<leader>bp` | Toggle pin on current buffer |
| `<leader>bx` | Close every **unpinned** buffer with **no unsaved changes** (pinned buffers and anything modified are left alone) |
| `<leader>bd` | Close current buffer |
Setting an explicit `<F1>` mapping here also overrides Neovim's built-in `<F1>`-opens-help default — any explicit keymap for a key always takes precedence over Neovim's default for it.
## File & text search (`telescope`)
| Key | Action |
@@ -120,8 +122,8 @@ C/C++ (and Rust) debugging via `codelldb`, auto-installed by Mason on first use.
| Key | Action |
|---|---|
| `F5` / `<leader>dc` | Continue / start debugging |
| `F10` / `<leader>do` | Step over |
| `F5` / `<leader>dc` | Continue / start debugging — `F5` only while a session is already active; before that it's the "jump to buffer 5" shortcut, so **start a session with `<leader>dc` or `<leader>db`**, not `F5` |
| `F10` / `<leader>do` | Step over — `F10` only while a debug session is active; otherwise it's the "jump to last buffer" shortcut (see [Buffers & tabs](#buffers--tabs-bufferline)) |
| `F11` / `<leader>di` | Step into |
| `F12` / `<leader>dO` | Step out |
| `<leader>db` | Toggle breakpoint |
@@ -150,7 +152,7 @@ Neovim's embedded terminal launches **fish** instead of your login shell, purely
## Formatting
`~/.clang-format` is written on every run (LLVM-based, `BreakBeforeBraces: Attach` for K&R-style braces, 4-space indent, 100-column limit). `clang-format` walks upward from the file being formatted looking for a `.clang-format`; since `$HOME` sits above every project, this acts as a personal default for any project that doesn't ship its own `.clang-format` — a project's own file always takes precedence.
`~/.clang-format` is written on every run (LLVM-based, `BreakBeforeBraces: Attach` for K&R-style braces, 4-wide real tabs via `UseTab: Always`/`TabWidth: 4` to match the editor, 100-column limit). `clang-format` walks upward from the file being formatted looking for a `.clang-format`; since `$HOME` sits above every project, this acts as a personal default for any project that doesn't ship its own `.clang-format` — a project's own file always takes precedence.
## Known quirks
+59 -5
View File
@@ -68,11 +68,11 @@ vim.g.maplocalleader = " "
-- Basic Options
vim.opt.number = true
-- Tab width: 4 spaces, expanded (matches IndentWidth: 4 in ~/.clang-format)
-- Tab width: 4, using real tab characters (not expanded to spaces)
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.softtabstop = 4
vim.opt.expandtab = true
vim.opt.expandtab = false
vim.opt.relativenumber = true
vim.opt.mouse = "a"
vim.opt.clipboard = "unnamedplus"
@@ -467,6 +467,31 @@ return {
require('bufferline').go_to(-1, true)
end, { desc = "Go to Last Buffer" })
-- F1..F9: same jump-by-position, on Fn+Number instead of
-- Alt+Number. Explicitly setting <F1> here overrides Neovim's
-- default <F1>-opens-help binding outright (any explicit
-- vim.keymap.set for a key always supersedes Neovim's built-in
-- default for it), so no separate step is needed to "disable"
-- that.
--
-- <F5> and <F10> are set below, OUTSIDE this loop -- both are
-- shared with nvim-dap (Continue and Step Over respectively) and
-- toggle dynamically based on whether a debug session is active
-- (see the dap.listeners hooks in the DAP plugin further down).
-- At rest, both act as ordinary buffer jumps like everything
-- else in this loop.
for _, i in ipairs({ 1, 2, 3, 4, 6, 7, 8, 9 }) do
vim.keymap.set('n', ('<F%d>'):format(i), function()
require('bufferline').go_to(i, true)
end, { desc = "Go to Buffer " .. i })
end
vim.keymap.set('n', '<F5>', function()
require('bufferline').go_to(5, true)
end, { desc = "Go to Buffer 5" })
vim.keymap.set('n', '<F10>', function()
require('bufferline').go_to(-1, true)
end, { desc = "Go to Last Buffer" })
-- Alt+,/. : reorder the current buffer left/right in the
-- bufferline (persists for the session as long as
-- sessionoptions includes "globals", which lazy.nvim's default
@@ -923,6 +948,31 @@ return {
dapui.close()
end
-- <F5> and <F10> are each shared between an nvim-dap action
-- (Continue, Step Over) and a bufferline buffer jump (buffer 5,
-- last buffer) -- at rest they're buffer jumps; for the
-- duration of a debug session they're handed over to DAP
-- instead, so nothing fights over the same key. Note this means
-- <F5> can no longer START a fresh session on its own (there's
-- no session yet at that point, so it's still doing buffer-jump
-- duty) -- use <leader>dc or <leader>db to start one, then <F5>
-- takes over for continuing from there. Reusing the same
-- listener points as the dapui open/close hooks above.
dap.listeners.after.event_initialized["fkey_toggle"] = function()
vim.keymap.set('n', '<F5>', dap.continue, { desc = "Debug: Continue" })
vim.keymap.set('n', '<F10>', dap.step_over, { desc = "Debug: Step Over" })
end
local function restore_fkey_buffer_jumps()
vim.keymap.set('n', '<F5>', function()
require('bufferline').go_to(5, true)
end, { desc = "Go to Buffer 5" })
vim.keymap.set('n', '<F10>', function()
require('bufferline').go_to(-1, true)
end, { desc = "Go to Last Buffer" })
end
dap.listeners.before.event_terminated["fkey_toggle"] = restore_fkey_buffer_jumps
dap.listeners.before.event_exited["fkey_toggle"] = restore_fkey_buffer_jumps
-- C / C++ / Rust launch configs, all sharing the codelldb adapter
dap.configurations.cpp = {
{
@@ -958,8 +1008,10 @@ return {
vim.api.nvim_set_hl(0, "DapStoppedLine", { bg = "#0b3528" })
-- Keymaps, grouped under <leader>d (shows in which-key)
vim.keymap.set('n', '<F5>', dap.continue, { desc = "Debug: Continue" })
vim.keymap.set('n', '<F10>', dap.step_over, { desc = "Debug: Step Over" })
-- <F5> and <F10> intentionally NOT bound here -- both are set
-- dynamically by the dap.listeners hooks above (Continue/Step
-- Over only while a session is active; bufferline's buffer-5/
-- last-buffer jumps otherwise).
vim.keymap.set('n', '<F11>', dap.step_into, { desc = "Debug: Step Into" })
vim.keymap.set('n', '<F12>', dap.step_out, { desc = "Debug: Step Out" })
@@ -1158,8 +1210,10 @@ BasedOnStyle: LLVM
BreakBeforeBraces: Attach
IndentWidth: 4
ColumnLimit: 100
UseTab: Always
TabWidth: 4
EOF
echo "Wrote ~/.clang-format (Attach braces)."
echo "Wrote ~/.clang-format (Attach braces, real tabs)."
echo "========================================="
echo " Setup Complete!"