Skip to content

Instantly share code, notes, and snippets.

@sidneydemoraes
Created June 29, 2019 15:28
Show Gist options
  • Save sidneydemoraes/4c185b426280bdd38765305202511036 to your computer and use it in GitHub Desktop.
Save sidneydemoraes/4c185b426280bdd38765305202511036 to your computer and use it in GitHub Desktop.
Exemplo de configuração para Vim do Filipe Deschamps
" Author: Filipe Deschamps
" Source: https://github.com/filipedeschamps/dotfiles
" LEADER KEY
let mapleader=","
" COMPATIBILITY
" Set 'nocompatible' to avoid unexpected things that your distro might have
set nocompatible
set t_ut=
" BUNDLE
" Automatically download vim-plug if it doesn't exist
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Configure vim-plug
call plug#begin('~/.vim/bundle')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/syntastic'
Plug 'tomasr/molokai'
Plug 'jeffkreeftmeijer/vim-numbertoggle'
Plug 'editorconfig/editorconfig-vim'
Plug 'vim-scripts/AutoComplPop'
Plug 'Raimondi/delimitMate'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'scrooloose/nerdcommenter'
Plug 'rking/ag.vim'
Plug 'sheerun/vim-polyglot'
call plug#end()
" SYNTAX
" Enable syntax highlighting
syntax on
" SEARCH
" Highlight search term. Use :nohl to redraw screen and disable highlight
set hlsearch
" Make Ag search from your project root
let g:ag_working_path_mode="r"
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" AUTO IDENTATION
" Enable auto identation with 'spaces' instead of 'tabs'
set smartindent
set expandtab
set softtabstop=2
set shiftwidth=2
" MOVING BETWEEN FILES
" Set 'hidden' if you want to open a new file inside the same buffer without the
" need to save it first (if there's any unsaved changes).
set hidden
" REMEMBER THIGS
" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='10,\"100,:20,%,n~/.viminfo
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END
" BACKUP
" Disable all backup files, never used them
set nobackup
set nowritebackup
set noswapfile
" SYNTASTIC
" Syntastic is a syntax checking plugin for Vim that runs files through
" external syntax checkers and displays any resulting errors to the user.
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" Configure Standar JS as default linter
let g:syntastic_javascript_checkers = ['standard']
" COLOR SCHEME
" Load molokai (alternative to Monokai from TextMate) color scheme
colorscheme molokai
" FONT
set guifont=Monaco\ for\ Powerline:h12
set antialias
" ENCODING
set encoding=utf-8
" COMMAND LINE
" Enhanced command line completion
set wildmenu
" Complete files like a shell
set wildmode=list:longest
" SEARCH
" Vim will start searching as you type
set incsearch
" FILE NUMBERS
" Enable relative and absolute file numbers
set number relativenumber
" WRAP
" Stop wrapping long lines
set nowrap
" AUTORELOAD
" Automatically reload buffers when file changes
set autoread
" PLUGINS CONFIGURATIONS
" CtrlP
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
" Syntastic
nnoremap <leader>st :SyntasticToggleMode<cr>
" NERDTree
nnoremap <leader>ft :NERDTreeToggle<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment