what mean n,i,c,v,x etc of Mode in lazyvim?
Let me explain the different modes in Vim/LazyVim:
n (Normal Mode)
- This is the default mode you start in
- Used for navigation and executing commands
- You can enter this mode from any other mode by pressing
Esc
- In this mode, keystrokes are interpreted as commands rather than text input
x (Visual Mode)
- Used for selecting and manipulating blocks of text
- There are actually three types of visual mode:
v
- Character-wise visual mode (select characters)V
- Line-wise visual mode (select entire lines)Ctrl+v
- Block-wise visual mode (select rectangular blocks)
Other important modes include:
i
(Insert Mode) - For typing/inserting textR
(Replace Mode) - For replacing existing textc
(Command Mode) - Entered by typing:
in normal mode
To see which mode you’re currently in, look at the bottom left of your LazyVim window. It will show:
NORMAL
for normal modeVISUAL
for visual modeINSERT
for insert modeCOMMAND
for command mode
Command\Mode | Normal | Insert | Command-line | Visual | Select | Operator-pending | Terminal | Lang-Arg |
---|---|---|---|---|---|---|---|---|
[nore]map | yes | - | - | yes | yes | yes | - | - |
n[nore]map | yes | - | - | - | - | - | - | - |
[nore]map! | - | yes | yes | - | - | - | - | - |
i[nore]map | - | yes | - | - | - | - | - | - |
c[nore]map | - | - | yes | - | - | - | - | - |
v[nore]map | - | - | - | yes | yes | - | - | - |
x[nore]map | - | - | - | yes | - | - | - | - |
s[nore]map | - | - | - | - | yes | - | - | - |
o[nore]map | - | - | - | - | - | yes | - | - |
t[nore]map | - | - | - | - | - | - | yes | - |
l[nore]map | - | yes | yes | - | - | - | - | yes |
注:You can found it:
:help map-table
(map-table in map.txt)
vim shortcut
Here are some essential Vim shortcuts to help you navigate and edit efficiently:
Basic Navigation (Normal Mode)
h
j
k
l
- Move left, down, up, rightw
- Jump to start of next wordb
- Jump to start of previous word0
- Jump to start of line$
- Jump to end of linegg
- Go to first lineG
- Go to last line{number}G
- Go to specific line number
Editing (Normal Mode)
i
- Insert mode before cursora
- Insert mode after cursoro
- Insert new line belowO
- Insert new line abovedd
- Delete current lineyy
- Copy (yank) current linep
- Paste after cursoru
- UndoCtrl + r
- Redo
Visual Mode
v
- Enter visual mode (for selecting text)V
- Select entire linesCtrl + v
- Visual block mode
Search and Replace
/pattern
- Search forward?pattern
- Search backwardn
- Next occurrenceN
- Previous occurrence:%s/old/new/g
- Replace all occurrences
Save and Quit
:w
- Save:q
- Quit:wq
or:x
- Save and quit:q!
- Quit without saving
LazyVim Specific
Space
- Leader keySpace + e
- Toggle file explorerSpace + ff
- Find filesSpace + fg
- Live grepSpace + /
- Search in current buffergc
- Comment/uncomment linesCtrl + /
- Toggle terminal
Multiple Windows
Ctrl + w + v
- Split verticallyCtrl + w + s
- Split horizontallyCtrl + w + h/j/k/l
- Navigate between windows
how to chage brew mirrors on macOS?
To change Homebrew’s download source (mirrors) on macOS, you can use the following steps:
-
View current brew source:
brew doctor
-
Popular mirrors you can use:
-
Official GitHub Mirror (Default, generally good worldwide):
export HOMEBREW_BREW_GIT_REMOTE="https://github.com/Homebrew/brew.git" export HOMEBREW_CORE_GIT_REMOTE="https://github.com/Homebrew/homebrew-core.git"
-
USTC (China):
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git" export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
-
Tsinghua University (China):
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git" export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
-
-
Make the change permanent: Add the export commands to your shell configuration file (
~/.zshrc
for Zsh or~/.bash_profile
for Bash):echo 'export HOMEBREW_BREW_GIT_REMOTE="your-chosen-mirror-url"' >> ~/.zshrc echo 'export HOMEBREW_CORE_GIT_REMOTE="your-chosen-mirror-url"' >> ~/.zshrc
-
Run:
source ~/.zshrc # or source ~/.bash_profile brew update-reset brew update
-
After changing the mirror, you should see faster download speeds when installing or updating packages if you’ve chosen a mirror that’s geographically closer to you.
Note: If you want to revert to the official source, you can remove the export commands from your shell configuration file and run the update-reset command again.
how to set proxy in Lazyvim?
To set up a proxy in LazyVim, you have several options:
System-wide Git Proxy (Recommended):
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
In LazyVim Configuration: Create or edit ~/.config/nvim/lua/config/options.lua
and add:
-- Set proxy for network operations
vim.g.proxy = 'http://127.0.0.1:7890'
For Mason Package Manager: Edit ~/.config/nvim/lua/config/lazy.lua
and add:
{
"williamboman/mason.nvim",
opts = {
-- Add proxy settings to mason
proxy_url = "http://127.0.0.1:7890",
},
}
For Neovim’s built-in LSP: Add to your ~/.config/nvim/lua/config/options.lua
:
vim.env.http_proxy = 'http://127.0.0.1:7890'
vim.env.https_proxy = 'http://127.0.0.1:7890'
Notes:
- Replace
7890
with your actual proxy port - Common proxy ports are: 7890 (Clash), 1080 (SOCKS5), 8080 (HTTP)
- After making changes, restart Neovim for the settings to take effect
- You might need to run
:Mason
and:MasonUpdate
to verify the proxy settings are working
To remove the proxy settings:
git config --global --unset http.proxy
git config --global --unset https.proxy
Remember to adjust the proxy address and port according to your specific proxy setup (e.g., if you’re using a different proxy service or port).
how to set shortcut of Insert Mode in Lazyvim?
To set shortcuts for Insert Mode in LazyVim, you can modify or add keymaps in your configuration. Here’s how to do it:
Edit Keymaps File: Create or edit ~/.config/nvim/lua/config/keymaps.lua
:
-- Basic cursor movement in Insert Mode
vim.keymap.set('i', '<C-h>', '<Left>', { desc = 'Move left' })
vim.keymap.set('i', '<C-j>', '<Down>', { desc = 'Move down' })
vim.keymap.set('i', '<C-k>', '<Up>', { desc = 'Move up' })
vim.keymap.set('i', '<C-l>', '<Right>', { desc = 'Move right' })
-- Word movement in Insert Mode
vim.keymap.set('i', '<C-b>', '<C-Left>', { desc = 'Move word backward' })
vim.keymap.set('i', '<C-w>', '<C-Right>', { desc = 'Move word forward' })
-- Line movement in Insert Mode
vim.keymap.set('i', '<C-e>', '<End>', { desc = 'Move to line end' })
vim.keymap.set('i', '<C-a>', '<Home>', { desc = 'Move to line start' })
-- Delete operations in Insert Mode
vim.keymap.set('i', '<C-d>', '<Delete>', { desc = 'Delete forward' })
vim.keymap.set('i', '<C-BS>', '<C-w>', { desc = 'Delete word backward' })
-- Other useful Insert Mode mappings
vim.keymap.set('i', '<C-u>', '<C-g>u<C-u>', { desc = 'Delete to start of line' })
vim.keymap.set('i', '<C-y>', '<Esc>pa', { desc = 'Paste in insert mode' })
Syntax Explanation:
vim.keymap.set({mode}, {lhs}, {rhs}, {opts})
-- mode: 'i' for Insert Mode
-- lhs: the key combination you press
-- rhs: the action to perform
-- opts: additional options like description
Common Options:
local opts = {
desc = "Description of the mapping",
silent = true, -- Don't show command in command line
noremap = true, -- Don't use recursive mapping
expr = false, -- Expression mapping
buffer = nil -- Buffer local mapping
}
Check Existing Mappings:
- In Normal mode, type
:map
to see all mappings - Use
:verbose imap
to see Insert mode mappings and where they were set
Remove Mappings:
-- Remove a mapping
vim.keymap.del('i', '<C-h>')
Remember:
- Test your mappings after setting them
- Avoid overriding essential functionality
- Use
:checkhealth
to check for conflicts - Add descriptions for better documentation
- Use
<Cmd>
instead of:
for command mappings in Insert mode
After making changes, restart Neovim or source the config file:
:source ~/.config/nvim/lua/config/keymaps.lua
Caused by SSLError
Q: Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)’))) - skipping
A:
# Download certificates
curl https://curl.se/ca/cacert.pem -o ~/cacert.pem
# Set the SSL certificate path
export SSL_CERT_FILE=~/cacert.pem
export REQUESTS_CA_BUNDLE=~/cacert.pem
评论区