Moves point to the first non-whitespace character on this line
Moving by word
Key Binding
Purpose
M-f
Move forward by word
M-b
Move backward by word
Subword and superword
movement
Command
Purpose
M-x subword-mode
Minor mode that treats CamelCase as distinct words
M-x superword-mode
Minor mode that treats snake_case as one word
Moving by s-expression
Key Binding
Purpose
C-M-f
Move forward by s-expression
C-M-b
Move backward by s-expression
Down and up List
Key Binding
Purpose
C-M-d
Move down into a list
C-M-u
Move up out of a list
Forward and backward list
Key Binding
Purpose
C-M-n
Move forward to the next list
C-M-p
Move backward to the previous list
Other movement commands
Moving by Paragraph
Key Binding
Purpose
M-}
Move forward to end of paragraph
M-{
Move backward to start of paragraph
a set of variables that define the beginning and end of a
paragraph:
Variable Name
Purpose
paragraph-start
Defines the beginning of a paragraph using a large regular
expression
paragraph-separate
Defines the paragraph separator as a regular expression
use-hard-newlines
Set by the command M-x use-hard-newlines and defines whether a hard
newline defines a paragraph
Moving by sentence
Key Binding
Purpose
M-a
Move to beginning of sentence
M-e
Move to end of sentence
You can alter this behavior by customizing (with M-x
customize-option) the following variables:
Variable Name
Purpose
sentence-end-double-space
Non-nil means a single space does not end a sentence
sentence-end-without-period
Non-nil means a sentence will end without a period
sentence-end-without-space
A string of characters that end a sentence without requiring spaces
after
Moving by Defun
Key Binding
Purpose
C-M-a
Move to beginning of defun
C-M-e
Move to end of defun
Moving by Pages
Key Binding
Purpose
C-x ]
Moves forward one page
C-x [
Moves backward one page
Scrolling
Key Binding
Purpose
C-v
Scroll down one page
M-v
Scroll up one page
C-M-v
Scroll down the other window
C-M-S-v
Scroll up the other window
In Mac iterm2, you should use M-PageUp and
M-PageDn to scroll the other window.
Move to begin and end
Key Binding
Purpose
M-<
Move to the beginning of the buffer
M->
Move to the end of the buffer
When you move to the beginning or end of the buffer, Emacs will place
the mark – an invisible location marker – where you came from, so you
can return to your old position. For instance, if you type
M-< to jump to the beginning of the buffer, you can type
C-u C-<SPC> to go back.
Numeric arguments
Move down 50 lines
1
M-5 0 C-n
C-u alone has the special meaning of “four times”, moves forward
sixteen characters
My favorite player Kobe has gone. So sad these days. The beginning of
2020 seems so hard. Hold on, man, take a breath and be relax. We will
win the battle!
We always want run faster, but not solid on the way. We should slow
down, make little things right.
Learning basics
Math basic is so important, calculus, linear algebra, probability.
Figure out every detail.
Emacs, thinking in emacs way, try to forget vim.
Dig deep into any concept, try to proof each formula.
Sushi and ramen spirit
Sushi and ramen is a spirit, they tell us to focus on one thing, do
it all life time, and do it better.
To be a coder, we first need have faith, and then working hard, keep
going, focus and do one little thing better.
Let's begin
I'll begin the basics from now on. Study every details I face.
Reinforcement learning is every where in the world. I learn to write
blogs in English. I learn to use emacs to do coding jobs. I do some
stock trading.
Reinforcement learning includes:
Policy: agent's behavior function
Value function: how good is each state and/or action
Reward signal: defines the goal of a reinforcement learning
problem
Policy
Policy is the agent's behavior, it is a map from state to action
Deteministic policy:
Stocastic policy:
Value function
Value funciton is a prediction of future reward, used to evaluate the
goodness/badness of states,and therefor to select between actions.
Exploration and Exploitation
To obtain a lot of reward, a reinforcement learning agent must prefer
actions that it has tried in the pat and found to be effective in
producing reward. But to discover such actions, it has to try actions
that it has not selected before. The agent has to exploit what
it has already exprienced in order to obtain reward, but it also has to
explore in order to make better action selections in the
future.
Like variance and bias in machine learning, we always need to make
trade-off. So to be or not to be, this is a problem.
I used to use vi as my coding tools. I want expore a new
tool called emacs. It may bring more reward in the future, but it seems
very hard at the beginning.
When you are coding, remember that never do same thing twice. For
example you want indent some lines.
1 2 3 4 5
automain() -> int { std::cout << "indent me\n"; std::cout << "indent me again\n"; }
Never move to line 3, keypress 4 spaces and move to line 4, keypress
4 space again.
Use vi, there are many ways
move to line 3, shift v enter vi visual mode,
j select line 4, shift > to increase
indent
move to line 3, shift v enter vi visual mode,
:normal i and press 4 spaces and enter
move to line 3, shift v enter vi visual mode,
shift > and then move to line 4, press
.
move to line 3, ctrl v block select, and j
to select next line, shift i to insert 4 spaces,
esc
Also, you can use awk and sed to achieve the same effects.
Actions on the code
Actions on the code, or code transformations, is a serial's
operations on the code. Record all operations into tape, called macro,
and the macro can be applied to some other places, mapping the code from
origin state to desired state.
Operation space
All possible operations compose an Action space. AI should learn to
choice some actions, transform the code to a stable state, a state may
be pass compile or pass unit test. If AI can do this, we call it auto
coding.
Learning from
history and some basic rules
Bayesian learning
We init some prior rules to the bot. He will update the prior with
posterior.
Reinforcement Learning
Use some reinforcement strategies to perform better actions on the
code.
Interactive with human
Consider the indent example above, when I indent line 3, bot help me
indent line 4, is it stable? Yes, done!