mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-20 18:45:08 +02:00
refactor single file
This commit is contained in:
parent
476f7bb22f
commit
2423fcdc90
37 changed files with 1088 additions and 1169 deletions
|
@ -62,7 +62,6 @@ O.leader_key = ' '
|
|||
O.plugin.dashboard.active = true
|
||||
O.plugin.floatterm.active = true
|
||||
O.plugin.zen.active = true
|
||||
O.plugin.telescope_project.active = true
|
||||
|
||||
-- if you don't want all the parsers change this to a table of the ones you want
|
||||
O.treesitter.ensure_installed = "all"
|
||||
|
|
1
init.lua
1
init.lua
|
@ -8,7 +8,6 @@ require "plugins"
|
|||
vim.g.colors_name = O.colorscheme -- Colorscheme must get called after plugins are loaded or it will break new installs.
|
||||
require "settings"
|
||||
require "lv-utils"
|
||||
require "lv-treesitter"
|
||||
|
||||
-- TODO: these guys need to be in language files
|
||||
-- require "lsp"
|
||||
|
|
|
@ -1,12 +1,41 @@
|
|||
--if not package.loaded['compe'] then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
local M = {}
|
||||
|
||||
vim.g.vsnip_snippet_dir = O.vnsip_dir
|
||||
|
||||
M.config = function()
|
||||
O.completion = {
|
||||
enabled = true,
|
||||
autocomplete = true,
|
||||
debug = false,
|
||||
min_length = 1,
|
||||
preselect = "enable",
|
||||
throttle_time = 80,
|
||||
source_timeout = 200,
|
||||
incomplete_delay = 400,
|
||||
max_abbr_width = 100,
|
||||
max_kind_width = 100,
|
||||
max_menu_width = 100,
|
||||
documentation = true,
|
||||
|
||||
source = {
|
||||
path = { kind = " (Path)" },
|
||||
buffer = { kind = " (Buffer)" },
|
||||
calc = { kind = " (Calc)" },
|
||||
vsnip = { kind = " (Snippet)" },
|
||||
nvim_lsp = { kind = " (LSP)" },
|
||||
nvim_lua = false,
|
||||
spell = { kind = " (Spell)" },
|
||||
tags = false,
|
||||
vim_dadbod_completion = false,
|
||||
snippets_nvim = false,
|
||||
ultisnips = false,
|
||||
treesitter = false,
|
||||
emoji = { kind = " ﲃ (Emoji)", filetypes = { "markdown", "text" } },
|
||||
-- for emoji press : (idk if that in compe tho)
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
vim.g.vsnip_snippet_dir = O.vnsip_dir
|
||||
|
||||
local status_ok, compe = pcall(require, "compe")
|
||||
if not status_ok then
|
||||
return
|
41
lua/core/dap.lua
Normal file
41
lua/core/dap.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
local M = {}
|
||||
M.config = function()
|
||||
O.plugin.dap = {
|
||||
active = false,
|
||||
breakpoint = {
|
||||
text = "",
|
||||
texthl = "LspDiagnosticsSignError",
|
||||
linehl = "",
|
||||
numhl = "",
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
local status_ok, dap = pcall(require, "dap")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
vim.fn.sign_define("DapBreakpoint", O.plugin.dap.breakpoint)
|
||||
dap.defaults.fallback.terminal_win_cmd = "50vsplit new"
|
||||
|
||||
O.user_which_key["d"] = {
|
||||
name = "Debug",
|
||||
t = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "Toggle Breakpoint" },
|
||||
b = { "<cmd>lua require'dap'.step_back()<cr>", "Step Back" },
|
||||
c = { "<cmd>lua require'dap'.continue()<cr>", "Continue" },
|
||||
C = { "<cmd>lua require'dap'.run_to_cursor()<cr>", "Run To Cursor" },
|
||||
d = { "<cmd>lua require'dap'.disconnect()<cr>", "Disconnect" },
|
||||
g = { "<cmd>lua require'dap'.session()<cr>", "Get Session" },
|
||||
i = { "<cmd>lua require'dap'.step_into()<cr>", "Step Into" },
|
||||
o = { "<cmd>lua require'dap'.step_over()<cr>", "Step Over" },
|
||||
u = { "<cmd>lua require'dap'.step_out()<cr>", "Step Out" },
|
||||
p = { "<cmd>lua require'dap'.pause.toggle()<cr>", "Pause" },
|
||||
r = { "<cmd>lua require'dap'.repl.toggle()<cr>", "Toggle Repl" },
|
||||
s = { "<cmd>lua require'dap'.continue()<cr>", "Start" },
|
||||
q = { "<cmd>lua require'dap'.stop()<cr>", "Quit" },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
100
lua/core/dashboard.lua
Normal file
100
lua/core/dashboard.lua
Normal file
|
@ -0,0 +1,100 @@
|
|||
local M = {}
|
||||
M.config = function()
|
||||
O.plugin.dashboard = {
|
||||
active = false,
|
||||
search_handler = "telescope",
|
||||
custom_header = {
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣤⣶⣾⠿⠿⠟⠛⠛⠛⠛⠿⠿⣿⣷⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⡿⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠒⠂⠉⠉⠉⠉⢩⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⢰⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⠠⡀⠀⠀⢀⣾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⢀⣸⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡧⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠈⠁⠒⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣇⠀⠀⠀⠀⠀⠀⠉⠢⠤⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡟⠈⠑⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠑⠒⠤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⡇⠀⠀⢀⣣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⠒⠢⠤⠄⣀⣀⠀⠀⠀⢠⣿⡟⠀⠀⠀⣺⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⣿⠇⠀⠀⠀⠀⠀⣤⡄⠀⠀⢠⣤⡄⠀⢨⣭⣠⣤⣤⣤⡀⠀⠀⢀⣤⣤⣤⣤⡄⠀⠀⠀⣤⣄⣤⣤⣤⠀⠀⣿⣯⠉⠉⣿⡟⠀⠈⢩⣭⣤⣤⠀⠀⠀⠀⣠⣤⣤⣤⣄⣤⣤",
|
||||
"⢠⣿⠀⠀⠀⠀⠀⠀⣿⠃⠀⠀⣸⣿⠁⠀⣿⣿⠉⠀⠈⣿⡇⠀⠀⠛⠋⠀⠀⢹⣿⠀⠀⠀⣿⠏⠀⠸⠿⠃⠀⣿⣿⠀⣰⡟⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⣿⡟⢸⣿⡇⢀⣿",
|
||||
"⣸⡇⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⣿⡟⠀⢠⣿⡇⠀⠀⢰⣿⡇⠀⣰⣾⠟⠛⠛⣻⡇⠀⠀⢸⡿⠀⠀⠀⠀⠀⠀⢻⣿⢰⣿⠀⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⢸⣿⠇⢸⣿⠀⢸⡏",
|
||||
"⣿⣧⣤⣤⣤⡄⠀⠘⣿⣤⣤⡤⣿⠇⠀⢸⣿⠁⠀⠀⣼⣿⠀⠀⢿⣿⣤⣤⠔⣿⠃⠀⠀⣾⡇⠀⠀⠀⠀⠀⠀⢸⣿⣿⠋⠀⠀⠀⢠⣤⣤⣿⣥⣤⡄⠀⣼⣿⠀⣸⡏⠀⣿⠃",
|
||||
"⠉⠉⠉⠉⠉⠁⠀⠀⠈⠉⠉⠀⠉⠀⠀⠈⠉⠀⠀⠀⠉⠉⠀⠀⠀⠉⠉⠁⠈⠉⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⠁⠀⠉⠁⠀⠉⠁⠀⠉⠀",
|
||||
},
|
||||
|
||||
custom_section = {
|
||||
a = {
|
||||
description = { " Find File " },
|
||||
command = "Telescope find_files",
|
||||
},
|
||||
b = {
|
||||
description = { " Recently Used Files" },
|
||||
command = "Telescope oldfiles",
|
||||
},
|
||||
-- c = {
|
||||
-- description = { " Load Last Session " },
|
||||
-- command = "SessionLoad",
|
||||
-- },
|
||||
c = {
|
||||
description = { " Find Word " },
|
||||
command = "Telescope live_grep",
|
||||
},
|
||||
d = {
|
||||
description = { " Settings " },
|
||||
command = ":e " .. CONFIG_PATH .. "/lv-config.lua",
|
||||
},
|
||||
},
|
||||
|
||||
footer = { "chrisatmachine.com" },
|
||||
}
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
vim.g.dashboard_disable_at_vimenter = 0
|
||||
|
||||
vim.g.dashboard_custom_header = O.plugin.dashboard.custom_header
|
||||
|
||||
vim.g.dashboard_default_executive = O.plugin.dashboard.search_handler
|
||||
|
||||
vim.g.dashboard_custom_section = O.plugin.dashboard.custom_section
|
||||
|
||||
-- f = {
|
||||
-- description = { " Neovim Config Files" },
|
||||
-- command = "Telescope find_files cwd=" .. CONFIG_PATH,
|
||||
-- },
|
||||
-- e = {description = {' Marks '}, command = 'Telescope marks'}
|
||||
vim.cmd "let g:dashboard_session_directory = $HOME..'/.config/nvim/.sessions'"
|
||||
vim.cmd "let packages = len(globpath('~/.local/share/nvim/site/pack/packer/start', '*', 0, 1))"
|
||||
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
let g:dashboard_custom_footer = ['LuaJIT loaded '..packages..' plugins']
|
||||
]],
|
||||
false
|
||||
)
|
||||
|
||||
-- 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
|
||||
require("lv-utils").define_augroups {
|
||||
_dashboard = {
|
||||
-- seems to be nobuflisted that makes my stuff disapear will do more testing
|
||||
{
|
||||
"FileType",
|
||||
"dashboard",
|
||||
"setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell nolist nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= ",
|
||||
},
|
||||
{
|
||||
"FileType",
|
||||
"dashboard",
|
||||
"set showtabline=0 | autocmd BufLeave <buffer> set showtabline=2",
|
||||
},
|
||||
{ "FileType", "dashboard", "nnoremap <silent> <buffer> q :q<CR>" },
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,6 +1,18 @@
|
|||
local M = {}
|
||||
|
||||
M.config = function()
|
||||
O.plugin.floatterm = {
|
||||
active = false,
|
||||
dimensions = {
|
||||
height = 0.9,
|
||||
width = 0.9,
|
||||
x = 0.5,
|
||||
y = 0.3,
|
||||
},
|
||||
border = "single", -- or 'double'
|
||||
}
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
local status_ok, fterm = pcall(require, "FTerm")
|
||||
if not status_ok then
|
||||
return
|
353
lua/core/galaxyline.lua
Normal file
353
lua/core/galaxyline.lua
Normal file
|
@ -0,0 +1,353 @@
|
|||
local M = {}
|
||||
M.config = function()
|
||||
O.plugin.galaxyline = {
|
||||
active = true,
|
||||
colors = {
|
||||
alt_bg = "#2E2E2E",
|
||||
grey = "#858585",
|
||||
blue = "#569CD6",
|
||||
green = "#608B4E",
|
||||
yellow = "#DCDCAA",
|
||||
orange = "#FF8800",
|
||||
purple = "#C586C0",
|
||||
magenta = "#D16D9E",
|
||||
cyan = "#4EC9B0",
|
||||
red = "#D16969",
|
||||
error_red = "#F44747",
|
||||
warning_orange = "#FF8800",
|
||||
info_yellow = "#FFCC66",
|
||||
hint_blue = "#9CDCFE",
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
-- if not package.loaded['galaxyline'] then
|
||||
-- return
|
||||
-- end
|
||||
local status_ok, gl = pcall(require, "galaxyline")
|
||||
if not status_ok then
|
||||
return
|
||||
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")
|
||||
if not palette_status_ok then
|
||||
colors = O.plugin.galaxyline.colors
|
||||
end
|
||||
|
||||
local condition = require "galaxyline.condition"
|
||||
local gls = gl.section
|
||||
gl.short_line_list = { "NvimTree", "vista", "dbui", "packer" }
|
||||
|
||||
table.insert(gls.left, {
|
||||
ViMode = {
|
||||
provider = function()
|
||||
-- auto change color according the vim mode
|
||||
local mode_color = {
|
||||
n = colors.blue,
|
||||
i = colors.green,
|
||||
v = colors.purple,
|
||||
[""] = colors.purple,
|
||||
V = colors.purple,
|
||||
c = colors.magenta,
|
||||
no = colors.blue,
|
||||
s = colors.orange,
|
||||
S = colors.orange,
|
||||
[""] = colors.orange,
|
||||
ic = colors.yellow,
|
||||
R = colors.red,
|
||||
Rv = colors.red,
|
||||
cv = colors.blue,
|
||||
ce = colors.blue,
|
||||
r = colors.cyan,
|
||||
rm = colors.cyan,
|
||||
["r?"] = colors.cyan,
|
||||
["!"] = colors.blue,
|
||||
t = colors.blue,
|
||||
}
|
||||
vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()])
|
||||
return "▊"
|
||||
end,
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { "NONE", colors.alt_bg },
|
||||
},
|
||||
})
|
||||
-- print(vim.fn.getbufvar(0, 'ts'))
|
||||
vim.fn.getbufvar(0, "ts")
|
||||
|
||||
table.insert(gls.left, {
|
||||
GitIcon = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
condition = condition.check_git_workspace,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.orange, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.left, {
|
||||
GitBranch = {
|
||||
provider = "GitBranch",
|
||||
condition = condition.check_git_workspace,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.left, {
|
||||
DiffAdd = {
|
||||
provider = "DiffAdd",
|
||||
condition = condition.hide_in_width,
|
||||
icon = " ",
|
||||
highlight = { colors.green, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.left, {
|
||||
DiffModified = {
|
||||
provider = "DiffModified",
|
||||
condition = condition.hide_in_width,
|
||||
icon = " 柳",
|
||||
highlight = { colors.blue, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.left, {
|
||||
DiffRemove = {
|
||||
provider = "DiffRemove",
|
||||
condition = condition.hide_in_width,
|
||||
icon = " ",
|
||||
highlight = { colors.red, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.left, {
|
||||
Filler = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
-- get output from shell command
|
||||
function os.capture(cmd, raw)
|
||||
local f = assert(io.popen(cmd, "r"))
|
||||
local s = assert(f:read "*a")
|
||||
f:close()
|
||||
if raw then
|
||||
return s
|
||||
end
|
||||
s = string.gsub(s, "^%s+", "")
|
||||
s = string.gsub(s, "%s+$", "")
|
||||
s = string.gsub(s, "[\n\r]+", " ")
|
||||
return s
|
||||
end
|
||||
-- cleanup virtual env
|
||||
local function env_cleanup(venv)
|
||||
if string.find(venv, "/") then
|
||||
local final_venv = venv
|
||||
for w in venv:gmatch "([^/]+)" do
|
||||
final_venv = w
|
||||
end
|
||||
venv = final_venv
|
||||
end
|
||||
return venv
|
||||
end
|
||||
local PythonEnv = function()
|
||||
if vim.bo.filetype == "python" then
|
||||
local venv = os.getenv "CONDA_DEFAULT_ENV"
|
||||
if venv ~= nil then
|
||||
return " (" .. env_cleanup(venv) .. ")"
|
||||
end
|
||||
venv = os.getenv "VIRTUAL_ENV"
|
||||
if venv ~= nil then
|
||||
return " (" .. env_cleanup(venv) .. ")"
|
||||
end
|
||||
return ""
|
||||
end
|
||||
return ""
|
||||
end
|
||||
table.insert(gls.left, {
|
||||
VirtualEnv = {
|
||||
provider = PythonEnv,
|
||||
event = "BufEnter",
|
||||
highlight = { colors.green, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
DiagnosticError = {
|
||||
provider = "DiagnosticError",
|
||||
icon = " ",
|
||||
highlight = { colors.red, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
table.insert(gls.right, {
|
||||
DiagnosticWarn = {
|
||||
provider = "DiagnosticWarn",
|
||||
icon = " ",
|
||||
highlight = { colors.orange, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
DiagnosticInfo = {
|
||||
provider = "DiagnosticInfo",
|
||||
icon = " ",
|
||||
highlight = { colors.yellow, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
DiagnosticHint = {
|
||||
provider = "DiagnosticHint",
|
||||
icon = " ",
|
||||
highlight = { colors.blue, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
TreesitterIcon = {
|
||||
provider = function()
|
||||
if next(vim.treesitter.highlighter.active) ~= nil then
|
||||
return " "
|
||||
end
|
||||
return ""
|
||||
end,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.green, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
local get_lsp_client = function(msg)
|
||||
msg = msg or "LSP Inactive"
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
local lsps = ""
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
-- print(client.name)
|
||||
if lsps == "" then
|
||||
-- print("first", lsps)
|
||||
lsps = client.name
|
||||
else
|
||||
if not string.find(lsps, client.name) then
|
||||
lsps = lsps .. ", " .. client.name
|
||||
end
|
||||
-- print("more", lsps)
|
||||
end
|
||||
end
|
||||
end
|
||||
if lsps == "" then
|
||||
return msg
|
||||
else
|
||||
return lsps
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(gls.right, {
|
||||
ShowLspClient = {
|
||||
provider = get_lsp_client,
|
||||
condition = function()
|
||||
local tbl = { ["dashboard"] = true, [" "] = true }
|
||||
if tbl[vim.bo.filetype] then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
icon = " ",
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
LineInfo = {
|
||||
provider = "LineColumn",
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
PerCent = {
|
||||
provider = "LinePercent",
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
Tabstop = {
|
||||
provider = function()
|
||||
return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " "
|
||||
end,
|
||||
condition = condition.hide_in_width,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
BufferType = {
|
||||
provider = "FileTypeName",
|
||||
condition = condition.hide_in_width,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
FileEncode = {
|
||||
provider = "FileEncode",
|
||||
condition = condition.hide_in_width,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
Space = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.short_line_left, {
|
||||
BufferType = {
|
||||
provider = "FileTypeName",
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.short_line_left, {
|
||||
SFileName = {
|
||||
provider = "SFileName",
|
||||
condition = condition.buffer_not_empty,
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
--table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.alt_bg}}})
|
||||
end
|
||||
|
||||
return M
|
|
@ -8,7 +8,7 @@ if not status_ok then
|
|||
return
|
||||
end
|
||||
--
|
||||
M.config = function()
|
||||
M.setup = function()
|
||||
local g = vim.g
|
||||
|
||||
vim.o.termguicolors = true
|
94
lua/core/telescope.lua
Normal file
94
lua/core/telescope.lua
Normal file
|
@ -0,0 +1,94 @@
|
|||
local M = {}
|
||||
M.config = function()
|
||||
local status_ok, actions = pcall(require, "telescope.actions")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
O.plugin.telescope = {
|
||||
active = false,
|
||||
defaults = {
|
||||
find_command = {
|
||||
"rg",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
},
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "descending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
width = 0.75,
|
||||
prompt_position = "bottom",
|
||||
preview_cutoff = 120,
|
||||
horizontal = { mirror = false },
|
||||
vertical = { mirror = false },
|
||||
},
|
||||
file_sorter = require("telescope.sorters").get_fzy_sorter,
|
||||
file_ignore_patterns = {},
|
||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||
path_display = { "shorten" },
|
||||
winblend = 0,
|
||||
border = {},
|
||||
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||
color_devicons = true,
|
||||
use_less = true,
|
||||
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
|
||||
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
|
||||
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
||||
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
||||
|
||||
-- Developer configurations: Not meant for general override
|
||||
-- buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-c>"] = actions.close,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||
["<CR>"] = actions.select_default + actions.center,
|
||||
-- To disable a keymap, put [map] = false
|
||||
-- So, to not map "<C-n>", just put
|
||||
-- ["<c-t>"] = trouble.open_with_trouble,
|
||||
-- ["<c-x>"] = false,
|
||||
-- ["<esc>"] = actions.close,
|
||||
-- Otherwise, just set the mapping to the function that you want it to be.
|
||||
-- ["<C-i>"] = actions.select_horizontal,
|
||||
-- Add up multiple actions
|
||||
-- You can perform as many actions in a row as you like
|
||||
-- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action,
|
||||
},
|
||||
n = {
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||
-- ["<c-t>"] = trouble.open_with_trouble,
|
||||
-- ["<C-i>"] = my_cool_custom_action,
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
fzy_native = {
|
||||
override_generic_sorter = false,
|
||||
override_file_sorter = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
local status_ok, telescope = pcall(require, "telescope")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
telescope.setup(O.plugin.telescope)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>f", ":Telescope find_files<CR>", { noremap = true, silent = true })
|
||||
end
|
||||
|
||||
return M
|
187
lua/core/treesitter.lua
Normal file
187
lua/core/treesitter.lua
Normal file
|
@ -0,0 +1,187 @@
|
|||
local M = {}
|
||||
M.config = function()
|
||||
O.treesitter = {
|
||||
ensure_installed = {}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
ignore_install = {},
|
||||
matchup = {
|
||||
enable = false, -- mandatory, false will disable the whole extension
|
||||
-- disable = { "c", "ruby" }, -- optional, list of language that will be disabled
|
||||
},
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
additional_vim_regex_highlighting = true,
|
||||
disable = { "latex" },
|
||||
},
|
||||
context_commentstring = {
|
||||
enable = false,
|
||||
config = { css = "// %s" },
|
||||
},
|
||||
-- indent = {enable = true, disable = {"python", "html", "javascript"}},
|
||||
-- TODO seems to be broken
|
||||
indent = { enable = { "javascriptreact" } },
|
||||
autotag = { enable = false },
|
||||
textobjects = {
|
||||
swap = {
|
||||
enable = false,
|
||||
-- swap_next = textobj_swap_keymaps,
|
||||
},
|
||||
-- move = textobj_move_keymaps,
|
||||
select = {
|
||||
enable = false,
|
||||
-- keymaps = textobj_sel_keymaps,
|
||||
},
|
||||
},
|
||||
textsubjects = {
|
||||
enable = false,
|
||||
keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" },
|
||||
},
|
||||
playground = {
|
||||
enable = false,
|
||||
disable = {},
|
||||
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
|
||||
persist_queries = false, -- Whether the query persists across vim sessions
|
||||
keybindings = {
|
||||
toggle_query_editor = "o",
|
||||
toggle_hl_groups = "i",
|
||||
toggle_injected_languages = "t",
|
||||
toggle_anonymous_nodes = "a",
|
||||
toggle_language_display = "I",
|
||||
focus_language = "f",
|
||||
unfocus_language = "F",
|
||||
update = "R",
|
||||
goto_node = "<cr>",
|
||||
show_help = "?",
|
||||
},
|
||||
},
|
||||
rainbow = {
|
||||
enable = false,
|
||||
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
|
||||
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)
|
||||
end
|
||||
|
||||
return M
|
197
lua/core/which-key.lua
Normal file
197
lua/core/which-key.lua
Normal file
|
@ -0,0 +1,197 @@
|
|||
local M = {}
|
||||
M.config = function()
|
||||
O.plugin.which_key = {
|
||||
active = false,
|
||||
setup = {
|
||||
plugins = {
|
||||
marks = true, -- shows a list of your marks on ' and `
|
||||
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
||||
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
||||
-- No actual key bindings are created
|
||||
presets = {
|
||||
operators = false, -- adds help for operators like d, y, ...
|
||||
motions = false, -- adds help for motions
|
||||
text_objects = false, -- help for text objects triggered after entering an operator
|
||||
windows = true, -- default bindings on <c-w>
|
||||
nav = true, -- misc bindings to work with windows
|
||||
z = true, -- bindings for folds, spelling and others prefixed with z
|
||||
g = true, -- bindings for prefixed with g
|
||||
},
|
||||
spelling = { enabled = true, suggestions = 20 }, -- use which-key for spelling hints
|
||||
},
|
||||
icons = {
|
||||
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
||||
separator = "➜", -- symbol used between a key and it's label
|
||||
group = "+", -- symbol prepended to a group
|
||||
},
|
||||
window = {
|
||||
border = "single", -- none, single, double, shadow
|
||||
position = "bottom", -- bottom, top
|
||||
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
|
||||
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
|
||||
},
|
||||
layout = {
|
||||
height = { min = 4, max = 25 }, -- min and max height of the columns
|
||||
width = { min = 20, max = 50 }, -- min and max width of the columns
|
||||
spacing = 3, -- spacing between columns
|
||||
},
|
||||
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
|
||||
show_help = true, -- show help message on the command line when the popup is visible
|
||||
},
|
||||
|
||||
opts = {
|
||||
mode = "n", -- NORMAL mode
|
||||
prefix = "<leader>",
|
||||
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
||||
silent = true, -- use `silent` when creating keymaps
|
||||
noremap = true, -- use `noremap` when creating keymaps
|
||||
nowait = true, -- use `nowait` when creating keymaps
|
||||
},
|
||||
vopts = {
|
||||
mode = "v", -- VISUAL mode
|
||||
prefix = "<leader>",
|
||||
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
||||
silent = true, -- use `silent` when creating keymaps
|
||||
noremap = true, -- use `noremap` when creating keymaps
|
||||
nowait = true, -- use `nowait` when creating keymaps
|
||||
},
|
||||
-- NOTE: Prefer using : over <cmd> as the latter avoids going back in normal-mode.
|
||||
-- see https://neovim.io/doc/user/map.html#:map-cmd
|
||||
vmappings = {
|
||||
["/"] = { ":CommentToggle<CR>", "Comment" },
|
||||
},
|
||||
mappings = {
|
||||
["w"] = { "<cmd>w!<CR>", "Save" },
|
||||
["q"] = { "<cmd>q!<CR>", "Quit" },
|
||||
["/"] = { "<cmd>CommentToggle<CR>", "Comment" },
|
||||
["c"] = { "<cmd>BufferClose<CR>", "Close Buffer" },
|
||||
["e"] = { "<cmd>lua require'core.nvimtree'.toggle_tree()<CR>", "Explorer" },
|
||||
["f"] = { "<cmd>Telescope find_files<CR>", "Find File" },
|
||||
["h"] = { '<cmd>let @/=""<CR>', "No Highlight" },
|
||||
[";"] = { "<cmd>Dashboard<CR>", "Dashboard" },
|
||||
p = {
|
||||
name = "Packer",
|
||||
c = { "<cmd>PackerCompile<cr>", "Compile" },
|
||||
i = { "<cmd>PackerInstall<cr>", "Install" },
|
||||
r = { "<cmd>lua require('lv-utils').reload_lv_config()<cr>", "Reload" },
|
||||
s = { "<cmd>PackerSync<cr>", "Sync" },
|
||||
u = { "<cmd>PackerUpdate<cr>", "Update" },
|
||||
},
|
||||
|
||||
-- " Available Debug Adapters:
|
||||
-- " https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/
|
||||
-- " Adapter configuration and installation instructions:
|
||||
-- " https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation
|
||||
-- " Debug Adapter protocol:
|
||||
-- " https://microsoft.github.io/debug-adapter-protocol/
|
||||
-- " Debugging
|
||||
g = {
|
||||
name = "Git",
|
||||
j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
|
||||
k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
|
||||
l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
|
||||
p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
|
||||
r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
|
||||
R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
|
||||
s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
|
||||
u = {
|
||||
"<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
|
||||
"Undo Stage Hunk",
|
||||
},
|
||||
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
|
||||
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
|
||||
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
|
||||
C = {
|
||||
"<cmd>Telescope git_bcommits<cr>",
|
||||
"Checkout commit(for current file)",
|
||||
},
|
||||
},
|
||||
|
||||
l = {
|
||||
name = "LSP",
|
||||
a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
|
||||
d = {
|
||||
"<cmd>Telescope lsp_document_diagnostics<cr>",
|
||||
"Document Diagnostics",
|
||||
},
|
||||
w = {
|
||||
"<cmd>Telescope lsp_workspace_diagnostics<cr>",
|
||||
"Workspace Diagnostics",
|
||||
},
|
||||
f = { "<cmd>silent FormatWrite<cr>", "Format" },
|
||||
i = { "<cmd>LspInfo<cr>", "Info" },
|
||||
j = {
|
||||
"<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<cr>",
|
||||
"Next Diagnostic",
|
||||
},
|
||||
k = {
|
||||
"<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<cr>",
|
||||
"Prev Diagnostic",
|
||||
},
|
||||
q = { "<cmd>Telescope quickfix<cr>", "Quickfix" },
|
||||
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
|
||||
s = { "<cmd> Telescope lsp_document_symbols<cr>", "Document Symbols" },
|
||||
S = {
|
||||
"<cmd>Telescope lsp_dynamic_workspace_symbols<cr>",
|
||||
"Workspace Symbols",
|
||||
},
|
||||
},
|
||||
|
||||
s = {
|
||||
name = "Search",
|
||||
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
|
||||
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
|
||||
f = { "<cmd>Telescope find_files<cr>", "Find File" },
|
||||
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
|
||||
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
|
||||
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
|
||||
R = { "<cmd>Telescope registers<cr>", "Registers" },
|
||||
t = { "<cmd>Telescope live_grep<cr>", "Text" },
|
||||
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
|
||||
C = { "<cmd>Telescope commands<cr>", "Commands" },
|
||||
},
|
||||
T = {
|
||||
name = "Treesitter",
|
||||
i = { ":TSConfigInfo<cr>", "Info" },
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
-- if not package.loaded['which-key'] then
|
||||
-- return
|
||||
-- end
|
||||
local status_ok, which_key = pcall(require, "which-key")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
which_key.setup(O.plugin.which_key.setup)
|
||||
|
||||
local opts = O.plugin.which_key.opts
|
||||
local vopts = O.plugin.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
|
||||
|
||||
for k, v in pairs(O.user_which_key) do
|
||||
mappings[k] = v
|
||||
end
|
||||
|
||||
local wk = require "which-key"
|
||||
wk.register(mappings, opts)
|
||||
wk.register(vmappings, vopts)
|
||||
end
|
||||
|
||||
return M
|
34
lua/core/zen.lua
Normal file
34
lua/core/zen.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
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
|
|
@ -55,6 +55,8 @@ O = {
|
|||
scrolloff = 8, -- is one of my fav
|
||||
},
|
||||
|
||||
plugin = {},
|
||||
|
||||
-- TODO: refactor for tree
|
||||
auto_close_tree = 0,
|
||||
nvim_tree_disable_netrw = 0,
|
||||
|
@ -66,17 +68,6 @@ O = {
|
|||
|
||||
database = { save_location = "~/.config/lunarvim_db", auto_execute = 1 },
|
||||
|
||||
plugin = {
|
||||
-- Builtins
|
||||
diffview = { active = false },
|
||||
ts_hintobjects = { active = false },
|
||||
ts_textobjects = { active = false },
|
||||
ts_textsubjects = { active = false },
|
||||
telescope_project = { active = false },
|
||||
indent_line = { active = false },
|
||||
lush = { active = false },
|
||||
},
|
||||
|
||||
-- TODO: just using mappings (leader mappings)
|
||||
user_which_key = {},
|
||||
|
||||
|
@ -293,15 +284,13 @@ O = {
|
|||
},
|
||||
}
|
||||
|
||||
require "lv-zen.config"
|
||||
require "lv-compe.config"
|
||||
require "lv-dashboard.config"
|
||||
require "lv-floatterm.config"
|
||||
require "lv-galaxyline.config"
|
||||
require("core.gitsigns").config()
|
||||
-- print(vim.inspect(O["gitsigns"]))
|
||||
require "lv-telescope.config"
|
||||
require "lv-floatterm.config"
|
||||
require "lv-dap.config"
|
||||
require "lv-which-key.config"
|
||||
require "lv-treesitter.config"
|
||||
require("core.compe").config()
|
||||
require("core.dashboard").config()
|
||||
require("core.dap").config()
|
||||
require("core.floatterm").config()
|
||||
require("core.zen").config()
|
||||
require("core.galaxyline").config()
|
||||
require("core.telescope").config()
|
||||
require("core.treesitter").config()
|
||||
require("core.which-key").config()
|
||||
|
|
|
@ -64,8 +64,8 @@ local mappings = {
|
|||
{ "<", "<gv" },
|
||||
{ ">", ">gv" },
|
||||
|
||||
{ "p", '"0p', { silent = true } },
|
||||
{ "P", '"0P', { silent = true } },
|
||||
-- { "p", '"0p', { silent = true } },
|
||||
-- { "P", '"0P', { silent = true } },
|
||||
},
|
||||
x = { -- Visual mode
|
||||
-- Move selected line / block of text in visual mode
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
O.completion = {
|
||||
enabled = true,
|
||||
autocomplete = true,
|
||||
debug = false,
|
||||
min_length = 1,
|
||||
preselect = "enable",
|
||||
throttle_time = 80,
|
||||
source_timeout = 200,
|
||||
incomplete_delay = 400,
|
||||
max_abbr_width = 100,
|
||||
max_kind_width = 100,
|
||||
max_menu_width = 100,
|
||||
documentation = true,
|
||||
|
||||
source = {
|
||||
path = { kind = " (Path)" },
|
||||
buffer = { kind = " (Buffer)" },
|
||||
calc = { kind = " (Calc)" },
|
||||
vsnip = { kind = " (Snippet)" },
|
||||
nvim_lsp = { kind = " (LSP)" },
|
||||
nvim_lua = false,
|
||||
spell = { kind = " (Spell)" },
|
||||
tags = false,
|
||||
vim_dadbod_completion = false,
|
||||
snippets_nvim = false,
|
||||
ultisnips = false,
|
||||
treesitter = false,
|
||||
emoji = { kind = " ﲃ (Emoji)", filetypes = { "markdown", "text" } },
|
||||
-- for emoji press : (idk if that in compe tho)
|
||||
},
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
O.plugin.dap = {
|
||||
active = false,
|
||||
breakpoint = {
|
||||
text = "",
|
||||
texthl = "LspDiagnosticsSignError",
|
||||
linehl = "",
|
||||
numhl = "",
|
||||
},
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
local status_ok, dap = pcall(require, "dap")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
-- require "dap"
|
||||
vim.fn.sign_define("DapBreakpoint", O.plugin.dap.breakpoint)
|
||||
dap.defaults.fallback.terminal_win_cmd = "50vsplit new"
|
||||
|
||||
O.user_which_key["d"] = {
|
||||
name = "Debug",
|
||||
t = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "Toggle Breakpoint" },
|
||||
b = { "<cmd>lua require'dap'.step_back()<cr>", "Step Back" },
|
||||
c = { "<cmd>lua require'dap'.continue()<cr>", "Continue" },
|
||||
C = { "<cmd>lua require'dap'.run_to_cursor()<cr>", "Run To Cursor" },
|
||||
d = { "<cmd>lua require'dap'.disconnect()<cr>", "Disconnect" },
|
||||
g = { "<cmd>lua require'dap'.session()<cr>", "Get Session" },
|
||||
i = { "<cmd>lua require'dap'.step_into()<cr>", "Step Into" },
|
||||
o = { "<cmd>lua require'dap'.step_over()<cr>", "Step Over" },
|
||||
u = { "<cmd>lua require'dap'.step_out()<cr>", "Step Out" },
|
||||
p = { "<cmd>lua require'dap'.pause.toggle()<cr>", "Pause" },
|
||||
r = { "<cmd>lua require'dap'.repl.toggle()<cr>", "Toggle Repl" },
|
||||
s = { "<cmd>lua require'dap'.continue()<cr>", "Start" },
|
||||
q = { "<cmd>lua require'dap'.stop()<cr>", "Quit" },
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
O.plugin.dashboard = {
|
||||
active = false,
|
||||
search_handler = "telescope",
|
||||
custom_header = {
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣤⣶⣾⠿⠿⠟⠛⠛⠛⠛⠿⠿⣿⣷⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⡿⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠒⠂⠉⠉⠉⠉⢩⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⢰⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⠠⡀⠀⠀⢀⣾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⢀⣸⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡧⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠈⠁⠒⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣇⠀⠀⠀⠀⠀⠀⠉⠢⠤⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡟⠈⠑⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠑⠒⠤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⡇⠀⠀⢀⣣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⠒⠢⠤⠄⣀⣀⠀⠀⠀⢠⣿⡟⠀⠀⠀⣺⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⣿⠇⠀⠀⠀⠀⠀⣤⡄⠀⠀⢠⣤⡄⠀⢨⣭⣠⣤⣤⣤⡀⠀⠀⢀⣤⣤⣤⣤⡄⠀⠀⠀⣤⣄⣤⣤⣤⠀⠀⣿⣯⠉⠉⣿⡟⠀⠈⢩⣭⣤⣤⠀⠀⠀⠀⣠⣤⣤⣤⣄⣤⣤",
|
||||
"⢠⣿⠀⠀⠀⠀⠀⠀⣿⠃⠀⠀⣸⣿⠁⠀⣿⣿⠉⠀⠈⣿⡇⠀⠀⠛⠋⠀⠀⢹⣿⠀⠀⠀⣿⠏⠀⠸⠿⠃⠀⣿⣿⠀⣰⡟⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⣿⡟⢸⣿⡇⢀⣿",
|
||||
"⣸⡇⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⣿⡟⠀⢠⣿⡇⠀⠀⢰⣿⡇⠀⣰⣾⠟⠛⠛⣻⡇⠀⠀⢸⡿⠀⠀⠀⠀⠀⠀⢻⣿⢰⣿⠀⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⢸⣿⠇⢸⣿⠀⢸⡏",
|
||||
"⣿⣧⣤⣤⣤⡄⠀⠘⣿⣤⣤⡤⣿⠇⠀⢸⣿⠁⠀⠀⣼⣿⠀⠀⢿⣿⣤⣤⠔⣿⠃⠀⠀⣾⡇⠀⠀⠀⠀⠀⠀⢸⣿⣿⠋⠀⠀⠀⢠⣤⣤⣿⣥⣤⡄⠀⣼⣿⠀⣸⡏⠀⣿⠃",
|
||||
"⠉⠉⠉⠉⠉⠁⠀⠀⠈⠉⠉⠀⠉⠀⠀⠈⠉⠀⠀⠀⠉⠉⠀⠀⠀⠉⠉⠁⠈⠉⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⠁⠀⠉⠁⠀⠉⠁⠀⠉⠀",
|
||||
},
|
||||
|
||||
custom_section = {
|
||||
a = {
|
||||
description = { " Find File " },
|
||||
command = "Telescope find_files",
|
||||
},
|
||||
b = {
|
||||
description = { " Recently Used Files" },
|
||||
command = "Telescope oldfiles",
|
||||
},
|
||||
-- c = {
|
||||
-- description = { " Load Last Session " },
|
||||
-- command = "SessionLoad",
|
||||
-- },
|
||||
c = {
|
||||
description = { " Find Word " },
|
||||
command = "Telescope live_grep",
|
||||
},
|
||||
d = {
|
||||
description = { " Settings " },
|
||||
command = ":e " .. CONFIG_PATH .. "/lv-config.lua",
|
||||
},
|
||||
},
|
||||
|
||||
footer = { "chrisatmachine.com" },
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
M.config = function()
|
||||
vim.g.dashboard_disable_at_vimenter = 0
|
||||
|
||||
vim.g.dashboard_custom_header = O.plugin.dashboard.custom_header
|
||||
|
||||
vim.g.dashboard_default_executive = O.plugin.dashboard.search_handler
|
||||
|
||||
vim.g.dashboard_custom_section = O.plugin.dashboard.custom_section
|
||||
|
||||
-- f = {
|
||||
-- description = { " Neovim Config Files" },
|
||||
-- command = "Telescope find_files cwd=" .. CONFIG_PATH,
|
||||
-- },
|
||||
-- e = {description = {' Marks '}, command = 'Telescope marks'}
|
||||
vim.cmd "let g:dashboard_session_directory = $HOME..'/.config/nvim/.sessions'"
|
||||
vim.cmd "let packages = len(globpath('~/.local/share/nvim/site/pack/packer/start', '*', 0, 1))"
|
||||
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
let g:dashboard_custom_footer = ['LuaJIT loaded '..packages..' plugins']
|
||||
]],
|
||||
false
|
||||
)
|
||||
|
||||
-- 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
|
||||
end
|
||||
|
||||
require("lv-utils").define_augroups {
|
||||
_dashboard = {
|
||||
-- seems to be nobuflisted that makes my stuff disapear will do more testing
|
||||
{
|
||||
"FileType",
|
||||
"dashboard",
|
||||
"setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell nolist nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= ",
|
||||
},
|
||||
{
|
||||
"FileType",
|
||||
"dashboard",
|
||||
"set showtabline=0 | autocmd BufLeave <buffer> set showtabline=2",
|
||||
},
|
||||
{ "FileType", "dashboard", "nnoremap <silent> <buffer> q :q<CR>" },
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
|
@ -1,10 +0,0 @@
|
|||
O.plugin.floatterm = {
|
||||
active = false,
|
||||
dimensions = {
|
||||
height = 0.9,
|
||||
width = 0.9,
|
||||
x = 0.5,
|
||||
y = 0.3,
|
||||
},
|
||||
border = "single", -- or 'double'
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
O.plugin.galaxyline = {
|
||||
active = true,
|
||||
colors = {
|
||||
alt_bg = "#2E2E2E",
|
||||
grey = "#858585",
|
||||
blue = "#569CD6",
|
||||
green = "#608B4E",
|
||||
yellow = "#DCDCAA",
|
||||
orange = "#FF8800",
|
||||
purple = "#C586C0",
|
||||
magenta = "#D16D9E",
|
||||
cyan = "#4EC9B0",
|
||||
red = "#D16969",
|
||||
error_red = "#F44747",
|
||||
warning_orange = "#FF8800",
|
||||
info_yellow = "#FFCC66",
|
||||
hint_blue = "#9CDCFE",
|
||||
},
|
||||
}
|
|
@ -1,326 +0,0 @@
|
|||
-- if not package.loaded['galaxyline'] then
|
||||
-- return
|
||||
-- end
|
||||
local status_ok, gl = pcall(require, "galaxyline")
|
||||
if not status_ok then
|
||||
return
|
||||
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")
|
||||
if not palette_status_ok then
|
||||
colors = O.plugin.galaxyline.colors
|
||||
end
|
||||
|
||||
local condition = require "galaxyline.condition"
|
||||
local gls = gl.section
|
||||
gl.short_line_list = { "NvimTree", "vista", "dbui", "packer" }
|
||||
|
||||
table.insert(gls.left, {
|
||||
ViMode = {
|
||||
provider = function()
|
||||
-- auto change color according the vim mode
|
||||
local mode_color = {
|
||||
n = colors.blue,
|
||||
i = colors.green,
|
||||
v = colors.purple,
|
||||
[""] = colors.purple,
|
||||
V = colors.purple,
|
||||
c = colors.magenta,
|
||||
no = colors.blue,
|
||||
s = colors.orange,
|
||||
S = colors.orange,
|
||||
[""] = colors.orange,
|
||||
ic = colors.yellow,
|
||||
R = colors.red,
|
||||
Rv = colors.red,
|
||||
cv = colors.blue,
|
||||
ce = colors.blue,
|
||||
r = colors.cyan,
|
||||
rm = colors.cyan,
|
||||
["r?"] = colors.cyan,
|
||||
["!"] = colors.blue,
|
||||
t = colors.blue,
|
||||
}
|
||||
vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()])
|
||||
return "▊"
|
||||
end,
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { "NONE", colors.alt_bg },
|
||||
},
|
||||
})
|
||||
-- print(vim.fn.getbufvar(0, 'ts'))
|
||||
vim.fn.getbufvar(0, "ts")
|
||||
|
||||
table.insert(gls.left, {
|
||||
GitIcon = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
condition = condition.check_git_workspace,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.orange, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.left, {
|
||||
GitBranch = {
|
||||
provider = "GitBranch",
|
||||
condition = condition.check_git_workspace,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.left, {
|
||||
DiffAdd = {
|
||||
provider = "DiffAdd",
|
||||
condition = condition.hide_in_width,
|
||||
icon = " ",
|
||||
highlight = { colors.green, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.left, {
|
||||
DiffModified = {
|
||||
provider = "DiffModified",
|
||||
condition = condition.hide_in_width,
|
||||
icon = " 柳",
|
||||
highlight = { colors.blue, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.left, {
|
||||
DiffRemove = {
|
||||
provider = "DiffRemove",
|
||||
condition = condition.hide_in_width,
|
||||
icon = " ",
|
||||
highlight = { colors.red, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.left, {
|
||||
Filler = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
-- get output from shell command
|
||||
function os.capture(cmd, raw)
|
||||
local f = assert(io.popen(cmd, "r"))
|
||||
local s = assert(f:read "*a")
|
||||
f:close()
|
||||
if raw then
|
||||
return s
|
||||
end
|
||||
s = string.gsub(s, "^%s+", "")
|
||||
s = string.gsub(s, "%s+$", "")
|
||||
s = string.gsub(s, "[\n\r]+", " ")
|
||||
return s
|
||||
end
|
||||
-- cleanup virtual env
|
||||
local function env_cleanup(venv)
|
||||
if string.find(venv, "/") then
|
||||
local final_venv = venv
|
||||
for w in venv:gmatch "([^/]+)" do
|
||||
final_venv = w
|
||||
end
|
||||
venv = final_venv
|
||||
end
|
||||
return venv
|
||||
end
|
||||
local PythonEnv = function()
|
||||
if vim.bo.filetype == "python" then
|
||||
local venv = os.getenv "CONDA_DEFAULT_ENV"
|
||||
if venv ~= nil then
|
||||
return " (" .. env_cleanup(venv) .. ")"
|
||||
end
|
||||
venv = os.getenv "VIRTUAL_ENV"
|
||||
if venv ~= nil then
|
||||
return " (" .. env_cleanup(venv) .. ")"
|
||||
end
|
||||
return ""
|
||||
end
|
||||
return ""
|
||||
end
|
||||
table.insert(gls.left, {
|
||||
VirtualEnv = {
|
||||
provider = PythonEnv,
|
||||
event = "BufEnter",
|
||||
highlight = { colors.green, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
DiagnosticError = {
|
||||
provider = "DiagnosticError",
|
||||
icon = " ",
|
||||
highlight = { colors.red, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
table.insert(gls.right, {
|
||||
DiagnosticWarn = {
|
||||
provider = "DiagnosticWarn",
|
||||
icon = " ",
|
||||
highlight = { colors.orange, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
DiagnosticInfo = {
|
||||
provider = "DiagnosticInfo",
|
||||
icon = " ",
|
||||
highlight = { colors.yellow, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
DiagnosticHint = {
|
||||
provider = "DiagnosticHint",
|
||||
icon = " ",
|
||||
highlight = { colors.blue, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
TreesitterIcon = {
|
||||
provider = function()
|
||||
if next(vim.treesitter.highlighter.active) ~= nil then
|
||||
return " "
|
||||
end
|
||||
return ""
|
||||
end,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.green, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
local get_lsp_client = function(msg)
|
||||
msg = msg or "LSP Inactive"
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
local lsps = ""
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
-- print(client.name)
|
||||
if lsps == "" then
|
||||
-- print("first", lsps)
|
||||
lsps = client.name
|
||||
else
|
||||
if not string.find(lsps, client.name) then
|
||||
lsps = lsps .. ", " .. client.name
|
||||
end
|
||||
-- print("more", lsps)
|
||||
end
|
||||
end
|
||||
end
|
||||
if lsps == "" then
|
||||
return msg
|
||||
else
|
||||
return lsps
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(gls.right, {
|
||||
ShowLspClient = {
|
||||
provider = get_lsp_client,
|
||||
condition = function()
|
||||
local tbl = { ["dashboard"] = true, [" "] = true }
|
||||
if tbl[vim.bo.filetype] then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
icon = " ",
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
LineInfo = {
|
||||
provider = "LineColumn",
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
PerCent = {
|
||||
provider = "LinePercent",
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
Tabstop = {
|
||||
provider = function()
|
||||
return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " "
|
||||
end,
|
||||
condition = condition.hide_in_width,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
BufferType = {
|
||||
provider = "FileTypeName",
|
||||
condition = condition.hide_in_width,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
FileEncode = {
|
||||
provider = "FileEncode",
|
||||
condition = condition.hide_in_width,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.right, {
|
||||
Space = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.short_line_left, {
|
||||
BufferType = {
|
||||
provider = "FileTypeName",
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
table.insert(gls.short_line_left, {
|
||||
SFileName = {
|
||||
provider = "SFileName",
|
||||
condition = condition.buffer_not_empty,
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
--table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.alt_bg}}})
|
|
@ -1,47 +0,0 @@
|
|||
O.plugin.gitsigns = {
|
||||
signs = {
|
||||
-- TODO: add hl to colorscheme
|
||||
add = {
|
||||
hl = "GitSignsAdd",
|
||||
text = "▎",
|
||||
numhl = "GitSignsAddNr",
|
||||
linehl = "GitSignsAddLn",
|
||||
},
|
||||
change = {
|
||||
hl = "GitSignsChange",
|
||||
text = "▎",
|
||||
numhl = "GitSignsChangeNr",
|
||||
linehl = "GitSignsChangeLn",
|
||||
},
|
||||
delete = {
|
||||
hl = "GitSignsDelete",
|
||||
text = "契",
|
||||
numhl = "GitSignsDeleteNr",
|
||||
linehl = "GitSignsDeleteLn",
|
||||
},
|
||||
topdelete = {
|
||||
hl = "GitSignsDelete",
|
||||
text = "契",
|
||||
numhl = "GitSignsDeleteNr",
|
||||
linehl = "GitSignsDeleteLn",
|
||||
},
|
||||
changedelete = {
|
||||
hl = "GitSignsChange",
|
||||
text = "▎",
|
||||
numhl = "GitSignsChangeNr",
|
||||
linehl = "GitSignsChangeLn",
|
||||
},
|
||||
},
|
||||
numhl = false,
|
||||
linehl = false,
|
||||
keymaps = {
|
||||
-- Default keymap options
|
||||
noremap = true,
|
||||
buffer = true,
|
||||
},
|
||||
watch_index = { interval = 1000 },
|
||||
sign_priority = 6,
|
||||
update_debounce = 200,
|
||||
status_formatter = nil, -- Use default
|
||||
use_decoration_api = false,
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
M.config = function()
|
||||
local status_ok, gitsigns = pcall(require, "gitsigns")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
gitsigns.setup(O.plugin.gitsigns)
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,80 +0,0 @@
|
|||
local status_ok, actions = pcall(require, "telescope.actions")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
O.plugin.telescope = {
|
||||
active = false,
|
||||
defaults = {
|
||||
find_command = {
|
||||
"rg",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
},
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "descending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
width = 0.75,
|
||||
prompt_position = "bottom",
|
||||
preview_cutoff = 120,
|
||||
horizontal = { mirror = false },
|
||||
vertical = { mirror = false },
|
||||
},
|
||||
file_sorter = require("telescope.sorters").get_fzy_sorter,
|
||||
file_ignore_patterns = {},
|
||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||
path_display = { "shorten" },
|
||||
winblend = 0,
|
||||
border = {},
|
||||
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||
color_devicons = true,
|
||||
use_less = true,
|
||||
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
|
||||
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
|
||||
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
||||
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
||||
|
||||
-- Developer configurations: Not meant for general override
|
||||
-- buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-c>"] = actions.close,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||
["<CR>"] = actions.select_default + actions.center,
|
||||
-- To disable a keymap, put [map] = false
|
||||
-- So, to not map "<C-n>", just put
|
||||
-- ["<c-t>"] = trouble.open_with_trouble,
|
||||
-- ["<c-x>"] = false,
|
||||
-- ["<esc>"] = actions.close,
|
||||
-- Otherwise, just set the mapping to the function that you want it to be.
|
||||
-- ["<C-i>"] = actions.select_horizontal,
|
||||
-- Add up multiple actions
|
||||
-- You can perform as many actions in a row as you like
|
||||
-- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action,
|
||||
},
|
||||
n = {
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||
-- ["<c-t>"] = trouble.open_with_trouble,
|
||||
-- ["<C-i>"] = my_cool_custom_action,
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
fzy_native = {
|
||||
override_generic_sorter = false,
|
||||
override_file_sorter = true,
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
local status_ok, telescope = pcall(require, "telescope")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
telescope.setup(O.plugin.telescope)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>f", ":Telescope find_files<CR>", { noremap = true, silent = true })
|
|
@ -1,90 +0,0 @@
|
|||
O.treesitter = {
|
||||
ensure_installed = {}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
ignore_install = {},
|
||||
matchup = {
|
||||
enable = false, -- mandatory, false will disable the whole extension
|
||||
-- disable = { "c", "ruby" }, -- optional, list of language that will be disabled
|
||||
},
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
additional_vim_regex_highlighting = true,
|
||||
disable = { "latex" },
|
||||
},
|
||||
context_commentstring = {
|
||||
enable = false,
|
||||
config = { css = "// %s" },
|
||||
},
|
||||
-- indent = {enable = true, disable = {"python", "html", "javascript"}},
|
||||
-- TODO seems to be broken
|
||||
indent = { enable = { "javascriptreact" } },
|
||||
autotag = { enable = false },
|
||||
textobjects = {
|
||||
swap = {
|
||||
enable = false,
|
||||
-- swap_next = textobj_swap_keymaps,
|
||||
},
|
||||
-- move = textobj_move_keymaps,
|
||||
select = {
|
||||
enable = false,
|
||||
-- keymaps = textobj_sel_keymaps,
|
||||
},
|
||||
},
|
||||
textsubjects = {
|
||||
enable = false,
|
||||
keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" },
|
||||
},
|
||||
playground = {
|
||||
enable = false,
|
||||
disable = {},
|
||||
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
|
||||
persist_queries = false, -- Whether the query persists across vim sessions
|
||||
keybindings = {
|
||||
toggle_query_editor = "o",
|
||||
toggle_hl_groups = "i",
|
||||
toggle_injected_languages = "t",
|
||||
toggle_anonymous_nodes = "a",
|
||||
toggle_language_display = "I",
|
||||
focus_language = "f",
|
||||
unfocus_language = "F",
|
||||
update = "R",
|
||||
goto_node = "<cr>",
|
||||
show_help = "?",
|
||||
},
|
||||
},
|
||||
rainbow = {
|
||||
enable = false,
|
||||
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
|
||||
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" },
|
||||
-- },
|
|
@ -1,90 +0,0 @@
|
|||
-- 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)
|
|
@ -4,7 +4,7 @@ function lv_utils.reload_lv_config()
|
|||
vim.cmd "source ~/.config/nvim/lv-config.lua"
|
||||
vim.cmd "source ~/.config/nvim/lua/plugins.lua"
|
||||
vim.cmd "source ~/.config/nvim/lua/settings.lua"
|
||||
vim.cmd "source ~/.config/nvim/lua/lv-formatter/init.lua"
|
||||
vim.cmd "source ~/.config/nvim/lua/core/formatter.lua"
|
||||
vim.cmd ":PackerCompile"
|
||||
vim.cmd ":PackerInstall"
|
||||
end
|
||||
|
|
|
@ -1,150 +0,0 @@
|
|||
O.plugin.which_key = {
|
||||
active = false,
|
||||
setup = {
|
||||
plugins = {
|
||||
marks = true, -- shows a list of your marks on ' and `
|
||||
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
||||
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
||||
-- No actual key bindings are created
|
||||
presets = {
|
||||
operators = false, -- adds help for operators like d, y, ...
|
||||
motions = false, -- adds help for motions
|
||||
text_objects = false, -- help for text objects triggered after entering an operator
|
||||
windows = true, -- default bindings on <c-w>
|
||||
nav = true, -- misc bindings to work with windows
|
||||
z = true, -- bindings for folds, spelling and others prefixed with z
|
||||
g = true, -- bindings for prefixed with g
|
||||
},
|
||||
spelling = { enabled = true, suggestions = 20 }, -- use which-key for spelling hints
|
||||
},
|
||||
icons = {
|
||||
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
||||
separator = "➜", -- symbol used between a key and it's label
|
||||
group = "+", -- symbol prepended to a group
|
||||
},
|
||||
window = {
|
||||
border = "single", -- none, single, double, shadow
|
||||
position = "bottom", -- bottom, top
|
||||
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
|
||||
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
|
||||
},
|
||||
layout = {
|
||||
height = { min = 4, max = 25 }, -- min and max height of the columns
|
||||
width = { min = 20, max = 50 }, -- min and max width of the columns
|
||||
spacing = 3, -- spacing between columns
|
||||
},
|
||||
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
|
||||
show_help = true, -- show help message on the command line when the popup is visible
|
||||
},
|
||||
|
||||
opts = {
|
||||
mode = "n", -- NORMAL mode
|
||||
prefix = "<leader>",
|
||||
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
||||
silent = true, -- use `silent` when creating keymaps
|
||||
noremap = true, -- use `noremap` when creating keymaps
|
||||
nowait = true, -- use `nowait` when creating keymaps
|
||||
},
|
||||
vopts = {
|
||||
mode = "v", -- VISUAL mode
|
||||
prefix = "<leader>",
|
||||
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
||||
silent = true, -- use `silent` when creating keymaps
|
||||
noremap = true, -- use `noremap` when creating keymaps
|
||||
nowait = true, -- use `nowait` when creating keymaps
|
||||
},
|
||||
-- NOTE: Prefer using : over <cmd> as the latter avoids going back in normal-mode.
|
||||
-- see https://neovim.io/doc/user/map.html#:map-cmd
|
||||
vmappings ={
|
||||
["/"] = { ":CommentToggle<CR>", "Comment" },
|
||||
},
|
||||
mappings = {
|
||||
["w"] = { "<cmd>w!<CR>", "Save" },
|
||||
["q"] = { "<cmd>q!<CR>", "Quit" },
|
||||
["/"] = { "<cmd>CommentToggle<CR>", "Comment" },
|
||||
["c"] = { "<cmd>BufferClose<CR>", "Close Buffer" },
|
||||
["e"] = { "<cmd>lua require'lv-nvimtree'.toggle_tree()<CR>", "Explorer" },
|
||||
["f"] = { "<cmd>Telescope find_files<CR>", "Find File" },
|
||||
["h"] = { '<cmd>let @/=""<CR>', "No Highlight" },
|
||||
[";"] = { "<cmd>Dashboard<CR>", "Dashboard" },
|
||||
p = {
|
||||
name = "Packer",
|
||||
c = { "<cmd>PackerCompile<cr>", "Compile" },
|
||||
i = { "<cmd>PackerInstall<cr>", "Install" },
|
||||
r = { "<cmd>lua require('lv-utils').reload_lv_config()<cr>", "Reload" },
|
||||
s = { "<cmd>PackerSync<cr>", "Sync" },
|
||||
u = { "<cmd>PackerUpdate<cr>", "Update" },
|
||||
},
|
||||
|
||||
-- " Available Debug Adapters:
|
||||
-- " https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/
|
||||
-- " Adapter configuration and installation instructions:
|
||||
-- " https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation
|
||||
-- " Debug Adapter protocol:
|
||||
-- " https://microsoft.github.io/debug-adapter-protocol/
|
||||
-- " Debugging
|
||||
g = {
|
||||
name = "Git",
|
||||
j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
|
||||
k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
|
||||
l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
|
||||
p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
|
||||
r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
|
||||
R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
|
||||
s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
|
||||
u = {
|
||||
"<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
|
||||
"Undo Stage Hunk",
|
||||
},
|
||||
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
|
||||
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
|
||||
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
|
||||
C = {
|
||||
"<cmd>Telescope git_bcommits<cr>",
|
||||
"Checkout commit(for current file)",
|
||||
},
|
||||
},
|
||||
|
||||
l = {
|
||||
name = "LSP",
|
||||
a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
|
||||
d = {
|
||||
"<cmd>Telescope lsp_document_diagnostics<cr>",
|
||||
"Document Diagnostics",
|
||||
},
|
||||
w = {
|
||||
"<cmd>Telescope lsp_workspace_diagnostics<cr>",
|
||||
"Workspace Diagnostics",
|
||||
},
|
||||
f = { "<cmd>silent FormatWrite<cr>", "Format" },
|
||||
i = { "<cmd>LspInfo<cr>", "Info" },
|
||||
j = { "<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<cr>", "Next Diagnostic" },
|
||||
k = { "<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<cr>", "Prev Diagnostic" },
|
||||
q = { "<cmd>Telescope quickfix<cr>", "Quickfix" },
|
||||
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
|
||||
s = { "<cmd> Telescope lsp_document_symbols<cr>", "Document Symbols" },
|
||||
S = {
|
||||
"<cmd>Telescope lsp_dynamic_workspace_symbols<cr>",
|
||||
"Workspace Symbols",
|
||||
},
|
||||
},
|
||||
|
||||
s = {
|
||||
name = "Search",
|
||||
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
|
||||
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
|
||||
f = { "<cmd>Telescope find_files<cr>", "Find File" },
|
||||
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
|
||||
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
|
||||
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
|
||||
R = { "<cmd>Telescope registers<cr>", "Registers" },
|
||||
t = { "<cmd>Telescope live_grep<cr>", "Text" },
|
||||
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
|
||||
C = { "<cmd>Telescope commands<cr>", "Commands" },
|
||||
},
|
||||
T = {
|
||||
name = "Treesitter",
|
||||
i = { ":TSConfigInfo<cr>", "Info" },
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
-- if not package.loaded['which-key'] then
|
||||
-- return
|
||||
-- end
|
||||
local status_ok, which_key = pcall(require, "which-key")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
which_key.setup(O.plugin.which_key.setup)
|
||||
|
||||
local opts = O.plugin.which_key.opts
|
||||
local vopts = O.plugin.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
|
||||
|
||||
if O.plugin.telescope_project.active then
|
||||
-- open projects
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<leader>P",
|
||||
":lua require'telescope'.extensions.project.project{}<CR>",
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
mappings["P"] = "Projects"
|
||||
end
|
||||
|
||||
if O.plugin.lush.active then
|
||||
mappings["L"] = {
|
||||
name = "+Lush",
|
||||
l = { ":Lushify<cr>", "Lushify" },
|
||||
x = { ":lua require('lush').export_to_buffer(require('lush_theme.cool_name'))", "Lush Export" },
|
||||
t = { ":LushRunTutorial<cr>", "Lush Tutorial" },
|
||||
q = { ":LushRunQuickstart<cr>", "Lush Quickstart" },
|
||||
}
|
||||
end
|
||||
|
||||
for k, v in pairs(O.user_which_key) do
|
||||
mappings[k] = v
|
||||
end
|
||||
|
||||
local wk = require "which-key"
|
||||
wk.register(mappings, opts)
|
||||
wk.register(vmappings, vopts)
|
|
@ -1,21 +0,0 @@
|
|||
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
|
||||
},
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
local M = {}
|
||||
local status_ok, zen_mode = pcall(require, "zen-mode")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
M.config = function()
|
||||
zen_mode.setup(O.plugin.zen)
|
||||
end
|
||||
return M
|
|
@ -44,7 +44,7 @@ return require("packer").startup(function(use)
|
|||
-- Telescope
|
||||
use {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
config = [[require('lv-telescope')]],
|
||||
config = [[require('core.telescope').setup()]],
|
||||
}
|
||||
|
||||
-- Autocomplete
|
||||
|
@ -52,7 +52,7 @@ return require("packer").startup(function(use)
|
|||
"hrsh7th/nvim-compe",
|
||||
-- event = "InsertEnter",
|
||||
config = function()
|
||||
require("lv-compe").config()
|
||||
require("core.compe").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ return require("packer").startup(function(use)
|
|||
-- event = "InsertEnter",
|
||||
after = { "telescope.nvim" },
|
||||
config = function()
|
||||
require "lv-autopairs"
|
||||
require "core.autopairs"
|
||||
end,
|
||||
}
|
||||
|
||||
|
@ -72,13 +72,18 @@ return require("packer").startup(function(use)
|
|||
use { "rafamadriz/friendly-snippets", event = "InsertEnter" }
|
||||
|
||||
-- Treesitter
|
||||
use { "nvim-treesitter/nvim-treesitter" }
|
||||
use {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
config = function()
|
||||
require("core.treesitter").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
-- Formatter.nvim
|
||||
use {
|
||||
"mhartington/formatter.nvim",
|
||||
config = function()
|
||||
require "lv-formatter"
|
||||
require "core.formatter"
|
||||
end,
|
||||
event = "BufRead",
|
||||
}
|
||||
|
@ -90,7 +95,7 @@ return require("packer").startup(function(use)
|
|||
-- cmd = "NvimTreeToggle",
|
||||
commit = "fd7f60e242205ea9efc9649101c81a07d5f458bb",
|
||||
config = function()
|
||||
require("lv-nvimtree").config()
|
||||
require("core.nvimtree").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
|
@ -107,7 +112,7 @@ return require("packer").startup(function(use)
|
|||
use {
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
require "lv-which-key"
|
||||
require("core.which-key").setup()
|
||||
end,
|
||||
event = "BufWinEnter",
|
||||
}
|
||||
|
@ -140,7 +145,7 @@ return require("packer").startup(function(use)
|
|||
use {
|
||||
"glepnir/galaxyline.nvim",
|
||||
config = function()
|
||||
require "lv-galaxyline"
|
||||
require("core.galaxyline").setup()
|
||||
end,
|
||||
event = "BufWinEnter",
|
||||
disable = not O.plugin.galaxyline.active,
|
||||
|
@ -149,7 +154,7 @@ return require("packer").startup(function(use)
|
|||
use {
|
||||
"romgrk/barbar.nvim",
|
||||
config = function()
|
||||
require "lv-barbar"
|
||||
require "core.bufferline"
|
||||
end,
|
||||
event = "BufWinEnter",
|
||||
}
|
||||
|
@ -159,7 +164,7 @@ return require("packer").startup(function(use)
|
|||
"mfussenegger/nvim-dap",
|
||||
-- event = "BufWinEnter",
|
||||
config = function()
|
||||
require "lv-dap"
|
||||
require("core.dap").setup()
|
||||
end,
|
||||
disable = not O.plugin.dap.active,
|
||||
}
|
||||
|
@ -179,7 +184,7 @@ return require("packer").startup(function(use)
|
|||
"ChristianChiarulli/dashboard-nvim",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("lv-dashboard").config()
|
||||
require("core.dashboard").setup()
|
||||
end,
|
||||
disable = not O.plugin.dashboard.active,
|
||||
}
|
||||
|
@ -190,7 +195,7 @@ return require("packer").startup(function(use)
|
|||
"numToStr/FTerm.nvim",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("lv-floatterm").config()
|
||||
require("core.floatterm").setup()
|
||||
end,
|
||||
disable = not O.plugin.floatterm.active,
|
||||
}
|
||||
|
@ -201,31 +206,11 @@ return require("packer").startup(function(use)
|
|||
cmd = "ZenMode",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("lv-zen").config()
|
||||
require("core.zen").setup()
|
||||
end,
|
||||
disable = not O.plugin.zen.active,
|
||||
}
|
||||
|
||||
use {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = "BufRead",
|
||||
setup = function()
|
||||
vim.g.indentLine_enabled = 1
|
||||
vim.g.indent_blankline_char = "▏"
|
||||
|
||||
vim.g.indent_blankline_filetype_exclude = {
|
||||
"help",
|
||||
"terminal",
|
||||
"dashboard",
|
||||
}
|
||||
vim.g.indent_blankline_buftype_exclude = { "terminal" }
|
||||
|
||||
vim.g.indent_blankline_show_trailing_blankline_indent = false
|
||||
vim.g.indent_blankline_show_first_indent_level = true
|
||||
end,
|
||||
disable = not O.plugin.indent_line.active,
|
||||
}
|
||||
|
||||
---------------------------------------------------------------------------------
|
||||
|
||||
-- LANGUAGE SPECIFIC GOES HERE
|
||||
|
@ -262,27 +247,4 @@ return require("packer").startup(function(use)
|
|||
-- ft = { "java" },
|
||||
disable = not O.lang.java.java_tools.active,
|
||||
}
|
||||
|
||||
-- Custom semantic text objects
|
||||
use {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
disable = not O.plugin.ts_textobjects.active,
|
||||
}
|
||||
|
||||
-- Smart text objects
|
||||
use {
|
||||
"RRethy/nvim-treesitter-textsubjects",
|
||||
disable = not O.plugin.ts_textsubjects.active,
|
||||
}
|
||||
|
||||
-- Text objects using hint labels
|
||||
use {
|
||||
"mfussenegger/nvim-ts-hint-textobject",
|
||||
event = "BufRead",
|
||||
disable = not O.plugin.ts_hintobjects.active,
|
||||
}
|
||||
|
||||
for _, plugin in pairs(O.user_plugins) do
|
||||
packer.use(plugin)
|
||||
end
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue