Skip to content

Instantly share code, notes, and snippets.

@shreeve
Created December 11, 2022 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shreeve/9a50dd4d1922542344aa9d5744ff7723 to your computer and use it in GitHub Desktop.
Save shreeve/9a50dd4d1922542344aa9d5744ff7723 to your computer and use it in GitHub Desktop.
Vim configuration file
" vim config
set nocompatible " Must come first because it changes other options
" Enable pathogen
execute pathogen#infect()
color benlight " Color theme
syntax on " Use syntax highlighting
set ruler " Show cursor position.
set incsearch " Highlight matches as you type
set hlsearch " Highlight matches
set ignorecase " Case-insensitive searching
set smartcase " But case-sensitive if expression contains a capital letter
set ttyfast " Send more characters for redraws
set mouse=a " enable mouse in all modes
set ttymouse=xterm2 " enable more mouse magic
set title " Set the terminal's title
set scrolloff=3 " Show 3 lines of context around the cursor
set tabstop=2 " Global tab width.
set shiftwidth=2 " And again, related.
set expandtab " Use spaces instead of tabs
" status bar
set laststatus=2 " always show the status bar
set statusline=[%n]\ %<%.99f\ %h%w%m%r%= " main status, file name, etc.
set statusline+=\ \ %-12(R:%l\ C:%v%) " position in rows and cols
set statusline+=\ \ %-14(0x%B\ (%b)%) " character under cursor
set statusline+=\ \ %P " percent through file
function! LineNoCycle()
if (&number == 1)
set nonumber
set relativenumber
elseif (&relativenumber == 1)
set norelativenumber
else
set number
end
endfunc
" Show line numbers (Ctrl+n)
nnoremap <C-n> :call LineNoCycle()<cr>
" Press enter to clear last search
nnoremap <cr> :noh<cr><cr>:<backspace>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment