enc: lua format custem

This commit is contained in:
asep.komarudin 2024-06-14 08:40:35 +07:00
parent 65857a4226
commit 384c0b5768
68 changed files with 1450 additions and 1450 deletions

View file

@ -1,26 +1,26 @@
local model = vim.g.pcode_model
if model ~= nil then
if model == 1 then
require("user.startify")
else
require("user.dashboard")
end
if model == 1 then
require("user.startify")
else
require("user.dashboard")
end
else
require("user.startify")
require("user.startify")
end
-- Disable statusline in dashboard
vim.api.nvim_create_autocmd("FileType", {
pattern = "alpha",
callback = function()
-- store current statusline value and use that
local old_laststatus = vim.opt.laststatus
vim.api.nvim_create_autocmd("BufUnload", {
buffer = 0,
callback = function()
vim.opt.laststatus = old_laststatus
end,
})
vim.opt.laststatus = 0
end,
pattern = "alpha",
callback = function()
-- store current statusline value and use that
local old_laststatus = vim.opt.laststatus
vim.api.nvim_create_autocmd("BufUnload", {
buffer = 0,
callback = function()
vim.opt.laststatus = old_laststatus
end,
})
vim.opt.laststatus = 0
end,
})

View file

@ -1,50 +1,50 @@
local status_ok, navic = pcall(require, "nvim-navic")
if not status_ok then
return
return
end
local ico = vim.g.pcode_icons
local icons = ico.kind
navic.setup({
icons = {
Array = icons.Array .. " ",
Boolean = icons.Boolean,
Class = icons.Class .. " ",
Color = icons.Color .. " ",
Constant = icons.Constant .. " ",
Constructor = icons.Constructor .. " ",
Enum = icons.Enum .. " ",
EnumMember = icons.EnumMember .. " ",
Event = icons.Event .. " ",
Field = icons.Field .. " ",
File = icons.File .. " ",
Folder = icons.Folder .. " ",
Function = icons.Function .. " ",
Interface = icons.Interface .. " ",
Key = icons.Key .. " ",
Keyword = icons.Keyword .. " ",
Method = icons.Method .. " ",
Module = icons.Module .. " ",
Namespace = icons.Namespace .. " ",
Null = icons.Null .. " ",
Number = icons.Number .. " ",
Object = icons.Object .. " ",
Operator = icons.Operator .. " ",
Package = icons.Package .. " ",
Property = icons.Property .. " ",
Reference = icons.Reference .. " ",
Snippet = icons.Snippet .. " ",
String = icons.String .. " ",
Struct = icons.Struct .. " ",
Text = icons.Text .. " ",
TypeParameter = icons.TypeParameter .. " ",
Unit = icons.Unit .. " ",
Value = icons.Value .. " ",
Variable = icons.Variable .. " ",
},
highlight = true,
separator = " " .. ico.ui.ChevronRight .. " ",
depth_limit = 0,
depth_limit_indicator = "..",
icons = {
Array = icons.Array .. " ",
Boolean = icons.Boolean,
Class = icons.Class .. " ",
Color = icons.Color .. " ",
Constant = icons.Constant .. " ",
Constructor = icons.Constructor .. " ",
Enum = icons.Enum .. " ",
EnumMember = icons.EnumMember .. " ",
Event = icons.Event .. " ",
Field = icons.Field .. " ",
File = icons.File .. " ",
Folder = icons.Folder .. " ",
Function = icons.Function .. " ",
Interface = icons.Interface .. " ",
Key = icons.Key .. " ",
Keyword = icons.Keyword .. " ",
Method = icons.Method .. " ",
Module = icons.Module .. " ",
Namespace = icons.Namespace .. " ",
Null = icons.Null .. " ",
Number = icons.Number .. " ",
Object = icons.Object .. " ",
Operator = icons.Operator .. " ",
Package = icons.Package .. " ",
Property = icons.Property .. " ",
Reference = icons.Reference .. " ",
Snippet = icons.Snippet .. " ",
String = icons.String .. " ",
Struct = icons.Struct .. " ",
Text = icons.Text .. " ",
TypeParameter = icons.TypeParameter .. " ",
Unit = icons.Unit .. " ",
Value = icons.Value .. " ",
Variable = icons.Variable .. " ",
},
highlight = true,
separator = " " .. ico.ui.ChevronRight .. " ",
depth_limit = 0,
depth_limit_indicator = "..",
})

