Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Latest commit

 

History

History
144 lines (92 loc) · 4.06 KB

lecture08-vim-sublime-tmux.md

File metadata and controls

144 lines (92 loc) · 4.06 KB

lecture8

Vim, Sublime, & Tmux

Below, I have listed examples of the many common commands and use cases for Vim, Sublime Text, and Tmux.

Vim

Opening and closing files

To open a file in vim, just type

vim <filename>

To save and exit files, you must be in command mode (click esc). You must type the : before each of the lettered commands.

  • :q    exit editor
  • :w    save changes
  • :wq  save changes and exit editor
  • :q!    force quit editor without saving changes

Moving through the text

  • h   move the cursor to the left
  • l    move it to the right
  • k   move up
  • j    move down
  • or use the arrow keys

- **^**    move the cursor to the begnning of the line - **$**    move the cursor to the end of the line - **gg**  move the cursor to the beginning of file - **G**    move the cursor to the end of the file

Get into Insert Mode

  • This will allow you to type and make changes just like you would in gedit or similar
  • i   insert mode

To exit editing mode, press ESC key.

Editing Text in Command Mode (The Basics)

  • dd      will delete current line
  • n dd   will delete n lines including and below current line
  • dw   will delete the word to the right of the cursor
  • n dw      will delete n words to the right of the cursor
  • x         will delete letter highlighted by the cursor
  • :n        go to the nth line in the file.

Sublime Text

Navigate Menus

Ctrl+Shift+P

Navigate Files

Ctrl+P

Finding Functions in Files

Ctrl+P @

Package Control

Package control lets you install plugins for Sublime on the fly. You can install it by going to https://sublime.wbond.net/installation.

Ctrl+Shift+P "Package Control"

After selecting "Install Package," you type the name of the package you want to install, and click enter.

Multiple Cursors

Multiple Cursors are incredibly useful. Naturally, they let you select multiple blocks of text and type at the same time.

There are two ways to get multiple cursors.

  • Selecting text and hitting Ctrl+D

  • Selecting lines and hitting Ctrl+Shift+L

Tmux

Running Tmux

# to open a new tmux session
tmux

# list all tmux sessions
tmux ls

# attach to a tmux session
tmux a -t <number>				# tmux a -t 2

Common Commands

# enter tmux command mode
Control+B

# detach from tmux
Control+B, d

# rename pane
Control+B, :rename <name>		# :rename testing

Panes & Windows

# vertical split panes
Control+B, %

# horizontal split panes
Control+B, “

# switch between panes
Control+B, <Left, Right, Up, or Down>

# new window
Control+B, c

# switch between windows
Control+B, n

Here is a great example of using multiple Tmux panes.