summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchristianchiarulli <[email protected]>2021-07-06 19:15:37 -0400
committerchristianchiarulli <[email protected]>2021-07-06 19:15:37 -0400
commit0e2ad0c1fec50a24177129c89b3edb9007776caf (patch)
tree795f0e9ed5c9f9fa325e218a73de69a1354c2ce8
parentf6e377fcfed932b71456a0b0780c1f5ed22cabd4 (diff)
testing autosave config poetnetially unstable
-rw-r--r--lua/lv-floatterm/init.lua62
-rw-r--r--lua/lv-utils/init.lua12
-rw-r--r--lua/lv-which-key/init.lua16
-rw-r--r--lua/plugins.lua14
4 files changed, 66 insertions, 38 deletions
diff --git a/lua/lv-floatterm/init.lua b/lua/lv-floatterm/init.lua
index 0901c1f6..5cd6a4ae 100644
--- a/lua/lv-floatterm/init.lua
+++ b/lua/lv-floatterm/init.lua
@@ -1,39 +1,43 @@
local M = {}
M.config = function()
- require'FTerm'.setup({
- dimensions = {
- height = 0.8,
- width = 0.8,
- x = 0.5,
- y = 0.5
- },
- border = 'single' -- or 'double'
- })
+ local status_ok, fterm = pcall(require, "FTerm")
+ if not status_ok then
+ return
+ end
- -- Create LazyGit Terminal
- local term = require("FTerm.terminal")
- local lazy = term:new():setup({
- cmd = "lazygit",
- dimensions = {
- height = 0.9,
- width = 0.9
- }
- })
+ fterm.setup {
+ dimensions = {
+ height = 0.8,
+ width = 0.8,
+ x = 0.5,
+ y = 0.5,
+ },
+ border = "single", -- or 'double'
+ }
- local function is_installed(exe)
- return vim.fn.executable(exe) == 1
- end
+ -- Create LazyGit Terminal
+ local term = require "FTerm.terminal"
+ local lazy = term:new():setup {
+ cmd = "lazygit",
+ dimensions = {
+ height = 0.9,
+ width = 0.9,
+ },
+ }
+
+ local function is_installed(exe)
+ return vim.fn.executable(exe) == 1
+ end
- -- Use this to toggle gitui in a floating terminal
- function _G.__fterm_lazygit()
- if is_installed("lazygit") ~= true then
- print("Please install lazygit. Check documentation for more information")
- return
- end
- lazy:toggle()
+ -- Use this to toggle gitui in a floating terminal
+ function _G.__fterm_lazygit()
+ if is_installed "lazygit" ~= true then
+ print "Please install lazygit. Check documentation for more information"
+ return
end
+ lazy:toggle()
+ end
end
return M
-
diff --git a/lua/lv-utils/init.lua b/lua/lv-utils/init.lua
index db3deb87..656905f2 100644
--- a/lua/lv-utils/init.lua
+++ b/lua/lv-utils/init.lua
@@ -1,5 +1,12 @@
local lv_utils = {}
+function lv_utils.reload_lv_config()
+ vim.cmd "source ~/.config/nvim/lv-config.lua"
+ vim.cmd "source ~/.config/nvim/lua/plugins.lua"
+ vim.cmd ":PackerCompile"
+ vim.cmd ":PackerInstall"
+end
+
function lv_utils.define_augroups(definitions) -- {{{1
-- Create autocommand groups based on the passed definitions
--
@@ -24,7 +31,7 @@ end
lv_utils.define_augroups {
- _user_autocommands = O.user_autocommands,
+ _user_autocommands = O.user_autocommands,
_general_settings = {
{
"TextYankPost",
@@ -46,6 +53,7 @@ lv_utils.define_augroups {
"*",
"setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
},
+ { "BufWritePost", "lv-config.lua", "lua require('lv-utils').reload_lv_config()" },
{ "VimLeavePre", "*", "set title set titleold=" },
},
-- _solidity = {
@@ -65,7 +73,7 @@ lv_utils.define_augroups {
},
_auto_resize = {
-- will cause split windows to be resized evenly if main window is resized
- {'VimResized ', '*', 'wincmd ='},
+ { "VimResized ", "*", "wincmd =" },
},
-- _mode_switching = {
-- -- will switch between absolute and relative line numbers depending on mode
diff --git a/lua/lv-which-key/init.lua b/lua/lv-which-key/init.lua
index a14a82b6..8edb244b 100644
--- a/lua/lv-which-key/init.lua
+++ b/lua/lv-which-key/init.lua
@@ -120,7 +120,7 @@ local mappings = {
name = "Packer",
c = { "<cmd>PackerCompile<cr>", "Compile" },
i = { "<cmd>PackerInstall<cr>", "Install" },
- r = { ":luafile %<cr>", "Reload" },
+ r = { "<cmd>lua require('lv-utils').reload_lv_config()<cr>", "Reload" },
s = { "<cmd>PackerSync<cr>", "Sync" },
u = { "<cmd>PackerUpdate<cr>", "Update" },
},
@@ -266,9 +266,19 @@ end
if O.plugin.floatterm.active then
vim.api.nvim_set_keymap("n", "<leader>gg", "<CMD>lua _G.__fterm_lazygit()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<A-i>", "<CMD>lua require('FTerm').toggle()<CR>", { noremap = true, silent = true })
- vim.api.nvim_set_keymap("t", "<A-i>", "<C-\\><C-n><CMD>lua require('FTerm').toggle()<CR>", { noremap = true, silent = true })
+ vim.api.nvim_set_keymap(
+ "t",
+ "<A-i>",
+ "<C-\\><C-n><CMD>lua require('FTerm').toggle()<CR>",
+ { noremap = true, silent = true }
+ )
vim.api.nvim_set_keymap("n", "<A-l>", "<CMD>lua _G.__fterm_lazygit()<CR>", { noremap = true, silent = true })
- vim.api.nvim_set_keymap("t", "<A-l>", "<C-\\><C-n><CMD>lua _G.__fterm_lazygit()<CR>", { noremap = true, silent = true })
+ vim.api.nvim_set_keymap(
+ "t",
+ "<A-l>",
+ "<C-\\><C-n><CMD>lua _G.__fterm_lazygit()<CR>",
+ { noremap = true, silent = true }
+ )
mappings["gg"] = "LazyGit"
end
if O.plugin.telescope_project.active then
diff --git a/lua/plugins.lua b/lua/plugins.lua
index 50f96517..33efdf05 100644
--- a/lua/plugins.lua
+++ b/lua/plugins.lua
@@ -202,14 +202,18 @@ return require("packer").startup(function(use)
use {
"mfussenegger/nvim-dap",
config = function()
- require "dap"
+ local status_ok, dap = pcall(require, "dap")
+ if not status_ok then
+ return
+ end
+ -- require "dap"
vim.fn.sign_define("DapBreakpoint", {
text = "ï—£",
texthl = "LspDiagnosticsSignError",
linehl = "",
numhl = "",
})
- require("dap").defaults.fallback.terminal_win_cmd = "50vsplit new"
+ dap.defaults.fallback.terminal_win_cmd = "50vsplit new"
end,
disable = not O.plugin.debug.active,
}
@@ -219,7 +223,7 @@ return require("packer").startup(function(use)
"numToStr/FTerm.nvim",
event = "BufWinEnter",
config = function()
- require('lv-floatterm').config()
+ require("lv-floatterm").config()
end,
disable = not O.plugin.floatterm.active,
}
@@ -235,7 +239,9 @@ return require("packer").startup(function(use)
use {
"nvim-telescope/telescope-project.nvim",
event = "BufRead",
- setup = function () vim.cmd[[packadd telescope.nvim]] end,
+ setup = function()
+ vim.cmd [[packadd telescope.nvim]]
+ end,
disable = not O.plugin.telescope_project.active,
}