Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
" For plugins to load correctly
filetype plugin indent on
" TODO: Pick a leader key
" let mapleader = ","
" Security
set modelines=0
" Show line numbers
set number
" Show file stats
set ruler
" Blink cursor on error instead of beeping (grr)
set visualbell
" Encoding
set encoding=utf-8
" Whitespace
set wrap
set textwidth=79
set formatoptions=tcqrn1
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set noshiftround
" Cursor motion
set scrolloff=3
set backspace=indent,eol,start
set matchpairs+=<:> " use % to jump between pairs
runtime! macros/matchit.vim
" Move up/down editor lines
nnoremap j gj
nnoremap k gk
" Allow hidden buffers
set hidden
" Rendering
set ttyfast
" Status bar
set laststatus=2
" Last line
set showmode
set showcmd
" Searching
nnoremap / /\v
vnoremap / /\v
set hlsearch
set incsearch
set ignorecase
set smartcase
set showmatch
map <leader><space> :let @/=''<cr> " clear search
" Remap help key.
inoremap <F1> <ESC>:set invfullscreen<CR>a
nnoremap <F1> :set invfullscreen<CR>
vnoremap <F1> :set invfullscreen<CR>
" Textmate holdouts
" Formatting
map <leader>q gqip
" Visualize tabs and newlines
set listchars=tab:▸\ ,eol
" Uncomment this to enable by default:
" set list " To enable by default
" Or use your leader key + l to toggle on/off
map <leader>l :set list!<CR> " Toggle tabs and EOL
" Color scheme (terminal)
set t_Co=256
set background=dark
let g:solarized_termcolors=256
let g:solarized_termtrans=1
" put https://raw.github.com/altercation/vim-colors-solarized/master/colors/solarized.vim
" in ~/.vim/colors/ and uncomment:
" colorscheme solarized
@DevinJamesK

This comment has been minimized.

Copy link

@DevinJamesK DevinJamesK commented Oct 15, 2015

This is nice, thanks!

@dracconi

This comment has been minimized.

Copy link

@dracconi dracconi commented Sep 24, 2016

thanks too!

@a1ultima

This comment has been minimized.

Copy link

@a1ultima a1ultima commented Nov 23, 2016

I get many errors, I'm using Vim 7.3, may I ask which version of Vim you are using?

@yahyaguzide

This comment has been minimized.

Copy link

@yahyaguzide yahyaguzide commented Mar 7, 2017

nice thank you

@stanleykylee

This comment has been minimized.

Copy link

@stanleykylee stanleykylee commented May 4, 2017

Worked great, thanks!

@njablonski

This comment has been minimized.

Copy link

@njablonski njablonski commented May 11, 2017

Excellent starting point, thanks!

@eightarcher

This comment has been minimized.

Copy link

@eightarcher eightarcher commented May 24, 2017

Wunderbar! Many thanks for this.

@Lijun21

This comment has been minimized.

Copy link

@Lijun21 Lijun21 commented Jun 24, 2017

Thank you!

@vibhuthasak

This comment has been minimized.

Copy link

@vibhuthasak vibhuthasak commented Jul 30, 2017

Thanks..

@wilirys

This comment has been minimized.

Copy link

@wilirys wilirys commented Aug 26, 2017

Actual on all time. Thanks!

@hlwei

This comment has been minimized.

Copy link

@hlwei hlwei commented Nov 3, 2017

Thanks! it is very useful~

@genisd

This comment has been minimized.

Copy link

@genisd genisd commented Dec 5, 2017

thanks!

@tandavala

This comment has been minimized.

Copy link

@tandavala tandavala commented Feb 26, 2018

thanks!

@ichergui

This comment has been minimized.

Copy link

@ichergui ichergui commented Mar 2, 2018

thanks :)

@hyojeonglee

This comment has been minimized.

Copy link

@hyojeonglee hyojeonglee commented Mar 12, 2018

thanks!

@Ungerfall

This comment has been minimized.

Copy link

@Ungerfall Ungerfall commented Mar 12, 2018

thanks : )

@MikeWise2718

This comment has been minimized.

Copy link

@MikeWise2718 MikeWise2718 commented Mar 21, 2018

