diff --git a/cards/emacs.org b/cards/emacs.org new file mode 100644 index 0000000..b0001a6 --- /dev/null +++ b/cards/emacs.org @@ -0,0 +1,73 @@ +#+title: Anki: Emacs +#+date: "2021-05-02 19:18:32 +08:00" +#+date_modified: "2021-05-04 01:02:26 +08:00" +#+language: en +#+property: anki_deck Emacs + +* The overview of buffers +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1620039512243 +:END: +** Front +What is a buffer? +** Back +A buffer is anything that Emacs displays. +It usually display file contents among other examples with ~butterfly~, ~doctor~, or the starting buffer when you first open Emacs. + +While buffers usually have an associated file path, a buffer doesn't need one. +This is one of the concepts that is applied to other text editors (Vim, Atom, Visual Studio Code). + +* The basics of modes +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1620039513634 +:END: +** Front +What is a mode? +** Back +A mode is set of behavior quite similar to Vim modes. + +Emacs further divides modes into two. + +*Major modes are Emacs' way of supporting programming languages and file formats.* +Programming language support usually comes in major mode — e.g., ~R-mode~ for R files, ~python-mode~ for Python scripts, ~org-mode~ for Org mode documents. +Think of them as an equivalent to Vim's filetype. +Only one major mode can be activated in one buffer at a time and all buffers have a major mode. + +*Minor modes usually contain little behavioral changes that improve the editing experience.* +When enabled, some of them are global modes — affecting every buffer in your session. +Others are only buffer-local — affecting only the buffer when you activated the mode. +Unlike major modes, multiple minor modes can be enabled at any given time. + +* Eagle's eye view of a window +:PROPERTIES: +:ANKI_DECK: Emacs +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1620039514055 +:END: +** Front +What is a window? +** Back +A window is where the buffers are being displayed. +One window can display all buffers but only one at a time. +To display two buffers at a single time, just add another window. + +All windows display the same buffer; +if the buffer is modified in one of the window, it will show the changes in all windows. + +* Point and marker +:PROPERTIES: + :ANKI_NOTE_TYPE: Styled cards + :ANKI_NOTE_ID: 1620040989788 + :END: +** Front + What is a point and a marker? +** Back + A point is the current location of the cursor in the buffer. + You can get the point with ~point~ function. + Often helpful for interacting with buffers. + + A marker is another point in the buffer. + It is usually found when interacting with regions when asked for the two points (i.e., the beginning and the ending position). + Furthermore, a marker can be used to save locations and jump back to that marker when asked. diff --git a/cards/linux.org b/cards/linux.org new file mode 100644 index 0000000..01cb21a --- /dev/null +++ b/cards/linux.org @@ -0,0 +1,40 @@ +#+title: Anki: Linux +#+date: "2021-05-01 20:20:25 +08:00" +#+date_modified: "2021-05-04 01:02:26 +08:00" +#+language: en +#+property: anki_deck Linux + +* Finding devices +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1619878728534 +:END: +** Front +How to list devices information? +(I mean all sorts of devices.) +** Back +- ~lspci~ is the most acceptable answer since it comprehensive lists all of the devices. +- ~lsusb~ list USB-connected devices. +- ~lsblk~ list the block devices which usually includes storage drives and such. + +* ~$PATH~ environment +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1619878774321 +:END: +** Front +How does a shell find the binaries? +** Back +Most shell searches through the ~$PATH~ variable, a colon-delimited list of paths containing the binaries. + +* Testing systemd timestamps +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1619878774617 +:END: +** Front +How to test out systemd timestamps? +** Back +~systemd-analyze {calendar,timestamp,timespan}~ + +To know how the format (i.e., calendar, timestamp, and timespan) looks like, you can refer to ~man systemd.time.5~. diff --git a/cards/vim.org b/cards/vim.org new file mode 100644 index 0000000..626e5ef --- /dev/null +++ b/cards/vim.org @@ -0,0 +1,79 @@ +#+title: Anki: Vim +#+date: "2021-05-01 17:52:58 +08:00" +#+date_modified: "2021-05-04 01:02:26 +08:00" +#+language: en +#+property: anki_deck Vim + +* Jump to previous jump point +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1619862911606 +:END: +** Front +How to get back in previous jump point? +** Back +=Ctrl + O= + +Remember it as getting *out* of the current jump point and back to the previous one. + +* Enter jump point +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1619866523112 +:END: +** Front +How to jump into a keyword? +** Back +- =Ctrl + ]= will enter into the definition block of a keyword. +- =K= also has the same effect. + +* Go to file path +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1619866578855 +:END: +** Front +How to go to the file path at point? +** Back +=gf= as in *goto file*. + +* Set as a pager +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1619873854130 +:END: +** Front +How to set Vim as a manpager? +** Back +~MANPAGER="nvim +Man!"~ + +~+Man!~ is a command invocation (as if entering ~:Man~ inside Vim). +It can also be written as ~-c Man!~. + +The ~:Man!~ command displays the current buffer as a manual page. + +* Show outline/table of content +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1619873854327 +:END: +** Front +How to show the table of contents of a document? +** Back +=gO=, although the results are filetype-specific (and some don't have any). +Helpful examples include for manual pages and help pages (from =:help=). + +* Detect files through filetypes +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1619937647469 +:END: +** Front +How does Vim detect the files? +** Back +Vim guesses the file by assigning *filetypes*, mainly through the file name and reading the file content. +A filetype is how Vim knows what plugins to apply to the current buffer. + +Vim has a few built-in filetypes such as shell, manual pages, Markdown, Asciidoc, xmodmap, patch files, and JSON among others (that are in =$VIMRUNTIME/filetype.vim=). + +For more information, run ~:help filetype~ inside Vim.