Neovim: Keys and commands in my new environment ver. 28

Last Updated on November 24, 2022 by shibatau

III.2.Alacritty is added.

The red parts are added.

KEYS AND COMMANDS

III.1.Pop!_OS

III.2.Alacritty

III.3.Kitty

III.4.trash_cli

III.5.Linux/Unix commands

III.6.Fish

III.7.Vim key bindings

III.8.Neovim

III.9.Ranger

III.10.RStudio

III.11.vimwiki

III.12.Vimium

III.13.Brave Browser

III.14.Sioyek-PDF viewer

I. My environment

Computer 1: Pop!_OS on iMac.

Computer 2: Kali Linux on MacBook Air

A. Terminal

1. Alacritty

Installing Alacritty

2. Kitty

kitty – is the fast, feature-rich, cross-platform, GPU based terminal.

Installing and customizing the Kitty terminal emulator on Mac

3. Fish

Fish – is a smart and user-friendly command line shell for Linux, macOS, and the rest of the family.

Installing Fish Shell

4. Oh-My-Posh

Oh-My-Posh – is a prompt theme engine for any shell.

Installing Fish Shell

B. Editor

1.Neovim

How to set up Neovim with Lua

2.Visual Studio Code

C. IDE

1.RStudio

RStudio IDE is a set of integrated tools designed to help you be more productive with R and Python.

D. Browser

1.Brave Browser

E. Programming

1.Python

1).Google Colaboratory

Colaboratory allows you to write and execute Python in your browser.

2).plottext for Python

plotext plots directly on terminal

3).RStudio

4).Visual Studio Code

2.R

1).RStudio

2).Google Colaboratory

3.Julia

1).Visual Studio Code

F. Drawing

Krita

II. Sample

1.Kitty + Neovim + Terminal

In Kitty

You can create a new tab with Ctrl + Shift + t

In Neovim

You can move to another window with Ctrl + w +w.

You can split a window with :split.

You can create a new tab with :tabnew.

You can open the terminal with :term.

You can quit the terminal with <Ctrl + \> + <Ctrl + n>.

In the terminal

You can quit Python with exit().

When no key for ~ on your keyboard like me, you can use Unicode and type:
<Ctrl + Shift + u> + 7 +e +Enter