Just what I needed to get started.

@crazycoder-io

This comment has been minimized.

Copy link

@crazycoder-io crazycoder-io commented Mar 27, 2018

thanks :))

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented May 10, 2018

Thanks. Nice job.

@laeshiny

This comment has been minimized.

Copy link

@laeshiny laeshiny commented Jul 16, 2018

thanks. it is so nice~!! 👍

@marquelamar

This comment has been minimized.

Copy link

@marquelamar marquelamar commented Aug 5, 2018

ThankyouThankyou

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Sep 14, 2018

There is this white flash on the screen if the cursor can't go further, what part of the code does it, I don't want that.

@theodorehadges

This comment has been minimized.

Copy link

@theodorehadges theodorehadges commented Oct 5, 2018

There is this white flash on the screen if the cursor can't go further, what part of the code does it, I don't want that.

@raudraroop Line 28: set visualbell does this

@Olimejj

This comment has been minimized.

Copy link

@Olimejj Olimejj commented Mar 21, 2019

Thanks, I finally figured out the vimrc file :) This template is what finally did it for me.

@Blithe-Chiang

This comment has been minimized.

Copy link

@Blithe-Chiang Blithe-Chiang commented Apr 27, 2019

Thanks

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Jun 8, 2019

Thank you! It looks good and easy to amend and update :)

@xxzelatron

This comment has been minimized.

Copy link

@xxzelatron xxzelatron commented Jul 16, 2019

if I use :set paste while pasting some lines, it is also modifying existing lines in file.how to avoid this?
If I paste without paste mode i.e. in insert mode then it is adding indentation for every line

@almokhtarbr

This comment has been minimized.

Copy link

@almokhtarbr almokhtarbr commented Sep 27, 2019

thanks

@mfrlinux

This comment has been minimized.

Copy link

@mfrlinux mfrlinux commented Oct 22, 2019

Thank you! Very good!

@marquelamar

This comment has been minimized.

Copy link

@marquelamar marquelamar commented Nov 1, 2019

Thanks.Again.

@banditelol

This comment has been minimized.

Copy link

@banditelol banditelol commented Nov 5, 2019

Thanks You :)
btw can anyone tell me what the "rn1" part of formatoptions does?

EDIT
nvm, just found out the options exist in fo-table

@MoatazAbdAlmageed

This comment has been minimized.

Copy link

@MoatazAbdAlmageed MoatazAbdAlmageed commented Dec 2, 2019

Thanks, I will try

@jerry-peng

This comment has been minimized.

Copy link

@jerry-peng jerry-peng commented Dec 20, 2019

Thnx m8

@fanliver

This comment has been minimized.

Copy link

@fanliver fanliver commented Feb 7, 2020

Thank you a lot for this nice file.

@LowProKill

This comment has been minimized.

Copy link

@LowProKill LowProKill commented Feb 26, 2020

Looks good mate. Thanks

@davivcgarcia

This comment has been minimized.

Copy link

@davivcgarcia davivcgarcia commented Apr 16, 2020

Perfect! ;-)

@santimirandarp

This comment has been minimized.

Copy link

@santimirandarp santimirandarp commented Apr 26, 2020

super nice, thanks.
On Firefox C-a selects all text (useful to copy on the raw file for the color scheme)

@hugowan

This comment has been minimized.

Copy link

@hugowan hugowan commented May 13, 2020

nice work

@liam102

This comment has been minimized.

Copy link

@liam102 liam102 commented May 29, 2020

Could someone please explain why does the keymap adds \v before search terms?

@oantolin

This comment has been minimized.

Copy link

@oantolin oantolin commented Jun 15, 2020

Could someone please explain why does the keymap adds \v before search terms?

It enables "very magic" regex syntax, which roughly means that characters that have a special meaning in regexes need not be escaped to have that special meaning. For example, normally to group a subregex you need to escape the parenthesis with a backslash: \(this is grouped\). With very magic syntax unescaped parenthesis have that function. Similarly alternation is usually \|, and with very magic syntax it is just |. But don't take my word for it, ask Vim: :help \v.

@damog

This comment has been minimized.

Copy link

@damog damog commented Nov 9, 2020

Thanks a lot 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.