Skip to content

Instantly share code, notes, and snippets.

@ConnorWGarvey
Created January 30, 2023 21:11
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 ConnorWGarvey/9ec331ed89d84abc752a8367819acff0 to your computer and use it in GitHub Desktop.
Save ConnorWGarvey/9ec331ed89d84abc752a8367819acff0 to your computer and use it in GitHub Desktop.
My .vimrc
" 'nocompatible' is the default for user .vimrcs. Consider setting it for a shared file. https://vimdoc.sourceforge.net/htmldoc/starting.html#compatible-default
"set nocompatible
" Auto-indentation on for known file types.
if has('filetype')
filetype indent plugin on
endif
" Syntax highlighting
if has('syntax')
syntax on
endif
" If not using tabs, 'hidden' can be set so that when an editor tab is abandoned, it's 'hidden' instead of unloaded,
" keeping history even after closing VIm.
" https://vimdoc.sourceforge.net/htmldoc/options.html#'hidden'
"set hidden
" Tab completion for VIm commands. Try ':help wildmenu'.
set wildmenu
" Show partial commands in the last line of the screen
set showcmd
" Highlight searches. Use <C-L> to temporarily turn off highlighting; see the mapping of <C-L> below)
set hlsearch
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" Allow backspacing over autoindent, line breaks and start of insert action
set backspace=indent,eol,start
" When adding a line, make that line's indentation similar to the current one
set autoindent
" Display the cursor position on the last line of the screen or in the status line of a window
set ruler
" Always display the status line, even if only one window is displayed
set laststatus=2
" Instead of failing a command because of unsaved changes, ask to save
set confirm
" Flash instead of beep when doing something VIm doesn't expect.
set visualbell
" Set the visual bell to not do anything.
set t_vb=
" Enable use of the mouse for all modes
"if has('mouse')
" set mouse=a
"endif
" Set the command window height to 2 lines, to avoid many cases of having to press <Enter> to continue
set cmdheight=2
" Display line numbers on the left
set number
" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200
" Use <F11> to toggle between 'paste' and 'nopaste'
set pastetoggle=<F11>
" Indentation settings for using spaces instead of tabs.
set shiftwidth=2
set softtabstop=2
set expandtab
" If using tab characters, display 2 wide.
"set shiftwidth=2
"set tabstop=2
" Have Y yank to end-of-line instead of yanking the whole line.
map Y y$
" Map <C-L> (redraw screen) to also turn off search highlighting until the next search
nnoremap <C-L> :nohl<CR><C-L>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment