Skip to content

Instantly share code, notes, and snippets.

@mikeslattery
Last active February 23, 2023 20:19
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 mikeslattery/e54cc77d69258a59bbb104dded7b5b2d to your computer and use it in GitHub Desktop.
Save mikeslattery/e54cc77d69258a59bbb104dded7b5b2d to your computer and use it in GitHub Desktop.
Beginner's Minimal Vim Config
" This is a beginners .vimrc or init.vim file
" with sane defaults so you can be productive at the start.
" Not designed to work with Neovim.
" Sane defaults.
source $VIMRUNTIME/defaults.vim
set mouse=a " Enable mouse
set clipboard+=unnamed,unnamedplus " Use desktop's clipboard
set hidden " Allow switch buffers if current not saved
set noswapfile autoread " Swap file annoyance. Use git.
" indentation default. These are overriden by various filetypes
set softtabstop=2 " number of spaces in tab when editing
set shiftwidth=2 " number of spaces to use for autoindent
set expandtab " expand tab to spaces so that tabs are spaces
" view format
set number " show line numbers
let g:netrw_liststyle=3 " Tree style netrw
set nowrap " No word wrap
" Auto-install plugin manager. Don't worry about understanding this.
" If this causes issues, remove and follow directions at https://github.com/junegunn/vim-plug#installation
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin()
Plug 'kien/ctrlp.vim'
call plug#end()
" <leader> is space key
let mapleader=' '
let maplocalleader=mapleader
" Some basic starter mappings for managing files.
" (Replace these with fzf.vim plugin commands at some point)
" Browse files from current directory using file exporer
nnoremap <leader>e :e .<cr>
" Search files
nnoremap <leader>f :CtrlP<cr>
" pick another buffer to switch to.
nnoremap <leader>b :CtrlPBuffer<cr>
" recently read files
nnoremap <leader>o :CtrlPMRU<cr>
" Close current buffer
nnoremap <leader>x :bp\|bd#<cr>
@mikeslattery
Copy link
Author

To upload to a server:

url=https://gist.githubusercontent.com/mikeslattery/e54cc77d69258a59bbb104dded7b5b2d/raw/6698d0bd1789590b07837327bd12c60ee705db12/.vimrc
curl -o /tmp/.vimrc "$url"
scp /tmp/.vimrc server:.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment