| Ambdós costats versió prèvia Revisió prèvia Següent revisió | Revisió prèvia |
| linux:vim:comandos [14/10/2018 03:23] – [Basics] mate | linux:vim:comandos [07/11/2020 14:25] (actual) – [Basics] admin |
|---|
| == info | == info |
| * [[linux:vim:vimrc]] | * [[linux:vim:vimrc]] |
| | * [[linux:vim:mlechon1aldia]] |
| |
| |
| </code> | </code> |
| |
| ==Basics | == 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 |
| | |
| | == more Basics |
| * '':e'' filename : Open filename for edition | * '':e'' filename : Open filename for edition |
| * '':w'' : Save file | * '':w'' : Save file |
| * ''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 |
| * '':%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 |
| |
| == 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) |