You can also insert ` by typing:
<Ctrl + Shift +u> + 6 + 0 + Enter

2.Kitty + Neovim + Terminal + xonsh + Neorg

III. Shortcuts, Keybindings and Commands

Here are the shortcuts often used. They include not only Neovim shortcus but also other shortcuts that I use for my daily note taking.

1.Pop!_OS

Pop!_OS Keyboard Shortcuts

2.Alacritty

2-1.tmux

TMUX-SESSIONS

New session
tmux

List session
tmux list, Ctrl + b s

TMUX-PANES

Horizontal split
Ctrl + b %

Vertical split
Ctrl + b “

Swap panes
Ctrl + b o

Kill pane
Ctrl + b x

TMUX-WINDOWS

Create window
Ctrl + b c

Close window
Ctrl + b &

Move windows
Ctrl + b p, Ctrl + b n

2-2.Vi Mode

Ctrl + Shift + Spacebar

3.Kitty

Open fish
fish
Move to the my-note directory
my-notes/
Close Kitty
Ctrl + d
Open Nvim
nvim

Tab

Open a new tab
Ctrl + shift + t

Close a tab
Ctrl + shift + q

Move to the right tab
Ctrl + shift + right arrow

Move to the left tab
 ctrl + shift + left arrow

Open a new window
Ctrl + shift + enter

Close a window
Ctrl + shift + w

Move to the next window
Ctrl + shift + ] 

Move to the previous window
Ctrl + shift + [

4.trash_cli

trash files and directories
trash-put
empty the trashcan(s)
trash-empty
list trashed files
trash-list
restore a trashed file
trash-restore
remove individual files from the trashcan
trash-rm

trash_cli

5.Linux/Unix commands

  • Ctrl-a Move cursor to beginning of line
  • Ctrl-e Move cursor to end of line
  • Ctrl-b Move cursor back one word
  • Ctrl-f Move cursor forward one word
  • Ctrl-w Cut the last word
  • Ctrl-k Cut everything after the cursor
  • Ctrl-u Cut everything before the cursor
  • Ctrl-y Paste the last thing to be cut
  • Ctrl-_ Undo
  • The Up Arrow and Down Arrow keys go back in the command history

exa

See: Installing exa

bat

dust

btm

See: Using CLI Tools

References

Learning Linux/Unix terminal commands

Master Mac/Linux Terminal Shortcuts Like a Ninja

Bash Scripting Tutorial for Beginners

6.Fish

Searchable command history
history + Alt + ↑ and Alt + ↓

See more here:

Tutorial

7.Vim key bindings

Open a file in the terminal
nvim file_name

Open a file in Neovm
:e file_name

Remove the number setting
:setlocal nonumber norelativenumber

Set absolute line number
:set nu

Set relative line number
:set rnu

Go to line 10
:10

Start writing at end of line
Shift-A

Delete everything from cursor onwards and start writing
Shift-C

Undo
u

Redo
Ctrl + r

Move down in a long line
gi

Move up in a long line
gk

Find and replace (to replace a with b)

:%s/a/b/gci

notes:

To search and replace the pattern in the entire file, use the percentage character

To replace all occurrences of the search pattern in the current line, add the g flag:

To substitute text, but want a confirmation every time you do it, you can use the c in the substitute command.

To ignore case for the search pattern, use the i flag:

Paste from system clipboard
“p or “+p

Paste to system clipboard
“*y or “+y

Moving to another window
Ctrl + w + w
Enter normal mode
Esc
Save the file
:w
Close the window
:q
Close all the buffers
:qa!

Open the terminal
:term

Quit the terminal
<CTRL + \><CTRL + n>

Enable spell check
:set spell

Correct spell errors
[s or ]s

Select a word
:viw (on the word)

Insert date and time on Unix-based systems
:r !date

Buffers

Show all the buffers

:ls 

Open a file in the list of buffers (you can use Tab key)

:buffer filename 

Open a file in a new buffer

:edit filename

Open a buffer

:bufferN (N is buffer number)

Go to next buffer

:bnext

Go back to the previous fuffer

:bprev

Tabs

Show all the tabs
:tabs

Open file.txt in a new tab
:tabnew file.txt

Close current tab
:tabclose

Go to next tab

:tabnext 

Go to previous tab
:tabprev

Windows

Split window horizontally
:split
:split filename

Split window vertically
:vsplit
:vsplit filename

Create new window
:new filename

Close a window
<Ctrl-w> + c

Move the cursor to left/bottom/top/right
<Ctrl-w> + h/j/k/l

Move the cursor to another window
<Ctrl-w> + w

You can learn more:

Find and Replace with yanked texts

Vim cheatsheet

Tips You Wish You Knew While Learning Vim

8.Neovim

8-1.Neorg

You can see the usage with the command:

:h neorg

Neovim-journal

  • :Neorg journal today
  • :Neorg journal yesterday
  • :Neorg journal tomorrow With this commands you can open the config files for the dates.
  • Neorg journal custom This command requires a date as an argument. The date should have to format yyyy-mm-dd.
  • :Neorg journal template This command creates a template file which will be used whenever a new journal entry is created.
  • :Neorg journal toc update This command creates or updates a TOC file containing all the entries located in the journal folder, named after the workspace index.
  • :Neorg journal toc open This command opens the TOC file without updating it.

You can see more here:

https://github.com/nvim-neorg/neorg/wiki/Journal

8-2.nvim-tree.lua

Open Nvim Tree Toggle
:NvmTreeToggle or , + n

Rename or Move
r
Copy the name
y
Copy the relative path
Y
Copy the absolute path
gy
Delete the file
d
Open the file with default system application
s
Open the file in a vertical split
<Ctrl + v>
Open the file in a horizontal split
<Ctrl + x>
Open the file in a new tab
<Ctrl + t>
Open the file as a preview (keeping the cursor in the tree)
<Tab>
Refresh the tree
R

Toggle the help to see all the commands
g?

8-3.Telescope.nvim

Find files
:Telescope find_files (, + ff in my key mapping)

Grep search
:Telescope live_grep (, +fg in my key mapping)

<C-n>/<Down> Next item
<C-p>/<Up> Previous item
j/k Next/previous (in normal mode)
H/M/L Select High/Middle/Low (in normal mode)
gg/G Select the first/last item (in normal mode)
<CR> Confirm selection
<C-x> Go to file selection as a split
<C-v> Go to file selection as a vsplit
<C-t> Go to a file in a new tab
<C-u> Scroll up in preview window
<C-d> Scroll down in preview window
<C-/> Show mappings for picker actions (insert mode)
? Show mappings for picker actions (normal mode)
<C-c> Close telescope
<Esc> Close telescope (in normal mode)
<Tab> Toggle selection and move to next selection
<S-Tab> Toggle selection and move to prev selection
<C-q> Send all items not filtered to quickfixlist (qflist)
<M-q> Send all selected items to qflist

You can see the key mappings here:

https://github.com/nvim-telescope/telescope.nvim

8-4.surround.nvim

  1. Provides key mapping to add surrounding characters.( visually select then press s<char> or press sa{motion}{char})
  2. Provides key mapping to replace surrounding characters.( sr<from><to> )
  3. Provides key mapping to delete surrounding characters.( sd<char> )
  4. ss repeats last surround command.

You can learn more here:

https://github.com/ur4ltz/surround.nvim

You can replace with in another way:

:%s/'/"/gci

9.Ranger

Open Ranger with the following command in the terminal when Ranger often freeze
ranger –clean

Shows or hides the floating window
:RnvimrToggle (in Neovim)

Delete files with trash-cli using Shell
:shell trash-put file_name1 file_name2

Go to the top of the list
gg

Preview file
i

Open file
r

View hidden files
zh

Rename current file
cw

Copy file
yy

Cut file
dd

Undo
u

Change settings
z

Delete file
dD

Move a file
dd (cut)
pp (paste)

Move a file using Shell
:shell -f mv %f /foo/bar

Move multiple files using Shell
Select multiple files with Space bar
:shell mv %s /foo/bar

You can learn more here:

Ranger on Linux – A Complete Terminal File Manager For Linux

10.RStudio

Comment / Uncomment codes
Ctrl + Shift + C

Add the Pipe |>
Ctrl + Shift + M

Insert The Assignment Operator <-
Alt + –

Select a Rectangular Block
ALT – click & drag

Show a keyboard shortcut cheat Sheet
Alt + Shift + K

11.vimwiki

  • <Leader>ww — Open default wiki index file.
  • <Leader>wt — Open default wiki index file in a new tab.
  • <Leader>ws — Select and open wiki index file.
  • <Leader>wd — Delete wiki file you are in.
  • <Leader>wr — Rename wiki file you are in.
  • <Enter> — Follow/Create wiki link.
  • <Shift-Enter> — Split and follow/create wiki link.
  • <Ctrl-Enter> — Vertical split and follow/create wiki link.
  • <Backspace> — Go back to parent(previous) wiki link.
  • <Tab> — Find next wiki link.
  • <Shift-Tab> — Find previous wiki link.

12.Brave browser + Vimium for keyboard-based navigation

a) Brave browser

Minimize window
Alt + Spacebar + Tab + Enter

You can learn shortcuts here:

What keyboard shortcuts can I use in Brave?

b) Vimium

Vimium is a browser extension that provides keyboard-based navigation and control of the web in the spirit of the Vim editor:

https://github.com/philc/vimium#readme

Navigating the current page:

?       show the help dialog for a list of all available keys
h       scroll left
j       scroll down
k       scroll up
l       scroll right
gg      scroll to top of the page
G       scroll to bottom of the page
d       scroll down half a page
u       scroll up half a page
f       open a link in the current tab
F       open a link in a new tab
r       reload
gs      view source
i       enter insert mode -- all commands will be ignored until you hit Esc to exit
yy      copy the current url to the clipboard
yf      copy a link url to the clipboard
gf      cycle forward to the next frame
gF      focus the main/top frame

Navigating to new pages:

o       Open URL, bookmark, or history entry
O       Open URL, bookmark, history entry in a new tab
b       Open bookmark
B       Open bookmark in a new tab

Using find:

/       enter find mode
          -- type your search query and hit enter to search, or Esc to cancel
n       cycle forward to the next find match
N       cycle backward to the previous find match

For advanced usage, see regular expressions on the wiki.

Navigating your history:

H       go back in history
L       go forward in history

Manipulating tabs:

J, gT   go one tab left
K, gt   go one tab right
g0      go to the first tab. Use ng0 to go to n-th tab
g$      go to the last tab
^       visit the previously-visited tab
t       create tab
yt      duplicate current tab
x       close current tab (Ctrl + w)
X       restore closed tab (i.e. unwind the 'x' command)
T       search through your open tabs
W       move current tab to new window
<a-p>   pin/unpin current tab

Using marks:

ma, mA  set local mark "a" (global mark "A")
`a, `A  jump to local mark "a" (global mark "A")
``      jump back to the position before the previous jump
          -- that is, before the previous gg, G, n, N, / or `a

Additional advanced browsing commands:

]], [[  Follow the link labeled 'next' or '>' ('previous' or '<')
          - helpful for browsing paginated sites
<a-f>   open multiple links in a new tab
gi      focus the first (or n-th) text input box on the page. Use <tab> to cycle through options.
gu      go up one level in the URL hierarchy
gU      go up to root of the URL hierarchy
ge      edit the current URL
gE      edit the current URL and open in a new tab
zH      scroll all the way left
zL      scroll all the way right
v       enter visual mode; use p/P to paste-and-go, use y to yank
V       enter visual line mode

How back from url address bar to site? Press F6 works for me. You can get information here:

How back from url address bar to site?

13.Brave Browser

Open the Home page in the current tab
Alt + Home

See:

What keyboard shortcuts can I use in Brave?

14.Sioyek-PDF viewer

See:

View PDF with keys

IV. Web-based IME

InputKing Online Input System is a web-based multilingual input method editor (IME). To use this tool, you don’t need to download and install any software on your computer.

Online Input System

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.