summaryrefslogtreecommitdiff
path: root/lua/lvim/config
diff options
context:
space:
mode:
Diffstat (limited to 'lua/lvim/config')
-rw-r--r--lua/lvim/config/defaults.lua4
-rw-r--r--lua/lvim/config/init.lua27
-rw-r--r--lua/lvim/config/settings.lua12
3 files changed, 29 insertions, 14 deletions
diff --git a/lua/lvim/config/defaults.lua b/lua/lvim/config/defaults.lua
index 7546644f..1bd57b94 100644
--- a/lua/lvim/config/defaults.lua
+++ b/lua/lvim/config/defaults.lua
@@ -1,6 +1,7 @@
return {
leader = "space",
- colorscheme = "onedarker",
+ reload_config_on_save = true,
+ colorscheme = "tokyonight",
transparent_window = false,
format_on_save = {
---@usage pattern string pattern used for the autocommand (Default: '*')
@@ -13,6 +14,7 @@ return {
keys = {},
use_icons = true,
+ icons = require "lvim.icons",
builtin = {},
diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua
index c6765f56..59722673 100644
--- a/lua/lvim/config/init.lua
+++ b/lua/lvim/config/init.lua
@@ -111,45 +111,56 @@ end
--- Override the configuration with a user provided one
-- @param config_path The path to the configuration overrides
function M:load(config_path)
- local autocmds = require "lvim.core.autocmds"
+ local autocmds = reload "lvim.core.autocmds"
config_path = config_path or self:get_user_config_path()
local ok, err = pcall(dofile, config_path)
if not ok then
if utils.is_file(user_config_file) then
Log:warn("Invalid configuration: " .. err)
else
- vim.notify_once(string.format("Unable to find configuration file [%s]", config_path), vim.log.levels.WARN)
+ vim.notify_once(
+ string.format("User-configuration not found. Creating an example configuration in %s", config_path)
+ )
+ local example_config = join_paths(get_lvim_base_dir(), "utils", "installer", "config.example.lua")
+ vim.loop.fs_copyfile(example_config, config_path)
end
end
+ Log:set_level(lvim.log.level)
+
handle_deprecated_settings()
autocmds.define_autocmds(lvim.autocommands)
vim.g.mapleader = (lvim.leader == "space" and " ") or lvim.leader
- require("lvim.keymappings").load(lvim.keys)
+ reload("lvim.keymappings").load(lvim.keys)
if lvim.transparent_window then
autocmds.enable_transparent_mode()
end
+
+ if lvim.reload_config_on_save then
+ autocmds.enable_reload_config_on_save()
+ end
end
--- Override the configuration with a user provided one
-- @param config_path The path to the configuration overrides
function M:reload()
vim.schedule(function()
- require_clean("lvim.utils.hooks").run_pre_reload()
+ reload("lvim.utils.hooks").run_pre_reload()
M:load()
- require("lvim.core.autocmds").configure_format_on_save()
+ reload("lvim.core.autocmds").configure_format_on_save()
- local plugins = require "lvim.plugins"
- local plugin_loader = require "lvim.plugin-loader"
+ local plugins = reload "lvim.plugins"
+ local plugin_loader = reload "lvim.plugin-loader"
plugin_loader.reload { plugins, lvim.plugins }
- require_clean("lvim.utils.hooks").run_post_reload()
+ reload("lvim.core.theme").setup()
+ reload("lvim.utils.hooks").run_post_reload()
end)
end
diff --git a/lua/lvim/config/settings.lua b/lua/lvim/config/settings.lua
index faa28641..4f61ed09 100644
--- a/lua/lvim/config/settings.lua
+++ b/lua/lvim/config/settings.lua
@@ -13,8 +13,7 @@ M.load_default_options = function()
local default_options = {
backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
- cmdheight = 2, -- more space in the neovim command line for displaying messages
- colorcolumn = "99999", -- fixes indentline for now
+ cmdheight = 1, -- more space in the neovim command line for displaying messages
completeopt = { "menuone", "noselect" },
conceallevel = 0, -- so that `` is visible in markdown files
fileencoding = "utf-8", -- the encoding written to a file
@@ -34,28 +33,31 @@ M.load_default_options = function()
splitright = true, -- force all vertical splits to go to the right of current window
swapfile = false, -- creates a swapfile
termguicolors = true, -- set term gui colors (most terminals support this)
- timeoutlen = 250, -- time to wait for a mapped sequence to complete (in milliseconds)
+ timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds)
title = true, -- set the title of window to the value of the titlestring
-- opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
undodir = undodir, -- set an undo directory
undofile = true, -- enable persistent undo
- updatetime = 300, -- faster completion
+ updatetime = 100, -- faster completion
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = true, -- convert tabs to spaces
shiftwidth = 2, -- the number of spaces inserted for each indentation
tabstop = 2, -- insert 2 spaces for a tab
cursorline = true, -- highlight the current line
number = true, -- set numbered lines
- relativenumber = false, -- set relative numbered lines
numberwidth = 4, -- set number column width to 2 {default 4}
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
wrap = false, -- display lines as one long line
shadafile = join_paths(get_cache_dir(), "lvim.shada"),
scrolloff = 8, -- minimal number of screen lines to keep above and below the cursor.
sidescrolloff = 8, -- minimal number of screen lines to keep left and right of the cursor.
+ showcmd = false,
+ ruler = false,
+ laststatus = 3,
}
--- SETTINGS ---
+ vim.opt.spelllang:append "cjk" -- disable spellchecking for asian characters (VIM algorithm does not support it)
vim.opt.shortmess:append "c" -- don't show redundant messages from ins-completion-menu
vim.opt.shortmess:append "I" -- don't show the default intro message
vim.opt.whichwrap:append "<,>,[,],h,l"