Skip to content

Instantly share code, notes, and snippets.

View daiyanze's full-sized avatar
💁
"artificial" stuff makes sense

Yanze Dai daiyanze

💁
"artificial" stuff makes sense
View GitHub Profile
@daiyanze
daiyanze / gist:7b323565d49e1b1c1efe0d7c0e414569
Created November 2, 2023 02:13 — forked from RRethy/gist:ad8a9a3b1112a48226ec3336fa981224
Seamlessly editing remote files in (Neo)Vim with Netrw and scp

Seamlessly editing remote files in (Neo)Vim with Netrw and scp

Neovim and Vim both come bundled with a standard plugin called Netrw. Netrw acts a file explorer (similar to NERDTree), but more importantly has the ability to work with scp (as well as sftp, rcp, ftp, and lots of others :h netrw-nread) to let you edit files and browse directories that are hosted on a remote machine, inside of your local Vim instance.

This is useful since you are able to use your Vim setup and plugins without copying over your dotfiles to the remote machine. As well, since the file is copied to your local machine, there will be no delay when typing.

Setup

This is optional for Vim, but required for Neovim (check this Neovim issue explaining why).

{ a: 2, b: 3, c: 5, d: 7, e: 11, f: 13, g: 17, h: 19, i: 23, j: 29, k: 31, l: 37, m: 41, n: 43, o: 47, p: 53, q: 59, r: 61, s: 67, t: 71, u: 73, v: 79, w: 83, x: 89, y: 97, z: 101 }
@daiyanze
daiyanze / gist:3ed19bf57e153ec2e30de63a2944bc0a
Created November 6, 2019 07:00
Git: go back to the status 10 minutes ago
git reset --hard master@{"10 minutes ago"}
@daiyanze
daiyanze / .git-commit-template.txt
Created July 11, 2019 02:35 — forked from adeekshith/.git-commit-template.txt
This commit message template helps you write great commit messages and enforce it across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@daiyanze
daiyanze / git_display_latest_commit.sh
Created October 2, 2018 09:14
git: 打印最新的commit
git show --summary
# or
git log -1
@daiyanze
daiyanze / bash_linux_commands.md
Last active September 28, 2018 01:11
Useful and common Bash Linux commands

cat

Display file’s contents to the standard output device

cat [options] [file ...]

-n : Number all output lines

cd Change to directory

cd [options] [dir]

@daiyanze
daiyanze / lsof_port.sh
Created August 1, 2018 07:01
在mac上显示端口所占用的程序ID
lsof -t -i :3000
@daiyanze
daiyanze / mac_memory.sh
Created July 2, 2018 02:59
在terminal里显示Mac的内存信息
vm_stat | perl -ne '/page size of (\d+)/ and $size=$1; /Pages\s+([^:]+)[^\d]+(\d+)/ and printf("%-16s % 16.2f Mi\n", "$1:", $2 * $size / 1048576);'
@daiyanze
daiyanze / git_checkout_prevous_branch.sh
Created June 21, 2018 05:46
git切换到之前一个分支
git checkout @{-1}
# or
git checkout -