yihong0618 和朋友们的频道 头像

消息来源频道

yihong0618 和朋友们的频道

@hyi0618

频道8,612 位成员公开可见0 人在线

yihong0618 和朋友们的频道

成员规模8,612 位成员
在线情况0 人在线
消息总数10,129 条消息
浏览量总数3,285,753 次浏览

在这个频道里搜索消息……

t.me/hyi0618

TIL:
Link: https://github.com/jbranchaud/til/blob/master/neovim/create-user-command-to-open-init-config.md
📌 Create User Command To Open Init Config
I'm experimenting with a fresh Neovim configuration using
kickstart. That means I'm
frequently navigating to my init.lua file to add and adjust things that I
find are missing from my workflow.
I got tired of typing out the path—in my case ~/.config/nvim/init.lua—every
single time I wanted to edit it. So, I typed out that path one last time so
that I could add a custom user command.
-- Open this config file
vim.api.nvim_create_user_command(
'Config',
"e ~/.config/nvim/init.lua",
{bang = true, desc = "Open init.lua Neovim config"}
)
This uses the lua command API to create a user-defined
command.
When I invoke :Config from the Neovim command prompt and hit enter, Neovim
will effectively replace that command with the second argument to that command
— :e ~/.config/nvim/init.lua. Which opens me up to the config file.