Browse Source

chore: format source code

my-config
github-actions[bot] 2 years ago
parent
commit
8506cbcdaa
  1. 2
      init.lua
  2. 10
      lua/doom/core/doom_global.lua
  3. 5
      lua/doom/core/functions.lua
  4. 6
      lua/doom/modules/core/reloader/init.lua
  5. 130
      lua/doom/modules/core/updater/init.lua
  6. 5
      lua/doom/modules/features/extra_snippets/init.lua
  7. 9
      lua/doom/modules/features/linter/init.lua
  8. 15
      lua/doom/modules/features/lsp/init.lua
  9. 5
      lua/doom/modules/features/repl/init.lua
  10. 7
      lua/doom/modules/features/statusline/init.lua
  11. 24
      lua/doom/modules/langs/vue/init.lua
  12. 14
      lua/doom/utils/init.lua
  13. 9
      lua/doom/utils/logging.lua
  14. 50
      modules.lua

2
init.lua

@ -8,7 +8,7 @@ if vim.fn.has("nvim-0.6.0") ~= 1 then
end
-- Makes sure ~/.local/share/nvim exists, to prevent problems with logging
vim.fn.mkdir(vim.fn.stdpath("data"), 'p')
vim.fn.mkdir(vim.fn.stdpath("data"), "p")
-- Add ~/.local/share to runtimepath early, such that
-- neovim autoloads plugin/packer_compiled.lua along with vimscript,

10
lua/doom/core/doom_global.lua

@ -166,11 +166,11 @@ doom = {
-- @default = false
use_floating_win_packer = false,
-- Set max cols
-- Defines the column to show a vertical marker
-- Set to false to disable
-- @default = 80
max_columns = 80,
-- Set max cols
-- Defines the column to show a vertical marker
-- Set to false to disable
-- @default = 80
max_columns = 80,
-- Default indent size
-- @default = 4

5
lua/doom/core/functions.lua

@ -178,9 +178,8 @@ end
-- Set the indent and tab related numbers.
-- Negative numbers mean tabstop -- Really though? Tabs?
functions.set_indent = function()
local indent = tonumber(
vim.fn.input("Set indent (>0 uses spaces, <0 uses tabs, 0 uses vim defaults): ")
)
local indent =
tonumber(vim.fn.input("Set indent (>0 uses spaces, <0 uses tabs, 0 uses vim defaults): "))
if not indent then
indent = -8
end

6
lua/doom/modules/core/reloader/init.lua

@ -122,7 +122,7 @@ reloader._reload_doom = function()
return t[1]
end, doom.packages)
local needs_install = vim.deep_equal(modules, old_modules)
and vim.deep_equal(packages, old_packages)
and vim.deep_equal(packages, old_packages)
if needs_install then
if not _G._doom_reloader._has_shown_packer_compile_message then
log.warn(
@ -151,8 +151,8 @@ reloader.reload = function()
log.info(
"Reloaded Doom in "
.. vim.fn.printf("%.3f", vim.fn.reltimefloat(vim.fn.reltime(reload_time)))
.. " seconds"
.. vim.fn.printf("%.3f", vim.fn.reltimefloat(vim.fn.reltime(reload_time)))
.. " seconds"
)
end

130
lua/doom/modules/core/updater/init.lua

@ -39,19 +39,17 @@ updater._cwd = vim.fn.stdpath("config")
---@param callback function Handler to receive the list of versions
updater._pull_tags = function(callback)
local Job = require("plenary.job")
Job
:new({
command = "git",
args = { "fetch", "--tags", "--all" },
cwd = updater._cwd,
on_exit = function(j, exit_code)
if exit_code ~= 0 then
callback(nil, "Error pulling tags... \n\n " .. vim.inspect(j.result()))
end
callback(j:result())
end,
})
:start()
Job:new({
command = "git",
args = { "fetch", "--tags", "--all" },
cwd = updater._cwd,
on_exit = function(j, exit_code)
if exit_code ~= 0 then
callback(nil, "Error pulling tags... \n\n " .. vim.inspect(j.result()))
end
callback(j:result())
end,
}):start()
end
--- Gets the current commit sha or error
@ -59,24 +57,22 @@ end
updater._get_commit_sha = function(callback)
local Job = require("plenary.job")
Job
:new({
command = "git",
args = { "rev-parse", "HEAD" },
on_exit = function(j, exit_code)
if exit_code ~= 0 then
callback(nil, "Error getting current commit... \n\n" .. vim.inspect(j:result()))
return
end
local result = j:result()
if #result == 1 then
callback(result[1])
else
callback(nil, "Error getting current commit... No output.")
end
end,
})
:start()
Job:new({
command = "git",
args = { "rev-parse", "HEAD" },
on_exit = function(j, exit_code)
if exit_code ~= 0 then
callback(nil, "Error getting current commit... \n\n" .. vim.inspect(j:result()))
return
end
local result = j:result()
if #result == 1 then
callback(result[1])
else
callback(nil, "Error getting current commit... No output.")
end
end,
}):start()
end
--- Given a version string, checks if it's an alpha/beta version
@ -116,25 +112,23 @@ end
---@param callback function(version_tag, error_string)
updater._get_last_version_for_commit = function(commit_sha, callback)
local Job = require("plenary.job")
Job
:new({
command = "git",
args = { "tag", "-l", "--sort", "-version:refname", "--merged", commit_sha },
cwd = updater._cwd,
on_exit = function(j, exit_code)
if exit_code ~= 0 then
callback(nil, "Error getting current version... \n\n " .. vim.inspect(j:result()))
return
end
local result = j:result()
if #result > 0 then
callback(result[1])
else
callback(nil, "Error getting current version... No output.")
end
end,
})
:start()
Job:new({
command = "git",
args = { "tag", "-l", "--sort", "-version:refname", "--merged", commit_sha },
cwd = updater._cwd,
on_exit = function(j, exit_code)
if exit_code ~= 0 then
callback(nil, "Error getting current version... \n\n " .. vim.inspect(j:result()))
return
end
local result = j:result()
if #result > 0 then
callback(result[1])
else
callback(nil, "Error getting current version... No output.")
end
end,
}):start()
end
--- Gets the current version and the latest upstream version
@ -255,25 +249,23 @@ end
---@param callback function(branch_name, error)
updater._get_branch_name = function(callback)
local Job = require("plenary.job")
Job
:new({
command = "git",
args = { "symbolic-ref", "--short", "-q", "HEAD" },
cwd = updater._cwd,
on_exit = function(j, exit_code)
if exit_code ~= 0 then
callback(nil, "Error getting branch name... \n\n " .. vim.inspect(j:result()))
return
end
local result = j:result()
if #result > 0 then
callback(result[1])
else
callback(nil, "Error getting branch name... No output.")
end
end,
})
:start()
Job:new({
command = "git",
args = { "symbolic-ref", "--short", "-q", "HEAD" },
cwd = updater._cwd,
on_exit = function(j, exit_code)
if exit_code ~= 0 then
callback(nil, "Error getting branch name... \n\n " .. vim.inspect(j:result()))
return
end
local result = j:result()
if #result > 0 then
callback(result[1])
else
callback(nil, "Error getting branch name... No output.")
end
end,
}):start()
end
--- Entry point for `:DoomUpdate`, fetches new tags, compares with current version and attempts to merge new tags into current branch

5
lua/doom/modules/features/extra_snippets/init.lua

@ -1,12 +1,11 @@
local extra_snippets = {}
extra_snippets.settings = {
}
extra_snippets.settings = {}
extra_snippets.packages = {
["friendly-snippets"] = {
"rafamadriz/friendly-snippets",
after = "LuaSnip"
after = "LuaSnip",
},
}

9
lua/doom/modules/features/linter/init.lua

@ -4,7 +4,7 @@ linter.settings = {
format_on_save = false,
null_ls_settings = {
default_timeout = 2000,
}
},
}
linter.packages = {
@ -22,8 +22,9 @@ linter.configs["null-ls.nvim"] = function()
local null_ls_settings = doom.features.linter.settings.null_ls_settings
null_ls.setup(vim.tbl_deep_extend("force", null_ls_settings, {
on_attach = function(client)
if client.server_capabilities.documentFormattingProvider
and doom.features.linter.settings.format_on_save
if
client.server_capabilities.documentFormattingProvider
and doom.features.linter.settings.format_on_save
then
vim.cmd([[
augroup LspFormatting
@ -43,7 +44,7 @@ linter.binds = {
local null_ls_settings = doom.features.linter.settings.null_ls_settings
if type(vim.lsp.buf.format) == "function" then
vim.lsp.buf.format({
timeout_ms = null_ls_settings.default_timeout
timeout_ms = null_ls_settings.default_timeout,
})
else
vim.lsp.buf.formatting_sync(nil, null_ls_settings.default_timeout)

15
lua/doom/modules/features/lsp/init.lua

@ -105,10 +105,10 @@ lsp.packages = {
"hrsh7th/nvim-cmp",
commit = "706371f1300e7c0acb98b346f80dad2dd9b5f679",
requires = {
"L3MON4D3/LuaSnip",
commit = "53e812a6f51c9d567c98215733100f0169bcc20a",
module = "luasnip",
},
"L3MON4D3/LuaSnip",
commit = "53e812a6f51c9d567c98215733100f0169bcc20a",
module = "luasnip",
},
},
["cmp-nvim-lua"] = {
"hrsh7th/cmp-nvim-lua",
@ -242,11 +242,8 @@ lsp.configs["nvim-cmp"] = function()
},
formatting = {
format = function(entry, item)
item.kind = string.format(
"%s %s",
doom.features.lsp.settings.completion.kinds[item.kind],
item.kind
)
item.kind =
string.format("%s %s", doom.features.lsp.settings.completion.kinds[item.kind], item.kind)
item.menu = source_map[entry.source.name]
item.dup = vim.tbl_contains({ "path", "buffer" }, entry.source.name)
return item

5
lua/doom/modules/features/repl/init.lua

@ -50,9 +50,8 @@ repl.configs = {
local iron = require("iron.core")
local settings = vim.tbl_deep_extend("force", {}, doom.features.repl.settings)
settings.config.repl_open_command = require("iron.view").curry[settings.config.position](
settings.config.size
)
settings.config.repl_open_command =
require("iron.view").curry[settings.config.position](settings.config.size)
iron.setup(settings)
end,

7
lua/doom/modules/features/statusline/init.lua

@ -251,11 +251,8 @@ statusline.configs["heirline.nvim"] = function()
init = function(self)
local filename = self.filename
local extension = vim.fn.fnamemodify(filename, ":e")
self.icon, self.icon_color = require("nvim-web-devicons").get_icon_color(
filename,
extension,
{ default = true }
)
self.icon, self.icon_color =
require("nvim-web-devicons").get_icon_color(filename, extension, { default = true })
end,
provider = function(self)
return self.icon and (self.icon .. " ")

24
lua/doom/modules/langs/vue/init.lua

@ -120,34 +120,22 @@ vue.autocmds = {
},
}
local volar_api_config = vim.tbl_deep_extend(
"force",
{},
doom.langs.vue.settings.volar_api,
base_config
)
local volar_api_config =
vim.tbl_deep_extend("force", {}, doom.langs.vue.settings.volar_api, base_config)
langs_utils.use_lsp("volar", {
name = "volar_api",
config = volar_api_config,
})
local volar_doc_config = vim.tbl_deep_extend(
"force",
{},
doom.langs.vue.settings.volar_doc,
base_config
)
local volar_doc_config =
vim.tbl_deep_extend("force", {}, doom.langs.vue.settings.volar_doc, base_config)
langs_utils.use_lsp("volar", {
name = "volar_doc",
config = volar_doc_config,
})
local volar_html_config = vim.tbl_deep_extend(
"force",
{},
doom.langs.vue.settings.volar_html,
base_config
)
local volar_html_config =
vim.tbl_deep_extend("force", {}, doom.langs.vue.settings.volar_html, base_config)
langs_utils.use_lsp("volar", {
name = "volar_html",
config = volar_html_config,

14
lua/doom/utils/init.lua

@ -9,12 +9,8 @@ utils.version = {
minor = 0,
patch = 0,
}
utils.doom_version = string.format(
"%d.%d.%d",
utils.version.major,
utils.version.minor,
utils.version.patch
)
utils.doom_version =
string.format("%d.%d.%d", utils.version.major, utils.version.minor, utils.version.patch)
-- Finds `filename` (where it is a doom config file).
utils.find_config = function(filename)
@ -29,10 +25,8 @@ utils.find_config = function(filename)
if fs.file_exists(path) then
return path
end
local candidates = vim.api.nvim_get_runtime_file(
get_filepath("*" .. system.sep .. "doon-nvim"),
false
)
local candidates =
vim.api.nvim_get_runtime_file(get_filepath("*" .. system.sep .. "doon-nvim"), false)
if not vim.tbl_isempty(candidates) then
return candidates[1]
end

9
lua/doom/utils/logging.lua

@ -70,13 +70,8 @@ log.new = function(config, standalone)
local console_output = vim.schedule_wrap(function(level_config, info, nameupper, msg)
local console_lineinfo = vim.fn.fnamemodify(info.short_src, ":t") .. ":" .. info.currentline
local console_string = string.format(
"[%-6s%s] %s: %s",
nameupper,
os.date("%H:%M:%S"),
console_lineinfo,
msg
)
local console_string =
string.format("[%-6s%s] %s: %s", nameupper, os.date("%H:%M:%S"), console_lineinfo, msg)
if config.highlights and level_config.hl then
vim.cmd(string.format("echohl %s", level_config.hl))

50
modules.lua

@ -9,31 +9,31 @@
return {
features = {
-- Language features
"annotations", -- Code annotation generator
"auto_install", -- Auto install LSP providers
"autopairs", -- Automatically close character pairs
"comment", -- Adds keybinds to comment in any language
"linter", -- Linting and formatting for languages
"lsp", -- Code completion
"extra_snippets", -- Code snippets for all languages
"annotations", -- Code annotation generator
"auto_install", -- Auto install LSP providers
"autopairs", -- Automatically close character pairs
"comment", -- Adds keybinds to comment in any language
"linter", -- Linting and formatting for languages
"lsp", -- Code completion
"extra_snippets", -- Code snippets for all languages
-- Editor
"auto_session", -- Remember sessions between loads
"colorizer", -- Show colors in neovim
"editorconfig", -- Support editorconfig files
"gitsigns", -- Show git changes in sidebar
"illuminate", -- Highlight other copies of the word you're hovering on
"indentlines", -- Show indent lines with special characters
"range_highlight", -- Highlight selected range from commands
"todo_comments", -- Highlight TODO: comments
"auto_session", -- Remember sessions between loads
"colorizer", -- Show colors in neovim
"editorconfig", -- Support editorconfig files
"gitsigns", -- Show git changes in sidebar
"illuminate", -- Highlight other copies of the word you're hovering on
"indentlines", -- Show indent lines with special characters
"range_highlight", -- Highlight selected range from commands
"todo_comments", -- Highlight TODO: comments
-- "doom_themes", -- Extra themes for doom
-- UI Components
"lsp_progress", -- Check status of LSP loading
"tabline", -- Tab bar buffer switcher
"dashboard", -- A pretty dashboard upon opening
"lsp_progress", -- Check status of LSP loading
"tabline", -- Tab bar buffer switcher
"dashboard", -- A pretty dashboard upon opening
-- "trouble", -- A pretty diagnostic viewer
"statusline", -- A pretty status line at the bottom of the buffer
"statusline", -- A pretty status line at the bottom of the buffer
-- "minimap", -- Shows current position in document
-- "terminal", -- Integrated terminal in neovim
-- "symbols", -- Navigate between code symbols using telescope
@ -44,16 +44,16 @@ return {
-- Tools
-- "dap", -- Debug code through neovim
"repl", -- Interactive REPL in neovim
"explorer", -- An enhanced filetree explorer
"explorer", -- An enhanced filetree explorer
-- "firenvim", -- Embed neovim in your browser
-- "lazygit", -- Lazy git integration
-- "neogit", -- A git client for neovim
"neorg", -- Organise your life
"projects", -- Quickly switch between projects
"neorg", -- Organise your life
"projects", -- Quickly switch between projects
-- "superman", -- Read unix man pages in neovim
-- "suda", -- Save using sudo when necessary
"telescope", -- Fuzzy searcher to find files, grep code and more
"whichkey", -- An interactive sheet
"telescope", -- Fuzzy searcher to find files, grep code and more
"whichkey", -- An interactive sheet
},
langs = {
-- Scripts
@ -81,7 +81,7 @@ return {
-- "config", -- JSON, YAML, TOML
-- "markdown",
-- "terraform", -- Terraform / hcl files support
}
},
}
-- vim: sw=2 sts=2 ts=2 fdm=indent expandtab

Loading…
Cancel
Save