Skip to content

Instantly share code, notes, and snippets.

@jphalip
Created October 21, 2024 17:47
Show Gist options
  • Save jphalip/f75ef966f38607a33709750d4eb3d087 to your computer and use it in GitHub Desktop.
Save jphalip/f75ef966f38607a33709750d4eb3d087 to your computer and use it in GitHub Desktop.
Some custom Vim key mappings
" Set the leader key to comma for custom mappings
let mapleader = ","
" Set timeout for key sequences (in milliseconds)
set timeout timeoutlen=500
" Use system clipboard for all yank, delete, and put operations
set clipboard=unnamedplus
" Insert new lines without leaving normal mode
" oo: Insert line below
" OO: Insert line above
nnoremap oo m`o<Esc>``
nnoremap OO m`O<Esc>``
" Prevent delete operations from saving text to register/clipboard
" This allows for 'delete without cut' functionality
nnoremap x "_x
nnoremap X "_X
nnoremap d "_d
nnoremap D "_D
vnoremap d "_d
" Use leader key for cut operations (moving text to system clipboard)
" <leader>d: Cut current line or selection
" <leader>D: Cut from cursor to end of line
nnoremap <leader>d "+d
nnoremap <leader>D "+D
vnoremap <leader>d "+d
"Select All
nnoremap <leader>a ggVG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment