Skip to content

Instantly share code, notes, and snippets.

@javier-lopez
Last active October 24, 2016 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javier-lopez/18dd89c32365b99636558f10b8413074 to your computer and use it in GitHub Desktop.
Save javier-lopez/18dd89c32365b99636558f10b8413074 to your computer and use it in GitHub Desktop.
Vim CDMX VI
https://sanctum.geek.nz/arabesque/vim-anti-patterns/ #Antipatrones de Vim
@javier-lopez
Copy link
Author

javier-lopez commented Oct 14, 2016

26623*2132  =
931-12      =
34/29       =
345*23      =
1+2+3+4+5+6 =
nnoremap Q 0yt=A<C-r>=<C-r>"<CR><Esc>

http://vimcasts.org/episodes/simple-calculations-with-vims-expression-register/
Registro '='

@javier-lopez
Copy link
Author

javier-lopez commented Oct 14, 2016

No me funcionó https://gist.github.com/chilicuil/880a02d9669b71d772d66eebdf3151e4#gistcomment-1882224 así que dejo una implementación alternativa.

fun! Fontsize_up() "{{{
    let l:gf_size_whole = matchstr(&guifont, '\( \)\@<=\d\+$')
    let l:gf_size_whole = l:gf_size_whole + 1
    let l:new_font_size = ' '.l:gf_size_whole
    let &guifont = substitute(&guifont, ' \d\+$', l:new_font_size, '')
endfunction "}}}

fun! Fontsize_down() "{{{
    let l:gf_size_whole = matchstr(&guifont, '\( \)\@<=\d\+$')
    let l:gf_size_whole = l:gf_size_whole - 1
    let l:new_font_size = ' '.l:gf_size_whole
    let &guifont = substitute(&guifont, ' \d\+$', l:new_font_size, '')
endfunction "}}}

nnoremap <silent> g0 :call Fontsize_up()<cr>
nnoremap <silent> g9 :call Fontsize_down()<cr>

http://vi.stackexchange.com/a/3104

@javier-lopez
Copy link
Author

Agrega :h modeline al archivo actual.

function! AppendModeLine()
  let save_cursor = getpos('.')
  let append = ' vim: set ts='.&tabstop.' sw='.&shiftwidth.' tw='.&textwidth.' ft='.&filetype.' :'
  $put =substitute(&commentstring, '%s', append, '')
  call setpos('.', save_cursor)
  redraw!
  echo "Added modeline :)"
endfunction

nnoremap <silent> m0 :call AppendModeLine()<cr>

http://vim.wikia.com/wiki/Modeline_magic

@javier-lopez
Copy link
Author

javier-lopez commented Oct 14, 2016

Limpia búsqueda actual

nmap <silent> <leader>/   :nohlsearch<cr>

@javier-lopez
Copy link
Author

javier-lopez commented Oct 14, 2016

Instala dependencias en plugins instalados con vim-plug

Bundle 'majutsushi/tagbar' , { 'on': 'TagbarToggle', 'do': 'wget --no-check-certificate https://raw.githubusercontent.com/chilicuil/learn/master/python/mkd2ctags && chmod +x mkd2ctags' }

@javier-lopez
Copy link
Author

:%d elimina todo el contenido del buffer activo

@javier-lopez
Copy link
Author

Una revisión al administrador de paquetes nativo de Vim 8, a la Pathogen:

https://shapeshed.com/vim-packages/

En mi opinión muy inferior a las alternativas actuales, vundle, vim-plug y con dependencia en Vim >= 8, incluso si la implementación nativa fuera increible pasaran muchos años antes de vim 8 se encuentre instalado por defecto en sistemas Unix.

@javier-lopez
Copy link
Author

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