Ambdós costats versió prèvia Revisió prèvia Següent revisió | Revisió prèvia |
linux:vim:comandos [18/07/2018 11:02] – [vim] mate | linux:vim:comandos [07/11/2020 14:25] (actual) – [Basics] admin |
---|
~~NOTOC~~ | ~~NOTOC~~ |
{{tag>linux}} | {{tag>linux}} |
/vía: [[https://www.catswhocode.com/blog/vim-cheat-sheet-for-2016]] | /vía: [[https://www.catswhocode.com/blog/vim-cheat-sheet-for-2016]]\\ |
<del>/vía:[[http://www.catswhocode.com/blog/130-essential-vim-commands]]</del> | <del>/vía:[[http://www.catswhocode.com/blog/130-essential-vim-commands]]</del> |
| |
[[linux:vim:vimrc]] | == info |
| * [[linux:vim:vimrc]] |
| * [[linux:vim:mlechon1aldia]] |
| |
| |
| ==Plugins/extensiones/personalización |
| <callout type="warning" title="Pendiente: modificación status line" icon="true">https://kadekillary.work/post/statusline/</callout> |
| <callout type="warning" title="Pendiente: modificación status line" icon="true">[[https://gist.github.com/millermedeiros/1262085]]</callout> |
| |
| * gestión/instalación plugins en sus propios directorios (runtimepath): [[https://github.com/tpope/vim-pathogen]] |
| * crear dos directorios: ''~/.vim/autoload'' (ubicación vim-pathogen.vim) y ''~/.vim/bundle'' (home_directory de los plugins) |
| * modificar **.vimrc** añadiendo ''execute pathogen#infect()'' |
| * stateline.vim (requiere pathogen.vim):<code bash>cd ~/.vim/bundle |
| git clone https://github.com/millermedeiros/vim-statline.git</code> |
| |
== config | == config |
</code> | </code> |
| |
| == Basics |
| * **[N] acción moción** |
| * acciones: |
| * d - delete |
| * c - caracter sustitución |
| * >,< - indentación, desindentación |
| * gU,u - uppercase |
| * y - copiar |
| * moción |
| * w - palabra |
| * e - final de palabra |
| * b - palabra anterior |
| * ^ - principio de línea |
| * $ - final de linea |
| * gg - principio documento |
| * G - final de documento |
| * iw - inside word |
| * aw - arorund word |
| * . - repite última edición |
| |
==Basics | == more Basics |
* '':e'' filename : Open filename for edition | * '':e'' filename : Open filename for edition |
* '':w'' : Save file | * '':w'' : Save file |
* '':q'' : Exit Vim | * '':q'' : Exit Vim |
* '':q!'' : Quit without saving | * '':q!'' : Quit without saving |
* '':x'' : Write file (if changes has been made) and exit | * ''%%:x%%'' : Write file (if changes has been made) and exit |
* '':sav'' filename : Saves file as filename | * '':sav'' filename : Saves file as filename |
* ''.'' : Repeats the last change made in normal mode | * ''.'' : Repeats the last change made in normal mode |
* ''5.'' : Repeats 5 times the last change made in normal mode | * ''5.'' : Repeats 5 times the last change made in normal mode |
| |
==Plugins/extensiones/personalización | |
<callout type="warning" title="Pendiente: modificación status line" icon="true">https://kadekillary.work/post/statusline/</callout> | |
==Moving in the file | ==Moving in the file |
* ''0'' : move the cursor to the begining of the line | * ''0'' : move the cursor to the begining of the line |
* ''gg'' : move the cursor to the begining of the file | * ''gg'' : move the cursor to the begining of the file |
* '':59'' : move cursor to line 59. Replace 59 by the desired line number. | * '':59'' : move cursor to line 59. Replace 59 by the desired line number. |
| |
* ''k or Up Arrow'' : move the cursor up one line | * ''k or Up Arrow'' : move the cursor up one line |
* ''j or Down Arrow'' : move the cursor down one line | * ''j or Down Arrow'' : move the cursor down one line |
* Rango: | * Rango: |
* ''%'' : de la primera a la última línea | * ''%'' : de la primera a la última línea |
* ''1-3'' : de la línea 1 a 3 | * ''1,3'' : de la línea 1 a 3 |
* ''3-$'' : de la línea 3 al final de fichero | * ''3,$'' : de la línea 3 al final de fichero |
* Flags: | * Flags: |
* ''g'' : global (en el ámbito, todas las sustituciones posibles) | * ''g'' : global (en el ámbito, todas las sustituciones posibles) |
* '':%s/^\(.*\)\n\1$/\1/'' : Delete lines which appears twice | * '':%s/^\(.*\)\n\1$/\1/'' : Delete lines which appears twice |
* '':g/string/d'' : Delete all lines containing string | * '':g/string/d'' : Delete all lines containing string |
| * ''g/^$/d'' : borra líneas en blanco -> ''v/./d'' |
| * ''g/^\s*$/d'' : borra líneas en blanco o con espacios/tabuladores |
| * más ejemplos: [[https://vim.fandom.com/wiki/Power_of_g]] |
* '':v/string/d'' : Delete all lines containing which didn’t contain string | * '':v/string/d'' : Delete all lines containing which didn’t contain string |
| |
* ''Ctrl+x'' : Decrement number under cursor | * ''Ctrl+x'' : Decrement number under cursor |
* ''ggVGg?'' : Change text to Rot13 | * ''ggVGg?'' : Change text to Rot13 |
| |
| |
==Case | ==Case |
* '':e .'' : Open integrated file explorer | * '':e .'' : Open integrated file explorer |
* '':Sex'' : Split window and open integrated file explorer | * '':Sex'' : Split window and open integrated file explorer |
* '':Sex!'' : Same as | * '':Sex!'' : Same as ''Sex'' but split window vertically |
* '':Sex'' but split window vertically | |
* '':browse e'' : Graphical file explorer | * '':browse e'' : Graphical file explorer |
* '':ls'' : List buffers | * '':ls'' : List buffers |
| |
== cifrado | == cifrado |
* '':X'' : pregunta por contraseña para cifrar el fichero a la hora de guardar | * ''%%:X%%'' : pregunta por contraseña para cifrar el fichero a la hora de guardar |
* '':setlocal cm?'' : show encryption method for the current file (cm abreviación de cryptmethod | * '':setlocal cm?'' : show encryption method for the current file (cm abreviación de cryptmethod |
* '':setlocal cm=zip'' : weak (default for backwards-compatibility) | * '':setlocal cm=zip'' : weak (default for backwards-compatibility) |
* ''set pastetoggle=<F2>'' | * ''set pastetoggle=<F2>'' |
* <code vim .vimrc>nnoremap <F2> :set invpaste paste?<CR> | * <code vim .vimrc>nnoremap <F2> :set invpaste paste?<CR> |
| * ''set (no)list'' : visualiza caracteres "ocultos" según establecido |
| * '': set listchars=space:·,eol:$,tab:>-,trail:~,extends:>,precedes:<'' [lcs] |
| * '': help listchars'' [lcs] |
set pastetoggle=<F2> | set pastetoggle=<F2> |
set showmode</code> | set showmode</code |
| |
=== otros | === otros |