Skip to content

Instantly share code, notes, and snippets.

@dinigo
Last active December 22, 2016 10:04
Show Gist options
  • Save dinigo/7360db571d11646e10752a60adbf650d to your computer and use it in GitHub Desktop.
Save dinigo/7360db571d11646e10752a60adbf650d to your computer and use it in GitHub Desktop.
Current virmc
set nocompatible " desabilita compatibilidad con vi
filetype off " desactiva reconocimiento de archivo por el momentoju
" añade Vundle al runtime para poder ejecutarlo
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" repositorio de vundle para comprobar las propias actualizaciones
Plugin 'VundleVim/Vundle.vim'
" plugins
Plugin 'leafgarland/typescript-vim'
Plugin 'flazz/vim-colorschemes'
Plugin 'pangloss/vim-javascript'
Plugin 'crusoexia/vim-javascript-lib'
Plugin 'crusoexia/vim-monokai'
Plugin 'jelera/vim-javascript-syntax'
Plugin 'elzr/vim-json'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'Raimondi/delimitMate'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdTree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'scrooloose/nerdcommenter'
Plugin 'mattn/emmet-vim'
Plugin 'terryma/vim-smooth-scroll'
Plugin 'NLKNguyen/papercolor-theme'
Plugin 'itchyny/lightline.vim'
Plugin 'ryanoasis/vim-devicons'
Plugin 'Tagbar'
Plugin 'ctrlp.vim'
call vundle#end() " fin del bloque de plugins
filetype plugin indent on " vuelve a activar el reconocimiento de archivo
let mapleader="," " usa la coma como tecla <leader>
if &cp | set nocp | endif
let s:cpo_save=&cpo
set cpo&vim
let &cpo=s:cpo_save
unlet s:cpo_save
" configuracion general
set backspace=indent,eol,start
set autoindent
set diffexpr=MyDiff()
set guifont=DejaVu_Sans_Mono:h10:cANSI
set helplang=es
set hlsearch
set incsearch
set keymodel=startsel,stopsel
set langnoremap
set ruler
set selection=exclusive
set selectmode=mouse,key
set mouse=a
set undodir=~/.vim/undo
set undofile
set whichwrap=b,s,<,>,[,]
set fillchars+=vert:│
syntax on
set number
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent
set smartindent
set scrolloff=3
set hlsearch
set encoding=utf8
"cd $HOME/Workspace " directorio por defecto
set clipboard=unnamed " use the clipboards of vim and win
set paste " Paste from a windows or from vim
filetype plugin indent on
" cambia entre numero relativo y absoluto cuando la ventana pierde el foto
" porque en realidad sólo nos importa cuando estamos editando
au FocusLost * :set number
au FocusGained * :set relativenumber
set guioptions-=m "oculta la barra de menu en gvim
set guioptions-=T "oculta la barra de erramientas en gvim
set guioptions-=r "oculta la barra de scroll en gvim
set guioptions-=L "oculta la barra de scroll izquierda en gvim
" muestra caracteres ocultos
set list
set listchars=tab:>-,trail:-
" pone la indentacion de javascript a 2 espacios
au FileType javascript setl sw=2 sts=2 et
" si no se ha especificado ningun archivo usa javascript por defecto
autocmd BufEnter * if &filetype == "" | setlocal ft=javascript | endif
set ignorecase " busquedas case-insensitive
set ruler " informacion de posicion del cursor
set visualbell " aviso visual en vez de audible
set wildmode=list:longest,full " autocompletar comandos con tab
set confirm " pedir confirmacion en vez de abortar las acciones
set autochdir " current directory is always matching the content of the active window
" directorio de trabajo el de el archivo actual
autocmd BufEnter * silent! lcd %:p:h
" usa html para los archivos handlebars
au BufRead,BufNewFile *.hbs set filetype=html
" esquema de color
"set background=dark
"colorscheme molokai
set background=dark
colorscheme PaperColor
"""""""""""""""""""""""
" NERDTREE "
"""""""""""""""""""""""
" abre y cierra nerdtree con ctrl+l
nmap <silent> <Leader>f :NERDTreeToggle<CR>
let NERDTreeMinimalUI=1
" cierra vim si la ultima ventana es nerdtree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" abre nerdtree al inicio si se abre sin ningun archivo
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
let NERDTreeShowHidden=1
"""""""""""""""""""""""
" SYNTASTIC "
"""""""""""""""""""""""
" ejecuta syntastic al inicio
let g:syntastic_check_on_open=1
" configuracion por defecto de syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
" configuracion de check de syntastic
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 = 1
" colores de indentado
set colorcolumn=80
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
" mostrar y ocultar panel de syntastic
function! ToggleErrors()
let old_last_winnr = winnr('$')
lclose
if old_last_winnr == winnr('$')
" Nothing was closed, open syntastic error location panel
Errors
endif
endfunction
nmap <silent> <Leader>e :<C-u>call ToggleErrors()<CR>
" muestra los errores de typescript
autocmd QuickFixCmdPost [^l]* nested cwindow
autocmd QuickFixCmdPost l* nested lwindow
"""""""""""""""""""""""
" EMMET "
"""""""""""""""""""""""
" activa emmet en todos los modos
let g:user_emmet_mode='a'
"""""""""""""""""""""""
" SMOOTH-SCROLL "
"""""""""""""""""""""""
" remapea el desplazamiento al plugin de smooth-scroll
noremap <silent> <c-u> :call smooth_scroll#up(&scroll, 0, 2)<CR>
noremap <silent> <c-d> :call smooth_scroll#down(&scroll, 0, 2)<CR>
noremap <silent> <c-b> :call smooth_scroll#up(&scroll*2, 0, 4)<CR>
noremap <silent> <c-f> :call smooth_scroll#down(&scroll*2, 0, 4)<CR>
" remapea la rueda del raton a desplazamiento rapido
map <ScrollWheelUp> <C-B>
map <ScrollWheelDown> <C-F>
" borra el termino de busqueda al pulstar escape dos veces en modo normal
nnoremap <esc> :let @/ = ""<return><esc>
nnoremap <esc>^[ <esc>^[
"""""""""""""""""""""""
" LIGHTLINE "
"""""""""""""""""""""""
let g:lightline = {
\ 'component_function': {
\ 'filetype': 'MyFiletype',
\ 'fileformat': 'MyFileformat',
\ }
\ }
function! MyFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : ''
endfunction
function! MyFileformat()
return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : ''
endfunction
function! MyMode()
let fname = expand('%:t')
return fname == '__Tagbar__' ? 'Tagbar' :
\ fname == 'ControlP' ? 'CtrlP' :
\ fname == '__Gundo__' ? 'Gundo' :
\ fname == '__Gundo_Preview__' ? 'Gundo Preview' :
\ fname =~ 'NERD_tree' ? NERDTreeStatusline():
\ &ft == 'unite' ? 'Unite' :
\ &ft == 'vimfiler' ? 'VimFiler' :
\ &ft == 'vimshell' ? 'VimShell' :
\ winwidth(0) > 60 ? lightline#mode() : ''
endfunction
"""""""""""""""""""""""
" TAGBAR "
"""""""""""""""""""""""
" mapea a ,<C-O>
nmap <leader>o :TagbarToggle<CR>
"""""""""""""""""""""""
" DEVICONS "
"""""""""""""""""""""""
" usa la fuente en gvim
set guifont=Droid\ Sans\ Mono\ for\ Powerline\ Plus\ Nerd\ File\ Types:h11
"""""""""""""""""""""""
" CTRL-P "
"""""""""""""""""""""""
" ignora los archivos temporales
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
" ignora las carpetas de los vcs
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
"""""""""""""""""""""""
" NERDCommenter "
"""""""""""""""""""""""
" pone un espacio después de un comentario de documentacion
let NERDSpaceDelims=1
"""""""""""""""""""""""
" VIM-MARKDOWN "
"""""""""""""""""""""""
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_json_frontmatter = 1
@dinigo
Copy link
Author

dinigo commented Dec 22, 2016

INSTALLATION

Configure you vim with this script:

git clone https://gist.github.com/demil133/7360db571d11646e10752a60adbf650d temp
cp temp/.vimrc ~/
rm -rf temp
mkdir -p ~/.vim/bundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
git clone
mkdir ~/.config
ln -s ~/.vim ~/.config/nvim
ln -s ~/.vimrc ~/.config/nvim/init.vim

CONTENT

  • NERDTree: to display file system
  • NERDCommenter: to quickly manage comments
  • TagBar: to easily overview functions and variables on a file
  • Devicons: to display icons in NERDTree
  • Ctrl-P: to quickly find files close to you hierarchically
  • Lightline: as a status line
  • SmoothScroll: to scroll without getting lost
  • Emmet: to quickly write html
  • Syntastic: to lint your code

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