fix: local and global declarations

This commit is contained in:
David JULIEN 2021-05-21 21:45:36 +02:00
parent 694b9d4024
commit 9c2569e575
5 changed files with 17 additions and 8 deletions

View File

@ -4,6 +4,7 @@
-- Description : neovim configuration file
require("globals") -- ./lua/globals.lua
require("utils") -- ./lua/utils.lua
require("settings") -- ./lua/settings.lua
require("plugins") -- ./lua/plugins.lua
require("maps") -- ./lua/maps.lua

View File

@ -1,4 +1,11 @@
globals = {
-- Author : swytch
-- Created : Friday May 21, 2021 22:26:24 CET
-- License : GPLv3
-- Description : neovim global variables file
local M = {} -- The module to export
M = {
lsp_path = vim.fn.stdpath("data").. "/lsp",
-- misc
@ -7,3 +14,8 @@ globals = {
sign_hint = "",
sign_info = "",
}
-- Make it accessible everywhere
_G.globals = M
-- Export the module
return M

View File

@ -3,8 +3,6 @@
-- License : GPLv3
-- Description : neovim mappings file
utils = require("utils")
utils.map("n", "<space>", "<leader>")
utils.map("n", "<leader>j", "<cmd>bn<CR>")
utils.map("n", "<leader>k", "<cmd>bp<CR>")

View File

@ -3,8 +3,6 @@
-- License : GPLv3
-- Description : neovim settings file
utils = require("utils")
local g = vim.g
local o = vim.o

View File

@ -6,7 +6,7 @@
local function gen_section(hl_string, items)
out = ""
local out = ""
for _, item in pairs(items) do
if item ~= "" then
out = out .. " " .. item
@ -134,7 +134,7 @@ end
local function spell_check()
if vim.wo.spell then
lang = vim.o.spelllang
local lang = vim.o.spelllang
return "[SPELL=" .. lang .. "]"
else
return ""
@ -204,7 +204,7 @@ local function statusline_not_focused()
}
end
function gen_statusline()
function _G.gen_statusline()
if vim.g.statusline_winid == vim.fn.win_getid() then
return statusline_focused()
else