Poprzednia rewizja po obu stronach Poprzednia wersja Nowa wersja | Poprzednia wersja |
linux:vim [2014/11/02 20:21] – [Tworzenie makr] flamenco | linux:vim [2022/05/22 10:38] (aktualna) – edycja zewnętrzna 127.0.0.1 |
---|
| |
Polecam rewelacyjny [[http://www.openvim.com/tutorial.html|VIM Tutorial]]. | Polecam rewelacyjny [[http://www.openvim.com/tutorial.html|VIM Tutorial]]. |
===== Czyt Szyt komend Vim ====== | |
| |
---- | ---- |
| |
| ===== Czyt Szyt komend Vim ====== |
| |
| ==== Zaznaczanie kolumny ==== |
| |
| W skrócie: |
| CTRL+V → <Down>→<Down>→<Down>→<Down> → c → napisz → <ESC><ESC> |
| |
| * Wejdź w tryb NORMALNY |
| * Połóż kursor na początek tekstu do zaznaczenia |
| * Naciśnij ''CTRL-V'' i kieruj kursor w dół zaznaczenia |
| * Po zaznaczeniu wszystkich linijek naciśnij ''c'' |
| * Wpisz nowy tekst. Nie bój, że widać tylko w pierwszej linijce! |
| * Uderz ''<ESC><ESC>''. Cały tekst się zmienił!!! |
==== Jak wyjść z Vima ===== | ==== Jak wyjść z Vima ===== |
| |
| :q[uit] | Zakończ Vim. //Nie// zadziała, jeżeli zostały wprowadzone zmiany. | | | :q[uit] | Zakończ Vim. Nie zadziała, jeżeli zostały wprowadzone zmiany. | |
| :q[uit]! | Wymuś zakończenie. Zakończ bez zapisywania zmian. | | | :q[uit]! | Wymuś zakończenie. Zakończ bez zapisywania zmian. | |
| :cq[uit] | Zawsze zakończ bez wprowadzania zmian. | | | :cq[uit] | Zawsze zakończ bez wprowadzania zmian. | |
| D | Skasuj znaki począwszy od tego POD kursorem DO KOŃCA LINII | | | D | Skasuj znaki począwszy od tego POD kursorem DO KOŃCA LINII | |
| {Visual}x lub\\ {Visual}d | Skasuj podświetlony tekst (w trybie WIZUALNYM), patrz-> [[#select|Zaznaczanie tekstu]]). | | | {Visual}x lub\\ {Visual}d | Skasuj podświetlony tekst (w trybie WIZUALNYM), patrz-> [[#select|Zaznaczanie tekstu]]). | |
/*| {Visual}CTRL-H lub\\ {Visual} | W trybie WIZUALNYM When in Select mode: Delete the highlighted text |*/ | /* | {Visual}CTRL-H lub\\ {Visual} | W trybie WIZUALNYM When in Select mode: Delete the highlighted text | */ |
| {Visual}X lub\\ {Visual}D | Skasuj podświetlone linie. | | | {Visual}X lub\\ {Visual}D | Skasuj podświetlone linie. | |
| :[range]d[elete] | Skasuj linię nr [range] (domyślnie: bieżąca linia) | | | :[range]d[elete] | Skasuj linię nr [range] (domyślnie: bieżąca linia) | |
==== Kopiowanie i przesuwanie tekstu ===== | ==== Kopiowanie i przesuwanie tekstu ===== |
| |
| "{a-zA-Z0-9.%#:-"} | Użyj rejestru {a-zA-Z0-9.%#:-"} dla następnego kasowania, kopiowania lub wklejania /*(użyj wielkich liter) (use uppercase character to append with delete and yank) ({.%#:} only work with put)*/. | | | "{a-zA-Z0-9.%#:-"} | Użyj rejestru {a-zA-Z0-9.%#:-"} dla następnego kasowania, kopiowania lub wklejania /* (użyj wielkich liter) (use uppercase character to append with delete and yank) ({.%#:} only work with put) */. | |
| :reg[isters] | Wyświetl zawartość wszystkich ponumerowanych i nazwanych rejestrów. | | | :reg[isters] | Wyświetl zawartość wszystkich ponumerowanych i nazwanych rejestrów. | |
| :reg[isters] {arg} | Wyświetl zawartość ponumerowanych i nazwanych rejestrów wymienionych w {arg}. | | | :reg[isters] {arg} | Wyświetl zawartość ponumerowanych i nazwanych rejestrów wymienionych w {arg}. | |
| :di[splay] [arg] | Tak samo jak '':registers''. | | | :di[splay] [arg] | Tak samo jak '':reg''. | |
| ["x]y{motion} | Yank {motion} text [into register x]. | | | [x]y{motion} | Skopiuj tekst z linii bieżącej i nast. wskazanej przez {motion} do rejestru //x//. | |
| ["x]yy | Yank [count] lines [into register x] | | /* | [x]yy | Skopiuj [count] lines [into register x] | */ |
| ["x]Y | yank [count] lines [into register x] (synonym for yy). | | | [x]y[count] | Skopiuj [count] linii + bieżąca (do rejestru //x// jeśli wpisany). |
| {Visual}["x]y | Yank the highlighted text [into register x] (for {Visual} see [[#select|Selecting Text]]). | | /* | [x]Y | yank [count] lines [into register x] (synonym for yy). | */ |
| {Visual}["x]Y | Yank the highlighted lines [into register x] | | | {Visual}[x]y | Skopiuj podświetlony tekst [do rejestru //x//] (Tryb WIZUALNY {Visual} -> patrz [[#select|Zaznaczanie tekstu]]). | |
| :[range]y[ank] [x] | Yank [range] lines [into register x]. | | | {Visual}[x]Y | Skopiuj podświetlone linie (nawet jeśli nie całe podświetlone) [do rejestru //x//] | |
| :[range]y[ank] [x] {count} | Yank {count} lines, starting with last line number in [range] (default: current line), [into register x]. | | | :[range]y[ank] [x] {motion} | Skopiuj [range] linii [do rejestru x] w kierunku {motion}. | |
| ["x]p | Put the text [from register x] after the cursor [count] times. | | | :[range]y[ank] [x] {count} | Skopiuj {count} linii, poczynając od linii ostatniej w [range] (domyślnie: aktualna linia), [do rejestru x]. | |
| ["x]P | Put the text [from register x] before the cursor [count] times. | | | [x]p | Wklej tekst [z rejestru x] PO kursorze. | |
| ["x]gp | Just like "p", but leave the cursor just after the new text. | | | [x]P | Wklej tekst [z rejestru x] PRZED kursorem. | |
| ["x]gP | Just like "P", but leave the cursor just after the new text. | | | [x]gp | Jak "p", ale zostaw kursor zaraz PO wklejonym tekście. | |
| :[line]pu[t] [x] | Put the text [from register x] after [line] (default current line). | | | [x]gP | Jak "p", ale zostaw kursor zaraz PO wklejonym tekście. | |
| :[line]pu[t]! [x] | Put the text [from register x] before [line] (default current line). | | | :[line]pu[t] [x] | Wklej tekst [z rejestru x] PO linii nr [line] (domyślnie: aktualna linia). | |
| | :[line]pu[t]! [x] | Wklej tekst [z rejestru x] PRZED linią nr [line] (domyślnie: aktualna linia). | |
| |
---- | ---- |
| |
==== Undo/Redo/Repeat ===== | ==== Undo/Redo/Repeat/Cofnij/Ponów/Powtórz ===== |
| |
| u | Undo [count] changes. | | | u | Cofnij. | |
| :u[ndo] | Undo one change. | | | :u[ndo] | Cofnij jedną zmianę. | |
| CTRL-R | Redo [count] changes which were undone. | | | :u[ndo][count] | Cofnij [count] zmian. | |
| :red[o] | Redo one change which was undone. | | | CTRL-R | Ponów cofniętą zmianę. | |
| U | Undo all latest changes on one line. {Vi: while not moved off of it} | | | :red[o] | Ponów cofniętą zmianę. | |
| . | Repeat last change, with count replaced with [count]. | | | :red[o][count] | Ponów [count] cofniętych zmian. | |
| | U | Cofnij wszystkie ostatnie zmiany w danej linii. | |
| | . | Powtórz ostatnią zmianę ile razy chcesz naciskając kropkę. | |
| |
---- | ---- |
==== Moving Around ===== | ==== Moving Around ===== |
| |
Basic motion commands: | Podstawowe komendy przemieszczania kursora: |
| <code> |
k | k |
h l | h l |
j | j |
| </code> |
| h or\\ | [count] characters to the left (exclusive). | | | [count]h | [count] znaków w lewo. | |
| l or\\ or\\ | [count] characters to the right (exclusive). | | | [count]l | [count] znaków w prawo. | |
| k or\\ or\\ CTRL-P | [count] lines upward | | | [count]k lub\\ -(minus) lub\\ CTRL-P | [count] znaków w górę. | |
| j or\\ or\\ CTRL-J or\\ or\\ CTRL-N | [count] lines downward (linewise). | | | [count]j lub\\ +(plus) lub\\CTRL-J lub\\CTRL-N | [count] znaków w dół. | |
| 0 | To the first character of the line (exclusive). | | | 0 | Do pierwszego znaku w linii. | |
| <Home> | To the first character of the line (exclusive). | | | <Home> | Do pierwszego znaku w linii. | |
| ^ | To the first non-blank character of the line | | | ^ | Do pierwszej nie-spacji w linii. | |
| $ or\\ <End> | To the end of the line and [count - 1] lines downward | | | $ | Do końca linii. | |
| g0 or\\ g<Home> | When lines wrap ('wrap on): To the first character of the screen line (exclusive). Differs from "0" when a line is wider than the screen. When lines don't wrap ('wrap' off): To the leftmost character of the current line that is on the screen. Differs from "0" when the first character of the line is not on the screen. | | | g0 or\\ g<Home> | Jeżeli wiersze się zawijają, idź do pierwszego znaku w linii ekranowej. Działa inaczej niż ''0'' na ekranach różnej szerokości.Kiedy linie nie zawijają się: idź do znaku najbardziej po lewej w danej linii na ekranie. | |
| g^ | When lines wrap ('wrap' on): To the first non-blank character of the screen line (exclusive). Differs from "^" when a line is wider than the screen. When lines don't wrap ('wrap' off): To the leftmost non-blank character of the current line that is on the screen. Differs from "^" when the first non-blank character of the line is not on the screen. | | | g^ | Kiedy linie się zawijają: idź do pierwszej nie-spacji na linii ekranowej. J.w. działa inaczej niż ''^''. | |
| g$ or\\ g<End&gr; | When lines wrap ('wrap' on): To the last character of the screen line and [count - 1] screen lines downward (inclusive). Differs from "$" when a line is wider than the screen. When lines don't wrap ('wrap' off): To the rightmost character of the current line that is visible on the screen. Differs from "$" when the last character of the line is not on the screen or when a count is used. | | | g$ | Kiedy linie się zawijają: idź do ostatniego znaku w linii ekranowej. J.w. działa inaczej niż ''$'', które każe iść do końca linii tekstu. | |
| f{char} | To [count]'th occurrence of {char} to the right. The cursor is placed on {char} (inclusive). | | | f{char} | Idź w prawo do wystąpienia znaku {char}. | |
| F{char} | To the [count]'th occurrence of {char} to the left. The cursor is placed on {char} (inclusive). | | | F{char} | Idź w lewo do wystąpienia znaku {char}. | |
| t{char} | Till before [count]'th occurrence of {char} to the right. The cursor is placed on the character left of {char} (inclusive). | | | t{char} | Idź w lewo do wystąpienia znaku {char}. Kursor stanie na znaku na lewo od {char} | |
| T{char} | Till after [count]'th occurrence of {char} to the left. The cursor is placed on the character right of {char} (inclusive). | | | T{char} | Idź w lewo do wystąpienia znaku {char}. Kursor stanie na znaku na prawo od {char} | |
| ; | Repeat latest f, t, F or T [count] times. | | | ; | Powtarzaj ostatnie ''f, t, F lub T''. | |
| , | Repeat latest f, t, F or T in opposite direction [count] times. | | | , | Powtarzaj ostatnie ''f, t, F lub T'' w przeciwnym kierunku. | |
| - <minus> | [count] lines upward, on the first non-blank character (linewise). | | /* | _ <underscore> | [count] - 1 lines downward, on the first non-blank character (linewise). | */ |
| + or\\ CTRL-M or\\ <CR> | [count] lines downward, on the first non-blank character (linewise). | | | <C-End> or\\ G | Idź do ostatniej linii. | |
| _ <underscore> | [count] - 1 lines downward, on the first non-blank character (linewise). | | | <C-Home> or\\ gg | Idź do pierwszej linii. | |
| <C-End> or\\ G | Goto line [count], default last line, on the first non-blank character. | | | <S-Right> or\\ w | słowo naprzód (w prawo). Rozpoznaje znaki inne niż spacja. | |
| <C-Home> or\\ gg | Goto line [count], default first line, on the first non-blank character. | | | <C-Right> or\\ W | słowo naprzód (w prawo). Rozpoznaje tylko spacje. | |
| <S-Right> or\\ w | [count] words forward | | | e | Na koniec słowa. Wg nie tylko spacji. | |
| <C-Right> or\\ W | [count] WORDS forward | | | E | Na koniec słowa. Wg tylko spacji. | |
| e | Forward to the end of word [count] | | |
| E | Forward to the end of WORD [count] | | |
| <S-Left> or\\ b | [count] words backward | | | <S-Left> or\\ b | [count] words backward | |
| <C-Left> or\\ B | [count] WORDS backward | | | <C-Left> or\\ B | [count] WORDS backward | |
| |
Daniel Gryniewicz / [[mailto:dang@fprintf.net|dang@fprintf.net]] | Daniel Gryniewicz / [[mailto:dang@fprintf.net|dang@fprintf.net]] |
| |
| |
===== Różne czyt-szyty ===== | ===== Różne czyt-szyty ===== |
===== Pluginy do Vima ===== | ===== Pluginy do Vima ===== |
| |
* [[http://karolsamborski.blogspot.com/2011/11/vim-ciekawsze-pluginy.html|ciekawe pluginy od Krzysztofa Samborskiego (nie jego autorstwa, tylko opis]] | |
| |
| ==== vim-templates ==== |
| Bardzo fajoski. Szymele dokumentów znajdują się w katalogu ~/.vim/templates/ i mogą się nazywać jak bądź (więc nie tylko formatem, ale i innymi cechami mogą się różnić). |
| |
| Wywołanie: |
| |
| '':setf html'' czyli **:setf**SPACJA//nazwa szymelku// |
| |
| [[http://www.vim.org/scripts/script.php?script_id=1172|Źródełko]] |
| ==== VIM-LATEXSUITE ==== |
| |
| * [[http://michaelgoerz.net/refcards/vimlatexqrc.pdf|cheat sheet]] - szybkie komendy |
| * [[http://vim-latex.sourceforge.net/documentation/|PEŁNA DOKUMENTACJA]] |
| |
| LatexSuite potrafi ukryć (to fold) całe partie pliku ''.tex''. Odsłania się je tak: |
| |
| * wejść w tryb NORMALNY (np. Esc) |
| * najechać kursorem na znacznik zafoldowanej linii |
| * napisać '':za'' |
| ==== INNE ==== |
| |
| |
| * [[http://karolsamborski.blogspot.com/2011/11/vim-ciekawsze-pluginy.html|ciekawe pluginy od Krzysztofa Samborskiego (nie jego autorstwa, tylko opis]] |
===== Makra w Vimie ===== | ===== Makra w Vimie ===== |
[[http://karolsamborski.blogspot.com/2011/11/makra-w-vimie.html| z tej strony]] | [[http://karolsamborski.blogspot.com/2011/11/makra-w-vimie.html| z tej strony]] |