This repository was archived by the owner on Aug 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
4. Reference
Jeffrey edited this page Oct 7, 2023
·
22 revisions
- neovim options
- lua api
- guide
- vim tips
- vim cheatshit
- learn vim the hard way
- vimfied
- vimdoc
- vim-be-good
- lazyvim
- gruvbox-material
- gruvbox
cpanm -n App::cpanminus --mirror http://mirrors.163.com/cpan --mirror-onlynpm config rm registry
npm config set proxy=http://127.0.0.1:7890
npm config set https-proxy http://127.0.0.1:7890
npm config list
# 如果需要取消代理
npm config delete proxy
npm config delete https-proxy
# 或者直接运行
npm install --registry=https://registry.npm.taobao.org -g bash-language-servergem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/[http "https://github.com"]
# no need to setup https for github
# http proxy
proxy = http://127.0.0.1:7890
# or can use socks5 proxy
#proxy = socks5://127.0.0.1:7891
[https]
proxy = https://127.0.0.1:7890
#https://raw.githubusercontent.com/double12gzh/dotfiles/main/ssh/.ssh/config
#https://raw.githubusercontent.com/double12gzh/dotfiles/main/git/.config/git/config
#https://gist.github.com/laispace/666dd7b27e9116faece6
https://stackoverflow.com/questions/70603564/windows-ssh-proxycommand-usr-bin-bash-line-0-exec-nc-not-found-on-git-bashadd the following to ~/.ssh/config and run cmd ssh -vvv -T git@github.com with debug
Host github.com
User git
Port 443
Hostname ssh.github.com
# http proxy
#ProxyCommand connect -S 127.0.0.1:7890 %h %p
#socks5 proxy
ProxyCommand nc -X 5 -x 127.0.0.1:7891 %h %p
IdentityFile ~/.ssh/id_rsa
TCPKeepAlive yes
Host ssh.github.com
User git
Port 443
Hostname ssh.github.com
TCPKeepAlive yes
IdentityFile ~/.ssh/id_rsa
PreferredAuthentications publickey
# http proxy
#ProxyCommand connect -S 127.0.0.1:7890 %h %p
#socks5 proxy
ProxyCommand nc -X 5 -x 127.0.0.1:7891 %h %p
Host *
# 共享连接
ControlMaster auto
# 与上述 ControlMaster 同时使用时,指定连接共享的路径
ControlPath ~/.ssh/master-%r@%h:%p
# 在后台保持打开
ControlPersist yes
ServerAliveInterval 60
IdentityFile ~/.ssh/id_rsa
HostKeyAlgorithms +ssh-dss
# http proxy
#ProxyCommand connect -S 127.0.0.1:7890 %h %p
#socks5 proxy
ProxyCommand nc -X 5 -x 127.0.0.1:7891 %h %p
# http://man.openbsd.org/ssh_config.5
# https://gist.github.com/laispace/666dd7b27e9116faece6
# https://gist.github.com/evantoli/f8c23a37eb3558ab8765在 Ubuntu 上安装 Nerd Fonts,你可以按照以下步骤操作:
打开终端。
下载你想要的 Nerd Font。例如,如果你想要下载 Fira Code Nerd Font,你可以运行以下命令:
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip
3. 解压下载的字体文件:
unzip FiraCode.zip
4. 创建一个 .fonts 目录(如果还没有的话)并将字体文件移动到这个目录:
mkdir -p ~/.fonts
mv *.ttf ~/.fonts/
5. 更新字体缓存:
fc-cache -fv
6. 现在,你应该可以在你的终端或文本编辑器的字体设置中看到新安装的 Nerd Font 了。
注意:你需要将上述命令中的 FiraCode.zip 替换为你实际下载的字体文件的名称。你可以在 Nerd Fonts 的 GitHub 仓库的 "Releases" 页面找到所有可用的字体。Nerd Fonts 是一种特殊的字体集,它包含了一些常用的符号和图标,如 FontAwesome、Devicons、Octicons、Weather Icons 等。这些字体非常适合在终端、编辑器和 IDE 中使用。
要在 macOS 上安装 Nerd Fonts,你可以使用 Homebrew。以下是具体步骤:
如果你还没有安装 Homebrew,你可以在终端中运行以下命令来安装:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. 安装 Homebrew 的字体管理器 cask:
brew tap homebrew/cask-fonts
3. 使用 cask 安装 Nerd Fonts。例如,如果你想安装 Fira Code Nerd Font,你可以运行以下命令:
brew install --cask font-fira-code-nerd-font
4. 安装完成后,你可能需要重启你的终端或者整个系统,以便系统能够识别新安装的字体。
5. 最后,你需要在你的终端模拟器的设置中选择 Nerd Font。具体的步骤取决于你使用的终端模拟器。通常,你需要打开终端模拟器的设置,找到字体设置,然后选择 Nerd Font。
注意:Nerd Fonts 包含了很多种字体,你可以在 Nerd Fonts 的官方网站上查看所有可用的字体,并选择你喜欢的字体进行安装。local icons = {}
local data = {
kind = {
Class = "",
Color = "",
Constant = "",
Constructor = "",
Enum = "",
EnumMember = "",
Event = "",
Field = "",
File = "",
Folder = "",
Fragment = "",
Function = "",
Interface = "",
Implementation = "",
Keyword = "",
Method = "",
Module = "",
Namespace = "",
Number = "",
Operator = "",
Package = "",
Property = "",
Reference = "",
Snippet = "",
Struct = "",
Text = "",
TypeParameter = "",
Undefined = "",
Unit = "",
Value = "",
Variable = "",
-- ccls-specific icons.
TypeAlias = "",
Parameter = "",
StaticMethod = "",
Macro = "",
},
type = {
Array = "",
Boolean = "",
Null = "",
Number = "",
Object = "",
String = "",
},
documents = {
Default = "",
File = "",
Files = "",
FileTree = "",
Import = "",
Symlink = "",
},
git = {
Add = "",
Branch = "",
Diff = "",
Git = "",
Ignore = "",
Mod = "M",
Mod_alt = "",
Remove = "",
Rename = "",
Repo = "",
Unmerged = "",
Untracked = "",
Unstaged = "",
Staged = "",
Conflict = "",
},
ui = {
Accepted = "",
ArrowClosed = "",
ArrowOpen = "",
BigCircle = "",
BigUnfilledCircle = "",
BookMark = "",
Bug = "",
Calendar = "",
Check = "",
ChevronRight = "",
Circle = "",
Close = "",
Close_alt = "",
CloudDownload = "",
Comment = "",
CodeAction = "",
Dashboard = "",
Emoji = "",
EmptyFolder = "",
EmptyFolderOpen = "",
File = "",
Fire = "",
Folder = "",
FolderOpen = "",
FolderWithHeart = "",
Gear = "",
History = "",
Incoming = "",
Indicator = "",
Keyboard = "",
Left = "",
List = "",
-- Square = "", -- https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/DejaVuSansMono
Square = "",
SymlinkFolder = "",
Lock = "",
Modified = "✥",
Modified_alt = "",
NewFile = "",
Newspaper = "",
Note = "",
Outgoing = "",
Package = "",
Pencil = "",
Perf = "",
Play = "",
Project = "",
Right = "",
-- RootFolderOpened = "", -- https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/DejaVuSansMono
-- RootFolderOpened = "",
-- Search = "",
RootFolderOpened = "",
Search = "",
Separator = "",
DoubleSeparator = "",
SignIn = "",
SignOut = "",
Sort = "",
Spell = "",
Symlink = "",
Tab = "",
Table = "",
Telescope = "",
},
diagnostics = {
Error = "",
Warning = "",
Information = "",
Question = "",
Hint = "",
-- Holo version
Error_alt = "",
Warning_alt = "",
Information_alt = "",
Question_alt = "",
Hint_alt = "",
},
misc = {
Campass = "",
Code = "",
EscapeST = "",
Gavel = "",
Glass = "",
PyEnv = "",
Squirrel = "",
Tag = "",
Tree = "",
Watch = "",
Lego = "",
LspAvailable = "",
Vbar = "│",
Add = "+",
Added = "",
Ghost = "",
ManUp = "",
Vim = "",
},
cmp = {
Codeium = "",
TabNine = "",
Copilot = "",
Copilot_alt = "",
-- Add source-specific icons here
buffer = "",
cmp_tabnine = "",
codeium = "",
copilot = "",
copilot_alt = "",
latex_symbols = "",
luasnip = "",
nvim_lsp = "",
nvim_lua = "",
orgmode = "",
path = "",
spell = "",
tmux = "",
treesitter = "",
undefined = "",
},
dap = {
Breakpoint = "",
BreakpointCondition = "",
BreakpointRejected = "",
LogPoint = "",
Pause = "",
Play = "",
RunLast = "↻",
StepBack = "",
StepInto = "",
StepOut = "",
StepOver = "",
Stopped = "",
Terminate = "",
},
}
---Get a specific icon set.
---@param category "kind"|"type"|"documents"|"git"|"ui"|"diagnostics"|"misc"|"cmp"|"dap"
---@param add_space? boolean @Add trailing space after the icon.
function icons.get(category, add_space)
if add_space then
return setmetatable({}, {
__index = function(_, key)
return data[category][key] .. " "
end,
})
else
return data[category]
end
end
return iconsreturn function()
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
require("modules.utils").gen_alpha_hl()
dashboard.section.header.val = {
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣴⣶⣶⣶⣶⣶⠶⣶⣤⣤⣀⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⠁⠀⢀⠈⢿⢀⣀⠀⠹⣿⣿⣿⣦⣄⠀⠀⠀ ]],
[[ ⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⠿⠀⠀⣟⡇⢘⣾⣽⠀⠀⡏⠉⠙⢛⣿⣷⡖⠀ ]],
[[ ⠀⠀⠀⠀⠀⣾⣿⣿⡿⠿⠷⠶⠤⠙⠒⠀⠒⢻⣿⣿⡷⠋⠀⠴⠞⠋⠁⢙⣿⣄ ]],
[[ ⠀⠀⠀⠀⢸⣿⣿⣯⣤⣤⣤⣤⣤⡄⠀⠀⠀⠀⠉⢹⡄⠀⠀⠀⠛⠛⠋⠉⠹⡇ ]],
[[ ⠀⠀⠀⠀⢸⣿⣿⠀⠀⠀⣀⣠⣤⣤⣤⣤⣤⣤⣤⣼⣇⣀⣀⣀⣛⣛⣒⣲⢾⡷ ]],
[[ ⢀⠤⠒⠒⢼⣿⣿⠶⠞⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⣼⠃ ]],
[[ ⢮⠀⠀⠀⠀⣿⣿⣆⠀⠀⠻⣿⡿⠛⠉⠉⠁⠀⠉⠉⠛⠿⣿⣿⠟⠁⠀⣼⠃⠀ ]],
[[ ⠈⠓⠶⣶⣾⣿⣿⣿⣧⡀⠀⠈⠒⢤⣀⣀⡀⠀⠀⣀⣀⡠⠚⠁⠀⢀⡼⠃⠀⠀ ]],
[[ ⠀⠀⠀⠈⢿⣿⣿⣿⣿⣿⣷⣤⣤⣤⣤⣭⣭⣭⣭⣭⣥⣤⣤⣤⣴⣟⠁ ]],
}
dashboard.section.header.opts.hl = "AlphaHeader"
local function button(sc, txt, leader_txt, keybind, keybind_opts)
local sc_after = sc:gsub("%s", ""):gsub(leader_txt, "<leader>")
local opts = {
position = "center",
shortcut = sc,
cursor = 5,
width = 50,
align_shortcut = "right",
hl = "AlphaButtons",
hl_shortcut = "AlphaShortcut",
}
if nil == keybind then
keybind = sc_after
end
keybind_opts = vim.F.if_nil(keybind_opts, { noremap = true, silent = true, nowait = true })
opts.keymap = { "n", sc_after, keybind, keybind_opts }
local function on_press()
-- local key = vim.api.nvim_replace_termcodes(keybind .. '<Ignore>', true, false, true)
local key = vim.api.nvim_replace_termcodes(sc_after .. "<Ignore>", true, false, true)
vim.api.nvim_feedkeys(key, "t", false)
end
return {
type = "button",
val = txt,
on_press = on_press,
opts = opts,
}
end
local leader = " "
dashboard.section.buttons.val = {
button("space f c", " Scheme change", leader, nil, {
noremap = true,
silent = true,
nowait = true,
callback = function()
require("telescope.builtin").colorscheme()
end,
}),
button("space f r", " File frecency", leader, nil, {
noremap = true,
silent = true,
nowait = true,
callback = function()
require("telescope").extensions.frecency.frecency()
end,
}),
button("space f e", " File history", leader, nil, {
noremap = true,
silent = true,
nowait = true,
callback = function()
require("telescope.builtin").oldfiles()
end,
}),
button("space f p", " Project find", leader, nil, {
noremap = true,
silent = true,
nowait = true,
callback = function()
require("telescope").extensions.projects.projects({})
end,
}),
button("space f f", " File find", leader, nil, {
noremap = true,
silent = true,
nowait = true,
callback = function()
require("telescope.builtin").find_files()
end,
}),
button("space f n", " File new", leader, nil, {
noremap = true,
silent = true,
nowait = true,
callback = function()
vim.api.nvim_command("enew")
end,
}),
button("space f w", " Word find", leader, nil, {
noremap = true,
silent = true,
nowait = true,
callback = function()
require("telescope.builtin").live_grep()
end,
}),
}
dashboard.section.buttons.opts.hl = "AlphaButtons"
local function footer()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return " Have Fun with neovim"
.. " v"
.. vim.version().major
.. "."
.. vim.version().minor
.. "."
.. vim.version().patch
.. " "
.. stats.count
.. " plugins in "
.. ms
.. "ms"
end
dashboard.section.footer.val = footer()
dashboard.section.footer.opts.hl = "AlphaFooter"
local head_butt_padding = 2
local occu_height = #dashboard.section.header.val + 2 * #dashboard.section.buttons.val + head_butt_padding
local header_padding = math.max(0, math.ceil((vim.fn.winheight("$") - occu_height) * 0.25))
local foot_butt_padding = 1
dashboard.config.layout = {
{ type = "padding", val = header_padding },
dashboard.section.header,
{ type = "padding", val = head_butt_padding },
dashboard.section.buttons,
{ type = "padding", val = foot_butt_padding },
dashboard.section.footer,
}
alpha.setup(dashboard.opts)
vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimStarted",
callback = function()
dashboard.section.footer.val = footer()
pcall(vim.cmd.AlphaRedraw)
end,
})
end