summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/lvim/core/bufferline.lua121
-rw-r--r--lua/lvim/core/info.lua34
-rw-r--r--lua/lvim/core/lualine/components.lua4
-rw-r--r--lua/lvim/core/nvimtree.lua28
-rw-r--r--lua/lvim/core/which-key.lua20
-rw-r--r--lua/lvim/keymappings.lua4
-rw-r--r--lua/lvim/lsp/config.lua7
-rw-r--r--lua/lvim/lsp/providers/jsonls.lua186
-rw-r--r--lua/lvim/plugins.lua55
-rw-r--r--lua/lvim/utils/git.lua2
10 files changed, 196 insertions, 265 deletions
diff --git a/lua/lvim/core/bufferline.lua b/lua/lvim/core/bufferline.lua
index 4f7493d6..06de3ac4 100644
--- a/lua/lvim/core/bufferline.lua
+++ b/lua/lvim/core/bufferline.lua
@@ -1,5 +1,38 @@
local M = {}
+local function is_ft(b, ft)
+ return vim.bo[b].filetype == ft
+end
+
+local function diagnostics_indicator(_, _, diagnostics)
+ local result = {}
+ local symbols = { error = "", warning = "", info = "" }
+ for name, count in pairs(diagnostics) do
+ if symbols[name] and count > 0 then
+ table.insert(result, symbols[name] .. count)
+ end
+ end
+ result = table.concat(result, " ")
+ return #result > 0 and result or ""
+end
+
+local function custom_filter(buf, buf_nums)
+ local logs = vim.tbl_filter(function(b)
+ return is_ft(b, "log")
+ end, buf_nums)
+ if vim.tbl_isempty(logs) then
+ return true
+ end
+ local tab_num = vim.fn.tabpagenr()
+ local last_tab = vim.fn.tabpagenr "$"
+ local is_log = is_ft(buf, "log")
+ if last_tab == 1 then
+ return true
+ end
+ -- only show log buffers in secondary tabs
+ return (tab_num == last_tab and is_log) or (tab_num ~= last_tab and not is_log)
+end
+
M.config = function()
lvim.builtin.bufferline = {
active = true,
@@ -7,11 +40,99 @@ M.config = function()
keymap = {
normal_mode = {},
},
+ highlights = {
+ background = {
+ gui = "italic",
+ },
+ buffer_selected = {
+ gui = "bold",
+ },
+ },
+ options = {
+ numbers = "none", -- can be "none" | "ordinal" | "buffer_id" | "both" | function
+ close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
+ right_mouse_command = "vert sbuffer %d", -- can be a string | function, see "Mouse actions"
+ left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
+ middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
+ -- NOTE: this plugin is designed with this icon in mind,
+ -- and so changing this is NOT recommended, this is intended
+ -- as an escape hatch for people who cannot bear it for whatever reason
+ indicator_icon = "▎",
+ buffer_close_icon = "",
+ modified_icon = "●",
+ close_icon = "",
+ left_trunc_marker = "",
+ right_trunc_marker = "",
+ --- name_formatter can be used to change the buffer's label in the bufferline.
+ --- Please note some names can/will break the
+ --- bufferline so use this at your discretion knowing that it has
+ --- some limitations that will *NOT* be fixed.
+ name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
+ -- remove extension from markdown files for example
+ if buf.name:match "%.md" then
+ return vim.fn.fnamemodify(buf.name, ":t:r")
+ end
+ end,
+ max_name_length = 18,
+ max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
+ tab_size = 18,
+ diagnostics = "nvim_lsp",
+ diagnostics_update_in_insert = false,
+ diagnostics_indicator = diagnostics_indicator,
+ -- NOTE: this will be called a lot so don't do any heavy processing here
+ custom_filter = custom_filter,
+ offsets = {
+ {
+ filetype = "undotree",
+ text = "Undotree",
+ highlight = "PanelHeading",
+ padding = 1,
+ },
+ {
+ filetype = "NvimTree",
+ text = "Explorer",
+ highlight = "PanelHeading",
+ padding = 1,
+ },
+ {
+ filetype = "DiffviewFiles",
+ text = "Diff View",
+ highlight = "PanelHeading",
+ padding = 1,
+ },
+ {
+ filetype = "flutterToolsOutline",
+ text = "Flutter Outline",
+ highlight = "PanelHeading",
+ },
+ {
+ filetype = "packer",
+ text = "Packer",
+ highlight = "PanelHeading",
+ padding = 1,
+ },
+ },
+ show_buffer_icons = true, -- disable filetype icons for buffers
+ show_buffer_close_icons = true,
+ show_close_icon = false,
+ show_tab_indicators = true,
+ persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
+ -- can also be a table containing 2 custom separators
+ -- [focused and unfocused]. eg: { '|', '|' }
+ separator_style = "thin",
+ enforce_regular_tabs = false,
+ always_show_bufferline = false,
+ sort_by = "id",
+ },
}
end
M.setup = function()
require("lvim.keymappings").load(lvim.builtin.bufferline.keymap)
+ require("bufferline").setup {
+ options = lvim.builtin.bufferline.options,
+ highlights = lvim.builtin.bufferline.highlights,
+ }
if lvim.builtin.bufferline.on_config_done then
lvim.builtin.bufferline.on_config_done()
diff --git a/lua/lvim/core/info.lua b/lua/lvim/core/info.lua
index da295b95..34a5a7dd 100644
--- a/lua/lvim/core/info.lua
+++ b/lua/lvim/core/info.lua
@@ -161,22 +161,24 @@ function M.toggle_popup(ft)
local content_provider = function(popup)
local content = {}
- for _, section in ipairs {
- M.banner,
- { "" },
- { "" },
- header,
- { "" },
- lsp_info,
- { "" },
- override_info,
- { "" },
- formatters_info,
- { "" },
- linters_info,
- { "" },
- code_actions_info,
- } do
+ for _, section in
+ ipairs {
+ M.banner,
+ { "" },
+ { "" },
+ header,
+ { "" },
+ lsp_info,
+ { "" },
+ override_info,
+ { "" },
+ formatters_info,
+ { "" },
+ linters_info,
+ { "" },
+ code_actions_info,
+ }
+ do
vim.list_extend(content, section)
end
diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua
index b1387afa..b97f946e 100644
--- a/lua/lvim/core/lualine/components.lua
+++ b/lua/lvim/core/lualine/components.lua
@@ -35,7 +35,7 @@ return {
diff = {
"diff",
source = diff_source,
- symbols = { added = "  ", modified = "柳", removed = " " },
+ symbols = { added = "  ", modified = " ", removed = " " },
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.yellow },
@@ -74,7 +74,7 @@ return {
function()
local b = vim.api.nvim_get_current_buf()
if next(vim.treesitter.highlighter.active[b]) then
- return "  "
+ return ""
end
return ""
end,
diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua
index 287791b8..17b8f36a 100644
--- a/lua/lvim/core/nvimtree.lua
+++ b/lua/lvim/core/nvimtree.lua
@@ -136,34 +136,6 @@ function M.setup()
}
end
- local function on_open()
- if package.loaded["bufferline.state"] and lvim.builtin.nvimtree.setup.view.side == "left" then
- require("bufferline.state").set_offset(lvim.builtin.nvimtree.setup.view.width + 1, "")
- end
- end
-
- local function on_close()
- local bufnr = vim.api.nvim_get_current_buf()
- local ft = vim.api.nvim_buf_get_option(bufnr, "filetype")
- if ft == "NvimTree" and package.loaded["bufferline.state"] then
- require("bufferline.state").set_offset(0)
- end
- end
-
- local tree_view = require "nvim-tree.view"
- local default_open = tree_view.open
- local default_close = tree_view.close
-
- tree_view.open = function()
- on_open()
- default_open()
- end
-
- tree_view.close = function()
- on_close()
- default_close()
- end
-
if lvim.builtin.nvimtree.on_config_done then
lvim.builtin.nvimtree.on_config_done(nvim_tree_config)
end
diff --git a/lua/lvim/core/which-key.lua b/lua/lvim/core/which-key.lua
index 8691a9a6..194cb314 100644
--- a/lua/lvim/core/which-key.lua
+++ b/lua/lvim/core/which-key.lua
@@ -67,30 +67,30 @@ M.config = function()
["w"] = { "<cmd>w!<CR>", "Save" },
["q"] = { "<cmd>q!<CR>", "Quit" },
["/"] = { "<cmd>lua require('Comment.api').toggle_current_linewise()<CR>", "Comment" },
- ["c"] = { "<cmd>BufferClose!<CR>", "Close Buffer" },
+ ["c"] = { "<cmd>bdelete!<CR>", "Close Buffer" },
["f"] = { require("lvim.core.telescope.custom-finders").find_project_files, "Find File" },
["h"] = { "<cmd>nohlsearch<CR>", "No Highlight" },
b = {
name = "Buffers",
- j = { "<cmd>BufferPick<cr>", "Jump" },
+ j = { "<cmd>BufferLinePick<cr>", "Jump" },
f = { "<cmd>Telescope buffers<cr>", "Find" },
- b = { "<cmd>b#<cr>", "Previous" },
- w = { "<cmd>BufferWipeout<cr>", "Wipeout" },
+ b = { "<cmd>BufferLineCyclePrev<cr>", "Previous" },
+ -- w = { "<cmd>BufferWipeout<cr>", "Wipeout" }, -- TODO: implement this for bufferline
e = {
- "<cmd>BufferCloseAllButCurrent<cr>",
- "Close all but current",
+ "<cmd>BufferLinePickClose<cr>",
+ "Pick which buffer to close",
},
- h = { "<cmd>BufferCloseBuffersLeft<cr>", "Close all to the left" },
+ h = { "<cmd>BufferLineCloseLeft<cr>", "Close all to the left" },
l = {
- "<cmd>BufferCloseBuffersRight<cr>",
+ "<cmd>BufferLineCloseRight<cr>",
"Close all to the right",
},
D = {
- "<cmd>BufferOrderByDirectory<cr>",
+ "<cmd>BufferLineSortByDirectory<cr>",
"Sort by directory",
},
L = {
- "<cmd>BufferOrderByLanguage<cr>",
+ "<cmd>BufferLineSortByExtension<cr>",
"Sort by language",
},
},
diff --git a/lua/lvim/keymappings.lua b/lua/lvim/keymappings.lua
index 86af1320..d0e4bbef 100644
--- a/lua/lvim/keymappings.lua
+++ b/lua/lvim/keymappings.lua
@@ -56,8 +56,8 @@ local defaults = {
["<C-Right>"] = ":vertical resize +2<CR>",
-- Tab switch buffer
- ["<S-l>"] = ":BufferNext<CR>",
- ["<S-h>"] = ":BufferPrevious<CR>",
+ ["<S-l>"] = ":BufferLineCycleNext<CR>",
+ ["<S-h>"] = ":BufferLineCyclePrev<CR>",
-- Move current line / block with Alt-j/k a la vscode.
["<A-j>"] = ":m .+1<CR>==",
diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua
index fb59ca51..26b1b489 100644
--- a/lua/lvim/lsp/config.lua
+++ b/lua/lvim/lsp/config.lua
@@ -23,7 +23,7 @@ return {
prefix = "",
format = function(d)
local t = vim.deepcopy(d)
- local code = d.code or d.user_data.lsp.code
+ local code = d.code or (d.user_data and d.user_data.lsp.code)
if code then
t.message = string.format("%s [%s]", t.message, code):gsub("1. ", "")
end
@@ -84,6 +84,7 @@ return {
"quick_lint_js",
"remark_ls",
"rome",
+ "scry",
"solang",
"solidity_ls",
"sorbet",
@@ -94,7 +95,9 @@ return {
"stylelint_lsp",
"tailwindcss",
"tflint",
- "volar",
+ "verible",
+ "vuels",
+ "zeta_note",
"zk",
},
}
diff --git a/lua/lvim/lsp/providers/jsonls.lua b/lua/lvim/lsp/providers/jsonls.lua
index 1fffa686..528c72a0 100644
--- a/lua/lvim/lsp/providers/jsonls.lua
+++ b/lua/lvim/lsp/providers/jsonls.lua
@@ -1,186 +1,12 @@
-local default_schemas = nil
-local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls")
-if status_ok then
- default_schemas = jsonls_settings.get_default_schemas()
-end
-
-local schemas = {
- {
- description = "TypeScript compiler configuration file",
- fileMatch = {
- "tsconfig.json",
- "tsconfig.*.json",
- },
- url = "https://json.schemastore.org/tsconfig.json",
- },
- {
- description = "Lerna config",
- fileMatch = { "lerna.json" },
- url = "https://json.schemastore.org/lerna.json",
- },
- {
- description = "Babel configuration",
- fileMatch = {
- ".babelrc.json",
- ".babelrc",
- "babel.config.json",
- },
- url = "https://json.schemastore.org/babelrc.json",
- },
- {
- description = "ESLint config",
- fileMatch = {
- ".eslintrc.json",
- ".eslintrc",
- },
- url = "https://json.schemastore.org/eslintrc.json",
- },
- {
- description = "Bucklescript config",
- fileMatch = { "bsconfig.json" },
- url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json",
- },
- {
- description = "Prettier config",
- fileMatch = {
- ".prettierrc",
- ".prettierrc.json",
- "prettier.config.json",
- },
- url = "https://json.schemastore.org/prettierrc",
- },
- {
- description = "Vercel Now config",
- fileMatch = { "now.json" },
- url = "https://json.schemastore.org/now",
- },
- {
- description = "Stylelint config",
- fileMatch = {
- ".stylelintrc",
- ".stylelintrc.json",
- "stylelint.config.json",
- },
- url = "https://json.schemastore.org/stylelintrc",
- },
- {
- description = "A JSON schema for the ASP.NET LaunchSettings.json files",
- fileMatch = { "launchsettings.json" },
- url = "https://json.schemastore.org/launchsettings.json",
- },
- {
- description = "Schema for CMake Presets",
- fileMatch = {
- "CMakePresets.json",
- "CMakeUserPresets.json",
- },
- url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json",
- },
- {
- description = "Configuration file as an alternative for configuring your repository in the settings page.",
- fileMatch = {
- ".codeclimate.json",
- },
- url = "https://json.schemastore.org/codeclimate.json",
- },
- {
- description = "LLVM compilation database",
- fileMatch = {
- "compile_commands.json",
- },
- url = "https://json.schemastore.org/compile-commands.json",
- },
- {
- description = "Config file for Command Task Runner",
- fileMatch = {
- "commands.json",
- },
- url = "https://json.schemastore.org/commands.json",
- },
- {
- description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.",
- fileMatch = {
- "*.cf.json",
- "cloudformation.json",
- },
- url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json",
- },
- {
- description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.",
- fileMatch = {
- "serverless.template",
- "*.sam.json",
- "sam.json",
- },
- url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json",
- },
- {
- description = "Json schema for properties json file for a GitHub Workflow template",
- fileMatch = {
- ".github/workflow-templates/**.properties.json",
- },
- url = "https://json.schemastore.org/github-workflow-template-properties.json",
- },
- {
- description = "golangci-lint configuration file",
- fileMatch = {
- ".golangci.toml",
- ".golangci.json",
- },
- url = "https://json.schemastore.org/golangci-lint.json",
- },
- {
- description = "JSON schema for the JSON Feed format",
- fileMatch = {
- "feed.json",
- },
- url = "https://json.schemastore.org/feed.json",
- versions = {
- ["1"] = "https://json.schemastore.org/feed-1.json",
- ["1.1"] = "https://json.schemastore.org/feed.json",
- },
- },
- {
- description = "Packer template JSON configuration",
- fileMatch = {
- "packer.json",
- },
- url = "https://json.schemastore.org/packer.json",
- },
- {
- description = "NPM configuration file",
- fileMatch = {
- "package.json",
- },
- url = "https://json.schemastore.org/package.json",
- },
- {
- description = "JSON schema for Visual Studio component configuration files",
- fileMatch = {
- "*.vsconfig",
- },
- url = "https://json.schemastore.org/vsconfig.json",
- },
- {
- description = "Resume json",
- fileMatch = { "resume.json" },
- url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
- },
-}
-
-local function extend(tab1, tab2)
- for _, value in ipairs(tab2) do
- table.insert(tab1, value)
- end
- return tab1
-end
-
-local extended_schemas = extend(schemas, default_schemas)
-
+local full_schemas = vim.tbl_deep_extend(
+ "force",
+ require("schemastore").json.schemas(),
+ require("nlspsettings.jsonls").get_default_schemas()
+)
local opts = {
settings = {
json = {
- schemas = extended_schemas,
+ schemas = full_schemas,
},
},
setup = {
diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua
index 90c77f7e..dbf0e978 100644
--- a/lua/lvim/plugins.lua
+++ b/lua/lvim/plugins.lua
@@ -1,38 +1,39 @@
local commit = {
- barbar = "6e638309efcad2f308eb9c5eaccf6f62b794bbab",
+ bufferline = "7451dfc97d28e6783dbeb1cdcff12619a9323c98",
cmp_buffer = "f83773e2f433a923997c5faad7ea689ec24d1785",
cmp_luasnip = "d6f837f4e8fe48eeae288e638691b91b97d1737f",
cmp_nvim_lsp = "ebdfc204afb87f15ce3d3d3f5df0b8181443b5ba",
- cmp_path = "c5230cb439df9547294678d0f1c1465ad7989e5f",
- comment = "90df2f87c0b17193d073d1f72cea2e528e5b162d",
- dapinstall = "568d946a99edb6780912cb39ca68c368516cd853",
+ cmp_path = "466b6b8270f7ba89abd59f402c73f63c7331ff6e",
+ comment = "af51a8af6b213336345f36fc7aba65f9c3316696",
+ dapinstall = "24923c3819a450a772bb8f675926d530e829665f",
dashboard_nvim = "d82ddae95fd4dc4c3b7bbe87f09b1840fbf20ecb",
fixcursorhold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e",
- friendly_snippets = "a8efb538f4be58b4f4586bc964f9f10496c05e31",
- gitsigns = "f43cee333fdfeb27aae86bab73a38c5885d5c7f4",
+ friendly_snippets = "2e575549910571ff5abb6b02178c69ad760a4e00",
+ gitsigns = "e2b2730254df7648c79794555978f10fceb4b163",
lua_dev = "a0ee77789d9948adce64d98700cc90cecaef88d5",
- lualine = "70691ae350fdbe1f15758e3b8e2973742a7967a9",
- luasnip = "0222ee63c9e4b80e6000d064f8efd8edcc6d0c48",
- nlsp_settings = "3a3942b5d1da30e3ca0dc431aada3191c5952054",
- null_ls = "0adceda4fb3fdd25ff015e68ebe176268b12bb2c",
+ lualine = "98dc2dd3a2a07c251bcbd43048157aa56f901402",
+ luasnip = "5a6a1503fc6b005737fc823e1cb90ce86249c2a0",
+ nlsp_settings = "35f8082ae5c14d621ae6e5b973ca148eaaf34c9f",
+ null_ls = "b1dbbc3807fcb82d6f562145debe6321610bef98",
nvim_autopairs = "97e454ce9b1371373105716d196c1017394bc947",
- nvim_cmp = "7cb14b0c0f926e3cd5ac4d2e19634f82534c9d3c",
- nvim_dap = "c9a58267524f560112ecb6faa36ab2b5bc2f78a3",
- nvim_lsp_installer = "cc34adb58de9e5a42af730c97ec04fc500bb5e63",
- nvim_lspconfig = "ea29110765cb42e842dc8372c793a6173d89b0c4",
- nvim_notify = "15f52efacd169ea26b0f4070451d3ea53f98cd5a",
- nvim_tree = "0a2f6b0b6ba558a88c77a6b262af647760e6eca8",
- nvim_treesitter = "9e90866bcea3e392126c4eb90fde56b1c0b56b69",
+ nvim_cmp = "a7fea2ca9f29869c75c3e2ccb683e7740868ba8b",
+ nvim_dap = "ee39d5d570d07161e16eb73054c295c6561eb2b4",
+ nvim_lsp_installer = "8c32ee62b8a08f3a3d66d87a83b59bb37d57a388",
+ nvim_lspconfig = "2008c5cebf2b84c5e5f8a566480b022ab2e7ebab",
+ nvim_notify = "2edf33d0eb3c358716d4474d6081d361c80f7aa3",
+ nvim_tree = "7a19c3e747f8953ed50c2f97a7d070f7a86190e8",
+ nvim_treesitter = "b1ef4033222fa86cbe5c6a0abf70098f157546d4",
nvim_ts_context_commentstring = "097df33c9ef5bbd3828105e4bee99965b758dc3f",
- nvim_web_devicons = "634e26818f2bea9161b7efa76735746838971824",
- packer = "7182f0ddbca2dd6f6723633a84d47f4d26518191",
- plenary = "563d9f6d083f0514548f2ac4ad1888326d0a1c66",
+ nvim_web_devicons = "e3294f687626b40754bb40ac2d636d166098b2fb",
+ packer = "e5c8c01374350b4fcfd56da2afc87434c51b3972",
+ plenary = "e86dc9b11241ff69ece50c15a5cdd49d20d4c27c",
popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac",
project = "cef52b8da07648b750d7f1e8fb93f12cb9482988",
+ schemastore = "a678baca09b8458b4c8695c259c88a0d8eb8acb9",
structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1",
- telescope = "0011b1148d3975600f5a9f0be8058cdaac4e30d9",
+ telescope = "f262e7d56d37625613c5de0df5a933cccacf13c5",
telescope_fzf_native = "b8662b076175e75e6497c59f3e2799b879d7b954",
- toggleterm = "f23866b8fbb0703be4e15d50c814ffe496242a67",
+ toggleterm = "d2ceb2ca3268d09db3033b133c0ee4642e07f059",
which_key = "28d2bd129575b5e9ebddd88506601290bb2bb221",
}
@@ -223,8 +224,8 @@ return {
},
{
- "romgrk/barbar.nvim",
- commit = commit.barbar,
+ "akinsho/bufferline.nvim",
+ commit = commit.bufferline,
config = function()
require("lvim.core.bufferline").setup()
end,
@@ -272,4 +273,10 @@ return {
end,
disable = not lvim.builtin.terminal.active,
},
+
+ -- SchemaStore
+ {
+ "b0o/schemastore.nvim",
+ commit = commit.schemastore,
+ },
}
diff --git a/lua/lvim/utils/git.lua b/lua/lvim/utils/git.lua
index c0a67bf0..8f25a2bb 100644
--- a/lua/lvim/utils/git.lua
+++ b/lua/lvim/utils/git.lua
@@ -89,7 +89,7 @@ end
---Get the current Lunarvim development branch
---@return string|nil
function M.get_lvim_branch()
- local ret, branch = git_cmd { args = { "branch", "--show-current" } }
+ local ret, branch = git_cmd { args = { "rev-parse", "--abbrev-ref", "HEAD" } }
if ret ~= 0 or (not branch or branch[1] == "") then
Log:error "Unable to retrieve the name of the current branch. Check the log for further information"
return