Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
chore: format source code
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 1, 2022
1 parent e0a3a11 commit 8506cbc
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 165 deletions.
2 changes: 1 addition & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions lua/doom/core/doom_global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions lua/doom/core/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lua/doom/modules/core/reloader/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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

Expand Down
130 changes: 61 additions & 69 deletions lua/doom/modules/core/updater/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,44 +39,40 @@ 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
---@param callback function(commit_sha, error_string)
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions lua/doom/modules/features/extra_snippets/init.lua
Original file line number Diff line number Diff line change
@@ -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",
},
}

Expand Down
9 changes: 5 additions & 4 deletions lua/doom/modules/features/linter/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ linter.settings = {
format_on_save = false,
null_ls_settings = {
default_timeout = 2000,
}
},
}

linter.packages = {
Expand All @@ -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
Expand All @@ -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)
Expand Down
15 changes: 6 additions & 9 deletions lua/doom/modules/features/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions lua/doom/modules/features/repl/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 2 additions & 5 deletions lua/doom/modules/features/statusline/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 .. " ")
Expand Down
24 changes: 6 additions & 18 deletions lua/doom/modules/langs/vue/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 4 additions & 10 deletions lua/doom/utils/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
Loading

0 comments on commit 8506cbc

Please sign in to comment.