Created
June 12, 2016 09:52
-
-
Save fluffels/d2bdfc593d7186a971a82e239214f40b to your computer and use it in GitHub Desktop.
No-plugin .vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
noremap <leader>[ :bp<CR> | |
noremap <leader>] :bn<CR> | |
"Indentation settings. | |
set autoindent | |
set shiftwidth=4 | |
set expandtab | |
set tabstop=4 | |
set softtabstop=4 | |
"Make Vim automatically write when switching buffers, compiling etc. | |
set autowrite | |
"Colors. | |
syntax enable | |
"Command to use sudo to write out a file (in case I forgot). | |
command W w !sudo tee % | |
"Switch off vi compatibility. | |
set nocompatible | |
"Some modelines apparently have security exploits. | |
set modelines=0 | |
"Use UTF-8 | |
set encoding=utf-8 | |
"Keep context visible at all times. | |
set scrolloff=5 | |
set sidescrolloff=5 | |
"Show the current mode. | |
set showmode | |
"Display current command. | |
set showcmd | |
"Display wildcard menu. | |
set wildmenu | |
set wildmode=list:longest | |
"Use a visual bell, instead of the system bell. | |
set visualbell | |
"Highlight the line containing the cursor. | |
set cursorline | |
"Tell Vim that we have a fast terminal. | |
set ttyfast | |
"Show position. | |
set ruler | |
"No idea what this does. | |
set backspace=indent,eol,start | |
"Always draw a status line. | |
set laststatus=2 | |
"Show line numbers relative to the current one. | |
set relativenumber | |
"Create a file to store undo commands. | |
set undofile | |
"Use normal regexes in searches. | |
nnoremap / /\v | |
vnoremap / /\v | |
"All-lower case searches will be case-insensitive, if there's one upper case | |
"letter, it will be case-sensitive. | |
set ignorecase | |
set smartcase | |
"Set Vim to globally substitute by default. | |
set gdefault | |
"Highlight search results. | |
set incsearch | |
set showmatch | |
set hlsearch | |
"Use <leader>space to clear searches. | |
nnoremap <leader><space> :noh<cr> | |
"Make tab match bracket pairs. | |
nnoremap <tab> % | |
vnoremap <tab> % | |
"Color Columns | |
set colorcolumn=80 | |
highlight ColorColumn ctermbg=10 | |
"Show invisible characters. | |
"set list | |
"set listchars=tab:▸\ ,eol:¬ | |
"Disable direction keys. | |
nnoremap <up> <nop> | |
nnoremap <down> <nop> | |
nnoremap <left> <nop> | |
nnoremap <right> <nop> | |
inoremap <up> <nop> | |
inoremap <down> <nop> | |
inoremap <left> <nop> | |
inoremap <right> <nop> | |
"Make j and k move by screen line, and not file line. | |
nnoremap j gj | |
nnoremap k gk | |
"Use ; like : so you dont have to press SHIFT. | |
nnoremap ; : | |
"Make Vim write on losing focus. | |
au FocusLost * :wa | |
"Map jj to escaping out of insert mode. | |
inoremap jj <ESC> | |
if has('autocmd') | |
augroup C | |
autocmd BufNewFile,BufRead *.[Cch],Makefile set wrap | |
autocmd BufNewFile,BufRead *.[Cch],Makefile set textwidth=80 | |
autocmd BufNewFile,BufRead *.[Cch],Makefile set formatoptions=tw | |
autocmd BufNewFile,BufRead *.[Cch],Makefile set colorcolumn=81 | |
autocmd BufNewFile,BufRead *.[Cch],Makefile noremap <leader>= :!clear; make<CR> | |
autocmd BufNewFile,BufRead *.[Cch],Makefile noremap <leader>- :!./main<CR> | |
autocmd BufNewFile,BufRead *.[Cch],Makefile noremap <leader>0 :make! test<CR> | |
autocmd BufNewFile,BufRead *.[Cch],Makefile noremap <leader>9 :!./test<CR> | |
augroup end | |
augroup Python | |
autocmd BufNewFile,BufRead *.py set shiftwidth=4 | |
autocmd BufNewFile,BufRead *.py set tabstop=4 | |
autocmd BufNewFile,BufRead *.py set softtabstop=4 | |
augroup end | |
augroup LaTeX | |
autocmd BufNewFile,BufRead *.tex let &colorcolumn=999 | |
augroup end | |
augroup HTML | |
autocmd BufNewFile,BufRead *.html let &colorcolumn=999 | |
augroup end | |
augroup markdown | |
autocmd BufNewFile,BufRead *.md,*.markdown setlocal filetype=ghmarkdown | |
autocmd BufNewFile,BufRead *.md,*.markdown let &colorcolumn=999 | |
augroup end | |
augroup JavaScript | |
autocmd BufNewFile,BufRead *.js let &colorcolumn=999 | |
autocmd BufNewFile,BufRead *.js set formatoptions=twcq | |
augroup end | |
augroup reStructuredText | |
autocmd BufNewFile,BufRead *.rst let &colorcolumn=999 | |
augroup end | |
augroup Text | |
autocmd BufNewFile,BufRead *.txt let &colorcolumn=999 | |
augroup end | |
augroup HiglightTODO | |
autocmd! | |
autocmd WinEnter,VimEnter * :silent! call matchadd('SpecialComment', 'NOTE', -1) | |
augroup END | |
endif | |
"NOTE | |
if $SHELL =~ '/bin/fish' | |
set shell=/bin/sh | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment