Created
February 28, 2017 18:41
-
-
Save eloyvega/a2819002b8c3a1987c7818651b8309bf to your computer and use it in GitHub Desktop.
Vim config
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
" VIM Configuration - Eloy Vega | |
" Cancel the compatibility with Vi. Essential if you want to enjoy the features of Vim | |
set nocompatible | |
" PATHOGEN | |
execute pathogen#infect() | |
" Change Leader key | |
let mapleader = "\<Space>" | |
" SOLARIZED THEME | |
set background=dark | |
colorscheme solarized | |
set nobackup | |
set noswapfile | |
" -- Display | |
set title " Update the title of your window or your terminal | |
set number " Display line numbers | |
set ruler " Display cursor position | |
set wrap " Wrap lines when they are too long | |
set scrolloff=3 " Display at least 3 lines around you cursor | |
" (for scrolling) | |
" -- Search | |
set ignorecase " Ignore case when searching | |
set smartcase " If there is an uppercase in your search term | |
" search case sensitive again | |
set incsearch " Highlight search results when typing | |
set hlsearch " Highlight search results | |
" -- Beep | |
set visualbell " Prevent Vim from beeping | |
set noerrorbells " Prevent Vim from beeping | |
" Backspace behaves as expected | |
set backspace=indent,eol,start | |
" Hide buffer (file) instead of abandoning when switching | |
" to another buffer | |
set hidden | |
" Enable syntax highlighting | |
syntax enable | |
" Enable file specific behavior like syntax highlighting and indentation | |
filetype on | |
filetype plugin on | |
filetype indent on | |
" Disable directional keys, MAN UP! | |
map <up> <nop> | |
map <down> <nop> | |
map <left> <nop> | |
map <right> <nop> | |
imap <up> <nop> | |
imap <down> <nop> | |
imap <left> <nop> | |
imap <right> <nop> | |
" :imap ;; <Esc> | |
" Four spaces tab | |
" show existing tab with 4 spaces width | |
set tabstop=4 | |
" when indenting with '>', use 4 spaces width | |
set shiftwidth=4 | |
set shiftround | |
" On pressing tab, insert 4 spaces | |
set expandtab | |
" CtrlP remapping | |
let g:ctrlp_map = '<leader>o' | |
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git|dist' | |
" Change to paste mode to avoid indentation on every line | |
set pastetoggle=<F2> | |
" Navigate through wrapped lines | |
nnoremap j gj | |
nnoremap k gk | |
" Clean search highlighting with ,/ | |
map <silent> ,/ :nohlsearch<CR> | |
" Easy navigation between panes | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
" Show status always | |
set ls=2 | |
" neocomplete | |
let g:neocomplete#enable_at_startup = 1 | |
" Open new split panes to right and bottom, which feels more natural | |
set splitbelow | |
set splitright | |
" Auto resize Vim splits to active split | |
set winwidth=104 | |
set winheight=5 | |
set winminheight=5 | |
set winheight=999 | |
" scroll the viewport faster | |
nnoremap <C-e> 3<C-e> | |
nnoremap <C-y> 3<C-y> | |
" Nerdtree | |
" Toggle with Ctrl-n | |
map <C-n> :NERDTreeToggle<CR> | |
" Enter with NerdTree | |
" autocmd StdinReadPre * let s:std_in=1 | |
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
" Close VIM when NerdTree is the only left window | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
" Copy & paste to system clipboard with <Space>p and <Space>y | |
vmap <Leader>y "+y | |
vmap <Leader>d "+d | |
nmap <Leader>p "+p | |
nmap <Leader>P "+P | |
vmap <Leader>p "+p | |
vmap <Leader>P "+P |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment