summaryrefslogtreecommitdiff
path: root/lua/core
diff options
context:
space:
mode:
Diffstat (limited to 'lua/core')
-rw-r--r--lua/core/bufferline.lua2
-rw-r--r--lua/core/compe.lua6
-rw-r--r--lua/core/dap.lua23
-rw-r--r--lua/core/dashboard.lua14
-rw-r--r--lua/core/formatter.lua60
-rw-r--r--lua/core/galaxyline.lua4
-rw-r--r--lua/core/gitsigns.lua4
-rw-r--r--lua/core/linter.lua33
-rw-r--r--lua/core/nvimtree.lua4
-rw-r--r--lua/core/status_colors.lua2
-rw-r--r--lua/core/telescope.lua4
-rw-r--r--lua/core/terminal.lua6
-rw-r--r--lua/core/treesitter.lua118
-rw-r--r--lua/core/which-key.lua30
-rw-r--r--lua/core/zen.lua34
15 files changed, 55 insertions, 289 deletions
diff --git a/lua/core/bufferline.lua b/lua/core/bufferline.lua
index d4e4b4fe..ef1d4780 100644
--- a/lua/core/bufferline.lua
+++ b/lua/core/bufferline.lua
@@ -3,7 +3,7 @@ vim.api.nvim_set_keymap("n", "<S-l>", ":BufferNext<CR>", { noremap = true, silen
vim.api.nvim_set_keymap("n", "<S-h>", ":BufferPrevious<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", { noremap = true, silent = true })
-O.plugin.which_key.mappings["b"] = {
+lvim.builtin.which_key.mappings["b"] = {
name = "Buffers",
j = { "<cmd>BufferPick<cr>", "jump to buffer" },
f = { "<cmd>Telescope buffers<cr>", "Find buffer" },
diff --git a/lua/core/compe.lua b/lua/core/compe.lua
index c8152ad1..a3521cfe 100644
--- a/lua/core/compe.lua
+++ b/lua/core/compe.lua
@@ -1,6 +1,6 @@
local M = {}
M.config = function()
- O.completion = {
+ lvim.completion = {
enabled = true,
autocomplete = true,
debug = false,
@@ -34,14 +34,14 @@ M.config = function()
end
M.setup = function()
- vim.g.vsnip_snippet_dir = O.vsnip_dir
+ vim.g.vsnip_snippet_dir = lvim.vsnip_dir
local status_ok, compe = pcall(require, "compe")
if not status_ok then
return
end
- compe.setup(O.completion)
+ compe.setup(lvim.completion)
local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
diff --git a/lua/core/dap.lua b/lua/core/dap.lua
index bc76e221..30e3aef9 100644
--- a/lua/core/dap.lua
+++ b/lua/core/dap.lua
@@ -1,6 +1,6 @@
local M = {}
M.config = function()
- O.plugin.dap = {
+ lvim.builtin.dap = {
active = false,
breakpoint = {
text = "ï—£",
@@ -17,10 +17,10 @@ M.setup = function()
return
end
- vim.fn.sign_define("DapBreakpoint", O.plugin.dap.breakpoint)
+ vim.fn.sign_define("DapBreakpoint", lvim.builtin.dap.breakpoint)
dap.defaults.fallback.terminal_win_cmd = "50vsplit new"
- O.user_which_key["d"] = {
+ lvim.builtin.which_key.mappings["d"] = {
name = "Debug",
t = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "Toggle Breakpoint" },
b = { "<cmd>lua require'dap'.step_back()<cr>", "Step Back" },
@@ -38,4 +38,21 @@ M.setup = function()
}
end
+-- TODO put this up there ^^^ call in ftplugin
+
+-- M.dap = function()
+-- if lvim.plugin.dap.active then
+-- local dap_install = require "dap-install"
+-- dap_install.config("python_dbg", {})
+-- end
+-- end
+--
+-- M.dap = function()
+-- -- gem install readapt ruby-debug-ide
+-- if lvim.plugin.dap.active then
+-- local dap_install = require "dap-install"
+-- dap_install.config("ruby_vsc_dbg", {})
+-- end
+-- end
+
return M
diff --git a/lua/core/dashboard.lua b/lua/core/dashboard.lua
index a1af5319..7433f2d6 100644
--- a/lua/core/dashboard.lua
+++ b/lua/core/dashboard.lua
@@ -1,6 +1,6 @@
local M = {}
M.config = function()
- O.plugin.dashboard = {
+ lvim.builtin.dashboard = {
active = false,
search_handler = "telescope",
custom_header = {
@@ -55,13 +55,13 @@ end
M.setup = function()
vim.g.dashboard_disable_at_vimenter = 0
- vim.g.dashboard_custom_header = O.plugin.dashboard.custom_header
+ vim.g.dashboard_custom_header = lvim.builtin.dashboard.custom_header
- vim.g.dashboard_default_executive = O.plugin.dashboard.search_handler
+ vim.g.dashboard_default_executive = lvim.builtin.dashboard.search_handler
- vim.g.dashboard_custom_section = O.plugin.dashboard.custom_section
+ vim.g.dashboard_custom_section = lvim.builtin.dashboard.custom_section
- O.plugin.which_key.mappings[";"] = { "<cmd>Dashboard<CR>", "Dashboard" }
+ lvim.builtin.which_key.mappings[";"] = { "<cmd>Dashboard<CR>", "Dashboard" }
-- f = {
-- description = { " Neovim Config Files" },
@@ -81,7 +81,7 @@ M.setup = function()
-- file_browser = {description = {' File Browser'}, command = 'Telescope find_files'},
-- vim.g.dashboard_session_directory = CACHE_PATH..'/session'
- -- vim.g.dashboard_custom_footer = O.dashboard.footer
+ -- vim.g.dashboard_custom_footer = lvim.dashboard.footer
require("lv-utils").define_augroups {
_dashboard = {
-- seems to be nobuflisted that makes my stuff disapear will do more testing
@@ -93,7 +93,7 @@ M.setup = function()
{
"FileType",
"dashboard",
- "set showtabline=0 | autocmd BufLeave <buffer> set showtabline=" .. O.default_options.showtabline,
+ "set showtabline=0 | autocmd BufLeave <buffer> set showtabline=" .. vim.opt.showtabline._value,
},
{ "FileType", "dashboard", "nnoremap <silent> <buffer> q :q<CR>" },
},
diff --git a/lua/core/formatter.lua b/lua/core/formatter.lua
deleted file mode 100644
index c8f1baeb..00000000
--- a/lua/core/formatter.lua
+++ /dev/null
@@ -1,60 +0,0 @@
--- autoformat
-if O.format_on_save then
- require("lv-utils").define_augroups {
- autoformat = {
- {
- "BufWritePost",
- "*",
- ":silent FormatWrite",
- },
- },
- }
-end
-
--- -- check if formatter has been defined for the language or not
--- local function formatter_exists(lang_formatter)
--- if lang_formatter == nil then
--- return false
--- end
--- if lang_formatter.exe == nil or lang_formatter.args == nil then
--- return false
--- end
--- return true
--- end
-
--- returns default formatter for given language
--- local function formatter_return(lang_formatter)
--- return {
--- exe = lang_formatter.exe,
--- args = lang_formatter.args,
--- stdin = not (lang_formatter.stdin ~= nil),
--- }
--- end
-
--- fill a table like this -> {rust: {exe:"sth",args:{"a","b"},stdin=true},go: {}...}
--- local formatter_filetypes = {}
--- for k, v in pairs(O.lang) do
--- if formatter_exists(v.formatter) then
--- local keys = v.filetypes
--- if keys == nil then
--- keys = { k }
--- end
--- for _, l in pairs(keys) do
--- formatter_filetypes[l] = {
--- function()
--- return formatter_return(v.formatter)
--- end,
--- }
--- end
--- end
--- end
-local status_ok, _ = pcall(require, "formatter")
-if not status_ok then
- return
-end
-
-if not O.format_on_save then
- vim.cmd [[if exists('#autoformat#BufWritePost')
- :autocmd! autoformat
- endif]]
-end
diff --git a/lua/core/galaxyline.lua b/lua/core/galaxyline.lua
index f880e430..8ca6f5c7 100644
--- a/lua/core/galaxyline.lua
+++ b/lua/core/galaxyline.lua
@@ -7,9 +7,9 @@ if not status_ok then
end
-- NOTE: if someone defines colors but doesn't have them then this will break
-local palette_status_ok, colors = pcall(require, O.colorscheme .. ".palette")
+local palette_status_ok, colors = pcall(require, lvim.colorscheme .. ".palette")
if not palette_status_ok then
- colors = O.plugin.galaxyline.colors
+ colors = lvim.builtin.galaxyline.colors
end
local condition = require "galaxyline.condition"
diff --git a/lua/core/gitsigns.lua b/lua/core/gitsigns.lua
index bc310ad6..2a5060be 100644
--- a/lua/core/gitsigns.lua
+++ b/lua/core/gitsigns.lua
@@ -1,6 +1,6 @@
local M = {}
M.config = function()
- O.plugin.gitsigns = {
+ lvim.builtin.gitsigns = {
signs = {
add = {
hl = "GitSignsAdd",
@@ -53,7 +53,7 @@ M.setup = function()
if not status_ok then
return
end
- gitsigns.setup(O.plugin.gitsigns)
+ gitsigns.setup(lvim.builtin.gitsigns)
end
return M
diff --git a/lua/core/linter.lua b/lua/core/linter.lua
deleted file mode 100644
index 676b0cf7..00000000
--- a/lua/core/linter.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-local M = {}
-
-M.setup = function()
- if O.lint_on_save then
- require("lv-utils").define_augroups {
- autolint = {
- {
- "BufWritePost",
- "<buffer>",
- ":silent lua require('lint').try_lint()",
- },
- {
- "BufEnter",
- "<buffer>",
- ":silent lua require('lint').try_lint()",
- },
- },
- }
- end
-end
-
-local status_ok, _ = pcall(require, "lint")
-if not status_ok then
- return
-end
-
-if not O.lint_on_save then
- vim.cmd [[if exists('#autolint#BufWritePost')
- :autocmd! autolint
- endif]]
-end
-
-return M
diff --git a/lua/core/nvimtree.lua b/lua/core/nvimtree.lua
index a763c71d..62f71d32 100644
--- a/lua/core/nvimtree.lua
+++ b/lua/core/nvimtree.lua
@@ -1,7 +1,7 @@
local M = {}
--
M.config = function()
- O.plugin.nvimtree = {
+ lvim.builtin.nvimtree = {
side = "left",
show_icons = {
git = 1,
@@ -52,7 +52,7 @@ M.setup = function()
end
local g = vim.g
- for opt, val in pairs(O.plugin.nvimtree) do
+ for opt, val in pairs(lvim.builtin.nvimtree) do
g["nvim_tree_" .. opt] = val
end
diff --git a/lua/core/status_colors.lua b/lua/core/status_colors.lua
index ddb4aa98..37e9d7c9 100644
--- a/lua/core/status_colors.lua
+++ b/lua/core/status_colors.lua
@@ -1,4 +1,4 @@
-O.plugin.galaxyline = {
+lvim.builtin.galaxyline = {
active = true,
colors = {
alt_bg = "#2E2E2E",
diff --git a/lua/core/telescope.lua b/lua/core/telescope.lua
index 4456d65e..1e605c7c 100644
--- a/lua/core/telescope.lua
+++ b/lua/core/telescope.lua
@@ -5,7 +5,7 @@ M.config = function()
return
end
- O.plugin.telescope = {
+ lvim.builtin.telescope = {
active = false,
defaults = {
find_command = {
@@ -89,7 +89,7 @@ M.setup = function()
if not status_ok then
return
end
- telescope.setup(O.plugin.telescope)
+ telescope.setup(lvim.builtin.telescope)
vim.api.nvim_set_keymap("n", "<Leader>f", ":Telescope find_files<CR>", { noremap = true, silent = true })
end
diff --git a/lua/core/terminal.lua b/lua/core/terminal.lua
index 0f930453..b7c58c0d 100644
--- a/lua/core/terminal.lua
+++ b/lua/core/terminal.lua
@@ -1,6 +1,6 @@
local M = {}
M.config = function()
- O.plugin["terminal"] = {
+ lvim.builtin["terminal"] = {
-- size can be a number or function which is passed the current terminal
size = 5,
-- open_mapping = [[<c-\>]],
@@ -47,8 +47,8 @@ M.setup = function()
"<cmd>lua require('core.terminal')._lazygit_toggle()<CR>",
{ noremap = true, silent = true }
)
- O.plugin.which_key.mappings["gg"] = "LazyGit"
- terminal.setup(O.plugin.terminal)
+ lvim.builtin.which_key.mappings["gg"] = "LazyGit"
+ terminal.setup(lvim.builtin.terminal)
end
local function is_installed(exe)
diff --git a/lua/core/treesitter.lua b/lua/core/treesitter.lua
index 2b7a2d54..c81f0696 100644
--- a/lua/core/treesitter.lua
+++ b/lua/core/treesitter.lua
@@ -1,6 +1,6 @@
local M = {}
M.config = function()
- O.treesitter = {
+ lvim.builtin.treesitter = {
ensure_installed = {}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
ignore_install = {},
matchup = {
@@ -59,129 +59,15 @@ M.config = function()
max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int
},
}
-
- -- -- TODO refactor treesitter
- -- -- @usage pass a table with your desired languages
- -- treesitter = {
- -- ensure_installed = "all",
- -- ignore_install = { "haskell" },
- -- highlight = { enabled = true },
- -- -- The below are for treesitter-textobjects plugin
- -- textobj_prefixes = {
- -- goto_next = "]", -- Go to next
- -- goto_previous = "[", -- Go to previous
- -- inner = "i", -- Select inside
- -- outer = "a", -- Selct around
- -- swap = "<leader>a", -- Swap with next
- -- },
- -- textobj_suffixes = {
- -- -- Start and End respectively for the goto keys
- -- -- for other keys it only uses the first
- -- ["function"] = { "f", "F" },
- -- ["class"] = { "m", "M" },
- -- ["parameter"] = { "a", "A" },
- -- ["block"] = { "k", "K" },
- -- ["conditional"] = { "i", "I" },
- -- ["call"] = { "c", "C" },
- -- ["loop"] = { "l", "L" },
- -- ["statement"] = { "s", "S" },
- -- ["comment"] = { "/", "?" },
- -- },
- -- -- The below is for treesitter hint textobjects plugin
- -- hint_labels = { "h", "j", "f", "d", "n", "v", "s", "l", "a" },
- -- },
end
M.setup = function()
- -- TODO: refacor this whole file and treesitter in general
- -- if not package.loaded['nvim-treesitter'] then return end
- --
- -- Custom parsers
- -- local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
- -- parser_config.make = {
- -- install_info = {
- -- url = "https://github.com/alemuller/tree-sitter-make", -- local path or git repo
- -- files = {"src/parser.c"},
- -- requires_generate_from_grammar = true
- -- }
- -- }
- -- parser_config.just = {
- -- install_info = {
- -- url = "~/dev/tree-sitter-just", -- local path or git repo
- -- files = {"src/parser.c"}
- -- }
- -- -- filetype = "just", -- if filetype does not agrees with parser name
- -- -- used_by = {"bar", "baz"} -- additional filetypes that use this parser
- -- }
- -- Custom text objects
- -- local textobj_prefixes = O.treesitter.textobj_prefixes
- -- local textobj_suffixes = O.treesitter.textobj_suffixes
- -- local textobj_sel_keymaps = {}
- -- local textobj_swap_keymaps = {}
- -- local textobj_move_keymaps = {
- -- enable = O.plugin.ts_textobjects,
- -- set_jumps = true, -- whether to set jumps in the jumplist
- -- goto_next_start = {},
- -- goto_next_end = {},
- -- goto_previous_start = {},
- -- goto_previous_end = {},
- -- }
- -- for obj, suffix in pairs(textobj_suffixes) do
- -- if textobj_prefixes["goto_next"] ~= nil then
- -- textobj_move_keymaps["goto_next_start"][textobj_prefixes["goto_next"] .. suffix[1]] = "@" .. obj .. ".outer"
- -- textobj_move_keymaps["goto_next_end"][textobj_prefixes["goto_next"] .. suffix[2]] = "@" .. obj .. ".outer"
- -- end
- -- if textobj_prefixes["goto_previous"] ~= nil then
- -- textobj_move_keymaps["goto_previous_start"][textobj_prefixes["goto_previous"] .. suffix[2]] = "@" .. obj .. ".outer"
- -- textobj_move_keymaps["goto_previous_end"][textobj_prefixes["goto_previous"] .. suffix[1]] = "@" .. obj .. ".outer"
- -- end
- --
- -- if textobj_prefixes["inner"] ~= nil then
- -- textobj_sel_keymaps[textobj_prefixes["inner"] .. suffix[1]] = "@" .. obj .. ".inner"
- -- end
- -- if textobj_prefixes["outer"] ~= nil then
- -- textobj_sel_keymaps[textobj_prefixes["outer"] .. suffix[1]] = "@" .. obj .. ".outer"
- -- end
- --
- -- if textobj_prefixes["swap"] ~= nil then
- -- textobj_swap_keymaps[textobj_prefixes["swap"] .. suffix[1]] = "@" .. obj .. ".outer"
- -- end
- -- end
- -- vim.g.ts_hint_textobject_keys = O.treesitter.hint_labels -- Requires https://github.com/mfussenegger/nvim-ts-hint-textobject/pull/2
- --
- -- -- Add which key menu entries
- -- local status, wk = pcall(require, "which-key")
- -- if status then
- -- local normal = {
- -- mode = "n", -- Normal mode
- -- }
- -- local operators = {
- -- mode = "o", -- Operator mode
- -- }
- -- wk.register(textobj_sel_keymaps, operators)
- -- wk.register({
- -- ["m"] = "Hint Objects",
- -- ["."] = "Textsubject",
- -- [";"] = "Textsubject-big",
- -- }, operators)
- -- wk.register(textobj_swap_keymaps, normal)
- -- wk.register({
- -- [textobj_prefixes["swap"]] = "Swap",
- -- -- [textobj_prefixes["goto_next"]] = "Jump [",
- -- -- [textobj_prefixes["goto_previous"]] = "Jump ]"
- -- }, normal)
- -- wk.register(textobj_move_keymaps["goto_next_start"], normal)
- -- wk.register(textobj_move_keymaps["goto_next_end"], normal)
- -- wk.register(textobj_move_keymaps["goto_previous_start"], normal)
- -- wk.register(textobj_move_keymaps["goto_previous_end"], normal)
- -- end
-
local status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs")
if not status_ok then
return
end
- treesitter_configs.setup(O.treesitter)
+ treesitter_configs.setup(lvim.builtin.treesitter)
end
return M
diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua
index 47661df6..1126bea5 100644
--- a/lua/core/which-key.lua
+++ b/lua/core/which-key.lua
@@ -1,6 +1,6 @@
local M = {}
M.config = function()
- O.plugin.which_key = {
+ lvim.builtin.which_key = {
active = false,
setup = {
plugins = {
@@ -117,14 +117,15 @@ M.config = function()
"<cmd>Telescope lsp_workspace_diagnostics<cr>",
"Workspace Diagnostics",
},
- f = { "<cmd>silent FormatWrite<cr>", "Format" },
+ -- f = { "<cmd>silent FormatWrite<cr>", "Format" },
+ f = { "<cmd>lua vim.lsp.buf.formatting()<cr>", "Format" },
i = { "<cmd>LspInfo<cr>", "Info" },
j = {
- "<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<cr>",
+ "<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = lvim.lsp.popup_border}})<cr>",
"Next Diagnostic",
},
k = {
- "<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<cr>",
+ "<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = lvim.lsp.popup_border}})<cr>",
"Prev Diagnostic",
},
l = { "<cmd>silent lua require('lint').try_lint()<cr>", "Lint" },
@@ -171,29 +172,18 @@ M.setup = function()
return
end
- which_key.setup(O.plugin.which_key.setup)
+ which_key.setup(lvim.builtin.which_key.setup)
- local opts = O.plugin.which_key.opts
- local vopts = O.plugin.which_key.vopts
+ local opts = lvim.builtin.which_key.opts
+ local vopts = lvim.builtin.which_key.vopts
- local mappings = O.plugin.which_key.mappings
- local vmappings = O.plugin.which_key.vmappings
-
- -- if O.plugin.ts_playground.active then
- -- vim.api.nvim_set_keymap("n", "<leader>Th", ":TSHighlightCapturesUnderCursor<CR>", { noremap = true, silent = true })
- -- mappings[""] = "Highlight Capture"
- -- end
-
- if O.plugin.zen.active then
- vim.api.nvim_set_keymap("n", "<leader>z", ":ZenMode<CR>", { noremap = true, silent = true })
- mappings["z"] = "Zen"
- end
+ local mappings = lvim.builtin.which_key.mappings
+ local vmappings = lvim.builtin.which_key.vmappings
local wk = require "which-key"
wk.register(mappings, opts)
wk.register(vmappings, vopts)
- wk.register(O.user_which_key, opts)
end
return M
diff --git a/lua/core/zen.lua b/lua/core/zen.lua
deleted file mode 100644
index 99a5d769..00000000
--- a/lua/core/zen.lua
+++ /dev/null
@@ -1,34 +0,0 @@
-local M = {}
-M.config = function()
- O.plugin["zen"] = {
- window = {
- backdrop = 1,
- height = 0.85, -- height of the Zen window
- options = {
- signcolumn = "no", -- disable signcolumn
- number = false, -- disable number column
- relativenumber = false, -- disable relative numbers
- -- cursorline = false, -- disable cursorline
- -- cursorcolumn = false, -- disable cursor column
- -- foldcolumn = "0", -- disable fold column
- -- list = false, -- disable whitespace characters
- },
- },
- plugins = {
- gitsigns = { enabled = false }, -- disables git signs
- -- your configuration comes here
- -- or leave it empty to use the default settings
- -- refer to the configuration section below
- },
- }
-end
-
-M.setup = function()
- local status_ok, zen_mode = pcall(require, "zen-mode")
- if not status_ok then
- return
- end
- zen_mode.setup(O.plugin.zen)
-end
-
-return M