Skip to content

Text Editor

Lưu Cao Hoàng edited this page Nov 30, 2025 · 3 revisions

nano

image
  • every linux have nano, if not install yet (very rare), usually in distroless docker image

Install

sudo apt-get install nano

Command

  • Create new file without touch
nano hehe.txt
  • Create a file name hihi.txt with some text
echo "first line" > hihi.txt
  • Append a text to end of file
# Redirection operator
echo "first line" >> hihi.txt
  • Cut/Delete a line
Ctrl + K
  • Copy, paste selected line
Ctrl + 6 #Mark set
Alt  + 6  #Copy selected
Ctrl + U #Paste
  • Moving a line
Ctrl + K
Ctrl + U

vim, neovim, lazyVim

Install neovim aka nvim (https://neovim.io/doc/install/)

# Pre-built archives
# The Releases page provides pre-built binaries for Linux systems.

curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz
sudo rm -rf /opt/nvim-linux-x86_64
sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz
  • Then add this to your shell config (~/.bashrc, ~/.zshrc, …):
export PATH="$PATH:/opt/nvim-linux-x86_64/bin"
image
  • Bug:
Error detected while processing User Autocommands for "VeryLazy":
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
sudo apt install build-essential
  • Vim has 3 modes: Normal, Insert, Visual

  • Default Nvim/Vim start with Normal Mode, we switch to Insert Mode by type any text on keyboard one time, vice versa we need to type Esc keyboard

  • Visual Mode is used to select text, we can switch to Visual Mode by type v on keyboard

  • https://www.tutorialspoint.com/vim/vim_navigating.htm

Normal Mode

1. Basic Navigation

  • h and l (Move the current cursor to left or right one position)
  • j and k (Move the current cursor to down or up one position)

2. Move line

  • Alt + j (Move the current line down)

  • Alt + k (Move the current line up)

  • dd: delete one line

  • u: undo ~ Ctrl + Z

  • :bprev

  • :bnext

Kate

Clone this wiki locally