- 1. COLON
- 1.1. show line numbers
- 2. Find and replace
- 2.1. replace something
- 2.2. search and delete
- 3. Verb Modifier Objects
- 3.1. delete word
- 3.2. delete word and insert
- 3.3. change the current sentence
- 3.4. change all words inside bracket
function p() {
if [[ $# -eq 0 ]]; then
hello_var=$(cat /Users/username/desktop/macbook_pro_scripts/echo_files/count_open.txt)
second=$hello_var
let second++
echo -n $second > /Users/stanleytan/desktop/macbook_pro_scripts/echo_files/count_open.txt
open "$(find . -type f -maxdepth 2 -not -path '*/\.*' | sort | head -$second | tail -1)"
echo "$(find . -type f -maxdepth 2 -not -path '*/\.*' | sort | head -$second | tail -1)"
else
function dropbox () {
if [[ $# -eq 0 ]]; then
echo 'need parameter'
echo 'dropbox_delete_screenshots_2'
else
rclone copy $@ dropbox:screenshots_macbook2
fi
function opens(){
if [[ $# -eq 0 ]]; then
elif [[ $# -eq 1 ]]; then
open "$(find . -type f -maxdepth 2 -not -path '*/\.*' | sort | head -$1 | tail -1)"
else
hello_var=$(echo -n "$1")
minus_var=$(echo -n "$2")
count_=0
function copy() {
if [[ $# -eq 0 ]]; then
echo 'first argument: file'
echo 'second argument: line number'
else
sed -n $2p $1 | pbcopy
fi
}
function cd_func () {
local x2 the_new_dir adir index
local -i cnt
if [[ $1 == "--" ]]; then
cat -n /Users/username/desktop/macbook_pro_scripts/echo_files/test_3.txt
return 0
fi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function browse() { | |
hello_var=$(echo -n `pbpaste`) | |
# set the clipboard to a variable | |
char=":" | |
# char in case there are multiple links | |
hello_var_2=$(awk -F"${char}" '{print NF-1}' <<< "${hello_var}") | |
# checking for mulitple https: links | |
if [ "$hello_var_2" -gt 1 ]; then | |
# if there are multiple links then return this statement | |
echo 'set str1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function delete() { | |
echo "sed -i '' '/^#/d'" | |
echo "sed -i '' '/^$/d;G'" | |
} | |
in command line for mac: | |
$ sed -i '' '/^#/d' (yourfilename here) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#going in and out of folders with CD resets the count | |
function cd() { | |
local x2 the_new_dir adir index | |
local -i cnt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function 00(){ | |
if [[ $# -eq 0 ]]; then | |
current_folder_count=$(cat /Users/stanleytan/Desktop/macbook_pro_scripts/echo_files/other_test.txt) | |
current_folder_count=$(($current_folder_count + 0)) | |
#echo $current_folder_count | |
second_count=$(cat /Users/stanleytan/desktop/macbook_pro_scripts/echo_files/count_open.txt) | |
second_count=$((second_count+1)) | |
echo -n $second_count > /Users/stanleytan/desktop/macbook_pro_scripts/echo_files/count_open.txt |
OlderNewer