Sometimes you just need to quickly take some notes.
A trick is to use the data: scheme with data:text/html to show just a piece of HTML in your browser. Then using the mighty contentEditable to make the whole thing editable.
To copy/paste into your browser address bar: html
data:text/html,<html contenteditable>
And from there you can get fancier. Adding better styling: html
data:text/html,<html contenteditable autofocus style="font: 500 1rem/1.5 Menlo,
monospace; background:#fafafa">
From there, no limit: Turning it into a full editor:
|C:\Users\archerda>python |Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32 |Type “help”, “copyright”, “credits” or “license” for more information. |>>>
| Performing system checks… | System check identified no issues (0 silenced). | You have unapplied migrations; your app may not work properly until they are applied. | Run ‘python manage.py migrate’ to apply them. | July 24, 2015 - 10:30:05 | Django version 1.8.3, using settings ‘testdjango.settings’ | Starting development server at http://127.0.0.1:8080/ | Quit the server with CTRL-BREAK.
Conventional wisdom says that electrons compute and photons communicate. That’s because the strong Coulomb interactions of charged electrons can be leveraged to perform nonlinear computations (Boolean logic), whereas charge-free photons do not interact with each other at all in free space.
An electronic computer operates at baseband by manipulating the flow of charges in semiconductors, such as silicon, whereas most optical systems transfer information encoded on a carrier frequency of several hundred THz by the polarization of bound electrons in dielectric materials, such as glasses. Indeed, the lack of photon-photon interaction makes it possible to use a large number of spatial and spectral channels to increase the information-carrying capacity of optical communication systems.
Electronic telecommunication systems evolved from telegraphy, with baseband operation using simple metal wires for transmission, through telephony, whose increased demand for transmission bandwidth was initially met by higher carrier frequencies that require more complex guiding structures such as coaxial cables, and finally into fiber optic technology for long-haul communications beginning in the late 1980s. The starting point for computers was similar to that of early communications systems—that is, simple electrical circuits operating at baseband frequencies, with bandwidth of several MHz.
Unlike communications however, computers have continued to operate at baseband—and, thus far, with great success. Computers have acquired complexity and speed through improvements in the resolution of lithography, which allowed exponential gains under Moore’s law. Transistors with ever-shrinking dimensions provide a highly localized interaction between electrical signals (typically the gate and source voltages), through the 1/r2 drop of the electric field established by the charge at the gate of the transistor. Such localization is essential for Boolean logic, in which only two bits typically interact at a time.
The miniaturization of transistors made possible by ever-finer-scale lithography leads to increased speed, greater density, lower power and lower cost (through increased integration)—all at the same time—and has formed the basis of the microelectronic revolution. In contrast to communications, placing the data on a high carrier frequency before performing nonlinear logic computations has offered no obvious advantages.Electronic computing’s historical strengths
Big data and physical limits
In recent years, it’s been widely recognized that conventional scaling in CMOS processors is reaching its physical limits, and can’t provide the same exponential improvement in computational capabilities as in the past. The computational challenges now posed by so-called big-data analytics are also necessitating a rethinking at a fundamental level.
All of this has driven increased interest in alternatives to silicon-CMOS-based hardware for digital computation, a trend captured by a variety of campaigns by industry groups to “reboot” information technology. These initiatives envision tight integration among specific applications, alternative models of computation, and new, potentially unconventional hardware platforms. Proposals for building optical systems implementing a “reservoir” model of computation—a variation on neural-net models—constitute one recent example.
In those efforts, nanophotonics could play a key role. The same advances in lithography and manufacturing that have driven Moore’s law have also, in the past decade, brought a veritable revolution in photonics technology, making it possible to precisely create features far smaller than wavelength of light. As a result, photonic-crystal structures, metamaterials, plasmonics and highly resonant nanostructures are now enabling unprecedented control over light propagation, modulation, generation and detection. Novel ideas in bottom-up self-assembly of materials are also opening new vistas in light-matter interactions through tools such as quantum dots.
These integrated-photonics developments are leading to exploration of ever-smaller, ever-higher-performance devices for electrical-to-optical and optical-to-electrical conversion. They have also rekindled interest in nonlinear optical switches as logic devices for special-purpose digital optical circuits—if not as CPUs in general-purpose digital computers. The rapidly evolving landscape of information processing—and the increasing limits faced by Moore’s law—makes now an opportune time to explore such advanced optical-computing techniques.
h # move cursor left j # move cursor down k # move cursor up l # move cursor right H # move to top of screen M # move to middle of screen L # move to bottom of screen w # jump forwards to the start of a word W # jump forwards to the start of a word (words can contain punctuation) e # jump forwards to the end of a word E # jump forwards to the end of a word (words can contain punctuation) b # jump backwards to the start of a word B # jump backwards to the start of a word (words can contain punctuation) 0 # jump to the start of the line ^ # jump to the first non-blank character of the line $ # jump to the end of the line g_ # jump to the last non-blank character of the line gg # go to the first line of the document G # go to the last line of the document 5G # go to line 5 fx # jump to next occurrence of character x tx # jump to before next occurrence of character x } # jump to next paragraph (or function/block, when editing code) { # jump to previous paragraph (or function/block, when editing code) zz # center cursor on screen Ctrl + b # move back one full screen Ctrl + f # move forward one full screen Ctrl + d # move forward 1/2 a screen Ctrl + u # move back 1/2 a screen
Insert mode - inserting/appending text
1 2 3 4 5 6 7 8
i # insert before the cursor I # insert at the beginning of the line a # insert (append) after the cursor A # insert (append) at the end of the line o # append (open) a new line below the current line O # append (open) a new line above the current line ea # insert (append) at the end of the word Esc # exit insert mode
Editing
1 2 3 4 5 6 7 8 9 10 11
r # replace a single character J # join line below to the current one cc # change (replace) entire line cw # change (replace) to the end of the word c$ # change (replace) to the end of the line s # delete character and substitute text S # delete line and substitute text (same as cc) xp # transpose two letters (delete and paste) . # repeat last command u # undo Ctrl + r # redo
Marking text (visual mode)
1 2 3 4 5 6 7 8 9 10 11
v # start visual mode, mark lines, then do a command (like y-yank) V # start linewise visual mode o # move to other end of marked area O # move to other corner of block aw # mark a word ab # a block with () aB # a block with {} ib # inner block with () iB # inner block with {} Esc # exit visual mode Ctrl + v # start visual block mode
Visual commands
1 2 3 4 5
> # shift text right < # shift text left y # yank (copy) marked text d # delete marked text ~ # switch case
Cut and paste
1 2 3 4 5 6 7 8 9 10 11 12
yy # yank (copy) a line 2yy # yank (copy) 2 lines yw # yank (copy) the characters of the word from the cursor position to the start of the next word y$ # yank (copy) to end of line p # put (paste) the clipboard after cursor P # put (paste) before cursor dd # delete (cut) a line 2dd # delete (cut) 2 lines dw # delete (cut) the characters of the word from the cursor position to the start of the next word D # delete (cut) to the end of the line d$ # delete (cut) to the end of the line x # delete (cut) character
Search and replace
1 2 3 4 5 6 7 8
/pattern # search for pattern ?pattern # search backward for pattern \vpattern # 'very magic' pattern: non-alphanumeric characters are interpreted as special regex symbols (no escaping needed) n # repeat search in same direction N # repeat search in opposite direction :%s/old/new/g # replace all old with new throughout file :%s/old/new/gc # replace all old with new throughout file with confirmations :noh # remove highlighting of search matches
Search in multiple files
1 2 3 4
:vimgrep /pattern/ {file} # search for pattern in multiple files :cn # jump to the next match :cp # jump to the previous match :copen # open a window containing the list of matches
Exiting
1 2 3 4 5
:w # write (save) the file, but don't exit :w !sudo tee % # write out the current file using sudo :wq or :x or ZZ # write (save) and quit :q # quit (fails if there are unsaved changes) :q! or ZQ # quit and throw away unsaved changes
Working with multiple files
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
:e file # edit a file in a new buffer :bnext or :bn # go to the next buffer :bprev or :bp # go to the previous buffer :bd # delete a buffer (close a file) :ls # list all open buffers :sp file # open a file in a new buffer and split window :vsp file # open a file in a new buffer and vertically split window Ctrl + ws # split window Ctrl + ww # switch windows Ctrl + wq # quit a window Ctrl + wv # split window vertically Ctrl + wh # move cursor to the left window (vertical split) Ctrl + wl # move cursor to the right window (vertical split) Ctrl + wj # move cursor to the window below (horizontal split) Ctrl + wk # move cursor to the window above (horizontal split)
Tabs
1 2 3 4 5 6 7 8 9
:tabnew or :tabnew file # open a file in a new tab Ctrl + wT # move the current split window into its own tab gt or :tabnext or :tabn # move to the next tab gT or :tabprev or :tabp # move to the previous tab <number>gt # move to tab <number> :tabmove <number> # move current tab to the <number>th position (indexed from 0) :tabclose or :tabc # close the current tab and all its windows :tabonly or :tabo # close all tabs except for the current one :tabdo command# run the command on all tabs (e.g. :tabdo q - closes all opened tabs)
Vim (an acronym for Vi IMproved) is a text editor written by Bram Moolenaar and
first released publicly in 1991. Based on the vi editor common to Unix-like
systems, Vim is designed for use both from a command line interface and as a
standalone application in a graphical user interface. Vim is free and open
source software and is released under a license that includes some charityware
clauses, encouraging users who enjoy the software to consider donating to
children in Uganda. The license is compatible with the GNU General Public
License.
\begin{tabular}{cccc} a & b & c & d \ Ef & long long & ss & a \ test & n & long content & small \ \end{tabular} “ 选中表格内容,按 tt,就可以对齐了,豁然开朗。 \begin{tabular}{cccc} a & b & c & d \ Ef & long long & ss & a \ test & n & long content & small \ \end{tabular}
Posted onEdited onViews: Valine: Symbols count in article: 2.3kReading time ≈2 mins.
An h1 header
Paragraphs are separated by a blank line.
2nd paragraph. Italic, bold, and monospace. Itemized lists look like:
this one
that one
the other one
Note that — not considering the asterisk — the actual text content starts at 4-columns in.
Block quotes are written like so.
They can span multiple paragraphs, if you like.
Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., “it’s all in chapters 12–14”). Three dots … will be converted to an ellipsis. Unicode is supported. ☺
An h2 header
Here’s a numbered list:
first item
second item
third item
Note again how the actual text starts at 4 columns in (4 characters from the left side). Here’s a code sample:
# Let me re-iterate ...
for i in 1 .. 10 { do-something(i) }
As you probably guessed, indented 4 spaces. By the way, instead of indenting the block, you can use delimited blocks, if you like:
1 2 3
define foobar() { print "Welcome to flavor country!"; }
(which makes copying & pasting easier). You can optionally mark the delimited block for Pandoc to syntax highlight it:
1 2 3 4 5 6
import time # Quick, count to ten! for i in range(10): # (but not *too* quick) time.sleep(0.5) print i
An h3 header
Now a nested list:
First, get these ingredients:
carrots
celery
lentils
Boil some water.
Dump everything in the pot and follow this algorithm:
find wooden spoon
uncover pot
stir
cover pot
balance wooden spoon precariously on pot handle
wait 10 minutes
goto first step (or shut off burner when done)
Do not bump wooden spoon or it will fall.
Notice again how text always lines up on 4-space indents (including that last line which continues item 3 above).