|
|
| | | |
| :%s/\t/ /g | | :%s/\t/ /g |
| t | | t | |
| | | |
| vimdiff or hg merge | | vimdiff or hg merge |
| ----------------------- | | ----------------------- |
|
|
| set expandtab | | set expandtab |
| | | |
| t | | t | how to set replace all tabs with a space |
| | | ----------------------------------------- |
| | | |
| | | .. code-block:: vim |
| | | |
| | | :%s/\t/ /g |
| vimdiff or hg merge | | vimdiff or hg merge |
| ----------------------- | | ----------------------- |
|
|
| ----------------------------------------- | | ----------------------------------------- |
| | | |
| n | | n | Add the following into your .vimrc file: |
| | | |
| .. code-block:: vim | | .. code-block:: vim |
| | | |
| t | set ts=4 | t | set tabstop=4 |
| | | set shiftwidth=4 |
| | | set expandtab |
| | | |
| vimdiff or hg merge | | vimdiff or hg merge |
|
|
| As I learn more about vim, I plan to document the tips and tricks I learn here. | | As I learn more about vim, I plan to document the tips and tricks I learn here. |
| | | |
| t | | t | |
| | | how to set tab to 4 spaces in vim |
| | | ----------------------------------------- |
| | | |
| | | .. code-block:: vim |
| | | |
| | | set ts=4 |
| | | |
| vimdiff or hg merge | | vimdiff or hg merge |
|
|
| switch windows | | switch windows |
| | | |
| n | | n | | |
| | | |
| do | | do |
| diff obtain, take the other window's differences. Pull the change. | | diff obtain, take the other window's differences. Pull the change. |
| n | | n | |
| | | | |
| | | |
| dp | | dp |
| diff put, give the other window our differences. Push the change. | | diff put, give the other window our differences. Push the change. |
| | | |
| n | | n | | |
| | | |
| [c | | [c |
| move focus to previous difference. | | move focus to previous difference. |
| n | | n | |
| | | | |
| | | |
| ]c | | ]c |
| move focus to next difference. | | move focus to next difference. |
| | | |
| n | | n | | |
| | | |
| :diffupdate | | :diffupdate |
| diff update | | diff update |
| n | | n | |
| | | | |
| | | |
| :diffget <window number> | | :diffget <window number> |
| get changes from specified window number and place them into current window. | | get changes from specified window number and place them into current window. |
| | | |
| n | | n | | |
| | | |
| :diffput <window number> | | :diffput <window number> |
| put changes from current window into specified window number. | | put changes from current window into specified window number. |
| n | | n | |
| | | | |
| | | |
| zo | | zo |
| open folded text | | open folded text |
| | | |
| n | | n | | |
| | | |
| zc | | zc |
| close folded text | | close folded text |
| t | | t | |
| | | | |
|
|
| ----------------------- | | ----------------------- |
| | | |
| n | Some common commands: | n | This is a list of some common commands when using vimdiff: |
| | | |
| n | .. code-block:: none | n | |
| | | |
| ctrl w (twice) | | ctrl w (twice) |
| | | |
| switch windows | | switch windows |
| | | |
| n | do | n | do |
| | | diff obtain, take the other window's differences. Pull the change. |
| | | |
| n | | n | dp |
| diff obtain, take the other window's differences. Pull the change. | | diff put, give the other window our differences. Push the change. |
| | | |
| n | dp | n | [c |
| | | move focus to previous difference. |
| | | |
| n | diff put, give the other window our differences. Push the change. | n | ]c |
| | | move focus to next difference. |
| | | |
| n | [c | n | :diffupdate |
| | | diff update |
| move focus to previous difference. | | |
| | | |
| n | ]c | n | :diffget <window number> |
| | | get changes from specified window number and place them into current window. |
| move focus to next difference. | | |
| | | |
| n | :diffupdate | n | :diffput <window number> |
| | | put changes from current window into specified window number. |
| diff update | | |
| | | |
| n | | n | zo |
| | | open folded text |
| | | |
| t | :diffget <window number> | t | |
| | | |
| get changes from specified window number and place them into current window. | | |
| | | |
| | | |
| :diffput <window number> | | |
| | | |
| put changes from current window into specified window number. | | |
| | | |
| | | |
| zo | | |
| | | |
| open folded text | | |
| | | |
| zc | | zc |
| | | |
| close folded text | | close folded text |
|
|
| Some common commands: | | Some common commands: |
| | | |
| n | .. code-block:: python | n | .. code-block:: none |
| | | |
| n | ctrl w | n | ctrl w (twice) |
| | | |
| switch windows | | switch windows |
| diff update | | diff update |
| | | |
| n | | n | |
| :diffget <window number> | | :diffget <window number> |
| | | |
| get changes from specified window number and place them into current window. | | get changes from specified window number and place them into current window. |
| | | |
| n | | n | |
| :diffput <window number> | | :diffput <window number> |
| | | |
| put changes from current window into specified window number. | | put changes from current window into specified window number. |
| t | | t | |
| | | |
| zo | | zo |
|
|
| Some common commands: | | Some common commands: |
| | | |
| n | **ctrl w** | n | .. code-block:: python |
| | | |
| | | ctrl w |
| | | |
| switch windows | | switch windows |
| | | |
| n | **do** | n | do |
| | | |
| diff obtain, take the other window's differences. Pull the change. | | diff obtain, take the other window's differences. Pull the change. |
| | | |
| n | **dp** | n | dp |
| | | |
| diff put, give the other window our differences. Push the change. | | diff put, give the other window our differences. Push the change. |
| | | |
| n | **[c** | n | [c |
| | | |
| move focus to previous difference. | | move focus to previous difference. |
| | | |
| n | **]c** | n | ]c |
| | | |
| move focus to next difference. | | move focus to next difference. |
| | | |
| n | **:diffupdate** | n | :diffupdate |
| | | |
| diff update | | diff update |
| | | |
| n | **:diffget <window number>** | n | :diffget <window number> |
| | | |
| get changes from specified window number and place them into current window. | | get changes from specified window number and place them into current window. |
| | | |
| n | **diffput <window number>** | n | :diffput <window number> |
| | | |
| put changes from current window into specified window number. | | put changes from current window into specified window number. |
| | | |
| n | **zo** | n | zo |
| | | |
| open folded text | | open folded text |
| | | |
| t | **zc** | t | zc |
| | | |
| close folded text | | close folded text |
|
|
| Some common commands: | | Some common commands: |
| | | |
| n | **ctrl w** | n | **ctrl w** |
| | | |
| switch windows | | switch windows |
| | | |
| **do** | | **do** |
| n | | n | |
| diff obtain, take the other window's differences. Pull the change. | | diff obtain, take the other window's differences. Pull the change. |
| | | |
| **dp** | | **dp** |
| n | | n | |
| diff put, give the other window our differences. Push the change. | | diff put, give the other window our differences. Push the change. |
| | | |
| n | **[c** | n | **[c** |
| | | |
| move focus to previous difference. | | move focus to previous difference. |
| | | |
| n | **]c** | n | **]c** |
| | | |
| move focus to next difference. | | move focus to next difference. |
| | | |
| n | **:diffupdate** | n | **:diffupdate** |
| | | |
| diff update | | diff update |
| | | |
| n | | n | **:diffget <window number>** |
| | | |
| | | get changes from specified window number and place them into current window. |
| | | |
| | | **diffput <window number>** |
| | | |
| | | put changes from current window into specified window number. |
| | | |
| **zo** | | **zo** |
| n | | n | |
| open folded text | | open folded text |
| | | |
| **zc** | | **zc** |
| t | | t | |
| close folded text | | close folded text |
|
|
| t | | t | Vim Tips and Tricks |
| | | ======================== |
| | | |
| | | .. contents:: |
| | | |
| | | As I learn more about vim, I plan to document the tips and tricks I learn here. |
| | | |
| | | |
| | | vimdiff or hg merge |
| | | ----------------------- |
| | | |
| | | Some common commands: |
| | | |
| | | **ctrl w** |
| | | switch windows |
| | | |
| | | **do** |
| | | diff obtain, take the other window's differences. Pull the change. |
| | | |
| | | **dp** |
| | | diff put, give the other window our differences. Push the change. |
| | | |
| | | **[c** |
| | | move focus to previous difference. |
| | | |
| | | **]c** |
| | | move focus to next difference. |
| | | |
| | | **:diffupdate** |
| | | diff update |
| | | |
| | | **zo** |
| | | open folded text |
| | | |
| | | **zc** |
| | | close folded text |