View file

@ -1,54 +1,54 @@
local transparent = false
local data_exists, custom_ui = pcall(require, "custom.ui")
if not data_exists then
return
return
end
local transparent_mode = custom_ui.transparent_mode
if transparent_mode ~= nil then
if transparent_mode == 1 then
transparent = true
end
if transparent_mode == 1 then
transparent = true
end
end
require("catppuccin").setup({
flavour = "macchiato", -- latte, frappe, macchiato, mocha
background = { -- :h background
light = "latte",
dark = "macchiato",
},
transparent_background = transparent,
show_end_of_buffer = false, -- show the '~' characters after the end of buffers
term_colors = false,
dim_inactive = {
enabled = false,
shade = "dark",
percentage = 0.15,
},
no_italic = false, -- Force no italic
no_bold = false, -- Force no bold
styles = {
comments = { "italic" },
conditionals = { "italic" },
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
operators = {},
},
color_overrides = {},
custom_highlights = {},
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
telescope = true,
notify = false,
mini = false,
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
},
flavour = "macchiato", -- latte, frappe, macchiato, mocha
background = { -- :h background
light = "latte",
dark = "macchiato",
},
transparent_background = transparent,
show_end_of_buffer = false, -- show the '~' characters after the end of buffers
term_colors = false,
dim_inactive = {
enabled = false,
shade = "dark",
percentage = 0.15,
},
no_italic = false, -- Force no italic
no_bold = false, -- Force no bold
styles = {
comments = { "italic" },
conditionals = { "italic" },
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
operators = {},
},
color_overrides = {},
custom_highlights = {},
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
telescope = true,
notify = false,
mini = false,
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
},
})

View file

@ -5,7 +5,7 @@ end
local WELCOME_MESSAGE = [[
Welcome to ChatGPT.
]]
chatgpt.setup {
chatgpt.setup({
welcome_message = WELCOME_MESSAGE, -- set to "" if you don't like the fancy godot robot
loading_text = "loading",
question_sign = "", -- you can use emoji if you want e.g. 🙂
@ -73,4 +73,4 @@ chatgpt.setup {
new_session = "<C-n>",
cycle_windows = "<Tab>",
},
}
})

View file

@ -8,5 +8,5 @@ end
local ok, _ = pcall(vim.cmd.colorscheme, colorscheme)
if not ok then
require "notify"("Colorscheme '" .. colorscheme .. "' not found!", "error")
require("notify")("Colorscheme '" .. colorscheme .. "' not found!", "error")
end

View file

@ -2,80 +2,80 @@
local dap_status_ok, dap = pcall(require, "dap")
if not dap_status_ok then
return
return
end
local dap_ui_status_ok, dapui = pcall(require, "dapui")
if not dap_ui_status_ok then
return
return
end
-- dapui.setup()
dapui.setup({
icons = { expanded = "", collapsed = "" },
mappings = {
-- Use a table to apply multiple mappings
expand = { "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
edit = "e",
repl = "r",
toggle = "t",
},
-- Expand lines larger than the window
-- Requires >= 0.7
expand_lines = vim.fn.has("nvim-0.7"),
-- Layouts define sections of the screen to place windows.
-- The position can be "left", "right", "top" or "bottom".
-- The size specifies the height/width depending on position. It can be an Int
-- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while
-- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns)
-- Elements are the elements shown in the layout (in order).
-- Layouts are opened in order so that earlier layouts take priority in window sizing.
layouts = {
{
elements = {
-- Elements can be strings or table with id and size keys.
{ id = "scopes", size = 0.25 },
"breakpoints",
-- "stacks",
-- "watches",
},
size = 40, -- 40 columns
position = "right",
},
{
elements = {
"repl",
"console",
},
size = 0.25, -- 25% of total lines
position = "bottom",
},
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = "single", -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
},
icons = { expanded = "", collapsed = "" },
mappings = {
-- Use a table to apply multiple mappings
expand = { "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
edit = "e",
repl = "r",
toggle = "t",
},
-- Expand lines larger than the window
-- Requires >= 0.7
expand_lines = vim.fn.has("nvim-0.7"),
-- Layouts define sections of the screen to place windows.
-- The position can be "left", "right", "top" or "bottom".
-- The size specifies the height/width depending on position. It can be an Int
-- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while
-- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns)
-- Elements are the elements shown in the layout (in order).
-- Layouts are opened in order so that earlier layouts take priority in window sizing.
layouts = {
{
elements = {
-- Elements can be strings or table with id and size keys.
{ id = "scopes", size = 0.25 },
"breakpoints",
-- "stacks",
-- "watches",
},
size = 40, -- 40 columns
position = "right",
},
{
elements = {
"repl",
"console",
},
size = 0.25, -- 25% of total lines
position = "bottom",
},
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = "single", -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
},
})
dap.listeners.after.event_initialized["dapui_config"] = function()
-- dapui.setup()
dapui.open()
-- dapui.setup()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
dapui.close()
end
-- vim.fn.sign_define("DapBreakpoint", { text = "🟥", texthl = "", linehl = "", numhl = "" })
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" })

