Skip to content

Instantly share code, notes, and snippets.

@woodRock
Last active March 14, 2020 06:18
Show Gist options
  • Save woodRock/c4915fab008f042b09bcb7ac036a201f to your computer and use it in GitHub Desktop.
Save woodRock/c4915fab008f042b09bcb7ac036a201f to your computer and use it in GitHub Desktop.
Vim Configuration

Vim Configuraiton

Plugins

Requires the vim-plug vim extension manager.

call plug#begin()
Plug 'preservim/nerdtree'
Plug 'ryanoasis/vim-devicons'
Plug 'scrooloose/nerdcommenter'
Plug 'mattn/emmet-vim'
Plug 'valloric/youcompleteme'
Plug 'vim-airline/vim-airline'
Plug 'leafgarland/typescript-vim'
Plug 'scrooloose/syntastic'
Plug 'kien/ctrlp.vim'
Plug 'w0rp/ale'
Plug 'lervag/vimtex'
Plug 'Chiel92/vim-autoformat'
call plug#end()

Atom-like tree view

Maps the NERDTree command to the same as atom

"maps the tree view key
map <C-\> :NERDTreeToggle<CR>

Tabs vs Spaces

The eternal debate

"line numbers are shown by default
set number sts=2 ts=2 et

"formats the tabs automatically for haskell file types
autocmd FileType haskell setlocal shiftwidth=2 tabstop=2
autocmd FileType typscript setlocal shiftwidth=2 tabstop=2

Exit insert mode

The escape key is very far away, it can be more appropriate to make it closer.

N.B. Ctrl + [ can be used perform the same operation without mapping needed !

"maps the Tab key to ESC
nnoremap <Tab> <Esc>
vnoremap <Tab> <Esc>gV
onoremap <Tab> <Esc>
cnoremap <Tab> <C-C><Esc>
inoremap <Tab> <Esc>`^
inoremap <Leader><Tab> <Tab>

Additional Configuration for packages

"needs to be set for the vim-devicons
set encoding=UTF-8

"syntastic recommended settings
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment