Skip to content

Instantly share code, notes, and snippets.

@raven-rock
Last active June 5, 2025 17:29
Show Gist options
  • Select an option

  • Save raven-rock/d447b818e12348538c40aeb452e34d88 to your computer and use it in GitHub Desktop.

Select an option

Save raven-rock/d447b818e12348538c40aeb452e34d88 to your computer and use it in GitHub Desktop.
colorscheme jellybeans
filetype plugin indent on " This does though, including ruby.
syntax on " turn on syntax hilighting
set hidden " allow hidden buffers, i.e. unsaved buffers in background
" set mouse +=a " enable mouse support in terminal -> http://stackoverflow.com/questions/2149456/reasons-for-using-command-line-vim-versus-gui-vim
" set clipboard=unnamedplus
set clipboard=unnamed " enable yanks to go to OS clipboard.
set nu " line numbers on
set ignorecase " ignore case in searches
set smartcase " ignore case if search pattern is all lowercase, case-sensitive otherwise
set nocompatible " vim only
set tabstop=4 " tab width
set shiftwidth=4 "
set softtabstop=4 "
set expandtab " tabs are spaces instead of tabs
set ruler " line, column display always on
set hlsearch " hilight last search pattern
"set cursorline " cursor line easy to see
set autoindent " always set autoindenting on
set incsearch " show search matches as you type
set laststatus=2 " always show status line
set linebreak " [Levi] cause long lines to wrap by words instead of just chars. http://stackoverflow.com/questions/13294489/make-vim-only-do-a-soft-word-wrap-not-hard-word-wrap
set noswapfile
set nobackup
"" Alternatively:
"set backupdir=~/.vim/var/backup//
"set directory=~/.vim/var/swp//
"" https://vi.stackexchange.com/questions/12794/how-to-share-config-between-vim-and-neovim
"" > To fix the colorscheme I had to set to 256 terminal color mode, i.e. add this to your .vimrc (= init.vim) file, which will be ignored by nvim:
set t_Co=256 " Note: Neovim ignores t_Co and other terminal codes.
nnoremap Y y$
let g:mapleader = ' '
nnoremap <leader>fs :w<return>
nnoremap <leader>wq :wq<return>
nnoremap <leader>qq :q<return>
nnoremap <leader>qa :qa<return>
nnoremap <leader>QQ :qa!<return>
nnoremap <leader>dd :bd<return>
nnoremap <leader>ww <C-w><C-w>
nnoremap <leader>wo <C-w><C-o>
nnoremap <leader>w/ :sp<return>
nnoremap <leader>w- :vs<return>
nnoremap <leader>/ :Lines<return> " fzf search all buffer lines
nnoremap <leader>ff :Files<return>
nnoremap <leader>[ mmO<esc>`m
nnoremap <leader>] mmo<esc>`m
nnoremap <leader><tab> :b#<cr> " Toggle between last 2 buffers (same as vim default: `:buffer #` / `C-^`)
nnoremap <leader>nu :set<space>nu!<cr> " Toggle line numbers
nnoremap <leader>bb :Buffers<cr> " fzf pick buffer with previews
nnoremap <leader><leader> :Buffers<cr> " fzf pick buffer with previews
nnoremap <leader>ol :History<cr>
nnoremap <leader>wr :set<space>wrap!<cr>
" when `set nowrap`, page scroll right and left
nnoremap z< 2zH
nnoremap z> 2zL
nnoremap <C-Right> 2zL
nnoremap <C-Left> 2zH
" execute current paragraph of code with different interpreters
nnoremap <leader>is msvipy}o<cr><esc>Pvip:!bash<cr>`s
nnoremap <leader>ir msvipy}o<cr><esc>Pvip:!ruby<cr>`s
nnoremap <leader>id msvipy}o<cr><esc>Pvip:!duckdb<space>-bail<space>-cmd<space>".maxwidth<space>-1"<space>-cmd<space>".maxrows 50000"<cr>`s
augroup csv_nowrap
autocmd!
autocmd BufRead,BufNewFile *.csv,*.csv.gz,*.csv.zst setlocal nowrap
augroup END
call plug#begin('~/.vim/var/plugged')
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'junegunn/fzf' " , { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'simeji/winresizer'
Plug 'tommcdo/vim-lion' " simple alignment operator gl and gL
call plug#end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment