Vi: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
= | = Add to end of the line = | ||
<pre> | |||
A | |||
</pre> | |||
Also works with multiple visually selected lines! | |||
=copy selection to command line= | =copy selection to command line= | ||
Line 141: | Line 138: | ||
:find asdf | :find asdf | ||
</pre> | </pre> | ||
=links= | |||
*[http://www.atmos.albany.edu/deas/atmclasses/atm350/vi_cheat_sheet.pdf Cheat Sheet] | |||
*[https://www.cs.oberlin.edu/~kuperman/help/vim/home.html vim tips and tricks] | |||
*[http://learnvimscriptthehardway.stevelosh.com Learn vimscript the hard way] | |||
*https://devhints.io/vimscript-functions | |||
*[https://vim.fandom.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_1) key mappings tutorial] | |||
*https://wikimatze.de/vimtex-the-perfect-tool-for-working-with-tex-and-vim/ | |||
*https://jdhao.github.io/2019/04/29/nvim_spell_check/ | |||
*https://en.wikibooks.org/wiki/Learning_the_vi_Editor/Vim |
Latest revision as of 17:29, 20 February 2023
Add to end of the line
A
Also works with multiple visually selected lines!
copy selection to command line
https://stackoverflow.com/questions/3997078/how-to-paste-yanked-text-into-the-vim-command-line
Ctrl+R " / buffername
movement
Q # Ex-Mode e # move to the end of a word gi # restart insert mode at the previous positition s3 # substitue the next three characters ci] # change until the closing square bracket vi) # visually mark everything till the next parentesis "ky # save marked part in register k "Ky # append marked part to register k (use capital letter) f # move forward to the next occurence of a character F # move forward to the next occurence of a character q: # show list of commands q\ # show list of past searches
buffers
:buffers :MBEToggle # ,t :b1 # jump to first buffer :1bd # close first buffer
neovim
- https://jdhao.github.io/2019/03/26/nvim_latex_write_preview/
- https://castel.dev/post/lecture-notes-1/
alias vi=nvim
Config is located at ~/.config/nvim
Update plugins
:PlugUpdate
.vimrc
lrwxrwxrwx 1 homaar homaar 17 Nov 4 04:14 .vimrc -> c_praktikum/vimrc
Help
helpg 'pattern' :set [no]nu - Zeilennummerierung :set autoindent - Automatischer formatierter Zeilenumbruch follow links: CTRL+] (forward) CTRL+T (back)
Split Windows
STRG-W n
Move between Windows
STRG-W hjkl
Header Link folgen
gf Strg-O springt zurück
Visual Mode
V - markiert ganze Zeile v - markiert einzelne Zeichen > - Einrücken (:set sw=...) . - letzte Aktion wiederholen
search highlighted text
Visually select the text you want to search.
y q / p Enter
q/ works similarly to vanilla search / except you're in command mode so p actually does "paste" instead of typing the character p. So the above will yank the characters you're searching for, then paste them into a search.
(see :help q/)
ganze Textbereiche ein- oder auskommentieren
STRG+V drücken, dies aktiviert den Blockmodus (im Status erscheint: – VISUAL BLOCK –) Mit shift+i (großes I) in den Eingabemodus wechseln und das gewünschte Kommentarzeichen (#, / / ) eingeben. ESC z
forgotten sudo
:w !sudo tee %
text selection
vi' #"select inner single quotes" vib # "select inner block" viB # "capital B" :help text-objects
variable scoping
s... The variable is local to the current script file a... The variable is a parameter of the current function
see https://www.gilesorr.com/blog/vim-variable-scope.html
how to document
:help help-writing
write key mappings to a file
:redir! > vim_keys.txt :silent verbose map :redir END
add current folder to path
set path+=** # now files are findable in subfolders :find asdf
links
- Cheat Sheet
- vim tips and tricks
- Learn vimscript the hard way
- https://devhints.io/vimscript-functions
- key mappings tutorial
- https://wikimatze.de/vimtex-the-perfect-tool-for-working-with-tex-and-vim/
- https://jdhao.github.io/2019/04/29/nvim_spell_check/
- https://en.wikibooks.org/wiki/Learning_the_vi_Editor/Vim