268 lines
7.9 KiB
HTML
268 lines
7.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self'; font-src 'self' data:; img-src 'self' data:; connect-src 'self'; base-uri 'self'; form-action 'self' https://defcon.social https://bsky.app;">
|
|
<meta http-equiv="X-Content-Type-Options" content="nosniff">
|
|
<link rel="stylesheet" href="../assets/css/style.css">
|
|
<link rel="icon" type="image/x-icon" href="../favicon.ico">
|
|
<script>
|
|
// Apply theme immediately to prevent flash
|
|
(function() {
|
|
const theme = localStorage.getItem('theme') ||
|
|
(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
|
document.documentElement.setAttribute('data-theme', theme);
|
|
})();
|
|
</script>
|
|
<title>Neovim Cheatsheet - Cheatsheets - Launch Pad</title>
|
|
</head>
|
|
<body>
|
|
<button class="theme-toggle" id="themeToggle" aria-label="Toggle dark mode">
|
|
<svg class="theme-icon theme-icon-moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
|
|
<svg class="theme-icon theme-icon-sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display: none;"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>
|
|
</button>
|
|
<br/><br/>
|
|
<div class="name">
|
|
__ _______________________ _________._________________________
|
|
\_ _____/ \______ \ / _ \ / _____/ / _____/ | | \_ _____/
|
|
| __) | _/ / /_\ \ / \ ___ / \ ___ | | | __)_
|
|
| \ | | \ / | \ \ \_\ \ \ \_\ \ | |___ | \
|
|
\___ / |____|_ / \____|__ / \______ / \______ / |_______ \ /_______ /
|
|
\/ \/ \/ \/ \/ \/ \/
|
|
</div>
|
|
<div class="blog-page-header">
|
|
<div class="blog-header-content">
|
|
<a href="/cheatsheets" class="back-link" title="Back to Cheatsheets">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 24 24" class="home-icon"><path fill="currentColor" d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>
|
|
</a>
|
|
<h1 class="blog-page-title">Neovim Cheatsheet</h1>
|
|
</div>
|
|
</div>
|
|
<div class="blog-post-container">
|
|
<div class="blog-posts-container" style="max-width: 900px; margin: 0 auto;">
|
|
<div class="blog-post">
|
|
<div class="blog-post-content">
|
|
<p><a href="index.html">← Back to cheatsheets</a></p>
|
|
<p><a href="../index.html">← Home</a></p>
|
|
<hr>
|
|
<h2>Modes</h2>
|
|
<ul>
|
|
<li>i - Insert mode</li>
|
|
</ul>
|
|
<ul>
|
|
<li>v - Visual mode (character)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>V - Visual mode (line)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Ctrl+v - Visual mode (block)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>R - Replace mode</li>
|
|
</ul>
|
|
<ul>
|
|
<li>: - Command mode</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Esc - Normal mode (from any mode)</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Basic Movement</h2>
|
|
<h3>Character Movement</h3>
|
|
<ul>
|
|
<li>h - Left</li>
|
|
</ul>
|
|
<ul>
|
|
<li>j - Down</li>
|
|
</ul>
|
|
<ul>
|
|
<li>k - Up</li>
|
|
</ul>
|
|
<ul>
|
|
<li>l - Right</li>
|
|
</ul>
|
|
<ul>
|
|
<li>0 - Start of line</li>
|
|
</ul>
|
|
<ul>
|
|
<li>^ - First non-blank character of line</li>
|
|
</ul>
|
|
<ul>
|
|
<li>$ - End of line</li>
|
|
</ul>
|
|
<ul>
|
|
<li>g_ - Last non-blank character of line</li>
|
|
</ul>
|
|
<h3>Word Movement</h3>
|
|
<ul>
|
|
<li>w - Next word start</li>
|
|
</ul>
|
|
<ul>
|
|
<li>W - Next WORD start (space-separated)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>e - End of word</li>
|
|
</ul>
|
|
<ul>
|
|
<li>E - End of WORD</li>
|
|
</ul>
|
|
<ul>
|
|
<li>b - Previous word start</li>
|
|
</ul>
|
|
<ul>
|
|
<li>B - Previous WORD start</li>
|
|
</ul>
|
|
<ul>
|
|
<li>ge - End of previous word</li>
|
|
</ul>
|
|
<h3>Line Movement</h3>
|
|
<ul>
|
|
<li>gg - First line</li>
|
|
</ul>
|
|
<ul>
|
|
<li>G - Last line</li>
|
|
</ul>
|
|
<ul>
|
|
<li>{number}G - Go to line number</li>
|
|
</ul>
|
|
<ul>
|
|
<li>: - Go to line (command mode)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>% - Matching bracket/parenthesis</li>
|
|
</ul>
|
|
<ul>
|
|
<li>* - Next occurrence of word under cursor</li>
|
|
</ul>
|
|
<ul>
|
|
<li># - Previous occurrence of word under cursor</li>
|
|
</ul>
|
|
<h3>Screen Movement</h3>
|
|
<ul>
|
|
<li>H - Top of screen</li>
|
|
</ul>
|
|
<ul>
|
|
<li>M - Middle of screen</li>
|
|
</ul>
|
|
<ul>
|
|
<li>L - Bottom of screen</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Ctrl+u - Half page up</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Ctrl+d - Half page down</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Ctrl+b - Full page up</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Ctrl+f - Full page down</li>
|
|
</ul>
|
|
<ul>
|
|
<li>zz - Center cursor on screen</li>
|
|
</ul>
|
|
<ul>
|
|
<li>zt - Top of screen</li>
|
|
</ul>
|
|
<ul>
|
|
<li>zb - Bottom of screen</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Configuration</h2>
|
|
<h3>Config File Location</h3>
|
|
<ul>
|
|
<li>~/.config/nvim/init.lua (Lua config, recommended)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>~/.config/nvim/init.vim (Vimscript config)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>~/.vimrc (legacy location, still works)</li>
|
|
</ul>
|
|
<h3>Example Key Bindings</h3>
|
|
<p>Customize key mappings in your config:</p>
|
|
<pre><code>-- Example Lua config
|
|
vim.keymap.set('n', '<leader>w', ':w<CR>', { desc = 'Save file' })
|
|
vim.keymap.set('n', '<leader>q', ':q<CR>', { desc = 'Quit' })
|
|
vim.keymap.set('n', '<C-h>', '<C-w>h', { desc = 'Move to left window' })
|
|
vim.keymap.set('n', '<C-j>', '<C-w>j', { desc = 'Move to bottom window' })
|
|
vim.keymap.set('n', '<C-k>', '<C-w>k', { desc = 'Move to top window' })
|
|
vim.keymap.set('n', '<C-l>', '<C-w>l', { desc = 'Move to right window' })</code></pre>
|
|
<p>Or in Vimscript:</p>
|
|
<pre><code>" Example Vimscript config
|
|
nnoremap <leader>w :w<CR>
|
|
nnoremap <leader>q :q<CR>
|
|
nnoremap <C-h> <C-w>h
|
|
nnoremap <C-j> <C-w>j
|
|
nnoremap <C-k> <C-w>k
|
|
nnoremap <C-l> <C-w>l</code></pre>
|
|
<hr>
|
|
<h2>Tips</h2>
|
|
<ul>
|
|
<li>Use :help <topic> for built-in help</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use :checkhealth to diagnose issues</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Leader key is space by default (can be changed)</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use motions with operators (d, c, y) for powerful editing</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use . to repeat last change</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use u to undo, Ctrl+r to redo</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use :w to save, :q to quit, :wq to save and quit</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use :split or :vsplit for multiple windows</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use :tabnew for tabs</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use * and # to search for word under cursor</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use /pattern to search forward, ?pattern to search backward</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use n and N to navigate search results</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use % to jump to matching bracket/parenthesis</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use gg to go to top, G to go to bottom</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use :set number to show line numbers</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use :set relativenumber for relative line numbers</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Lua config (init.lua) is recommended over Vimscript</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use plugins via plugin managers (lazy.nvim, packer.nvim, etc.)</li>
|
|
</ul>
|
|
<hr>
|
|
<p><a href="index.html">← Back to cheatsheets</a></p>
|
|
<p><a href="../index.html">← Home</a></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script async type="text/javascript" src="../blog/analytics.js"></script>
|
|
<script src="../theme.js"></script>
|
|
</body>
|
|
</html> |