Skip to content

Instantly share code, notes, and snippets.

@ManvendraSK
Last active Nov 18, 2019
Embed
What would you like to do?
Sample .vimrc to enable React and JSX inside vim with emmet and other things.
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/syntastic'
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
Plugin 'Raimondi/delimitMate'
Plugin 'docunext/closetag.vim'
Plugin 'ervandew/supertab'
Plugin 'mattn/emmet-vim'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'tpope/vim-fugitive'
Plugin 'eslint/eslint'
" All of your Plugins must be added before this line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
set number
set cursorline
set noswapfile
set nowb
set nobackup
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set autoread
set hlsearch
set smartcase
set showmatch
set mat=2
set laststatus=2
set guifont=Monaco:h11
:syntax on
" vim-jsx configuration
let g:jsx_ext_required = 0
" NERDTree configuration
" Give a shortcut key to NERD Tree
map <F2> :NERDTreeToggle<CR>
let g:NERDTreeChDirMode=2
" CtrlP configuration
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_switch_buffer = 'Et'
" Ignore using vim
set wildignore+=*\\node_modules\\*
" Ignore using CtrlP
let g:ctrlp_custom_ignore = {
\ 'dir': 'node_modules',
\ }
" Emmet-vim configuration
let g:user_emmet_leader_key='<C-I>'
" vim-airline configuration
let g:airline#extensions#tabline#enabled = 1

How to Install it.

  1. This .vimrc is utilizing Vundle to install and manage the plugins. Vundle is in itself is a plugin. So basically, to install plugins in VIM you need to install Vundle plugin. To install it, just issue a command git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim.

  2. Copy this .vimrc to your home folder.

  • On Windows: C:\Users\.vimrc
  • On Linux: ~/.vimrc
  1. Now open, the new instance of Vim and in the ex editor type :PluginInstall and press enter/return key. This would install all of the plugins listed in the .vimrc file.

  2. Start using new plugins! :-)

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