Add stylua formatting file, change tabs back to spaces
This commit is contained in:
parent
bb64daece4
commit
4c8a1623f0
3
config/nvim/.stylua.toml
Normal file
3
config/nvim/.stylua.toml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
indent_type = "Spaces"
|
||||||
|
call_parentheses = "None"
|
||||||
|
collapse_simple_statement = "Always"
|
|
@ -1,11 +1,11 @@
|
||||||
vim.opt.fillchars:append({
|
vim.opt.fillchars:append {
|
||||||
horiz = '━',
|
horiz = "━",
|
||||||
horizup = '┻',
|
horizup = "┻",
|
||||||
horizdown = '┳',
|
horizdown = "┳",
|
||||||
vert = '┃',
|
vert = "┃",
|
||||||
vertleft = '┨',
|
vertleft = "┨",
|
||||||
vertright = '┣',
|
vertright = "┣",
|
||||||
verthoriz = '╋',
|
verthoriz = "╋",
|
||||||
})
|
}
|
||||||
require("config.catppuccin")
|
require "config.catppuccin"
|
||||||
vim.cmd("colorscheme catppuccin")
|
vim.cmd "colorscheme catppuccin"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require("catppuccin").setup({
|
require("catppuccin").setup {
|
||||||
flavour = "macchiato",
|
flavour = "macchiato",
|
||||||
transparent_background = true,
|
transparent_background = true,
|
||||||
term_colors = true,
|
term_colors = true,
|
||||||
|
@ -10,13 +10,13 @@ require("catppuccin").setup({
|
||||||
},
|
},
|
||||||
cmp = true,
|
cmp = true,
|
||||||
native_lsp = {
|
native_lsp = {
|
||||||
enabled = true
|
enabled = true,
|
||||||
},
|
},
|
||||||
notify = true,
|
notify = true,
|
||||||
nvimtree = true,
|
nvimtree = true,
|
||||||
treesitter = true,
|
treesitter = true,
|
||||||
treesitter_context = true,
|
treesitter_context = true,
|
||||||
telescope = true,
|
telescope = true,
|
||||||
lsp_trouble = true
|
lsp_trouble = true,
|
||||||
}
|
},
|
||||||
})
|
}
|
||||||
|
|
|
@ -1,512 +1,478 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local C = require("catppuccin.palettes").get_palette()
|
local C = require("catppuccin.palettes").get_palette()
|
||||||
local lsp = require("feline.providers.lsp")
|
local lsp = require "feline.providers.lsp"
|
||||||
|
|
||||||
local assets = {
|
local assets = {
|
||||||
left_separator = "",
|
left_separator = "",
|
||||||
right_separator = "",
|
right_separator = "",
|
||||||
mode_icon = "",
|
mode_icon = "",
|
||||||
dir = "",
|
dir = "",
|
||||||
file = "",
|
file = "",
|
||||||
lsp = {
|
lsp = {
|
||||||
server = "",
|
server = "",
|
||||||
error = "",
|
error = "",
|
||||||
warning = "",
|
warning = "",
|
||||||
info = "",
|
info = "",
|
||||||
hint = "",
|
hint = "",
|
||||||
},
|
},
|
||||||
git = {
|
git = {
|
||||||
branch = "",
|
branch = "",
|
||||||
added = "",
|
added = "",
|
||||||
changed = "",
|
changed = "",
|
||||||
removed = "",
|
removed = "",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local sett = {
|
local sett = {
|
||||||
text = C.surface0,
|
text = C.surface0,
|
||||||
bkg = C.surface0,
|
bkg = C.surface0,
|
||||||
diffs = C.mauve,
|
diffs = C.mauve,
|
||||||
extras = C.overlay1,
|
extras = C.overlay1,
|
||||||
curr_file = C.maroon,
|
curr_file = C.maroon,
|
||||||
curr_dir = C.flamingo,
|
curr_dir = C.flamingo,
|
||||||
show_modified = false,
|
show_modified = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
if require("catppuccin").flavour == "latte" then
|
if require("catppuccin").flavour == "latte" then
|
||||||
local latte = require("catppuccin.palettes").get_palette("latte")
|
local latte = require("catppuccin.palettes").get_palette "latte"
|
||||||
sett.text = latte.base
|
sett.text = latte.base
|
||||||
sett.bkg = latte.crust
|
sett.bkg = latte.crust
|
||||||
end
|
end
|
||||||
|
|
||||||
if require("catppuccin").options.transparent_background then
|
if require("catppuccin").options.transparent_background then sett.bkg = "NONE" end
|
||||||
sett.bkg = "NONE"
|
|
||||||
end
|
|
||||||
|
|
||||||
local mode_colors = {
|
local mode_colors = {
|
||||||
["n"] = { "NORMAL", C.lavender },
|
["n"] = { "NORMAL", C.lavender },
|
||||||
["no"] = { "N-PENDING", C.lavender },
|
["no"] = { "N-PENDING", C.lavender },
|
||||||
["i"] = { "INSERT", C.green },
|
["i"] = { "INSERT", C.green },
|
||||||
["ic"] = { "INSERT", C.green },
|
["ic"] = { "INSERT", C.green },
|
||||||
["t"] = { "TERMINAL", C.green },
|
["t"] = { "TERMINAL", C.green },
|
||||||
["v"] = { "VISUAL", C.flamingo },
|
["v"] = { "VISUAL", C.flamingo },
|
||||||
["V"] = { "V-LINE", C.flamingo },
|
["V"] = { "V-LINE", C.flamingo },
|
||||||
[""] = { "V-BLOCK", C.flamingo },
|
[""] = { "V-BLOCK", C.flamingo },
|
||||||
["R"] = { "REPLACE", C.maroon },
|
["R"] = { "REPLACE", C.maroon },
|
||||||
["Rv"] = { "V-REPLACE", C.maroon },
|
["Rv"] = { "V-REPLACE", C.maroon },
|
||||||
["s"] = { "SELECT", C.maroon },
|
["s"] = { "SELECT", C.maroon },
|
||||||
["S"] = { "S-LINE", C.maroon },
|
["S"] = { "S-LINE", C.maroon },
|
||||||
[""] = { "S-BLOCK", C.maroon },
|
[""] = { "S-BLOCK", C.maroon },
|
||||||
["c"] = { "COMMAND", C.peach },
|
["c"] = { "COMMAND", C.peach },
|
||||||
["cv"] = { "COMMAND", C.peach },
|
["cv"] = { "COMMAND", C.peach },
|
||||||
["ce"] = { "COMMAND", C.peach },
|
["ce"] = { "COMMAND", C.peach },
|
||||||
["r"] = { "PROMPT", C.teal },
|
["r"] = { "PROMPT", C.teal },
|
||||||
["rm"] = { "MORE", C.teal },
|
["rm"] = { "MORE", C.teal },
|
||||||
["r?"] = { "CONFIRM", C.mauve },
|
["r?"] = { "CONFIRM", C.mauve },
|
||||||
["!"] = { "SHELL", C.green },
|
["!"] = { "SHELL", C.green },
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
if opts then
|
if opts then
|
||||||
opts.assets = opts.assets or {}
|
opts.assets = opts.assets or {}
|
||||||
opts.sett = opts.sett or {}
|
opts.sett = opts.sett or {}
|
||||||
opts.mode_colors = opts.mode_colors or {}
|
opts.mode_colors = opts.mode_colors or {}
|
||||||
else
|
else
|
||||||
opts = {}
|
opts = {}
|
||||||
end
|
end
|
||||||
assets = vim.tbl_deep_extend("force", assets, opts.assets)
|
assets = vim.tbl_deep_extend("force", assets, opts.assets)
|
||||||
sett = vim.tbl_deep_extend("force", sett, opts.sett)
|
sett = vim.tbl_deep_extend("force", sett, opts.sett)
|
||||||
mode_colors = vim.tbl_deep_extend("force", mode_colors, opts.mode_colors)
|
mode_colors = vim.tbl_deep_extend("force", mode_colors, opts.mode_colors)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get()
|
function M.get()
|
||||||
local shortline = false
|
local shortline = false
|
||||||
|
|
||||||
local components = {
|
local components = {
|
||||||
active = { {}, {} }, -- left, right
|
active = { {}, {} }, -- left, right
|
||||||
inactive = { {} },
|
inactive = { {} },
|
||||||
}
|
}
|
||||||
|
|
||||||
local function is_enabled(min_width)
|
local function is_enabled(min_width)
|
||||||
if shortline then
|
if shortline then return true end
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return vim.api.nvim_win_get_width(0) > min_width
|
return vim.api.nvim_win_get_width(0) > min_width
|
||||||
end
|
end
|
||||||
|
|
||||||
-- global components
|
-- global components
|
||||||
local invi_sep = {
|
local invi_sep = {
|
||||||
str = " ",
|
str = " ",
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.bkg,
|
fg = sett.bkg,
|
||||||
bg = sett.bkg,
|
bg = sett.bkg,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- helpers
|
-- helpers
|
||||||
local function any_git_changes()
|
local function any_git_changes()
|
||||||
local gst = vim.b.gitsigns_status_dict -- git stats
|
local gst = vim.b.gitsigns_status_dict -- git stats
|
||||||
if gst then
|
if gst then
|
||||||
if
|
if
|
||||||
gst["added"] and gst["added"] > 0
|
gst["added"] and gst["added"] > 0
|
||||||
or gst["removed"] and gst["removed"] > 0
|
or gst["removed"] and gst["removed"] > 0
|
||||||
or gst["changed"] and gst["changed"] > 0
|
or gst["changed"] and gst["changed"] > 0
|
||||||
then
|
then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- #################### STATUSLINE ->
|
-- #################### STATUSLINE ->
|
||||||
|
|
||||||
-- ######## Left
|
-- ######## Left
|
||||||
|
|
||||||
-- Current vi mode ------>
|
-- Current vi mode ------>
|
||||||
local vi_mode_hl = function()
|
local vi_mode_hl = function()
|
||||||
return {
|
return {
|
||||||
fg = sett.text,
|
fg = sett.text,
|
||||||
bg = mode_colors[vim.fn.mode()][2],
|
bg = mode_colors[vim.fn.mode()][2],
|
||||||
style = "bold",
|
style = "bold",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
components.active[1][1] = {
|
components.active[1][1] = {
|
||||||
provider = " " .. assets.mode_icon .. " ",
|
provider = " " .. assets.mode_icon .. " ",
|
||||||
hl = function()
|
hl = function()
|
||||||
return {
|
return {
|
||||||
fg = sett.text,
|
fg = sett.text,
|
||||||
bg = mode_colors[vim.fn.mode()][2],
|
bg = mode_colors[vim.fn.mode()][2],
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
components.active[1][2] = {
|
components.active[1][2] = {
|
||||||
provider = function()
|
provider = function() return mode_colors[vim.fn.mode()][1] .. " " end,
|
||||||
return mode_colors[vim.fn.mode()][1] .. " "
|
hl = vi_mode_hl,
|
||||||
end,
|
}
|
||||||
hl = vi_mode_hl,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- there is a dilema: we need to hide Diffs if ther is no git info. We can do that, but this will
|
-- there is a dilema: we need to hide Diffs if ther is no git info. We can do that, but this will
|
||||||
-- leave the right_separator colored with purple, and since we can't change the color conditonally
|
-- leave the right_separator colored with purple, and since we can't change the color conditonally
|
||||||
-- then the solution is to create two right_separators: one with a mauve sett.bkg and the other one normal
|
-- then the solution is to create two right_separators: one with a mauve sett.bkg and the other one normal
|
||||||
-- sett.bkg; both have the same fg (vi mode). The mauve one appears if there is git info, else the one with
|
-- sett.bkg; both have the same fg (vi mode). The mauve one appears if there is git info, else the one with
|
||||||
-- the normal sett.bkg appears. Fixed :)
|
-- the normal sett.bkg appears. Fixed :)
|
||||||
|
|
||||||
-- enable if git diffs are not available
|
-- enable if git diffs are not available
|
||||||
components.active[1][3] = {
|
components.active[1][3] = {
|
||||||
provider = assets.right_separator,
|
provider = assets.right_separator,
|
||||||
hl = function()
|
hl = function()
|
||||||
return {
|
return {
|
||||||
fg = mode_colors[vim.fn.mode()][2],
|
fg = mode_colors[vim.fn.mode()][2],
|
||||||
bg = sett.bkg,
|
bg = sett.bkg,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
enabled = function()
|
enabled = function() return not any_git_changes() end,
|
||||||
return not any_git_changes()
|
}
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- enable if git diffs are available
|
-- enable if git diffs are available
|
||||||
components.active[1][4] = {
|
components.active[1][4] = {
|
||||||
provider = assets.right_separator,
|
provider = assets.right_separator,
|
||||||
hl = function()
|
hl = function()
|
||||||
return {
|
return {
|
||||||
fg = mode_colors[vim.fn.mode()][2],
|
fg = mode_colors[vim.fn.mode()][2],
|
||||||
bg = sett.diffs,
|
bg = sett.diffs,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
enabled = function()
|
enabled = function() return any_git_changes() end,
|
||||||
return any_git_changes()
|
}
|
||||||
end,
|
-- Current vi mode ------>
|
||||||
}
|
|
||||||
-- Current vi mode ------>
|
|
||||||
|
|
||||||
-- Diffs ------>
|
-- Diffs ------>
|
||||||
components.active[1][5] = {
|
components.active[1][5] = {
|
||||||
provider = "git_diff_added",
|
provider = "git_diff_added",
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.text,
|
fg = sett.text,
|
||||||
bg = sett.diffs,
|
bg = sett.diffs,
|
||||||
},
|
},
|
||||||
icon = " " .. assets.git.added .. " ",
|
icon = " " .. assets.git.added .. " ",
|
||||||
}
|
}
|
||||||
|
|
||||||
components.active[1][6] = {
|
components.active[1][6] = {
|
||||||
provider = "git_diff_changed",
|
provider = "git_diff_changed",
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.text,
|
fg = sett.text,
|
||||||
bg = sett.diffs,
|
bg = sett.diffs,
|
||||||
},
|
},
|
||||||
icon = " " .. assets.git.changed .. " ",
|
icon = " " .. assets.git.changed .. " ",
|
||||||
}
|
}
|
||||||
|
|
||||||
components.active[1][7] = {
|
components.active[1][7] = {
|
||||||
provider = "git_diff_removed",
|
provider = "git_diff_removed",
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.text,
|
fg = sett.text,
|
||||||
bg = sett.diffs,
|
bg = sett.diffs,
|
||||||
},
|
},
|
||||||
icon = " " .. assets.git.removed .. " ",
|
icon = " " .. assets.git.removed .. " ",
|
||||||
}
|
}
|
||||||
|
|
||||||
components.active[1][8] = {
|
components.active[1][8] = {
|
||||||
provider = " ",
|
provider = " ",
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.bkg,
|
fg = sett.bkg,
|
||||||
bg = sett.diffs,
|
bg = sett.diffs,
|
||||||
},
|
},
|
||||||
enabled = function()
|
enabled = function() return any_git_changes() end,
|
||||||
return any_git_changes()
|
}
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
components.active[1][9] = {
|
components.active[1][9] = {
|
||||||
provider = assets.right_separator,
|
provider = assets.right_separator,
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.diffs,
|
fg = sett.diffs,
|
||||||
bg = sett.bkg,
|
bg = sett.bkg,
|
||||||
},
|
},
|
||||||
enabled = function()
|
enabled = function() return any_git_changes() end,
|
||||||
return any_git_changes()
|
}
|
||||||
end,
|
-- Diffs ------>
|
||||||
}
|
|
||||||
-- Diffs ------>
|
|
||||||
|
|
||||||
-- Extras ------>
|
-- Extras ------>
|
||||||
|
|
||||||
-- file progess
|
-- file progess
|
||||||
components.active[1][10] = {
|
components.active[1][10] = {
|
||||||
provider = function()
|
provider = function()
|
||||||
local current_line = vim.fn.line(".")
|
local current_line = vim.fn.line "."
|
||||||
local total_line = vim.fn.line("$")
|
local total_line = vim.fn.line "$"
|
||||||
|
|
||||||
if current_line == 1 then
|
if current_line == 1 then
|
||||||
return "Top"
|
return "Top"
|
||||||
elseif current_line == vim.fn.line("$") then
|
elseif current_line == vim.fn.line "$" then
|
||||||
return "Bot"
|
return "Bot"
|
||||||
end
|
end
|
||||||
local result, _ = math.modf((current_line / total_line) * 100)
|
local result, _ = math.modf((current_line / total_line) * 100)
|
||||||
return result .. "%%"
|
return result .. "%%"
|
||||||
end,
|
end,
|
||||||
-- enabled = shortline or function(winid)
|
-- enabled = shortline or function(winid)
|
||||||
-- return vim.api.nvim_win_get_width(winid) > 90
|
-- return vim.api.nvim_win_get_width(winid) > 90
|
||||||
-- end,
|
-- end,
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.extras,
|
fg = sett.extras,
|
||||||
bg = sett.bkg,
|
bg = sett.bkg,
|
||||||
},
|
},
|
||||||
left_sep = invi_sep,
|
left_sep = invi_sep,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- position
|
-- position
|
||||||
components.active[1][11] = {
|
components.active[1][11] = {
|
||||||
provider = "position",
|
provider = "position",
|
||||||
-- enabled = shortline or function(winid)
|
-- enabled = shortline or function(winid)
|
||||||
-- return vim.api.nvim_win_get_width(winid) > 90
|
-- return vim.api.nvim_win_get_width(winid) > 90
|
||||||
-- end,
|
-- end,
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.extras,
|
fg = sett.extras,
|
||||||
bg = sett.bkg,
|
bg = sett.bkg,
|
||||||
},
|
},
|
||||||
left_sep = invi_sep,
|
left_sep = invi_sep,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- macro
|
-- macro
|
||||||
components.active[1][12] = {
|
components.active[1][12] = {
|
||||||
provider = "macro",
|
provider = "macro",
|
||||||
enabled = function()
|
enabled = function() return vim.api.nvim_get_option "cmdheight" == 0 end,
|
||||||
return vim.api.nvim_get_option("cmdheight") == 0
|
hl = {
|
||||||
end,
|
fg = sett.extras,
|
||||||
hl = {
|
bg = sett.bkg,
|
||||||
fg = sett.extras,
|
},
|
||||||
bg = sett.bkg,
|
left_sep = invi_sep,
|
||||||
},
|
}
|
||||||
left_sep = invi_sep,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- search count
|
-- search count
|
||||||
components.active[1][13] = {
|
components.active[1][13] = {
|
||||||
provider = "search_count",
|
provider = "search_count",
|
||||||
enabled = function()
|
enabled = function() return vim.api.nvim_get_option "cmdheight" == 0 end,
|
||||||
return vim.api.nvim_get_option("cmdheight") == 0
|
hl = {
|
||||||
end,
|
fg = sett.extras,
|
||||||
hl = {
|
bg = sett.bkg,
|
||||||
fg = sett.extras,
|
},
|
||||||
bg = sett.bkg,
|
left_sep = invi_sep,
|
||||||
},
|
}
|
||||||
left_sep = invi_sep,
|
-- Extras ------>
|
||||||
}
|
|
||||||
-- Extras ------>
|
|
||||||
|
|
||||||
-- ######## Left
|
-- ######## Left
|
||||||
-- treesitter position
|
-- treesitter position
|
||||||
components.active[1][14] = {
|
components.active[1][14] = {
|
||||||
provider = function()
|
provider = function()
|
||||||
-- if not require("vim.treesitter.language").require_language("lua") then
|
-- if not require("vim.treesitter.language").require_language("lua") then
|
||||||
-- return ""
|
-- return ""
|
||||||
-- end
|
-- end
|
||||||
local pos = require("nvim-treesitter").statusline({
|
local pos = require("nvim-treesitter").statusline {
|
||||||
indicator_size = 50,
|
indicator_size = 50,
|
||||||
transform_fn = function(line)
|
transform_fn = function(line) return line:gsub("%s*[%[%(%{]+.*$", "") end,
|
||||||
return line:gsub("%s*[%[%(%{]+.*$", "")
|
}
|
||||||
end,
|
if pos and pos ~= "" then return pos end
|
||||||
})
|
return ""
|
||||||
if pos and pos ~= "" then
|
end,
|
||||||
return pos
|
hl = {
|
||||||
end
|
fg = sett.extras,
|
||||||
return ""
|
bg = sett.bkg,
|
||||||
end,
|
},
|
||||||
hl = {
|
left_sep = invi_sep,
|
||||||
fg = sett.extras,
|
}
|
||||||
bg = sett.bkg,
|
|
||||||
},
|
|
||||||
left_sep = invi_sep,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- ######## Right
|
-- ######## Right
|
||||||
|
|
||||||
-- Diagnostics ------>
|
-- Diagnostics ------>
|
||||||
-- workspace loader
|
-- workspace loader
|
||||||
components.active[2][1] = {
|
components.active[2][1] = {
|
||||||
provider = function()
|
provider = function()
|
||||||
local Lsp = vim.lsp.util.get_progress_messages()[1]
|
local Lsp = vim.lsp.util.get_progress_messages()[1]
|
||||||
|
|
||||||
if Lsp then
|
if Lsp then
|
||||||
local msg = Lsp.message or ""
|
local msg = Lsp.message or ""
|
||||||
local percentage = Lsp.percentage
|
local percentage = Lsp.percentage
|
||||||
if not percentage then
|
if not percentage then return "" end
|
||||||
return ""
|
local title = Lsp.title or ""
|
||||||
end
|
local spinners = {
|
||||||
local title = Lsp.title or ""
|
"",
|
||||||
local spinners = {
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
}
|
||||||
"",
|
local success_icon = {
|
||||||
}
|
"",
|
||||||
local success_icon = {
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
}
|
||||||
"",
|
local ms = vim.loop.hrtime() / 1000000
|
||||||
}
|
local frame = math.floor(ms / 120) % #spinners
|
||||||
local ms = vim.loop.hrtime() / 1000000
|
|
||||||
local frame = math.floor(ms / 120) % #spinners
|
|
||||||
|
|
||||||
if percentage >= 70 then
|
if percentage >= 70 then
|
||||||
return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage)
|
return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage)
|
||||||
end
|
end
|
||||||
|
|
||||||
return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
|
return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
|
||||||
end
|
end
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
end,
|
end,
|
||||||
enabled = is_enabled(80),
|
enabled = is_enabled(80),
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.extras,
|
fg = sett.extras,
|
||||||
bg = sett.bkg,
|
bg = sett.bkg,
|
||||||
},
|
},
|
||||||
right_sep = invi_sep,
|
right_sep = invi_sep,
|
||||||
}
|
}
|
||||||
|
|
||||||
components.active[2][2] = {
|
components.active[2][2] = {
|
||||||
provider = "git_branch",
|
provider = "git_branch",
|
||||||
enabled = is_enabled(70),
|
enabled = is_enabled(70),
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.extras,
|
fg = sett.extras,
|
||||||
bg = sett.bkg,
|
bg = sett.bkg,
|
||||||
},
|
},
|
||||||
icon = assets.git.branch .. " ",
|
icon = assets.git.branch .. " ",
|
||||||
right_sep = invi_sep,
|
right_sep = invi_sep,
|
||||||
}
|
}
|
||||||
|
|
||||||
components.active[2][3] = {
|
components.active[2][3] = {
|
||||||
provider = function()
|
provider = function()
|
||||||
if next(vim.lsp.buf_get_clients()) ~= nil then
|
if next(vim.lsp.buf_get_clients()) ~= nil then
|
||||||
return assets.lsp.server .. " " .. "Lsp"
|
return assets.lsp.server .. " " .. "Lsp"
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.extras,
|
fg = sett.extras,
|
||||||
bg = sett.bkg,
|
bg = sett.bkg,
|
||||||
},
|
},
|
||||||
right_sep = invi_sep,
|
right_sep = invi_sep,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- genral diagnostics (errors, warnings. info and hints)
|
-- genral diagnostics (errors, warnings. info and hints)
|
||||||
components.active[2][4] = {
|
components.active[2][4] = {
|
||||||
provider = "diagnostic_errors",
|
provider = "diagnostic_errors",
|
||||||
enabled = function()
|
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.ERROR) end,
|
||||||
return lsp.diagnostics_exist(vim.diagnostic.severity.ERROR)
|
|
||||||
end,
|
|
||||||
|
|
||||||
hl = {
|
hl = {
|
||||||
fg = C.red,
|
fg = C.red,
|
||||||
bg = sett.bkg,
|
bg = sett.bkg,
|
||||||
},
|
},
|
||||||
icon = " " .. assets.lsp.error .. " ",
|
icon = " " .. assets.lsp.error .. " ",
|
||||||
right_sep = invi_sep,
|
right_sep = invi_sep,
|
||||||
}
|
}
|
||||||
|
|
||||||
components.active[2][5] = {
|
components.active[2][5] = {
|
||||||
provider = "diagnostic_warnings",
|
provider = "diagnostic_warnings",
|
||||||
enabled = function()
|
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.WARN) end,
|
||||||
return lsp.diagnostics_exist(vim.diagnostic.severity.WARN)
|
hl = {
|
||||||
end,
|
fg = C.yellow,
|
||||||
hl = {
|
bg = sett.bkg,
|
||||||
fg = C.yellow,
|
},
|
||||||
bg = sett.bkg,
|
icon = " " .. assets.lsp.warning .. " ",
|
||||||
},
|
right_sep = invi_sep,
|
||||||
icon = " " .. assets.lsp.warning .. " ",
|
}
|
||||||
right_sep = invi_sep,
|
|
||||||
}
|
|
||||||
|
|
||||||
components.active[2][6] = {
|
components.active[2][6] = {
|
||||||
provider = "diagnostic_info",
|
provider = "diagnostic_info",
|
||||||
enabled = function()
|
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.INFO) end,
|
||||||
return lsp.diagnostics_exist(vim.diagnostic.severity.INFO)
|
hl = {
|
||||||
end,
|
fg = C.sky,
|
||||||
hl = {
|
bg = sett.bkg,
|
||||||
fg = C.sky,
|
},
|
||||||
bg = sett.bkg,
|
icon = " " .. assets.lsp.info .. " ",
|
||||||
},
|
right_sep = invi_sep,
|
||||||
icon = " " .. assets.lsp.info .. " ",
|
}
|
||||||
right_sep = invi_sep,
|
|
||||||
}
|
|
||||||
|
|
||||||
components.active[2][7] = {
|
components.active[2][7] = {
|
||||||
provider = "diagnostic_hints",
|
provider = "diagnostic_hints",
|
||||||
enabled = function()
|
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.HINT) end,
|
||||||
return lsp.diagnostics_exist(vim.diagnostic.severity.HINT)
|
hl = {
|
||||||
end,
|
fg = C.rosewater,
|
||||||
hl = {
|
bg = sett.bkg,
|
||||||
fg = C.rosewater,
|
},
|
||||||
bg = sett.bkg,
|
icon = " " .. assets.lsp.hint .. " ",
|
||||||
},
|
right_sep = invi_sep,
|
||||||
icon = " " .. assets.lsp.hint .. " ",
|
}
|
||||||
right_sep = invi_sep,
|
-- Diagnostics ------>
|
||||||
}
|
|
||||||
-- Diagnostics ------>
|
|
||||||
|
|
||||||
components.active[2][8] = {
|
components.active[2][8] = {
|
||||||
provider = function()
|
provider = function()
|
||||||
local filename = vim.fn.expand("%:t")
|
local filename = vim.fn.expand "%:t"
|
||||||
local extension = vim.fn.expand("%:e")
|
local extension = vim.fn.expand "%:e"
|
||||||
local present, icons = pcall(require, "nvim-web-devicons")
|
local present, icons = pcall(require, "nvim-web-devicons")
|
||||||
local icon = present and icons.get_icon(filename, extension) or assets.file
|
local icon = present and icons.get_icon(filename, extension) or assets.file
|
||||||
return (sett.show_modified and "%m" or "") .. " " .. icon .. " " .. filename .. " "
|
return (sett.show_modified and "%m" or "") .. " " .. icon .. " " .. filename .. " "
|
||||||
end,
|
end,
|
||||||
enabled = is_enabled(70),
|
enabled = is_enabled(70),
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.text,
|
fg = sett.text,
|
||||||
bg = sett.curr_file,
|
bg = sett.curr_file,
|
||||||
},
|
},
|
||||||
left_sep = {
|
left_sep = {
|
||||||
str = assets.left_separator,
|
str = assets.left_separator,
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.curr_file,
|
fg = sett.curr_file,
|
||||||
bg = sett.bkg,
|
bg = sett.bkg,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
components.active[2][9] = {
|
components.active[2][9] = {
|
||||||
provider = function()
|
provider = function()
|
||||||
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
||||||
return " " .. assets.dir .. " " .. dir_name .. " "
|
return " " .. assets.dir .. " " .. dir_name .. " "
|
||||||
end,
|
end,
|
||||||
enabled = is_enabled(80),
|
enabled = is_enabled(80),
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.text,
|
fg = sett.text,
|
||||||
bg = sett.curr_dir,
|
bg = sett.curr_dir,
|
||||||
},
|
},
|
||||||
left_sep = {
|
left_sep = {
|
||||||
str = assets.left_separator,
|
str = assets.left_separator,
|
||||||
hl = {
|
hl = {
|
||||||
fg = sett.curr_dir,
|
fg = sett.curr_dir,
|
||||||
bg = sett.curr_file,
|
bg = sett.curr_file,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
-- ######## Right
|
-- ######## Right
|
||||||
|
|
||||||
-- Inanctive components
|
-- Inanctive components
|
||||||
components.inactive[1][1] = {
|
components.inactive[1][1] = {
|
||||||
provider = function()
|
provider = function() return " " .. string.upper(vim.bo.ft) .. " " end,
|
||||||
return " " .. string.upper(vim.bo.ft) .. " "
|
hl = {
|
||||||
end,
|
fg = C.overlay2,
|
||||||
hl = {
|
bg = C.mantle,
|
||||||
fg = C.overlay2,
|
},
|
||||||
bg = C.mantle,
|
}
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
return components
|
return components
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,75 +1,75 @@
|
||||||
local cmp = require("cmp")
|
local cmp = require "cmp"
|
||||||
local luasnip = require("luasnip")
|
local luasnip = require "luasnip"
|
||||||
|
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup {
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert {
|
||||||
["<C-u>"] = cmp.mapping.scroll_docs(-4), -- Up
|
["<C-u>"] = cmp.mapping.scroll_docs(-4), -- Up
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(4), -- Down
|
["<C-d>"] = cmp.mapping.scroll_docs(4), -- Down
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
["<CR>"] = cmp.mapping.confirm({
|
["<CR>"] = cmp.mapping.confirm {
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
select = true,
|
select = true,
|
||||||
}),
|
},
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
elseif luasnip.expand_or_jumpable() then
|
elseif luasnip.expand_or_jumpable() then
|
||||||
luasnip.expand_or_jump()
|
luasnip.expand_or_jump()
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
elseif luasnip.jumpable(-1) then
|
elseif luasnip.jumpable(-1) then
|
||||||
luasnip.jump(-1)
|
luasnip.jump(-1)
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
}),
|
},
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
{ name = "luasnip" },
|
{ name = "luasnip" },
|
||||||
{ name = "latex_symbols" },
|
{ name = "latex_symbols" },
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
||||||
-- Set configuration for specific filetype.
|
-- Set configuration for specific filetype.
|
||||||
cmp.setup.filetype("gitcommit", {
|
cmp.setup.filetype("gitcommit", {
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "git" },
|
{ name = "git" },
|
||||||
{ name = "commit" },
|
{ name = "commit" },
|
||||||
{ name = "buffer" },
|
{ name = "buffer" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
cmp.setup.filetype("markdown", {
|
cmp.setup.filetype("markdown", {
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "spell" },
|
{ name = "spell" },
|
||||||
{ name = "buffer" },
|
{ name = "buffer" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
cmp.setup.cmdline("/", {
|
cmp.setup.cmdline("/", {
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "buffer" },
|
{ name = "buffer" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
cmp.setup.cmdline(":", {
|
cmp.setup.cmdline(":", {
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "path" },
|
{ name = "path" },
|
||||||
{ name = "cmdline" },
|
{ name = "cmdline" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,4 +1,2 @@
|
||||||
local components = require("config.catppuccin_feline").get()
|
local components = require("config.catppuccin_feline").get()
|
||||||
require("feline").setup({
|
require("feline").setup { components = components }
|
||||||
components = components,
|
|
||||||
})
|
|
||||||
|
|
|
@ -1,57 +1,45 @@
|
||||||
require("gitsigns").setup({
|
require("gitsigns").setup {
|
||||||
signcolumn = true,
|
signcolumn = true,
|
||||||
numhl = true,
|
numhl = true,
|
||||||
linehl = false,
|
linehl = false,
|
||||||
current_line_blame = true,
|
current_line_blame = true,
|
||||||
word_diff = false,
|
word_diff = false,
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
local gs = package.loaded.gitsigns
|
local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
local function map(mode, l, r, opts)
|
local function map(mode, l, r, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
opts.buffer = bufnr
|
opts.buffer = bufnr
|
||||||
vim.keymap.set(mode, l, r, opts)
|
vim.keymap.set(mode, l, r, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Navigation
|
-- Navigation
|
||||||
map("n", "]c", function()
|
map("n", "]c", function()
|
||||||
if vim.wo.diff then
|
if vim.wo.diff then return "]c" end
|
||||||
return "]c"
|
vim.schedule(function() gs.next_hunk() end)
|
||||||
end
|
return "<Ignore>"
|
||||||
vim.schedule(function()
|
end, { expr = true })
|
||||||
gs.next_hunk()
|
|
||||||
end)
|
|
||||||
return "<Ignore>"
|
|
||||||
end, { expr = true })
|
|
||||||
|
|
||||||
map("n", "[c", function()
|
map("n", "[c", function()
|
||||||
if vim.wo.diff then
|
if vim.wo.diff then return "[c" end
|
||||||
return "[c"
|
vim.schedule(function() gs.prev_hunk() end)
|
||||||
end
|
return "<Ignore>"
|
||||||
vim.schedule(function()
|
end, { expr = true })
|
||||||
gs.prev_hunk()
|
|
||||||
end)
|
|
||||||
return "<Ignore>"
|
|
||||||
end, { expr = true })
|
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
map({ "n", "v" }, "<leader>hs", ":Gitsigns stage_hunk<CR>")
|
map({ "n", "v" }, "<leader>hs", ":Gitsigns stage_hunk<CR>")
|
||||||
map({ "n", "v" }, "<leader>hr", ":Gitsigns reset_hunk<CR>")
|
map({ "n", "v" }, "<leader>hr", ":Gitsigns reset_hunk<CR>")
|
||||||
map("n", "<leader>hS", gs.stage_buffer)
|
map("n", "<leader>hS", gs.stage_buffer)
|
||||||
map("n", "<leader>hu", gs.undo_stage_hunk)
|
map("n", "<leader>hu", gs.undo_stage_hunk)
|
||||||
map("n", "<leader>hR", gs.reset_buffer)
|
map("n", "<leader>hR", gs.reset_buffer)
|
||||||
map("n", "<leader>hp", gs.preview_hunk)
|
map("n", "<leader>hp", gs.preview_hunk)
|
||||||
map("n", "<leader>hb", function()
|
map("n", "<leader>hb", function() gs.blame_line { full = true } end)
|
||||||
gs.blame_line({ full = true })
|
map("n", "<leader>tb", gs.toggle_current_line_blame)
|
||||||
end)
|
map("n", "<leader>hd", gs.diffthis)
|
||||||
map("n", "<leader>tb", gs.toggle_current_line_blame)
|
map("n", "<leader>hD", function() gs.diffthis "~" end)
|
||||||
map("n", "<leader>hd", gs.diffthis)
|
map("n", "<leader>td", gs.toggle_deleted)
|
||||||
map("n", "<leader>hD", function()
|
|
||||||
gs.diffthis("~")
|
|
||||||
end)
|
|
||||||
map("n", "<leader>td", gs.toggle_deleted)
|
|
||||||
|
|
||||||
-- Text object
|
-- Text object
|
||||||
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
|
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
|
||||||
end,
|
end,
|
||||||
})
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
require("indent_blankline").setup({
|
require("indent_blankline").setup {
|
||||||
show_current_context = true,
|
show_current_context = true,
|
||||||
show_current_context_start = false,
|
show_current_context_start = false,
|
||||||
char_highlight_list = {
|
char_highlight_list = {
|
||||||
"IndentBlanklineIndent1",
|
"IndentBlanklineIndent1",
|
||||||
"IndentBlanklineIndent2",
|
"IndentBlanklineIndent2",
|
||||||
"IndentBlanklineIndent3",
|
"IndentBlanklineIndent3",
|
||||||
"IndentBlanklineIndent4",
|
"IndentBlanklineIndent4",
|
||||||
"IndentBlanklineIndent5",
|
"IndentBlanklineIndent5",
|
||||||
"IndentBlanklineIndent6",
|
"IndentBlanklineIndent6",
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
require("kanagawa").setup({
|
|
||||||
transparent = true,
|
|
||||||
dimInactive = true,
|
|
||||||
})
|
|
|
@ -1,10 +1,10 @@
|
||||||
local M = {
|
local M = {
|
||||||
install = {
|
install = {
|
||||||
colorscheme = {
|
colorscheme = {
|
||||||
"catppuccin",
|
"catppuccin",
|
||||||
"habamax",
|
"habamax",
|
||||||
"default",
|
"default",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -8,95 +8,91 @@ vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, opts)
|
||||||
|
|
||||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||||
for type, icon in pairs(signs) do
|
for type, icon in pairs(signs) do
|
||||||
local hl = "DiagnosticSign" .. type
|
local hl = "DiagnosticSign" .. type
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
end
|
end
|
||||||
|
|
||||||
local lsp_formatting = function(bufnr)
|
local lsp_formatting = function(bufnr)
|
||||||
vim.lsp.buf.format({
|
vim.lsp.buf.format {
|
||||||
filter = function(client)
|
filter = function(client) return client.name == "null-ls" end,
|
||||||
return client.name == "null-ls"
|
bufnr = bufnr,
|
||||||
end,
|
timeout_ms = 2000,
|
||||||
bufnr = bufnr,
|
-- async = true,
|
||||||
timeout_ms = 2000,
|
}
|
||||||
-- async = true,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Use an on_attach function to only map the following keys
|
-- Use an on_attach function to only map the following keys
|
||||||
-- after the language server attaches to the current buffer
|
-- after the language server attaches to the current buffer
|
||||||
local on_attach = function(_, bufnr)
|
local on_attach = function(_, bufnr)
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
vim.keymap.set("n", "gD", vim.lsp.buf.definition, bufopts)
|
vim.keymap.set("n", "gD", vim.lsp.buf.definition, bufopts)
|
||||||
vim.keymap.set("n", "gd", "<cmd>Trouble lsp_definitions<cr>", bufopts)
|
vim.keymap.set("n", "gd", "<cmd>Trouble lsp_definitions<cr>", bufopts)
|
||||||
vim.keymap.set("n", "gR", vim.lsp.buf.references, bufopts)
|
vim.keymap.set("n", "gR", vim.lsp.buf.references, bufopts)
|
||||||
vim.keymap.set("n", "gr", "<cmd>Trouble lsp_references<cr>", bufopts)
|
vim.keymap.set("n", "gr", "<cmd>Trouble lsp_references<cr>", bufopts)
|
||||||
vim.keymap.set("n", "gI", vim.lsp.buf.implementation, bufopts)
|
vim.keymap.set("n", "gI", vim.lsp.buf.implementation, bufopts)
|
||||||
vim.keymap.set("n", "gi", "<cmd>Trouble lsp_implementations<cr>", bufopts)
|
vim.keymap.set("n", "gi", "<cmd>Trouble lsp_implementations<cr>", bufopts)
|
||||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
|
||||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
|
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
|
||||||
vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, bufopts)
|
vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, bufopts)
|
||||||
vim.keymap.set("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
|
vim.keymap.set("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||||
vim.keymap.set("n", "<leader>wl", function()
|
vim.keymap.set("n", "<leader>wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, bufopts)
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
vim.keymap.set("n", "<leader>D", vim.lsp.buf.type_definition, bufopts)
|
||||||
end, bufopts)
|
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, bufopts)
|
||||||
vim.keymap.set("n", "<leader>D", vim.lsp.buf.type_definition, bufopts)
|
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, bufopts)
|
||||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, bufopts)
|
vim.keymap.set("n", "<leader>i", lsp_formatting, bufopts)
|
||||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, bufopts)
|
|
||||||
vim.keymap.set("n", "<leader>i", lsp_formatting, bufopts)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local lsp_flags = {
|
local lsp_flags = {
|
||||||
-- This is the default in Nvim 0.7+
|
-- This is the default in Nvim 0.7+
|
||||||
debounce_text_changes = 150,
|
debounce_text_changes = 150,
|
||||||
}
|
}
|
||||||
|
|
||||||
require("neodev").setup()
|
require("neodev").setup()
|
||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require "lspconfig"
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
lspconfig.pyright.setup({
|
lspconfig.pyright.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
}
|
||||||
|
|
||||||
lspconfig.fortls.setup({
|
lspconfig.fortls.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
}
|
||||||
|
|
||||||
lspconfig.lua_ls.setup({
|
lspconfig.lua_ls.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
}
|
||||||
|
|
||||||
lspconfig.texlab.setup({
|
lspconfig.texlab.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
}
|
||||||
|
|
||||||
local null_ls = require("null-ls")
|
local null_ls = require "null-ls"
|
||||||
null_ls.setup({
|
null_ls.setup {
|
||||||
sources = {
|
sources = {
|
||||||
null_ls.builtins.code_actions.gitsigns,
|
null_ls.builtins.code_actions.gitsigns,
|
||||||
null_ls.builtins.diagnostics.mypy,
|
null_ls.builtins.diagnostics.mypy,
|
||||||
null_ls.builtins.diagnostics.zsh,
|
null_ls.builtins.diagnostics.zsh,
|
||||||
null_ls.builtins.formatting.black,
|
null_ls.builtins.formatting.black,
|
||||||
null_ls.builtins.formatting.isort,
|
null_ls.builtins.formatting.isort,
|
||||||
null_ls.builtins.formatting.trim_whitespace,
|
null_ls.builtins.formatting.trim_whitespace,
|
||||||
null_ls.builtins.formatting.stylua,
|
null_ls.builtins.formatting.stylua,
|
||||||
null_ls.builtins.formatting.shfmt,
|
null_ls.builtins.formatting.shfmt,
|
||||||
null_ls.builtins.formatting.prettier,
|
null_ls.builtins.formatting.prettier,
|
||||||
null_ls.builtins.hover.dictionary,
|
null_ls.builtins.hover.dictionary,
|
||||||
},
|
},
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
require("lualine").setup({
|
|
||||||
options = {
|
|
||||||
global_status = true
|
|
||||||
},
|
|
||||||
})
|
|
|
@ -1,21 +1,21 @@
|
||||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
vim.cmd [[ let g:neo_tree_remove_legacy_commands = 1 ]]
|
||||||
require("neo-tree").setup({
|
require("neo-tree").setup {
|
||||||
close_if_last_window = true,
|
close_if_last_window = true,
|
||||||
filesystem = {
|
filesystem = {
|
||||||
filtered_items = {
|
filtered_items = {
|
||||||
hide_dotfiles = false,
|
hide_dotfiles = false,
|
||||||
},
|
},
|
||||||
group_empty_dirs = true,
|
group_empty_dirs = true,
|
||||||
},
|
},
|
||||||
buffers = {
|
buffers = {
|
||||||
follow_current_file = true,
|
follow_current_file = true,
|
||||||
group_empty_dirs = true,
|
group_empty_dirs = true,
|
||||||
},
|
},
|
||||||
git_status = {
|
git_status = {
|
||||||
group_empty_dirs = true,
|
group_empty_dirs = true,
|
||||||
},
|
},
|
||||||
source_selector = {
|
source_selector = {
|
||||||
winbar = true,
|
winbar = true,
|
||||||
statusline = false,
|
statusline = false,
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
require("nightfox").setup({
|
|
||||||
options = {
|
|
||||||
transparent = true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
require("nightfox").compile()
|
|
|
@ -1,6 +1,6 @@
|
||||||
require("nvim-test").setup({
|
require("nvim-test").setup {
|
||||||
termOpts = {
|
termOpts = {
|
||||||
direction = "horizontal",
|
direction = "horizontal",
|
||||||
keep_one = true,
|
keep_one = true,
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
require("project_nvim").setup({
|
|
||||||
-- Manual mode doesn't automatically change your root directory, so you have
|
|
||||||
-- the option to manually do so using `:ProjectRoot` command.
|
|
||||||
manual_mode = false,
|
|
||||||
|
|
||||||
-- Methods of detecting the root directory. **"lsp"** uses the native neovim
|
|
||||||
-- lsp, while **"pattern"** uses vim-rooter like glob pattern matching. Here
|
|
||||||
-- order matters: if one is not detected, the other is used as fallback. You
|
|
||||||
-- can also delete or rearangne the detection methods.
|
|
||||||
detection_methods = { "pattern", "lsp" },
|
|
||||||
|
|
||||||
-- All the patterns used to detect root dir, when **"pattern"** is in
|
|
||||||
-- detection_methods
|
|
||||||
patterns = { ".git", ".venv", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
|
|
||||||
|
|
||||||
-- Table of lsp clients to ignore by name
|
|
||||||
-- eg: { "efm", ... }
|
|
||||||
ignore_lsp = {},
|
|
||||||
|
|
||||||
-- Don't calculate root dir on specific directories
|
|
||||||
-- Ex: { "~/.cargo/*", ... }
|
|
||||||
exclude_dirs = {},
|
|
||||||
|
|
||||||
-- Show hidden files in telescope
|
|
||||||
show_hidden = false,
|
|
||||||
|
|
||||||
-- When set to false, you will get a message when project.nvim changes your
|
|
||||||
-- directory.
|
|
||||||
silent_chdir = true,
|
|
||||||
|
|
||||||
-- What scope to change the directory, valid options are
|
|
||||||
-- * global (default)
|
|
||||||
-- * tab
|
|
||||||
-- * win
|
|
||||||
scope_chdir = "global",
|
|
||||||
|
|
||||||
-- Path where project.nvim will store the project history for use in
|
|
||||||
-- telescope
|
|
||||||
datapath = vim.fn.stdpath("data"),
|
|
||||||
})
|
|
|
@ -1,31 +1,31 @@
|
||||||
require("telescope.actions")
|
require "telescope.actions"
|
||||||
local trouble = require("trouble.providers.telescope")
|
local trouble = require "trouble.providers.telescope"
|
||||||
|
|
||||||
require("telescope").setup({
|
require("telescope").setup {
|
||||||
extensions = {
|
extensions = {
|
||||||
fzf = {
|
fzf = {
|
||||||
fuzzy = true, -- false will only do exact matching
|
fuzzy = true, -- false will only do exact matching
|
||||||
override_generic_sorter = true, -- override the generic sorter
|
override_generic_sorter = true, -- override the generic sorter
|
||||||
override_file_sorter = true, -- override the file sorter
|
override_file_sorter = true, -- override the file sorter
|
||||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||||
-- the default case_mode is "smart_case"
|
-- the default case_mode is "smart_case"
|
||||||
},
|
},
|
||||||
aerial = {
|
aerial = {
|
||||||
show_nesting = {
|
show_nesting = {
|
||||||
["_"] = false,
|
["_"] = false,
|
||||||
python = true,
|
python = true,
|
||||||
json = true,
|
json = true,
|
||||||
yaml = true,
|
yaml = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
defaults = {
|
defaults = {
|
||||||
mappings = {
|
mappings = {
|
||||||
i = { ["<c-t>"] = trouble.open_with_trouble },
|
i = { ["<c-t>"] = trouble.open_with_trouble },
|
||||||
n = { ["<c-t>"] = trouble.open_with_trouble },
|
n = { ["<c-t>"] = trouble.open_with_trouble },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
||||||
require("telescope").load_extension("fzf")
|
require("telescope").load_extension "fzf"
|
||||||
require("telescope").load_extension("notify")
|
require("telescope").load_extension "notify"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require("nvim-treesitter.configs").setup({
|
require("nvim-treesitter.configs").setup {
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
additional_vim_regex_highlighting = false,
|
additional_vim_regex_highlighting = false,
|
||||||
disable = { "fortran" },
|
disable = { "fortran" },
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require("trouble").setup({
|
require("trouble").setup {
|
||||||
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
|
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
|
||||||
auto_open = false, -- automatically open the list when you have diagnostics
|
auto_open = false, -- automatically open the list when you have diagnostics
|
||||||
auto_close = false, -- automatically close the list when you have no diagnostics
|
auto_close = false, -- automatically close the list when you have no diagnostics
|
||||||
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
|
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
|
||||||
auto_jump = { "lsp_definitions", "lsp_references", "lsp_implementations" }, -- for the given modes, automatically jump if there is only a single result
|
auto_jump = { "lsp_definitions", "lsp_references", "lsp_implementations" }, -- for the given modes, automatically jump if there is only a single result
|
||||||
})
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ vim.opt.title = true
|
||||||
vim.opt.cmdheight = 0
|
vim.opt.cmdheight = 0
|
||||||
vim.g.python3_host_prog = "/usr/bin/python3"
|
vim.g.python3_host_prog = "/usr/bin/python3"
|
||||||
vim.g.python_indent = {
|
vim.g.python_indent = {
|
||||||
open_paren = "shiftwidth()",
|
open_paren = "shiftwidth()",
|
||||||
nested_paren = "shiftwidth()",
|
nested_paren = "shiftwidth()",
|
||||||
continue = "shiftwidth()",
|
continue = "shiftwidth()",
|
||||||
closed_paren_align_last_line = "v:false",
|
closed_paren_align_last_line = "v:false",
|
||||||
}
|
}
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
vim.opt.laststatus = 3
|
vim.opt.laststatus = 3
|
||||||
|
|
|
@ -1,126 +1,104 @@
|
||||||
local M = {
|
local M = {
|
||||||
{ "folke/lazy.nvim", cmd = "Lazy" },
|
{ "folke/lazy.nvim", cmd = "Lazy" },
|
||||||
{
|
{
|
||||||
"catppuccin/nvim",
|
"catppuccin/nvim",
|
||||||
name = "catppuccin",
|
name = "catppuccin",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
config = function()
|
config = function() require "colours" end,
|
||||||
require("colours")
|
},
|
||||||
end,
|
{ "stevearc/dressing.nvim" },
|
||||||
},
|
{
|
||||||
{ "stevearc/dressing.nvim" },
|
"feline-nvim/feline.nvim",
|
||||||
{
|
config = function() require "config.feline" end,
|
||||||
"feline-nvim/feline.nvim",
|
},
|
||||||
config = function()
|
{
|
||||||
require("config.feline")
|
"rcarriga/nvim-notify",
|
||||||
end,
|
config = function()
|
||||||
},
|
require("notify").setup {
|
||||||
{
|
background_colour = "#000000",
|
||||||
"rcarriga/nvim-notify",
|
}
|
||||||
config = function()
|
vim.notify = require "notify"
|
||||||
require("notify").setup({
|
end,
|
||||||
background_colour = "#000000",
|
},
|
||||||
})
|
{
|
||||||
vim.notify = require("notify")
|
"neovim/nvim-lspconfig",
|
||||||
end,
|
dependencies = {
|
||||||
},
|
{ "hrsh7th/nvim-cmp" },
|
||||||
{
|
{ "hrsh7th/cmp-nvim-lsp" },
|
||||||
"neovim/nvim-lspconfig",
|
{ "hrsh7th/cmp-buffer" },
|
||||||
dependencies = {
|
{ "hrsh7th/cmp-path" },
|
||||||
{ "hrsh7th/nvim-cmp" },
|
{ "hrsh7th/cmp-cmdline" },
|
||||||
{ "hrsh7th/cmp-nvim-lsp" },
|
{ "f3fora/cmp-spell" },
|
||||||
{ "hrsh7th/cmp-buffer" },
|
{ "petertriho/cmp-git" },
|
||||||
{ "hrsh7th/cmp-path" },
|
{ "Dosx001/cmp-commit" },
|
||||||
{ "hrsh7th/cmp-cmdline" },
|
{ "kdheepak/cmp-latex-symbols" },
|
||||||
{ "f3fora/cmp-spell" },
|
{ "L3MON4D3/LuaSnip" },
|
||||||
{ "petertriho/cmp-git" },
|
{ "saadparwaiz1/cmp_luasnip" },
|
||||||
{ "Dosx001/cmp-commit" },
|
{ "rafamadriz/friendly-snippets" },
|
||||||
{ "kdheepak/cmp-latex-symbols" },
|
{ "windwp/nvim-autopairs" },
|
||||||
{ "L3MON4D3/LuaSnip" },
|
{ "jose-elias-alvarez/null-ls.nvim" },
|
||||||
{ "saadparwaiz1/cmp_luasnip" },
|
{ "folke/neodev.nvim" },
|
||||||
{ "rafamadriz/friendly-snippets" },
|
},
|
||||||
{ "windwp/nvim-autopairs" },
|
config = function()
|
||||||
{ "jose-elias-alvarez/null-ls.nvim" },
|
require "config.lsp"
|
||||||
{ "folke/neodev.nvim" },
|
require "config.cmp"
|
||||||
},
|
end,
|
||||||
config = function()
|
},
|
||||||
require("config.lsp")
|
{
|
||||||
require("config.cmp")
|
"nvim-treesitter/nvim-treesitter",
|
||||||
end,
|
config = function() require "config.treesitter" end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"lewis6991/gitsigns.nvim",
|
||||||
config = function()
|
config = function() require "config.gitsigns" end,
|
||||||
require("config.treesitter")
|
},
|
||||||
end,
|
{
|
||||||
},
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
{
|
branch = "v2.x",
|
||||||
"lewis6991/gitsigns.nvim",
|
dependencies = {
|
||||||
config = function()
|
"nvim-lua/plenary.nvim",
|
||||||
require("config.gitsigns")
|
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||||
end,
|
"MunifTanjim/nui.nvim",
|
||||||
},
|
},
|
||||||
{
|
cmd = "Neotree",
|
||||||
"nvim-neo-tree/neo-tree.nvim",
|
config = function() require "config.neotree" end,
|
||||||
branch = "v2.x",
|
},
|
||||||
dependencies = {
|
{
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
branch = "0.1.x",
|
||||||
"MunifTanjim/nui.nvim",
|
dependencies = {
|
||||||
},
|
{ "nvim-lua/plenary.nvim" },
|
||||||
cmd = "Neotree",
|
{
|
||||||
config = function()
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
require("config.neotree")
|
build = "make",
|
||||||
end,
|
},
|
||||||
},
|
},
|
||||||
{
|
cmd = "Telescope",
|
||||||
"nvim-telescope/telescope.nvim",
|
config = function() require "config.telescope" end,
|
||||||
branch = "0.1.x",
|
},
|
||||||
dependencies = {
|
{
|
||||||
{ "nvim-lua/plenary.nvim" },
|
"folke/trouble.nvim",
|
||||||
{
|
dependencies = "nvim-tree/nvim-web-devicons",
|
||||||
"nvim-telescope/telescope-fzf-native.nvim",
|
cmd = "TroubleToggle",
|
||||||
build = "make",
|
config = function() require "config.trouble" end,
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
cmd = "Telescope",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
config = function()
|
config = function() require "config.indent_blankline" end,
|
||||||
require("config.telescope")
|
},
|
||||||
end,
|
{
|
||||||
},
|
"numToStr/Navigator.nvim",
|
||||||
{
|
config = function() require("Navigator").setup() end,
|
||||||
"folke/trouble.nvim",
|
},
|
||||||
dependencies = "nvim-tree/nvim-web-devicons",
|
{
|
||||||
cmd = "TroubleToggle",
|
"klen/nvim-test",
|
||||||
config = function()
|
config = function() require "config.nvim-test" end,
|
||||||
require("config.trouble")
|
},
|
||||||
end,
|
{
|
||||||
},
|
"numToStr/Comment.nvim",
|
||||||
{
|
name = "Comment",
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
config = function() require "Comment" end,
|
||||||
config = function()
|
},
|
||||||
require("config.indent_blankline")
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"numToStr/Navigator.nvim",
|
|
||||||
config = function()
|
|
||||||
require("Navigator").setup()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"klen/nvim-test",
|
|
||||||
config = function()
|
|
||||||
require("config.nvim-test")
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"numToStr/Comment.nvim",
|
|
||||||
name = "Comment",
|
|
||||||
config = function()
|
|
||||||
require("Comment")
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
-- TODO convert to lua
|
-- TODO convert to lua
|
||||||
vim.cmd("let &t_ut=''") -- For kitty background colour support
|
vim.cmd "let &t_ut=''" -- For kitty background colour support
|
||||||
vim.cmd([[
|
vim.cmd [[
|
||||||
au BufRead,BufNewFile *.ipynb setlocal filetype=json
|
au BufRead,BufNewFile *.ipynb setlocal filetype=json
|
||||||
au BufRead,BufNewFile *.md setlocal spell
|
au BufRead,BufNewFile *.md setlocal spell
|
||||||
au BufRead,BufNewFile *.code-workspace setlocal filetype=json
|
au BufRead,BufNewFile *.code-workspace setlocal filetype=json
|
||||||
|
@ -8,4 +8,4 @@ au BufRead,BufNewFile *.csv setlocal nowrap
|
||||||
au BufRead,BufNewFile *.service[a-zA-Z0-9]* setlocal filetype=systemd
|
au BufRead,BufNewFile *.service[a-zA-Z0-9]* setlocal filetype=systemd
|
||||||
au TermOpen * setlocal nonumber norelativenumber
|
au TermOpen * setlocal nonumber norelativenumber
|
||||||
syntax on
|
syntax on
|
||||||
]])
|
]]
|
||||||
|
|
Loading…
Reference in a new issue