Skip to content

Instantly share code, notes, and snippets.

@cronnelo
Created October 16, 2018 06:14
Show Gist options
  • Save cronnelo/5c31f4ba832e383250ac30bedb3a2fed to your computer and use it in GitHub Desktop.
Save cronnelo/5c31f4ba832e383250ac30bedb3a2fed to your computer and use it in GitHub Desktop.
call plug#begin('~/.vim/plugged')
Plug 'flazz/vim-colorschemes'
Plug 'altercation/vim-colors-solarized'
Plug 'tpope/vim-surround'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'ryanoasis/vim-devicons'
Plug 'scrooloose/nerdcommenter'
Plug 'vim-airline/vim-airline'
Plug 'mattn/emmet-vim'
Plug 'airblade/vim-gitgutter'
Plug 'jiangmiao/auto-pairs'
Plug 'terryma/vim-multiple-cursors'
Plug 'sirver/ultisnips'
Plug 'honza/vim-snippets'
Plug 'elzr/vim-json'
Plug 'mileszs/ack.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'w0rp/ale'
Plug 'easymotion/vim-easymotion'
" Plugins: Language specific
Plug 'hail2u/vim-css3-syntax', { 'for': ['css', 'sass', 'scss', 'less'] }
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'mxw/vim-jsx'
Plug 'tpope/vim-fugitive'
" Vim HardTime
Plug 'takac/vim-hardtime'
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
""""""""""""""""""""""""""
" => Mappings
""""""""""""""""""""""""""
let mapleader=","
set listchars=tab:▸\ ,eol:¬,nbsp:.
" make jk do esc
inoremap jk <Esc>
" make esc do nothing
inoremap <Esc> <Nop>
nnoremap <leader><space> :nohlsearch<CR>
nnoremap tj :tabprevious<CR>
nnoremap tk :tabnext<CR>
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" Mapping selecting mappings
map <C-p> :FZF<CR>
map <leader>t :NERDTreeToggle<CR>
map <leader>ev :tabe ~/.vimrc<CR>
map <leader>rv :source ~/.vimrc<CR>
map <leader>f :NERDTreeFind<cr>
let g:multi_cursor_prev_key = '<C-b>'
" Fugitive mappings
nnoremap <Leader>gs :Gstatus<CR>
nnoremap <Leader>gd :Gdiff<CR>
nnoremap <Leader>gb :Gblame<CR>
nnoremap <Leader>gr :Git branch<CR>
nnoremap <Leader>gco :Gread<CR>
nnoremap <Leader>ga :Gwrite<CR>
nnoremap <Leader>gl :Gpull<CR>
nnoremap <Leader>gp :Gpush<CR>
""""""""""""""""""""""""""
" => basic
""""""""""""""""""""""""""
set autoread
set textwidth=79
" Always show current position
set ruler
set colorcolumn=120
" Display line numbers on the left
set number
" Ignore case when searching
set ignorecase
" Don't offer to open certain files/directories
set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png,*.ico
set wildignore+=*.pdf,*.psd
set wildignore+=node_modules/*,bower_components/*
" Highlight search results
set hlsearch
" hi Visual term=reverse cterm=reverse ctermfg=7 ctermbg=0 guibg=Grey
" hi Search term=standout ctermfg=0 ctermbg=11 guifg=Black guibg=Yellow
" hi ColorColumn ctermbg=gray
" Makes search act like search in modern browsers
set incsearch
" Show tabs and spaces
set nolist
" Set 7 lines to the cursor - when moving vertically using j/k
set so=7
" Turn on the Wild menu
set wildmenu
" Height of the command bar
set cmdheight=2
" How many tenths of a second to blink when matching brackets
set mat=2
"set inccommand=split
" Add a bit extra margin to the left
set foldcolumn=1
set foldmethod=syntax
set foldlevelstart=1
nnoremap <Space> za
set splitbelow
set splitright
""""""""""""""""""""""""""
" => Colors and Fonts
""""""""""""""""""""""""""
" Enable syntax highlighting
syntax enable
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
set showmatch "highlight matching [{()}]
" solozarized options
" let g:solarized_termcolors=256
set background=dark
colorscheme solarized
"""""""""""""""""""""""""""""
" => Files, backups and undo
"""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in SVN, git etc., anyway...
set nobackup
set nowb
set noswapfile
"""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""
" make "tab" insert indents instead of tabs at the beginning of a line
set smarttab
" On pressing tab, insert 4 spaces
set expandtab
" when indenting with '> | <', use 4 spaces width
set shiftwidth=2
" show existing tab with 4 spaces width
set tabstop=2
" sets the number of clumns for a TAB
set softtabstop=2
set autoindent
set smartindent
set wrap "Wrap lines
""""""""""""""""""""""""""""""
" => Visual mode related
""""""""""""""""""""""""""""""
" Visual mode pressing * or # searches for the current selection
" Super useful! From an idea by Michael Naumann
vnoremap <silent> * :call VisualSelection('f')<CR>
vnoremap <silent> # :call VisualSelection('b')<CR>
""""""""""""""""""""""""""""""
" => Vim Fugitive
""""""""""""""""""""""""""""""
" Set :Gdiff to vertical
" set diffopt+=vertical
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Moving around, tabs, windows and buffers
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
"""""""""""""""""""""""
" Plugins Config
"""""""""""""""""""""""
let g:deoplete#enable_at_startup = 1
let g:user_emmet_leader_key = '<Tab>'
let g:user_emmet_settings = {
\ 'javascript.jsx' : {
\ 'extends' : 'jsx',
\ },
\}
let g:ale_javascript_eslint_executable = 'eslint'
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ 'jsx': ['eslint'],
\}
let g:ale_fixers = { 'javascript': ['eslint'] }
let g:ale_fix_on_save = 1
let g:ale_sign_error = '●'
let g:NERDTreeShowHidden = 1
nmap <leader>ue :UltiSnipsEdit<cr>
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
"""""""""""""""""""""""
" Neovim config
"""""""""""""""""""""""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment