improve terminal buffers

This commit is contained in:
2025-10-13 18:56:05 +03:00
parent 78239cafb8
commit 47823a0c50
15 changed files with 461 additions and 219 deletions

View File

@@ -0,0 +1,109 @@
#============================================================
# Neovim Command Reference (Core Commands)
#============================================================
#============================================================
# FILE & SESSION MANAGEMENT
#============================================================
:w (write) Save current buffer
:w <file> Write to <file> (does NOT rename buffer)
:sav (saveas) <file> Save to <file> and rename current buffer
:q (quit) Quit current window if no unsaved changes
:q! Force quit (discard changes)
:wq Write and quit current buffer
:wqa Write and quit all buffers
:qa Quit all windows
:qa! Quit all without saving
:e (edit) <file> Edit <file> in current window (new buffer)
:e! Revert buffer to last saved version (discard changes)
:enew Create new empty buffer
:r (read) <file> Read <file> into current buffer after cursor
:ter (terminal) Open terminal buffer
:clo (close) Close current window
#============================================================
# BUFFERS
#============================================================
:ls (buffers) List open buffers
:bn (bnext) Go to next buffer
:bp (bprev) Go to previous buffer
:b<num> Go to buffer by number
:b <file> Go to buffer by (partial) name
:bd (bdelete) [<num>] Delete current (or given) buffer
:bw (bwipeout) [<num>] Delete buffer and remove from memory
:bo (only) Close all windows except current
:e # Edit alternate (previous) buffer
:b# Switch to alternate buffer
:b% Re-edit current buffer (no-op)
:b$ Go to last buffer
#============================================================
# WINDOWS (SPLITS)
#============================================================
:sp (split) [<file>] Split horizontally (optionally open <file>)
:vsp (vsplit) [<file>] Split vertically (optionally open <file>)
:new Split with new empty buffer
:vnew Vertical split with new empty buffer
:close Close current window
:only Keep only current window open
#============================================================
# TABS
#============================================================
:tabnew [<file>] Open new tab (optionally edit <file>)
:tabn (tabnext) Go to next tab
:tabp (tabprev) Go to previous tab
:tabm (tabmove) <num> Move current tab to position <num>
:tabfirst Jump to first tab
:tablast Jump to last tab
:tabc (tabclose) Close current tab
:tabo (tabonly) Close all other tabs
:tabdo <cmd> Execute <cmd> in all tabs (e.g. :tabdo q)
#============================================================
# REGISTERS, MARKS & HISTORY
#============================================================
:reg (registers) Show register contents
:marks Show all marks
:ju (jumps) Show jump list
:changes Show change list
#============================================================
# SEARCH / GREP / QUICKFIX
#============================================================
:g/{pattern}/d Delete all lines matching {pattern}
:g!/{pattern}/d Delete all lines NOT matching {pattern}
:vim /{pattern}/ **/* Search for {pattern} recursively in all files
:cn (cnext) Jump to next quickfix entry
:cp (cprevious) Jump to previous quickfix entry
:cope (copen) Open quickfix window
:ccl (cclose) Close quickfix window
:cl (clist) List quickfix entries
#============================================================
# DIFF MODE
#============================================================
:diffthis Start diff mode for current window
:diffo (diffoff) Turn off diff mode
:diffu (diffupdate) Recalculate diff
:diffg (diffget) Get changes from other window
:diffpu (diffput) Send changes to other window
#============================================================
# NOTES & SYMBOLS
#============================================================
% Current buffer
# Alternate (last visited) buffer
$ Last buffer in list
+ Next buffer
- Previous buffer
" Most recently edited buffer (context dependent)

View File

@@ -42,6 +42,7 @@ TODO:
- lazygit Terminal UI for git commands. (optional)
- fzf Command-line fuzzy finder.
- bat "cat" but with colors
- curl Command-line for transferring data specified with URL syntax.
- wget Utility for downloading files from the Web.
- make
@@ -132,6 +133,7 @@ TODO:
- markdown-preview.nvim side by side md (disabled in folke)
- toppair/peek.nvim another markdown preview?
- render-markdown.nvim inline viewer
- markview.nvim
- diffview.nvim
- octo.nvim edit and review GH issues and pr
- yanky.nvim better yank+put. has history

View File

@@ -0,0 +1,119 @@
#============================================================
# NEOVIM KEYMAP REFERENCE (CORE & USEFUL)
#============================================================
#============================================================
# INSERT MODE (Ctrl + ...)
#============================================================
Ctrl + h Delete character before cursor
Ctrl + w Delete word before cursor
Ctrl + j Insert line break (newline) at cursor
Ctrl + t Indent current line one 'shiftwidth' to the right
Ctrl + d De-indent current line one 'shiftwidth' to the left
Ctrl + n Insert next auto-completion match
Ctrl + p Insert previous auto-completion match
Ctrl + r x Insert contents of register x
Ctrl + o {cmd} Temporarily enter Normal mode to execute {cmd}
Esc / Ctrl + c Exit insert mode and return to Normal mode
#============================================================
# NORMAL MODE — WINDOW & TAB MANAGEMENT
#============================================================
C-w s Split current window horizontally
C-w v Split current window vertically
C-w c Close current window
C-w q Quit current window (same as close but exit if last)
C-w w Cycle through open windows
C-w x Exchange window with next one
C-w = Equalize window sizes
C-w _ Maximize height of current window
C-w | Maximize width of current window
C-w h Move to window left
C-w j Move to window below
C-w k Move to window above
C-w l Move to window right
C-w H Move current window far left
C-w J Move current window to bottom
C-w K Move current window to top
C-w L Move current window far right
C-w t Move current split into a new tab
gt Go to next tab
gT Go to previous tab
<n>gt Go to tab number <n>
#============================================================
# NORMAL MODE — TAGS, JUMPS & MOTIONS
#============================================================
Ctrl + ] Jump to tag under cursor
gd Go to local declaration
gD Go to global declaration
{ Jump backward one paragraph/block
} Jump forward one paragraph/block
; Repeat last motion forward
, Repeat last motion backward
Ctrl + e Scroll window down (cursor stays put)
Ctrl + y Scroll window up (cursor stays put)
H Move cursor to top of screen
M Move cursor to middle of screen
L Move cursor to bottom of screen
#============================================================
# NORMAL MODE — TEXT OBJECTS
#============================================================
aw "A word" — select word + following space
ab "A block" — select around ()
aB "A Block" — select around {}
at "A tag" — select around XML/HTML tag
ib "Inner block" — inside ()
iB "Inner Block" — inside {}
it "Inner tag" — inside tag (no delimiters)
#============================================================
# NORMAL MODE — DIFF / CHANGES
#============================================================
do Obtain (get) changes from other window
dp Put (send) changes to other window
#============================================================
# REGISTERS & CLIPBOARD
#============================================================
"xy Yank into register x
"xp Paste contents of register x
"+y Yank into system clipboard
"+p Paste from system clipboard
#--- Common Registers ---
"0 Last yank
" Unnamed register (last delete or yank)
"% Current file name
"# Alternate file name
"* X11 primary selection clipboard
"+ X11 clipboard register
"/ Last search pattern
": Last command-line command
". Last inserted text
"- Last small (less than a line) delete
"= Expression register (evaluate expression)
"_ Black hole register (discard output)
#============================================================
# TIPS & NOTES
#============================================================
- Ctrl + o in Insert mode is a powerful way to run one Normal-mode command temporarily.
- Use “aw”, “iw”, “ab”, “ib”, etc. with operators (e.g., daw, yib) for precise text manipulation.
- The system clipboard is “+” (Windows/macOS/Linux), but some X11 systems also use “*”.
- When in diff mode, do and dp are complementary: “get” vs. “put” changes.

View File

@@ -6,78 +6,67 @@ Ctrl-w c - Close current window
Ctrl-w o - Close all windows except current one
-- Window Navigation
Ctrl-w h - Move to window on the left
Ctrl-w j - Move to window below
Ctrl-w k - Move to window above
Ctrl-w l - Move to window on the right
Ctrl-h - Move to window on the left
Ctrl-j - Move to window below
Ctrl-k - Move to window above
Ctrl-l - Move to window on the right
-- Window Moving/Rearranging
Ctrl-w H - Move current window to far left
Ctrl-w J - Move current window to bottom
Ctrl-w K - Move current window to top
Ctrl-w L - Move current window to far right
Ctrl-w r - Rotate windows downward/rightward
Ctrl-w R - Rotate windows upward/leftward
Ctrl-w x - Exchange current window with next one
-- Window Resizing
Ctrl-w = - Make all windows equal size
Ctrl-w _ - Maximize height of current window
Ctrl-w | - Maximize width of current window
Ctrl-w > - Increase width by 1 column
Ctrl-w < - Decrease width by 1 column
Ctrl-w + - Increase height by 1 row
Ctrl-w - - Decrease height by 1 row
Ctrl-w > - Increase width by 5 column
Ctrl-w < - Decrease width by 5 column
Ctrl-w + - Increase height by 5 row
Ctrl-w - - Decrease height by 5 row
-- Window Special Commands
Ctrl-w T - Move current window to new tab
Ctrl-w } - Preview definition in new window
Ctrl-w z - Close preview window
Ctrl-w ] - Split window and jump to definition
Ctrl-w f - Split window and edit file under cursor
Ctrl-w i - Split window and show declaration
Ctrl-w ^ - Split window and edit alternate file
-- Tab
gt :tabnext - Go to next tab
gT :tabprevious - Go to previous tab
{n}gt :tabnext {n} - Go to tab number {n}
<Leader>tn :tabnew - Create a new tab - Suggested
<Leader>tc :tabclose - Close current tab - Suggested
<Leader>to :tabonly - Close all other tabs - Suggested
<Leader>t{n} {n}gt - Go to tab {n} - Suggested
<Leader>tm. :tabmove +1 - Move tab right - Suggested
<Leader>tm, :tabmove -1 - Move tab left - Suggested
<Leader>t] :tabnext - Go to next tab
<Leader>t[ :tabprevious - Go to previous tab
<Leader>tn :tabnew - Create a new tab
<Leader>tc :tabclose - Close current tab
<Leader>to :tabonly - Close all other tabs
<Leader>{n} :{n}gt - Go to tab {n}
-- Buffer
<Leader>bl :ls - List all buffers - Suggested
<Leader>bd :bdelete - Delete current buffer - Suggested
<Leader>bn :bnext - Go to next buffer - Suggested
<Leader>bp :bprevious - Go to previous buffer - Suggested
<Leader>b{n} :buffer {n} - Go to buffer {n} - Suggested
<Leader>bb :b<Space> - Start buffer selection - Suggested
<Leader>bo :bufdo bd|1bd - Delete all other buffers - Suggested
-- note: mainly using the telescope one
<Leader>space telescope.buffers - open buffers with telescope. there can navigate and delete
<Leader>bl :ls - List all buffers
<Leader>bd :bdelete - Delete current buffer
<Leader>bn :bnext - Go to next buffer
<Leader>bp :bprevious - Go to previous buffer
<Leader>b{n} :buffer {n} - Go to buffer {n}
<Leader>bb :b<Space> - Start buffer selection
<Leader>bo :bufdo bd|1bd - Delete all other buffers
-- Telescope
<Leader>sf telescope.find_files - Search Files
<Leader>sg telescope.live_grep - Search by Grep
<Leader>sb telescope.buffers - Search Buffers
<Leader>sh telescope.help_tags - Search Help
<Leader>sp telescope.projects - Search Projects
<Leader>sm telescope.marks - Search Marks
<Leader>sc telescope.commands - Search Commands
<Leader>sk telescope.keymaps - Search Keymaps
<Leader>ss telescope.git_status - Search Git Status
<Leader>sw telescope.grep_string - Search current Word
<Leader>sd telescope.diagnostics - Search Diagnostics
<Leader>sr telescope.lsp_references - Search References
<Leader>ff telescope.find_files - Search Files
<Leader>fg telescope.live_grep - Search by Grep
<Leader>fb telescope.buffers - Search Buffers
<Leader>fh telescope.help_tags - Search Help
<Leader>fp telescope.projects - Search Projects
<Leader>fm telescope.marks - Search Marks
<Leader>fc telescope.commands - Search Commands
<Leader>fk telescope.keymaps - Search Keymaps
<Leader>fs telescope.git_status - Search Git Status
<Leader>fw telescope.grep_string - Search current Word
<Leader>fd telescope.diagnostics - Search Diagnostics
<Leader>fr telescope.lsp_references - Search References
-- Neo-tree
<Leader>e :Neotree toggle - Explorer Toggle
<Leader>E :Neotree focus - Explorer Focus
<Leader>ef :Neotree float - Explorer Float
<Leader>eb :Neotree buffers - Explorer Buffers
<Leader>eg :Neotree git_status - Explorer Git
<Leader>e :NvimTree toggle - Explorer Toggle
<Leader>E :NvimTree focus - Explorer Focus
-- Harpoon
<Leader>h harpoon_ui.toggle_menu - Harpoon Menu

View File

@@ -1,51 +0,0 @@
-- [[
-- TreeSitter parsers do not match directly with the filename.
-- See: github/nvim-treesitter:lua/nvim-treesitter/parsers.lua
-- ]]
local M = {
-- <filetype> = { <treesitter>, <lsp>, <linter>, <formatter> }
-- note: lsp will match the `<path>/lsp/<file>.lua` file. The CMD the proper language-server.
markdown = { 'markdown', 'lua_ls', 'luacheck', 'stylua' },
javascript = { 'javascript', ' ts_ls', 'eslint', 'prettierd' },
typescript = { 'typescript', ' ts_ls', 'eslint', 'prettierd' },
javascriptreact = { '', ' ts_ls', 'eslint', 'prettierd' },
typescript = { 'typescript', ' ts_ls', 'eslint', 'prettierd' },
}
return {
opts = {
view = { signcolumn = 'no' },
renderer = {
root_folder_label = false,
indent_width = 2,
indent_markers = {
enable = true,
icons = { corner = '', none = '', bottom = '' },
},
icons = {
show = {
file = true,
folder = true,
folder_arrow = false, -- KEEP FALSE
git = false,
modified = false,
hidden = false,
diagnostics = false,
bookmarks = false,
},
glyphs = {
default = ' ',
folder = {
default = '',
open = '',
},
},
},
},
hijack_cursor = true,
sync_root_with_cwd = true,
update_focused_file = {
enabled = true,
-- update_root = { enabled = true }
},
},
}