Compare commits

...

22 Commits

Author SHA1 Message Date
11839bf6a3 chore(main): release 0.4.0-alpha (#74)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-01-20 15:15:18 +01:00
2a440a1a06 chore(build): auto-generate vimdoc 2023-01-20 14:14:36 +00:00
354416f3d5 build: ugly code for generating lazyvim.github.io :) 2023-01-20 15:13:22 +01:00
5d3e126b63 feat(lsp): ignore lsp servers where setting is set to false 2023-01-19 22:10:38 +01:00
3362f0abc4 feat(buffer)!: remove <leader>b[, <leader>b] in favor of ]b and [b 2023-01-19 14:16:03 +01:00
c2693e2d16 feat(keymaps): added [b and ]b to switch buffers 2023-01-19 13:59:49 +01:00
dc3db065a8 chore(build): auto-generate vimdoc 2023-01-19 12:54:37 +00:00
6e2a462a78 refactor(build): publish with docusaurus 2023-01-19 13:53:30 +01:00
bb4e924bca docs: fixed release shield 2023-01-19 13:53:30 +01:00
46c0948174 chore(build): auto-generate vimdoc 2023-01-19 12:51:20 +00:00
87ec3af110 docs: updated readme 2023-01-19 13:50:31 +01:00
e6455b01a2 chore(build): auto-generate vimdoc 2023-01-18 07:37:55 +00:00
fe4b92492c fix(lsp): there is no declaration in telescope, use vim.lsp (#78) 2023-01-18 08:37:06 +01:00
895c5d8dd0 chore(build): auto-generate vimdoc 2023-01-17 15:48:36 +00:00
709181113d docs: updated keymaps 2023-01-17 16:47:48 +01:00
ba0040230e refactor(treesitter)!: use <bs> in visual mode to shrink delection. Fixes #71 2023-01-17 14:44:52 +01:00
201a3d171e chore(main): release 0.3.0-alpha (#73)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-01-17 14:37:32 +01:00
88c112fc3a refactor(todo)!: <leader>xtt => <leader>xT 2023-01-17 14:22:09 +01:00
7563b361b8 refactor(todo)!: moved search todo to <leader>st 2023-01-17 14:21:39 +01:00
254d3a0921 refactor(telescope)!: moved search diagnostics to <leader>sd 2023-01-17 14:20:58 +01:00
2d3137e1db chore(build): auto-generate vimdoc 2023-01-17 08:17:55 +00:00
8d8626c5d9 fix(keymaps): added Inspect to <leader>ui 2023-01-17 09:17:04 +01:00
10 changed files with 359 additions and 1343 deletions

View File

@ -1,5 +1,49 @@
# Changelog
## [0.4.0-alpha](https://github.com/LazyVim/LazyVim/compare/v0.3.0-alpha...v0.4.0-alpha) (2023-01-20)
### ⚠ BREAKING CHANGES
* **buffer:** remove `<leader>b[`, `<leader>b]` in favor of `]b` and `[b`
* **treesitter:** use `<bs>` in visual mode to shrink delection. Fixes #71
### Features
* **buffer:** remove `&lt;leader&gt;b[`, `<leader>b]` in favor of `]b` and `[b` ([3362f0a](https://github.com/LazyVim/LazyVim/commit/3362f0abc4a70c82dc1ea81fca169e14bbb61c6a))
* **keymaps:** added `[b` and `]b` to switch buffers ([c2693e2](https://github.com/LazyVim/LazyVim/commit/c2693e2d16ffc7f082d7b22b0da2d448a34b3778))
* **lsp:** ignore lsp servers where setting is set to `false` ([5d3e126](https://github.com/LazyVim/LazyVim/commit/5d3e126b63c3ebebc01cf7f847464562c553bf32))
### Bug Fixes
* **lsp:** there is no declaration in telescope, use vim.lsp ([#78](https://github.com/LazyVim/LazyVim/issues/78)) ([fe4b924](https://github.com/LazyVim/LazyVim/commit/fe4b92492ca1c8bba826609ed2c34fd927068e0e))
### Code Refactoring
* **treesitter:** use `&lt;bs&gt;` in visual mode to shrink delection. Fixes [#71](https://github.com/LazyVim/LazyVim/issues/71) ([ba00402](https://github.com/LazyVim/LazyVim/commit/ba0040230e56edb04ca26702f0816392a87405fd))
## [0.3.0-alpha](https://github.com/LazyVim/LazyVim/compare/v0.2.2-alpha...v0.3.0-alpha) (2023-01-17)
### ⚠ BREAKING CHANGES
* **todo:** `<leader>xtt` => `<leader>xT`
* **todo:** moved search todo to `<leader>st`
* **telescope:** moved search diagnostics to `<leader>sd`
### Bug Fixes
* **keymaps:** added Inspect to `&lt;leader&gt;ui` ([8d8626c](https://github.com/LazyVim/LazyVim/commit/8d8626c5d91ed0d5125dd2560271600c35bcf485))
### Code Refactoring
* **telescope:** moved search diagnostics to `&lt;leader&gt;sd` ([254d3a0](https://github.com/LazyVim/LazyVim/commit/254d3a092184b4327049ac7a0bc5202673f92c64))
* **todo:** `&lt;leader&gt;xtt` => `<leader>xT` ([88c112f](https://github.com/LazyVim/LazyVim/commit/88c112fc3ae298fe3a0414a689cbd715db0ad2e3))
* **todo:** moved search todo to `&lt;leader&gt;st` ([7563b36](https://github.com/LazyVim/LazyVim/commit/7563b361b8d7f62a75a6eb4e234326773ffbc89b))
## [0.2.2-alpha](https://github.com/LazyVim/LazyVim/compare/v0.2.1-alpha...v0.2.2-alpha) (2023-01-16)

695
README.md

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -27,11 +27,16 @@ vim.keymap.set("v", "<A-k>", ":m '<-2<cr>gv=gv", { desc = "Move up" })
vim.keymap.set("i", "<A-k>", "<Esc>:m .-2<cr>==gi", { desc = "Move up" })
-- buffers
if not Util.has("nvim-bufferline.lua") then
if Util.has("nvim-bufferline.lua") then
vim.keymap.set("n", "<S-h>", "<cmd>BufferLineCyclePrev<cr>", { desc = "Prev buffer" })
vim.keymap.set("n", "<S-l>", "<cmd>BufferLineCycleNext<cr>", { desc = "Next buffer" })
vim.keymap.set("n", "[b", "<cmd>BufferLineCyclePrev<cr>", { desc = "Prev buffer" })
vim.keymap.set("n", "]b", "<cmd>BufferLineCycleNext<cr>", { desc = "Next buffer" })
else
vim.keymap.set("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev buffer" })
vim.keymap.set("n", "<S-l>", "<cmd>bnext<cr>", { desc = "Next buffer" })
vim.keymap.set("n", "<leader>b[", "<cmd>bprevious<cr>", { desc = "Previous" })
vim.keymap.set("n", "<leader>b]", "<cmd>bnext<cr>", { desc = "Next" })
vim.keymap.set("n", "[b", "<cmd>bprevious<cr>", { desc = "Prev buffer" })
vim.keymap.set("n", "]b", "<cmd>bnext<cr>", { desc = "Next buffer" })
end
vim.keymap.set("n", "<leader>bb", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" })
vim.keymap.set("n", "<leader>`", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" })
@ -100,7 +105,7 @@ vim.keymap.set("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit all" })
-- highlights under cursor
if vim.fn.has("nvim-0.9.0") == 1 then
vim.keymap.set("n", "<leader>sH", vim.show_pos, { desc = "Highlight Groups at cursor" })
vim.keymap.set("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
end
-- floating terminal

View File

@ -66,6 +66,7 @@ return {
{ "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Buffer" },
{ "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Command History" },
{ "<leader>sC", "<cmd>Telescope commands<cr>", desc = "Commands" },
{ "<leader>sd", "<cmd>Telescope diagnostics<cr>", desc = "Diagnostics" },
{ "<leader>sg", Util.telescope("live_grep"), desc = "Grep (root dir)" },
{ "<leader>sG", Util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" },
{ "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "Help Pages" },
@ -74,7 +75,6 @@ return {
{ "<leader>sM", "<cmd>Telescope man_pages<cr>", desc = "Man Pages" },
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Jump to Mark" },
{ "<leader>so", "<cmd>Telescope vim_options<cr>", desc = "Options" },
{ "<leader>st", "<cmd>Telescope builtin<cr>", desc = "Telescope" },
{ "<leader>sw", Util.telescope("grep_string"), desc = "Word (root dir)" },
{ "<leader>sW", Util.telescope("grep_string", { cwd = false }), desc = "Word (cwd)" },
{ "<leader>uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" },
@ -253,9 +253,9 @@ return {
keys = {
{ "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" },
{ "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" },
{ "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Todo Trouble" },
{ "<leader>xtt", "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>", desc = "Todo Trouble" },
{ "<leader>xT", "<cmd>TodoTelescope<cr>", desc = "Todo Telescope" },
{ "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Todo (Trouble)" },
{ "<leader>xT", "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme (Trouble)" },
{ "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" },
},
},
}

View File

@ -28,6 +28,7 @@ return {
formatting_options = nil,
timeout_ms = nil,
},
-- LSP Server Settings
---@type lspconfig.options
servers = {
jsonls = {},
@ -88,6 +89,9 @@ return {
require("mason-lspconfig").setup({ ensure_installed = vim.tbl_keys(servers) })
require("mason-lspconfig").setup_handlers({
function(server)
if servers[server] == false then
return
end
local server_opts = servers[server] or {}
server_opts.capabilities = capabilities
if opts.setup[server] then

View File

@ -5,10 +5,9 @@ function M.on_attach(client, buffer)
self:map("<leader>cd", vim.diagnostic.open_float, { desc = "Line Diagnostics" })
self:map("<leader>cl", "LspInfo", { desc = "Lsp Info" })
self:map("<leader>xd", "Telescope diagnostics", { desc = "Telescope Diagnostics" })
self:map("gd", "Telescope lsp_definitions", { desc = "Goto Definition" })
self:map("gr", "Telescope lsp_references", { desc = "References" })
self:map("gD", "Telescope lsp_declarations", { desc = "Goto Declaration" })
self:map("gD", vim.lsp.buf.declaration, { desc = "Goto Declaration" })
self:map("gI", "Telescope lsp_implementations", { desc = "Goto Implementation" })
self:map("gt", "Telescope lsp_type_definitions", { desc = "Goto Type Definition" })
self:map("K", vim.lsp.buf.hover, { desc = "Hover" })

View File

@ -6,7 +6,7 @@ return {
event = "BufReadPost",
keys = {
{ "<c-space>", desc = "Increment selection" },
{ "<c-bs>", desc = "Schrink selection" },
{ "<bs>", desc = "Schrink selection", mode = "x" },
},
---@type TSConfig
opts = {
@ -35,8 +35,8 @@ return {
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<C-bs>",
scope_incremental = "<nop>",
node_decremental = "<bs>",
},
},
},

View File

@ -1,5 +1,5 @@
return {
-- better vim.notify
-- Better `vim.notify()`
{
"rcarriga/nvim-notify",
keys = {
@ -44,12 +44,6 @@ return {
{
"akinsho/nvim-bufferline.lua",
event = "VeryLazy",
init = function()
vim.keymap.set("n", "<s-h>", "<cmd>BufferLineCyclePrev<cr>", { desc = "Prev Buffer" })
vim.keymap.set("n", "<s-l>", "<cmd>BufferLineCycleNext<cr>", { desc = "Next Buffer" })
vim.keymap.set("n", "<leader>b[", "<cmd>BufferLineCyclePrev<cr>", { desc = "Previous" })
vim.keymap.set("n", "<leader>b]", "<cmd>BufferLineCycleNext<cr>", { desc = "Next" })
end,
opts = {
options = {
diagnostics = "nvim_lsp",

View File

@ -1,8 +1,9 @@
-- Ugly code to generate some things for the readme
local Docs = require("lazy.docs")
local Util = require("lazy.util")
local M = {}
local root = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":h:h:h:h")
local root = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":p:h:h:h:h")
---@return ReadmeBlock
function M.keymaps()
@ -59,7 +60,7 @@ function M.keymaps()
local lines = {}
for _, group in ipairs(groups) do
lines[#lines + 1] = "<details><summary>" .. group .. "</summary>"
lines[#lines + 1] = "## " .. group
lines[#lines + 1] = ""
vim.list_extend(lines, { "| Key | Description | Mode |", "| --- | --- | --- |" })
local mappings = vim.tbl_filter(function(m)
@ -85,44 +86,72 @@ function M.keymaps()
.. " |"
end
lines[#lines + 1] = ""
lines[#lines + 1] = "</details>"
lines[#lines + 1] = ""
end
return { content = table.concat(lines, "\n") }
end
function M.update()
local Docs = require("lazy.docs")
---@type table<string, ReadmeBlock>
local data = {
function M.general()
local lines = {
[[
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
]],
} ---@type string[]
for _, entry in ipairs({
{ name = "options", title = "Options" },
{ name = "keymaps", title = "Keymaps" },
{ name = "autocmds", title = "Auto Commands" },
}) do
local name, title = entry.name, entry.title
lines[#lines + 1] = "## " .. title
vim.list_extend(lines, {
"",
"<Tabs>",
([[<TabItem value="custom" label="Custom %s">]]):format(title),
"",
([[```lua title="lua/config/%s.lua"
%s
```]]):format(
name,
Util.read_file(vim.fn.fnamemodify(root .. "/../LazyVim-starter/lua/config/" .. name .. ".lua", ":p"))
),
"",
"</TabItem>",
([[<TabItem value="defaults" label="Default %s">]]):format(title),
"",
([[```lua title="lazyvim.config.%s"
%s
```]]):format(name, Util.read_file(vim.fn.fnamemodify(root .. "/lua/lazyvim/config/" .. name .. ".lua", ":p"))),
"",
"</TabItem>",
"</Tabs>",
"",
})
end
return { content = table.concat(lines, "\n") }
end
function M.update2()
local docs = vim.fs.normalize("~/projects/lazyvim.github.io/docs")
Docs.save({
general = M.general(),
}, docs .. "/configuration/general.md")
Docs.save({
keymaps = M.keymaps(),
config = Docs.extract("lua/lazyvim/config/init.lua", "\nlocal defaults = ({.-\n})"),
}
local core = require("lazy.core.plugin").Spec.new({ import = "lazyvim.plugins" })
---@type string[]
local plugins = {
"<details><summary>Core</summary>",
"",
Docs.plugins(core.plugins).content,
"",
"</details>",
"",
}
}, docs .. "/keymaps.md")
Util.walk(root .. "/lua/lazyvim/plugins/extras", function(path, name, type)
if type == "file" and name:find("%.lua$") then
local modname = path:gsub(".*/lua/", ""):gsub("/", "."):gsub("%.lua$", "")
local spec = require("lazy.core.plugin").Spec.new({ import = modname })
spec:fix_disabled()
vim.list_extend(plugins, {
("<details><summary>Extras: <code>%s</code></summary>"):format(modname:gsub(".*extras%.", "")),
local lines = {} ---@type string[]
vim.list_extend(lines, {
"",
([[
To use this, add it to your **lazy.nvim** imports:
```lua
```lua title="lua/config/lazy.lua"
require("lazy").setup({
spec = {
{ "folke/LazyVim", import = "lazyvim.plugins" },
@ -132,19 +161,152 @@ require("lazy").setup({
})
```
]]):format(modname),
Docs.plugins(spec.plugins).content,
"",
"</details>",
M.plugins("extras/" .. path:gsub(".*/extras/", "")).content,
"",
})
Docs.save({
plugins = { content = table.concat(lines, "\n") },
}, docs .. "/plugins/extras/" .. modname:gsub(".*extras%.", "") .. ".md")
end
end)
data.plugins = { content = table.concat(plugins, "\n") }
local examples = vim.fn.fnamemodify(root .. "/../LazyVim-starter/lua/plugins/example.lua", ":p")
data.examples = Util.read_file(examples):gsub("^[^\n]+\n[^\n]+\n[^\n]+\n", "")
Docs.save(data)
Docs.save({
examples = Util.read_file(examples):gsub("^[^\n]+\n[^\n]+\n[^\n]+\n", ""),
}, docs .. "/configuration/examples.md")
Docs.save({
plugins = M.plugins("lsp/init.lua"),
}, docs .. "/plugins/lsp.md")
for _, p in ipairs({ "coding", "colorscheme", "editor", "treesitter", "ui", "util" }) do
Docs.save({
plugins = M.plugins(p .. ".lua"),
}, docs .. "/plugins/" .. p .. ".md")
end
end
M.update()
function M.plugins(path)
local test = root .. "/lua/lazyvim/plugins/" .. path
local spec = require("lazy.core.plugin").Spec.new(dofile(test))
local source = Util.read_file(test)
local parser = vim.treesitter.get_string_parser(source, "lua")
---@type {code: string, opts: string, name: string, comment?:string, url: string}[]
local plugins = {}
local function get_text(node)
return Docs.fix_indent(vim.treesitter.get_node_text(node, source))
end
local function get_field(node, field)
for child in node:iter_children() do
if child:type() == "field" then
local name_node = child:field("name")[1]
if name_node and get_text(name_node) == field then
return child:field("value")[1]
end
end
end
end
local function find_plugins(node)
if node:type() == "string" then
local text = vim.treesitter.query.get_node_text(node, source):sub(2, -2)
if text:find("/") and #node:parent():field("name") == 0 then
local plugin_node = node:parent():parent()
if plugin_node:named_child(0):field("value")[1]:id() ~= node:id() then
plugin_node = node
end
local comment_node = plugin_node:parent():prev_named_sibling()
if comment_node and comment_node:type() ~= "comment" then
comment_node = nil
end
local opts_node = get_field(plugin_node, "opts")
local name_node = get_field(plugin_node, "name")
local name = name_node and get_text(name_node):sub(2, -2) or text:match("/(.*)$")
if spec.plugins[name] then
plugins[#plugins + 1] = {
name = name,
url = "https://github.com/" .. text,
code = get_text(plugin_node),
comment = comment_node and get_text(comment_node) or nil,
opts = opts_node and get_text(opts_node) or get_field(plugin_node, "config") and "{}" or nil,
}
end
end
end
for child in node:iter_children() do
find_plugins(child)
end
end
parser:parse()
parser:for_each_tree(function(tree)
local node = tree:root()
find_plugins(node)
-- print(vim.treesitter.query.get_node_text(node, str))
end)
---@type string[]
local lines = {
[[
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
]],
}
for _, plugin in ipairs(plugins) do
lines[#lines + 1] = "## [" .. plugin.name .. "](" .. plugin.url .. ")"
if plugin.comment then
lines[#lines + 1] = ""
lines[#lines + 1] = table.concat(
vim.tbl_map(function(line)
return line:gsub("^%-+", "")
end, vim.split(plugin.comment, "\n")),
"\n"
)
lines[#lines + 1] = ""
end
vim.list_extend(lines, {
"",
"<Tabs>",
})
vim.list_extend(lines, {
"",
[[<TabItem value="opts" label="Options">]],
"",
"```lua",
"opts = " .. (plugin.opts or "nil"),
"```",
"",
"</TabItem>",
"",
})
vim.list_extend(lines, {
"",
[[<TabItem value="code" label="Full Spec">]],
"",
"```lua",
plugin.code,
"```",
"",
"</TabItem>",
"",
})
vim.list_extend(lines, {
"</Tabs>",
"",
})
end
return { content = table.concat(lines, "\n") }
end
-- M.extract_opts("neovim/nvim-lspconfig")
M.update2()
return M