Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
systemverwaltung:user_info:vim [2016/03/16 08:57]
admin
systemverwaltung:user_info:vim [2021/12/02 11:27] (aktuell)
Zeile 3: Zeile 3:
 "vim" is a great editor. It started out as another vi-clone but has become the most enhanced version of vi on the planet. "vim" is a great editor. It started out as another vi-clone but has become the most enhanced version of vi on the planet.
  
-Here are some tips:+Here are some tips from https://box.matto.nl/vimtips.html :
  
   *     [[#Splitting windows]]   *     [[#Splitting windows]]
-  *     Pasting indented text +  *     [[#Pasting indented text]] 
-  *     Selecting blocks +  *     [[#Selecting blocks]] 
-  *     Showing all your bookmarks +  *     [[#Showing all your bookmarks]] 
-  *     Sort an part of your file in vim +  *     [[#Sort an part of your file in vim]] 
-  *     Jump to the last insert position +  *     [[#Jump to the last insert position]] 
-  *     Open a filebrowser +  *     [[#Open a filebrowser]] 
-  *     Edit your last shell command +  *     [[#Edit your last shell command]] 
-  *     Show word-count +  *     [[#Show word-count]] 
-  *     Mapping for opening companion include file +  *     [[#Mapping for opening companion include file]] 
-  *     Other sites+  *     [[#Other sites]]
  
 ===== Splitting windows ===== ===== Splitting windows =====
Zeile 22: Zeile 22:
 Open more then one file at the same time and edit them both. First, split the screen and open a second file: Open more then one file at the same time and edit them both. First, split the screen and open a second file:
  
-:split second_file_name+   :split second_file_name
  
 Now you have a screen splitted into two areas, one holding the first file and one holding the second file. Now you have a screen splitted into two areas, one holding the first file and one holding the second file.
Zeile 28: Zeile 28:
 Moving from one window to the next Moving from one window to the next
  
-Ctrl-w Ctrl-w: rotate through the windows +Ctrl-w Ctrl-w: rotate through the windows\\ 
-Ctrl-w space: rotate through the windows +Ctrl-w space: rotate through the windows\\ 
-Ctrl-w j: go to window downwards +Ctrl-w j: go to window downwards\\ 
-Ctrl-w k: go to window upwards +Ctrl-w k: go to window upwards\\ 
-Ctrl-w _: maximize current window +Ctrl-w _: maximize current window\\ 
-Ctrl-w =: make all windows same size+Ctrl-w =: make all windows same size\\
  
 ===== Pasting indented text ===== ===== Pasting indented text =====
Zeile 40: Zeile 40:
 When vim is autoindenting the results of pasting some text can be quite horrible. There is a simpel solution for this: When vim is autoindenting the results of pasting some text can be quite horrible. There is a simpel solution for this:
  
 +<code vi>
 :set paste :set paste
 < some pasting here > < some pasting here >
 :set nopaste :set nopaste
 +</code>
  
 That is all! That is all!
Zeile 54: Zeile 56:
 To select a block between ( and ) do: To select a block between ( and ) do:
  
-vab+   vab
  
 and to select a block between { and } do: and to select a block between { and } do:
  
-vaB+   vaB
  
 ===== Showing all your bookmarks ===== ===== Showing all your bookmarks =====
Zeile 67: Zeile 69:
 You can easy set bookmarks in your text with the command: m<label> where label is a character. Example: You can easy set bookmarks in your text with the command: m<label> where label is a character. Example:
  
-ma+   ma
  
 This sets the mark "a". This sets the mark "a".
 From anywhere in your file you can jump to this mark with single-quote-<label>. In the example above the label is "a", so you can jump to this mark with: From anywhere in your file you can jump to this mark with single-quote-<label>. In the example above the label is "a", so you can jump to this mark with:
  
-'a+   'a
  
 Doing stuff until the next mark Doing stuff until the next mark
Zeile 78: Zeile 80:
 Marks are not only great to find stuff in your file, you can also use them as a boundary when doing stuff over multiple lines. Example: Marks are not only great to find stuff in your file, you can also use them as a boundary when doing stuff over multiple lines. Example:
  
-.,'as/^/> /+   .,'as/^/> /
  
 This stands for: This stands for:
Zeile 92: Zeile 94:
 Say you mark the beginning of the area with a and the end with b. Now we can do stuff like: Say you mark the beginning of the area with a and the end with b. Now we can do stuff like:
  
-    delete area+delete area
  
     :'a,'b d     :'a,'b d
  
-    write area to a new file+write area to a new file
  
     :'a,'b w <filename>     :'a,'b w <filename>
  
-    substitute only in this area+substitute only in this area
  
     :'a,'b s/this/that/g     :'a,'b s/this/that/g
Zeile 111: Zeile 113:
 You can ask vim to show a list of all your marks (and some marks it made on its own) with the command: You can ask vim to show a list of all your marks (and some marks it made on its own) with the command:
  
-:marks+   :marks
  
 If you are only intested in what is under mark f, you can ask vim also: If you are only intested in what is under mark f, you can ask vim also:
  
-:marks f+   :marks f 
 + 
 +===== Sort an part of your file in vim =====
  
-Sort an part of your file in vim 
  
 Go to the beginning of the area you want to sort. Go to the beginning of the area you want to sort.
Zeile 127: Zeile 130:
 Hit Hit
  
- :sort+   :sort
  
 Et voila: the area is sorted alphabetical (well, ASCII-betical). Et voila: the area is sorted alphabetical (well, ASCII-betical).
  
-Jump to the last insert position+===== Jump to the last insert position =====
  
-Hit gi in normal mode will jump to the last position where you were in insert mode.+ 
 +Hit ''gi'' in normal mode will jump to the last position where you were in insert mode.
  
 ===== Open a filebrowser ===== ===== Open a filebrowser =====
Zeile 140: Zeile 144:
 Open a filebrowser with Open a filebrowser with
  
- :E+  :E
  
 ===== Edit your last shell command ===== ===== Edit your last shell command =====
Zeile 147: Zeile 151:
 In your bash-shell, hit In your bash-shell, hit
  
- fc+  fc
  
  
Zeile 157: Zeile 161:
 Some information of your current buffer is shown when entering the command Some information of your current buffer is shown when entering the command
  
-g Ctrl-g+  g Ctrl-g
  
 This includes the word-count This includes the word-count
Zeile 165: Zeile 169:
 When editing a file named foo.c this mapping will open a new window with file foo.h: When editing a file named foo.c this mapping will open a new window with file foo.h:
  
-map <C-h> :new %:p:r.h+  map <C-h> :new %:p:r.h
  
-Put this line in your .vimrc. Then, open a file foo.c and hit Ctrl-h.+Put this line in your ''.vimr''c. Then, open a file ''foo.c'' and hit Ctrl-h.
  
 (more to follow) (more to follow)
Zeile 175: Zeile 179:
  
 Vim 101: A Beginner's Guide to Vim http://ldn.linuxfoundation.org/article/vim-101-a-beginners-guide-vim Vim 101: A Beginner's Guide to Vim http://ldn.linuxfoundation.org/article/vim-101-a-beginners-guide-vim
 +
 Vim 201: An Intermediate Guide to Vim http://ldn.linuxfoundation.org/article/vim-201-an-intermediate-guide-vim-1 Vim 201: An Intermediate Guide to Vim http://ldn.linuxfoundation.org/article/vim-201-an-intermediate-guide-vim-1
  
 Last updated: $Date: 2010-01-29 10:55:32 Last updated: $Date: 2010-01-29 10:55:32
  
-From: https://box.matto.nl/vimtips.html+===== vim und LaTeX ===== 
 + 
 +LaTeX

QR-Code
QR-Code systemverwaltung:user_info:vim (erstellt für aktuelle Seite)