#我的 Vim 指令筆記
##vim 的三種模式 ###模式
輸入模式:輸入內文。指揮模式:也叫指令模式,主要是進入到可以對文件做修改,複製,剪下貼上,游標移動等動作。執行模式:文件存檔,離開等等行為。
###常用模式的切換
- 輸入模式 -> 指揮模式 : 鍵盤
Esc
| # Run the last command as root | |
| sudo !! | |
| # Serve current directory tree at http://$HOSTNAME:8000/ | |
| python -m SimpleHTTPServer | |
| # Save a file you edited in vim without the needed permissions | |
| :w !sudo tee % | |
| # change to the previous working directory | |
| cd - | |
| # Runs previous command but replacing | |
| ^foo^bar |
| /* | |
| iflist.c : retrieve network interface information thru netlink sockets | |
| (c) Jean Lorchat @ Internet Initiative Japan - Innovation Institute | |
| v1.0 : initial version - Feb 19th 2010 | |
| This file was obtained at the following address : | |
| http://www.iijlab.net/~jean/iflist.c |
| #!/usr/bin/env python | |
| #------------------------------------------------------------------------------- | |
| # Name: Get Stock Quote from TWSE | |
| # Purpose: | |
| # | |
| # Author: yangsheng | |
| # | |
| # Created: 03/15/2016 | |
| # Copyright: (c) yangsheng 2015 | |
| # Licence: <your licence> |
| # mac 安裝方式 | |
| ```bash | |
| # brew install youtube-dl | |
| # brew cask install mpv | |
| ``` |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <fcntl.h> | |
| #include <sys/wait.h> | |
| #include <sys/mman.h> | |
| // http://man7.org/tlpi/code/online/dist/mmap/anon_mmap.c | |
| //#define USE_MAP_ANON | |
| //#define USE_MAP_SHARED_WITH_OPEN |
| # | |
| # 'add' vs. 'force' | |
| # cf. http://sourceforge.net/projects/uncrustify/forums/forum/511737/topic/3066522?message=6693806 | |
| # | |
| # Uncrustify 0.60 | |
| # | |
| # General options | |
| # |
| #!/bin/bash | |
| function loop() { | |
| ## Do nothing if * doesn't match anything. | |
| ## This is needed for empty directories, otherwise | |
| ## "foo/*" expands to the literal string "foo/*"/ | |
| shopt -s nullglob | |
| ## Make ** recurse into subdirectories | |
| shopt -s globstar |
| "檢查文件的類型 | |
| filetype on | |
| syntax on | |
| " 自動縮排:啟用自動縮排以後,在貼上剪貼簿的資料時排版可能會亂掉,這時可以手動切換至貼上模式 :set paste 再進行貼上。 | |
| set ai | |
| set autoindent | |
| set cindent | |
| set smartindent |
| ## MAKEFILE V 1.3 ## | |
| BIN = a.out | |
| CC = gcc | |
| CPLUS = g++ | |
| LINK = g++ | |
| OBJC = $(shell find ./src -name "*.c" | sed 's/\.c/\.o/g' | sed 's/\.\/src\//\.\/obj\//g') | |
| OBJCPP = $(shell find ./src -name "*.cpp" | sed 's/\.cpp/\.opp/g' | sed 's/\.\/src\//\.\/obj\//g') | |
| OBJ = $(OBJC) $(OBJCPP) |
#我的 Vim 指令筆記
##vim 的三種模式 ###模式
輸入模式:輸入內文。指揮模式:也叫指令模式,主要是進入到可以對文件做修改,複製,剪下貼上,游標移動等動作。執行模式:文件存檔,離開等等行為。###常用模式的切換
Esc