View file

@ -19,7 +19,7 @@ if data_board ~= nil then
board = data_board
end
local dashboard = require "alpha.themes.dashboard"
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = board
dashboard.section.buttons.val = {
dashboard.button("F", "󰈞 Find file", ":Telescope find_files <CR>"),
@ -62,8 +62,8 @@ vim.api.nvim_create_autocmd("User", {
vim.api.nvim_create_autocmd({ "User" }, {
pattern = { "AlphaReady" },
callback = function()
vim.cmd [[
vim.cmd([[
set laststatus=0 | autocmd BufUnload <buffer> set laststatus=3
]]
]])
end,
})

View file

@ -14,25 +14,25 @@ end
if run == 1 then
function FORMAT_FILTER(client)
local filetype = vim.bo.filetype
local n = require "null-ls"
local s = require "null-ls.sources"
local n = require("null-ls")
local s = require("null-ls.sources")
local method = n.methods.FORMATTING
local available_formatters = s.get_available(filetype, method)
if #available_formatters > 0 then
return client.name == "null-ls"
elseif client.supports_method "textDocument/formatting" then
elseif client.supports_method("textDocument/formatting") then
return true
else
return false
end
end
vim.cmd [[
vim.cmd([[
augroup _lsp
autocmd!
" autocmd BufWritePre * lua vim.lsp.buf.format{timeout_ms =200, filter=format_filter}
autocmd BufWritePre * lua vim.lsp.buf.format{timeout_ms=pcode.format_timeout_ms or 5000 ,filter=FORMAT_FILTER}
augroup end
]]
]])
end

View file

@ -9,11 +9,11 @@ function M.smart_quit()
prompt = "You have unsaved changes. Quit anyway? (y/n) ",
}, function(input)
if input == "y" then
vim.cmd "q!"
vim.cmd("q!")
end
end)
else
vim.cmd "q!"
vim.cmd("q!")
end
end

View file

@ -1,6 +1,6 @@
local status_ok, impatient = pcall(require, "impatient")
if not status_ok then
return
return
end
impatient.enable_profile()

View file

@ -1,82 +1,82 @@
M = {}
local status_ok, jaq_nvim = pcall(require, "jaq-nvim")
if not status_ok then
return
return
end
jaq_nvim.setup({
-- Commands used with 'Jaq'
cmds = {
-- Default UI used (see `Usage` for options)
default = "term",
-- Commands used with 'Jaq'
cmds = {
-- Default UI used (see `Usage` for options)
default = "term",
-- Uses external commands such as 'g++' and 'cargo'
external = {
typescript = "deno run %",
javascript = "node %",
-- markdown = "glow %",
python = "python %",
-- rust = "rustc % && ./$fileBase && rm $fileBase",
rust = "cargo run",
cpp = "g++ % -o $fileBase && ./$fileBase",
go = "go run %",
sh = "sh %",
java = "java %",
},
-- Uses external commands such as 'g++' and 'cargo'
external = {
typescript = "deno run %",
javascript = "node %",
-- markdown = "glow %",
python = "python %",
-- rust = "rustc % && ./$fileBase && rm $fileBase",
rust = "cargo run",
cpp = "g++ % -o $fileBase && ./$fileBase",
go = "go run %",
sh = "sh %",
java = "java %",
},
-- Uses internal commands such as 'source' and 'luafile'
internal = {
-- lua = "luafile %",
-- vim = "source %",
},
},
-- Uses internal commands such as 'source' and 'luafile'
internal = {
-- lua = "luafile %",
-- vim = "source %",
},
},
behavior = {
-- Default type
default = "terminal",
behavior = {
-- Default type
default = "terminal",
-- Start in insert mode
startinsert = false,
-- Start in insert mode
startinsert = false,
-- Use `wincmd p` on startup
wincmd = false,
-- Use `wincmd p` on startup
wincmd = false,
-- Auto-save files
autosave = false,
},
-- Auto-save files
autosave = false,
},
-- UI settings
ui = {
-- Floating Window / FTerm settings
float = {
-- Floating window border (see ':h nvim_open_win')
border = "rounded", -- none, single, double, rounded
-- UI settings
ui = {
-- Floating Window / FTerm settings
float = {
-- Floating window border (see ':h nvim_open_win')
border = "rounded", -- none, single, double, rounded
-- Num from `0 - 1` for measurements
height = 0.8,
width = 0.8,
x = 0.5,
y = 0.5,
-- Num from `0 - 1` for measurements
height = 0.8,
width = 0.8,
x = 0.5,
y = 0.5,
-- Highlight group for floating window/border (see ':h winhl')
border_hl = "FloatBorder",
float_hl = "Normal",
-- Highlight group for floating window/border (see ':h winhl')
border_hl = "FloatBorder",
float_hl = "Normal",
-- Floating Window Transparency (see ':h winblend')
blend = 0,
},
-- Floating Window Transparency (see ':h winblend')
blend = 0,
},
terminal = {
-- Position of terminal
position = "bot",
terminal = {
-- Position of terminal
position = "bot",
-- Open the terminal without line numbers
line_no = false,
-- Open the terminal without line numbers
line_no = false,
-- Size of terminal
size = 20,
},
},
-- Size of terminal
size = 20,
},
},
})
local opts = { noremap = true, silent = true }

View file

@ -2,11 +2,11 @@ local opts = { noremap = true, silent = true }
function _LIVE_SERVER()
local Terminal = require("toggleterm.terminal").Terminal
local live_server = Terminal:new {
local live_server = Terminal:new({
cmd = "live-server",
hidden = true,
direction = "tab",
}
})
live_server:toggle()
end
@ -159,7 +159,7 @@ end
-- if pcall(require, "dap") then
-- modified function keys found with `showkey -a` in the terminal to get key code
-- run `nvim -V3log +quit` and search through the "Terminal info" in the `log` file for the correct keyname
if vim.fn.has "win32" == 0 then
if vim.fn.has("win32") == 0 then
map("n", "<F5>", function()
require("dap").continue()
end, "")

View file

@ -1,12 +1,12 @@
local status_ok, mason_null_ls = pcall(require, "mason-null-ls")
if not status_ok then
return
return
end
mason_null_ls.setup({
ensure_installed = {
-- Opt to list sources here, when available in mason.
},
automatic_setup = true,
handlers = {},
ensure_installed = {
-- Opt to list sources here, when available in mason.
},
automatic_setup = true,
handlers = {},
})
-- mason_null_ls.setup_handlers({})

View file

@ -1,18 +1,18 @@
local sources = {}
local dap_data = pcode.dap_ensure_installed or {}
for _, nullls in pairs(dap_data) do
table.insert(sources, nullls)
table.insert(sources, nullls)
end
require("mason").setup()
require("mason-nvim-dap").setup({
ensure_installed = sources,
automatic_setup = true,
handlers = {
function(config)
-- all sources with no handler get passed here
ensure_installed = sources,
automatic_setup = true,
handlers = {
function(config)
-- all sources with no handler get passed here
-- Keep original functionality
require("mason-nvim-dap").default_setup(config)
end,
},
-- Keep original functionality
require("mason-nvim-dap").default_setup(config)
end,
},
})

View file

@ -51,12 +51,12 @@ end
-- vim.opt.shortmess = "ilmnrx" -- flags to shorten vim messages, see :help 'shortmess'
-- vim.o.winbar = "%{%v:lua.require'nvim-navic'.get_location()%}"
vim.opt.shortmess:append "c" -- don't give |ins-completion-menu| messages
vim.opt.iskeyword:append "-" -- hyphenated words recognized by searches
vim.opt.formatoptions:remove { "t", "c", "q", "j" }
vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages
vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches
vim.opt.formatoptions:remove({ "t", "c", "q", "j" })
vim.opt.formatoptions = "croql"
-- vim.opt.formatoptions:remove({ "c", "r", "o" }) -- don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting <Enter> in insert mode, or hitting 'o' or 'O' in normal mode.
vim.opt.runtimepath:remove "/usr/share/vim/vimfiles" -- separate vim plugins from neovim in case vim still in use
vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") -- separate vim plugins from neovim in case vim still in use
-- config for blink cursor in normal, visual and insert mode
-- vim.opt.guicursor = {
-- "n-v-c:block-Cursor/lCursor-blinkwait1000-blinkon100-blinkoff100",

View file

@ -1,10 +1,10 @@
local status_ok = pcall(require, "luasnip")
if not status_ok then
return
return
end
local lpath = vim.fn.stdpath("config") .. "/my-snippets"
require("luasnip.loaders.from_vscode").lazy_load({
paths = lpath,
paths = lpath,
})
require("luasnip.loaders.from_vscode").load({ paths = lpath })

View file

@ -1,5 +1,5 @@
local alpha = require "alpha"
local startify = require "alpha.themes.startify"
local alpha = require("alpha")
local startify = require("alpha.themes.startify")
local dash_model = {}
dash_model = {
[[ _ __ __ ]],
@ -63,9 +63,9 @@ vim.api.nvim_create_autocmd("User", {
vim.api.nvim_create_autocmd({ "User" }, {
pattern = { "AlphaReady" },
callback = function()
vim.cmd [[
vim.cmd([[
set laststatus=0 | autocmd BufUnload <buffer> set laststatus=3
]]
]])
end,
})
-- ignore filetypes in MRU

View file

@ -1,71 +1,71 @@
local status_ok, tokyonight = pcall(require, "tokyonight")
if not status_ok then
return
return
end
local transp = false
local sidebar = "normal" --"dark , transparent, normal"
local hilight = "#292e42"
local tras = pcode.transparent_mode or 0
if tras == 1 then
transp = true
sidebar = "transparent"
-- hilight = "#3E4254"
-- hilight = "#353a56"
hilight = "#292e42"
transp = true
sidebar = "transparent"
-- hilight = "#3E4254"
-- hilight = "#353a56"
hilight = "#292e42"
end
tokyonight.setup({
-- your configuration comes here
-- or leave it empty to use the default settings
style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
light_style = "day", -- The theme is used when the background is set to light
transparent = transp, -- Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
styles = {
-- Style to be applied to different syntax groups
-- Value is any valid attr-list value for `:help nvim_set_hl`
-- comments = { italic = true },
comments = { italic = true },
keywords = {},
functions = {},
variables = {},
-- Background styles. Can be "dark", "transparent" or "normal"
sidebars = sidebar, -- style for sidebars, see below
floats = sidebar, -- style for floating windows
},
sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
day_brightness = 0.2, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
dim_inactive = false, -- dims inactive windows
lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
-- your configuration comes here
-- or leave it empty to use the default settings
style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
light_style = "day", -- The theme is used when the background is set to light
transparent = transp, -- Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
styles = {
-- Style to be applied to different syntax groups
-- Value is any valid attr-list value for `:help nvim_set_hl`
-- comments = { italic = true },
comments = { italic = true },
keywords = {},
functions = {},
variables = {},
-- Background styles. Can be "dark", "transparent" or "normal"
sidebars = sidebar, -- style for sidebars, see below
floats = sidebar, -- style for floating windows
},
sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
day_brightness = 0.2, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
dim_inactive = false, -- dims inactive windows
lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
--- You can override specific color groups to use other groups or a hex color
--- function will be called with a ColorScheme table
-- @param colors ColorScheme
on_colors = function(colors)
colors.bg_highlight = hilight
colors.bg_statusline = colors.none
end,
--- You can override specific color groups to use other groups or a hex color
--- function will be called with a ColorScheme table
-- @param colors ColorScheme
on_colors = function(colors)
colors.bg_highlight = hilight
colors.bg_statusline = colors.none
end,
--- You can override specific highlights to use other groups or a hex color
--- function will be called with a Highlights and ColorScheme table
--@param highlights Highlights
-- @param colors ColorScheme
on_highlights = function(highlights, colors)
highlights.NvimTreeFolderIcon = {
bg = colors.none,
fg = "#e0af68",
}
highlights.Underlined = {
underline = false,
}
highlights.NvimTreeWinSeparator = {
fg = colors.border,
}
highlights.BufferLineFill = { bg = colors.bg }
highlights.NvimTreeSpecialFile = { fg = colors.purple, underline = false }
highlights["@tag.attribute"] = { fg = colors.green1, italic = true }
-- highlights["@keyword.function"] = { fg = colors.blue, italic = true }
-- highlights["@function"] = { fg = colors.blue, italic = true }
end,
--- You can override specific highlights to use other groups or a hex color
--- function will be called with a Highlights and ColorScheme table
--@param highlights Highlights
-- @param colors ColorScheme
on_highlights = function(highlights, colors)
highlights.NvimTreeFolderIcon = {
bg = colors.none,
fg = "#e0af68",
}
highlights.Underlined = {
underline = false,
}
highlights.NvimTreeWinSeparator = {
fg = colors.border,
}
highlights.BufferLineFill = { bg = colors.bg }
highlights.NvimTreeSpecialFile = { fg = colors.purple, underline = false }
highlights["@tag.attribute"] = { fg = colors.green1, italic = true }
-- highlights["@keyword.function"] = { fg = colors.blue, italic = true }
-- highlights["@function"] = { fg = colors.blue, italic = true }
end,
})

View file

@ -1,42 +1,42 @@
local status_ok, tokyonight = pcall(require, "tokyonight")
if not status_ok then
return
return
end
tokyonight.setup({
-- your configuration comes here
-- or leave it empty to use the default settings
style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
light_style = "day", -- The theme is used when the background is set to light
transparent = true, -- Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
styles = {
-- Style to be applied to different syntax groups
-- Value is any valid attr-list value for `:help nvim_set_hl`
-- comments = { italic = true },
comments = { italic = true },
keywords = { italic = true },
functions = {},
variables = {},
-- Background styles. Can be "dark", "transparent" or "normal"
sidebars = "transparent", -- style for sidebars, see below
floats = "transparent", -- style for floating windows
},
sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
day_brightness = 0.2, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
dim_inactive = false, -- dims inactive windows
lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
-- your configuration comes here
-- or leave it empty to use the default settings
style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
light_style = "day", -- The theme is used when the background is set to light
transparent = true, -- Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
styles = {
-- Style to be applied to different syntax groups
-- Value is any valid attr-list value for `:help nvim_set_hl`
-- comments = { italic = true },
comments = { italic = true },
keywords = { italic = true },
functions = {},
variables = {},
-- Background styles. Can be "dark", "transparent" or "normal"
sidebars = "transparent", -- style for sidebars, see below
floats = "transparent", -- style for floating windows
},
sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
day_brightness = 0.2, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
dim_inactive = false, -- dims inactive windows
lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
--- You can override specific color groups to use other groups or a hex color
--- function will be called with a ColorScheme table
--@param colors ColorScheme
on_colors = function(colors)
colors.bg_highlight = "#9EA0A9"
end,
--- You can override specific color groups to use other groups or a hex color
--- function will be called with a ColorScheme table
--@param colors ColorScheme
on_colors = function(colors)
colors.bg_highlight = "#9EA0A9"
end,
--- You can override specific highlights to use other groups or a hex color
--- function will be called with a Highlights and ColorScheme table
--@param highlights Highlights
--@param colors ColorScheme
--on_highlights = function(highlights, colors) end,
--- You can override specific highlights to use other groups or a hex color
--- function will be called with a Highlights and ColorScheme table
--@param highlights Highlights
--@param colors ColorScheme
--on_highlights = function(highlights, colors) end,
})

View file

@ -1,44 +1,44 @@
local M = {}
function M.bufremove(buf)
buf = buf or 0
buf = buf == 0 and vim.api.nvim_get_current_buf() or buf
buf = buf or 0
buf = buf == 0 and vim.api.nvim_get_current_buf() or buf
if vim.bo.modified then
local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel")
if choice == 0 then -- Cancel
return
end
if choice == 1 then -- Yes
vim.cmd.write()
end
end
if vim.bo.modified then
local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel")
if choice == 0 then -- Cancel
return
end
if choice == 1 then -- Yes
vim.cmd.write()
end
end
for _, win in ipairs(vim.fn.win_findbuf(buf)) do
vim.api.nvim_win_call(win, function()
if not vim.api.nvim_win_is_valid(win) or vim.api.nvim_win_get_buf(win) ~= buf then
return
end
-- Try using alternate buffer
local alt = vim.fn.bufnr("#")
if alt ~= buf and vim.fn.buflisted(alt) == 1 then
vim.api.nvim_win_set_buf(win, alt)
return
end
for _, win in ipairs(vim.fn.win_findbuf(buf)) do
vim.api.nvim_win_call(win, function()
if not vim.api.nvim_win_is_valid(win) or vim.api.nvim_win_get_buf(win) ~= buf then
return
end
-- Try using alternate buffer
local alt = vim.fn.bufnr("#")
if alt ~= buf and vim.fn.buflisted(alt) == 1 then
vim.api.nvim_win_set_buf(win, alt)
return
end
-- Try using previous buffer
local has_previous = pcall(vim.cmd, "bprevious")
if has_previous and buf ~= vim.api.nvim_win_get_buf(win) then
return
end
-- Try using previous buffer
local has_previous = pcall(vim.cmd, "bprevious")
if has_previous and buf ~= vim.api.nvim_win_get_buf(win) then
return
end
-- Create new listed buffer
local new_buf = vim.api.nvim_create_buf(true, false)
vim.api.nvim_win_set_buf(win, new_buf)
end)
end
if vim.api.nvim_buf_is_valid(buf) then
pcall(vim.cmd, "bdelete! " .. buf)
end
-- Create new listed buffer
local new_buf = vim.api.nvim_create_buf(true, false)
vim.api.nvim_win_set_buf(win, new_buf)
end)
end
if vim.api.nvim_buf_is_valid(buf) then
pcall(vim.cmd, "bdelete! " .. buf)
end
end
return M

View file

@ -2,9 +2,9 @@ local null_ls = require("null-ls")
local M = {}
M.list_registered = function(filetype)
local method = null_ls.methods.FORMATTING
local registered_providers = require("user.utils.lsp").list_registered_providers_names(filetype)
return registered_providers[method] or {}
local method = null_ls.methods.FORMATTING
local registered_providers = require("user.utils.lsp").list_registered_providers_names(filetype)
return registered_providers[method] or {}
end
return M

View file

@ -2,18 +2,18 @@ local null_ls = require("null-ls")
local M = {}
M.alternative_methods = {
null_ls.methods.DIAGNOSTICS,
null_ls.methods.DIAGNOSTICS_ON_OPEN,
null_ls.methods.DIAGNOSTICS_ON_SAVE,
null_ls.methods.DIAGNOSTICS,
null_ls.methods.DIAGNOSTICS_ON_OPEN,
null_ls.methods.DIAGNOSTICS_ON_SAVE,
}
M.linter_list_registered = function(filetype)
local registered_providers = require("user.utils.lsp").list_registered_providers_names(filetype)
local providers_for_methods = vim.iter(vim.tbl_map(function(m)
return registered_providers[m] or {}
end, M.alternative_methods))
local registered_providers = require("user.utils.lsp").list_registered_providers_names(filetype)
local providers_for_methods = vim.iter(vim.tbl_map(function(m)
return registered_providers[m] or {}
end, M.alternative_methods))
return providers_for_methods
return providers_for_methods
end
return M

View file

@ -1,16 +1,16 @@
local M = {}
M.list_registered_providers_names = function(filetype)
local s = require("null-ls.sources")
local available_sources = s.get_available(filetype)
local registered = {}
for _, source in ipairs(available_sources) do
for method in pairs(source.methods) do
registered[method] = registered[method] or {}
table.insert(registered[method], source.name)
end
end
return registered
local s = require("null-ls.sources")
local available_sources = s.get_available(filetype)
local registered = {}
for _, source in ipairs(available_sources) do
for method in pairs(source.methods) do
registered[method] = registered[method] or {}
table.insert(registered[method], source.name)
end
end
return registered
end
return M

View file

@ -1,9 +1,9 @@
local hide_in_width = function()
return vim.fn.winwidth(0) > 75
end
local icons = require "user.icons"
local formatter = require "user.utils.formatter"
local linter = require "user.utils.linter"
local icons = require("user.icons")
local formatter = require("user.utils.formatter")
local linter = require("user.utils.linter")
local getLeftSubstring = function(word, length)
if #word > length then
@ -86,7 +86,7 @@ return {
local buf_ft = vim.bo.filetype
-- start register
local buf_clients = {}
buf_clients = vim.lsp.get_clients { bufnr = 0 }
buf_clients = vim.lsp.get_clients({ bufnr = 0 })
local buf_client_names = {}
if next(buf_clients) == nil then
-- TODO: clean up this if statement

View file

@ -1,6 +1,6 @@
local M = {}
local component = require "user.utils.lualine_component"
local component = require("user.utils.lualine_component")
local treesitter = component.treesitter
local lsp_info = component.lsp_info
local diagnostics = component.diagnostics

View file

@ -3,7 +3,7 @@ local M = {}
-- for debug
local debug_key = {}
if vim.fn.has "win32" == 0 then
if vim.fn.has("win32") == 0 then
debug_key = {
name = "  Debug",
t = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "Toggle Breakpoint" },
@ -26,47 +26,47 @@ end
function M._LAZYGIT_TOGGLE()
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new { cmd = "lazygit", hidden = true }
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
lazygit:toggle()
end
function M._NODE_TOGGLE()
local Terminal = require("toggleterm.terminal").Terminal
local node = Terminal:new { cmd = "node", hidden = true }
local node = Terminal:new({ cmd = "node", hidden = true })
node:toggle()
end
function M._BTOP_TOGGLE()
local Terminal = require("toggleterm.terminal").Terminal
local htop = Terminal:new { cmd = "btop", hidden = true }
local htop = Terminal:new({ cmd = "btop", hidden = true })
htop:toggle()
end
function M._PYTHON_TOGGLE()
local Terminal = require("toggleterm.terminal").Terminal
local python = Terminal:new { cmd = "python", hidden = true }
local python = Terminal:new({ cmd = "python", hidden = true })
python:toggle()
end
function M._NEWTAB_TOGGLE()
local Terminal = require("toggleterm.terminal").Terminal
local pwsh = Terminal:new { cmd = "pwsh", hidden = true, direction = "tab" }
local pwsh = Terminal:new({ cmd = "pwsh", hidden = true, direction = "tab" })
pwsh:toggle()
end
function M._OPEN_EXPLORER()
local Terminal = require("toggleterm.terminal").Terminal
local pwsh = Terminal:new { cmd = "explorer .", hidden = true, direction = "tab" }
local pwsh = Terminal:new({ cmd = "explorer .", hidden = true, direction = "tab" })
pwsh:toggle()
end
function M._LIVE_SERVER()
local Terminal = require("toggleterm.terminal").Terminal
local live_server = Terminal:new {
local live_server = Terminal:new({
cmd = "live-server",
hidden = true,
direction = "tab",
}
})
live_server:toggle()
end

View file

@ -30,9 +30,9 @@ local excludes = function()
end
local get_filename = function()
local filename = vim.fn.expand "%:t"
local extension = vim.fn.expand "%:e"
local f = require "user.functions"
local filename = vim.fn.expand("%:t")
local extension = vim.fn.expand("%:e")
local f = require("user.functions")
if not f.isempty(filename) then
local file_icon, hl_group = require("nvim-web-devicons").get_icon(filename, extension, { default = true })
@ -102,7 +102,7 @@ local get_winbar = function()
if excludes() then
return
end
local f = require "user.functions"
local f = require("user.functions")
local value = get_filename()
local gps_added = false
@ -114,7 +114,7 @@ local get_winbar = function()
end
end
if not f.isempty(value) and f.get_buf_option "mod" then
if not f.isempty(value) and f.get_buf_option("mod") then
-- TODO: replace with circle
local mod = "%#LspCodeLens#" .. icons.ui.Circle .. "%*"
if gps_added then
@ -138,7 +138,7 @@ local get_winbar = function()
end
vim.api.nvim_create_augroup("_winbar", {})
if vim.fn.has "nvim-0.8" == 1 then
if vim.fn.has("nvim-0.8") == 1 then
vim.api.nvim_create_autocmd(
{ "CursorHoldI", "CursorHold", "BufWinEnter", "BufFilePost", "InsertEnter", "BufWritePost", "TabClosed" },
{