Skip to content

Instantly share code, notes, and snippets.

@userhooke
Last active January 17, 2020 16:13
Show Gist options
  • Save userhooke/3392b3c69f94ef14fd03e2cfed0f6017 to your computer and use it in GitHub Desktop.
Save userhooke/3392b3c69f94ef14fd03e2cfed0f6017 to your computer and use it in GitHub Desktop.
vim config
"" always use vim instead of vi
set nocompatible
call plug#begin(stdpath('data') . '/plugged')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'editorconfig/editorconfig-vim'
call plug#end()
"" identify file types
filetype on
filetype indent on
filetype plugin on
syntax enable
" Set 7 lines to the cursor - when moving vertically using j/k
set so=7
"" Ctrl - n hotkey for NERD plugin
map <C-n> :NERDTreeToggle<CR>
"" ignore case sensitivity on search
set ignorecase
" When searching try to be smart about cases
set smartcase
"" enbale interactive search
set incsearch
"" highlight search results
set hlsearch
"" smart indentetion
set autoindent
"" force UTF-8
set fileencoding=utf-8
set encoding=utf-8
"" show line endings
"set listchars=tab:▸\ ,eol:¬
"" show line numbers
set number
"set relativenumber
"" To control the number of space characters that will be inserted when the tab key is pressed
set tabstop=2
"" To change the number of space characters inserted for indentation
set shiftwidth=2
set softtabstop=2
"" To insert space characters whenever the tab key is pressed
set expandtab
"" custom key mappings
imap jj <Esc>
"" highlght line where you at
"set cursorline
"" visual autocomplete for command menu
set wildmenu
" Configure backspace so it acts as it should act
set whichwrap+=<,>,h,l
set showmatch
" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowb
set noswapfile
" merge vim's clipboard and system
set clipboard=unnamedplus
" escape of parenthesis/brackets, etc
inoremap <S-Tab> <esc>la
" O in insert mode
imap <C-o> <esc>o
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment