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,4 +1,4 @@
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then if not (vim.uv or vim.loop).fs_stat(lazypath) then
-- bootstrap lazy.nvim -- bootstrap lazy.nvim
-- stylua: ignore -- stylua: ignore
@ -15,8 +15,8 @@ local icons = require("user.icons").ui
vim.opt.rtp:prepend(vim.env.LAZY or lazypath) vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = " " vim.g.maplocalleader = " "
vim.diagnostic.config { virtual_lines = false } vim.diagnostic.config({ virtual_lines = false })
require("lazy").setup { require("lazy").setup({
spec = { spec = {
{ import = "plugins.themes" }, { import = "plugins.themes" },
{ import = "plugins" }, { import = "plugins" },
@ -57,4 +57,4 @@ require("lazy").setup {
}, },
}, },
}, },
} })

View file

@ -1,8 +1,8 @@
local transparent_mode = pcode.transparent_mode or 0 local transparent_mode = pcode.transparent_mode or 0
if transparent_mode ~= nil then if transparent_mode ~= nil then
if transparent_mode == 1 then if transparent_mode == 1 then
vim.cmd "TransparentDisable" vim.cmd("TransparentDisable")
vim.cmd "TransparentEnable" vim.cmd("TransparentEnable")
end end
end end
@ -12,7 +12,7 @@ local _get_folder_name = function()
return " " .. str:lower():gsub("^%l", string.upper) .. " " return " " .. str:lower():gsub("^%l", string.upper) .. " "
end end
local term_program = vim.fn.getenv "TERM_PROGRAM" local term_program = vim.fn.getenv("TERM_PROGRAM")
if term_program == "WezTerm" then if term_program == "WezTerm" then
-- vim.cmd('silent !wezterm cli set-tab-title "' .. _get_folder_name() .. '"') -- vim.cmd('silent !wezterm cli set-tab-title "' .. _get_folder_name() .. '"')
-- create autocmd on insertEnter -- create autocmd on insertEnter

View file

@ -1,6 +1,6 @@
local opts, _ = pcall(require, "user.options") local opts, _ = pcall(require, "user.options")
if opts then if opts then
require "user.options" require("user.options")
end end
-- local key, _ = pcall(require, "user.keymaps") -- local key, _ = pcall(require, "user.keymaps")
-- if key then -- if key then
@ -8,11 +8,11 @@ end
-- end -- end
local cmd, _ = pcall(require, "user.autocommands") local cmd, _ = pcall(require, "user.autocommands")
if cmd then if cmd then
require "user.autocommands" require("user.autocommands")
end end
local onsave, _ = pcall(require, "user.format_onsave") local onsave, _ = pcall(require, "user.format_onsave")
if onsave then if onsave then
require "user.format_onsave" require("user.format_onsave")
end end
vim.g.pcode_icons = require "user.icons" vim.g.pcode_icons = require("user.icons")
return {} return {}

View file

@ -5,7 +5,7 @@ return {
lazy = true, lazy = true,
event = "VimEnter", event = "VimEnter",
config = function() config = function()
require "user.alpha" require("user.alpha")
end, end,
}, },
} }

View file

@ -4,7 +4,7 @@ return {
dependencies = "neovim/nvim-lspconfig", dependencies = "neovim/nvim-lspconfig",
event = "InsertEnter", event = "InsertEnter",
config = function() config = function()
require "user.breadcrumb" require("user.breadcrumb")
require "user.winbar" require("user.winbar")
end, end,
} }

View file

@ -38,7 +38,7 @@ return {
vim.opt.termguicolors = true vim.opt.termguicolors = true
bufferline.setup { bufferline.setup({
options = { options = {
color_icons = true, color_icons = true,
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
@ -174,6 +174,6 @@ return {
bg = { attribute = "bg", highlight = "Normal" }, bg = { attribute = "bg", highlight = "Normal" },
}, },
}, },
} })
end, end,
} }

View file

@ -18,12 +18,12 @@ return {
version = false, -- last release is way too old version = false, -- last release is way too old
event = "InsertEnter", event = "InsertEnter",
opts = function() opts = function()
local cmp = require "cmp" local cmp = require("cmp")
local luasnip = require "luasnip" local luasnip = require("luasnip")
local check_backspace = function() local check_backspace = function()
local col = vim.fn.col "." - 1 local col = vim.fn.col(".") - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
end end
return { return {
@ -35,12 +35,12 @@ return {
require("luasnip").lsp_expand(args.body) require("luasnip").lsp_expand(args.body)
end, end,
}, },
mapping = cmp.mapping.preset.insert { mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4), ["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(), ["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm { select = true }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. ["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<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()
@ -69,14 +69,14 @@ return {
"i", "i",
"s", "s",
}), }),
}, }),
sources = cmp.config.sources { sources = cmp.config.sources({
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "luasnip" }, { name = "luasnip" },
{ name = "buffer" }, { name = "buffer" },
{ name = "path" }, { name = "path" },
{ name = "nvim_lua" }, { name = "nvim_lua" },
}, }),
formatting = { formatting = {
fields = { "kind", "abbr", "menu" }, fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item) format = function(entry, vim_item)

View file

@ -14,11 +14,11 @@ if pcode.database then
end, end,
config = function() config = function()
local function db_completion() local function db_completion()
require("cmp").setup.buffer { require("cmp").setup.buffer({
sources = { { name = "vim-dadbod-completion" } }, sources = { { name = "vim-dadbod-completion" } },
} })
end end
vim.g.db_ui_save_location = vim.fn.stdpath "config" .. require("plenary.path").path.sep .. "db_ui" vim.g.db_ui_save_location = vim.fn.stdpath("config") .. require("plenary.path").path.sep .. "db_ui"
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = { pattern = {

View file

@ -41,12 +41,12 @@ if fidget then
tag = "legacy", tag = "legacy",
event = "BufRead", event = "BufRead",
config = function() config = function()
require("fidget").setup { require("fidget").setup({
window = { window = {
blend = 0, blend = 0,
relative = "editor", relative = "editor",
}, },
} })
end, end,
} }
elseif lualine then elseif lualine then
@ -57,7 +57,7 @@ elseif lualine then
branch = "main", branch = "main",
event = { "BufRead" }, event = { "BufRead" },
config = function() config = function()
require("lsp-progress").setup { require("lsp-progress").setup({
client_format = function(client_name, spinner, series_messages) client_format = function(client_name, spinner, series_messages)
return #series_messages > 0 return #series_messages > 0
and (spinner .. " " .. ambilKataDariKiri(table.concat(series_messages, ", "), 4) .. "...") and (spinner .. " " .. ambilKataDariKiri(table.concat(series_messages, ", "), 4) .. "...")
@ -69,7 +69,7 @@ elseif lualine then
and (sign .. " " .. ambilKataDariKiri(table.concat(client_messages, " "), 4) .. "...") and (sign .. " " .. ambilKataDariKiri(table.concat(client_messages, " "), 4) .. "...")
or sign or sign
end, end,
} })
end, end,
} }
else else

View file

@ -3,7 +3,7 @@ return {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
event = { "InsertEnter", "BufRead", "BufNewFile" }, event = { "InsertEnter", "BufRead", "BufNewFile" },
config = function() config = function()
local component = require "user.utils.lualine_component" local component = require("user.utils.lualine_component")
local colors = component.colors local colors = component.colors
-- check config for theme -- check config for theme
@ -43,7 +43,7 @@ return {
bubbles_theme = vim.fn.fnamemodify("auto", ":t") bubbles_theme = vim.fn.fnamemodify("auto", ":t")
end end
local gettheme = require "user.utils.lualine_template" local gettheme = require("user.utils.lualine_template")
local theme_option = pcode.lualinetheme or "rounded" local theme_option = pcode.lualinetheme or "rounded"
local theme = gettheme.rounded(bubbles_theme) local theme = gettheme.rounded(bubbles_theme)
if theme_option == "rounded" then if theme_option == "rounded" then
@ -61,13 +61,13 @@ return {
elseif theme_option == "default" then elseif theme_option == "default" then
theme = {} theme = {}
end end
require("lualine").setup { require("lualine").setup({
options = theme.options, options = theme.options,
sections = theme.sections, sections = theme.sections,
inactive_sections = theme.inactive_sections, inactive_sections = theme.inactive_sections,
tabline = theme.tabline, tabline = theme.tabline,
extensions = theme.extensions, extensions = theme.extensions,
} })
end, end,
}, },
} }

View file

@ -8,7 +8,7 @@ if not vim.g.neovide and pcode.minianimate and true or false then
opts = function() opts = function()
-- don't use animate when scrolling with the mouse -- don't use animate when scrolling with the mouse
local mouse_scrolled = false local mouse_scrolled = false
for _, scroll in ipairs { "Up", "Down" } do for _, scroll in ipairs({ "Up", "Down" }) do
local key = "<ScrollWheel" .. scroll .. ">" local key = "<ScrollWheel" .. scroll .. ">"
vim.keymap.set({ "", "i" }, key, function() vim.keymap.set({ "", "i" }, key, function()
mouse_scrolled = true mouse_scrolled = true
@ -16,14 +16,14 @@ if not vim.g.neovide and pcode.minianimate and true or false then
end, { expr = true }) end, { expr = true })
end end
local animate = require "mini.animate" local animate = require("mini.animate")
return { return {
resize = { resize = {
timing = animate.gen_timing.linear { duration = 100, unit = "total" }, timing = animate.gen_timing.linear({ duration = 100, unit = "total" }),
}, },
scroll = { scroll = {
timing = animate.gen_timing.linear { duration = 150, unit = "total" }, timing = animate.gen_timing.linear({ duration = 150, unit = "total" }),
subscroll = animate.gen_subscroll.equal { subscroll = animate.gen_subscroll.equal({
predicate = function(total_scroll) predicate = function(total_scroll)
if mouse_scrolled then if mouse_scrolled then
mouse_scrolled = false mouse_scrolled = false
@ -31,7 +31,7 @@ if not vim.g.neovide and pcode.minianimate and true or false then
end end
return total_scroll > 1 return total_scroll > 1
end, end,
}, }),
}, },
} }
end, end,

View file

@ -3,6 +3,6 @@ return {
event = "VeryLazy", event = "VeryLazy",
lazy = true, lazy = true,
config = function() config = function()
require("neoscroll").setup {} require("neoscroll").setup({})
end, end,
} }

View file

@ -6,7 +6,7 @@ return {
{ {
"<leader>un", "<leader>un",
function() function()
require("notify").dismiss { silent = true, pending = true } require("notify").dismiss({ silent = true, pending = true })
end, end,
desc = "Delete all Notifications", desc = "Delete all Notifications",
}, },
@ -22,10 +22,10 @@ return {
}, },
-- event = "BufWinEnter", -- event = "BufWinEnter",
config = function() config = function()
local notify = require "notify" local notify = require("notify")
-- this for transparency -- this for transparency
-- notify.setup { background_colour = "#000000", render = "compact" } -- notify.setup { background_colour = "#000000", render = "compact" }
notify.setup { render = "compact" } notify.setup({ render = "compact" })
-- this overwrites the vim notify function -- this overwrites the vim notify function
vim.notify = notify.notify vim.notify = notify.notify
end, end,

View file

@ -210,7 +210,7 @@ return {
}, },
config = function(_, opts) config = function(_, opts)
require("nvim-tree").setup(opts) require("nvim-tree").setup(opts)
local api = require "nvim-tree.api" local api = require("nvim-tree.api")
api.events.subscribe(api.events.Event.FileCreated, function(file) api.events.subscribe(api.events.Event.FileCreated, function(file)
vim.cmd("edit " .. file.fname) vim.cmd("edit " .. file.fname)
end) end)

View file

@ -20,8 +20,8 @@ if pcode.nvimufo then
{ {
"luukvbaal/statuscol.nvim", "luukvbaal/statuscol.nvim",
config = function() config = function()
local builtin = require "statuscol.builtin" local builtin = require("statuscol.builtin")
require("statuscol").setup { require("statuscol").setup({
setopt = true, setopt = true,
relculright = true, relculright = true,
segments = { segments = {
@ -33,7 +33,7 @@ if pcode.nvimufo then
}, },
{ text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" }, { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
}, },
} })
end, end,
}, },
}, },
@ -65,7 +65,7 @@ if pcode.nvimufo then
-- these are "extra", change them as you like -- these are "extra", change them as you like
vim.keymap.set("n", "zR", require("ufo").openAllFolds) vim.keymap.set("n", "zR", require("ufo").openAllFolds)
vim.keymap.set("n", "zM", require("ufo").closeAllFolds) vim.keymap.set("n", "zM", require("ufo").closeAllFolds)
vim.cmd("highlight FoldColumn guifg=" .. vim.fn.synIDattr(vim.fn.synIDtrans(vim.fn.hlID "Comment"), "fg")) vim.cmd("highlight FoldColumn guifg=" .. vim.fn.synIDattr(vim.fn.synIDtrans(vim.fn.hlID("Comment")), "fg"))
-- start ini bagian code support comment dan import -- start ini bagian code support comment dan import
local ftMap = { local ftMap = {
vim = "indent", vim = "indent",
@ -75,7 +75,7 @@ if pcode.nvimufo then
local function customizeSelector(bufnr) local function customizeSelector(bufnr)
local function handleFallbackException(err, providerName) local function handleFallbackException(err, providerName)
if type(err) == "string" and err:match "UfoFallbackException" then if type(err) == "string" and err:match("UfoFallbackException") then
return require("ufo").getFolds(bufnr, providerName) return require("ufo").getFolds(bufnr, providerName)
else else
return require("promise").reject(err) return require("promise").reject(err)
@ -92,7 +92,7 @@ if pcode.nvimufo then
end) end)
end end
require("ufo").setup { require("ufo").setup({
open_fold_hl_timeout = 150, open_fold_hl_timeout = 150,
close_fold_kinds_for_ft = { close_fold_kinds_for_ft = {
-- default = { "imports", "comment" }, -- default = { "imports", "comment" },
@ -127,21 +127,21 @@ if pcode.nvimufo then
-- Memeriksa apakah baris awal dari fold adalah komentar -- Memeriksa apakah baris awal dari fold adalah komentar
local start_line = vim.api.nvim_buf_get_lines(0, lnum - 1, lnum, false)[1] local start_line = vim.api.nvim_buf_get_lines(0, lnum - 1, lnum, false)[1]
-- cari comentar dengan awalan /* untuk generaal comment -- cari comentar dengan awalan /* untuk generaal comment
if start_line:find "^%s*%/%*" then if start_line:find("^%s*%/%*") then
is_comment = true is_comment = true
-- cara commentar dengan awalan <!-- untuk html -- cara commentar dengan awalan <!-- untuk html
elseif start_line:find "^%s*<!--" then elseif start_line:find("^%s*<!--") then
is_comment = true is_comment = true
-- cari comentar dengan awalan -- untuk lua -- cari comentar dengan awalan -- untuk lua
elseif start_line:find "^%s*%-%-" then elseif start_line:find("^%s*%-%-") then
is_comment = true is_comment = true
end end
-- cek fold yang berawalan import -- cek fold yang berawalan import
if start_line:find "^%s*import" then if start_line:find("^%s*import") then
is_import = true is_import = true
end end
-- cek fold dengan akhiran { -- cek fold dengan akhiran {
if start_line:find "%s*{%s*$" then if start_line:find("%s*{%s*$") then
is_bracket = true is_bracket = true
end end
if is_comment then if is_comment then
@ -221,7 +221,7 @@ if pcode.nvimufo then
end end
return result return result
end, end,
} })
-- end bagian code support comment dan import -- end bagian code support comment dan import
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = { pattern = {

View file

@ -4,7 +4,7 @@ return {
event = "BufRead", event = "BufRead",
config = function() config = function()
-- Modul ini berisi beberapa definisi default -- Modul ini berisi beberapa definisi default
local rainbow_delimiters = require "rainbow-delimiters" local rainbow_delimiters = require("rainbow-delimiters")
vim.g.rainbow_delimiters = { vim.g.rainbow_delimiters = {
strategy = { strategy = {
[""] = rainbow_delimiters.strategy["global"], [""] = rainbow_delimiters.strategy["global"],

View file

@ -22,7 +22,7 @@ return {
only_sort_text = true, only_sort_text = true,
} }
end end
local actions = require "telescope.actions" local actions = require("telescope.actions")
vim.g.theme_switcher_loaded = true vim.g.theme_switcher_loaded = true
return { return {
defaults = { defaults = {

View file

@ -25,7 +25,7 @@ if transparent then
event = "BufWinEnter", event = "BufWinEnter",
cmd = { "TransparentToggle", "TransparentEnable", "TransparentDisable" }, cmd = { "TransparentToggle", "TransparentEnable", "TransparentDisable" },
config = function() config = function()
require("transparent").setup { require("transparent").setup({
extra_groups = { extra_groups = {
"Normal", "Normal",
"NormalNC", "NormalNC",
@ -53,25 +53,25 @@ if transparent then
-- disable lualine background color -- disable lualine background color
"LualineNormal", "LualineNormal",
}, },
} })
require("transparent").clear_prefix "BufferLine" require("transparent").clear_prefix("BufferLine")
-- clear prefix for which-key -- clear prefix for which-key
require("transparent").clear_prefix "WhichKey" require("transparent").clear_prefix("WhichKey")
-- clear prefix for lazy.nvim -- clear prefix for lazy.nvim
require("transparent").clear_prefix "Lazy" require("transparent").clear_prefix("Lazy")
-- clear prefix for NvimTree -- clear prefix for NvimTree
require("transparent").clear_prefix "NvimTree" require("transparent").clear_prefix("NvimTree")
-- clear prefix for NeoTree -- clear prefix for NeoTree
require("transparent").clear_prefix "NeoTree" require("transparent").clear_prefix("NeoTree")
-- clear prefix for Telescope -- clear prefix for Telescope
require("transparent").clear_prefix "Telescope" require("transparent").clear_prefix("Telescope")
require("transparent").clear_prefix "mason" require("transparent").clear_prefix("mason")
if clear_lualine then if clear_lualine then
-- clear prefix for Lualine -- clear prefix for Lualine
require("transparent").clear_prefix "Lualine" require("transparent").clear_prefix("Lualine")
-- create auto command to set transparent -- create auto command to set transparent
vim.cmd "TransparentDisable" vim.cmd("TransparentDisable")
vim.cmd "TransparentEnable" vim.cmd("TransparentEnable")
end end
end, end,
}, },

View file

@ -7,12 +7,12 @@ if pcode.columnline then
opts = {}, opts = {},
config = function() config = function()
local icons = vim.g.pcode_icons local icons = vim.g.pcode_icons
require("virt-column").overwrite { require("virt-column").overwrite({
exclude = { exclude = {
filetypes = { "help", "text", "markdown" }, filetypes = { "help", "text", "markdown" },
}, },
char = icons.ui.LineMiddle, char = icons.ui.LineMiddle,
} })
-- Mengatur colum color max 80 caracter -- Mengatur colum color max 80 caracter
vim.api.nvim_create_autocmd("BufWinEnter", { vim.api.nvim_create_autocmd("BufWinEnter", {
pattern = "*", pattern = "*",

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,11 +2,11 @@ local opts = { noremap = true, silent = true }
function _LIVE_SERVER() function _LIVE_SERVER()
local Terminal = require("toggleterm.terminal").Terminal local Terminal = require("toggleterm.terminal").Terminal
local live_server = Terminal:new { local live_server = Terminal:new({
cmd = "live-server", cmd = "live-server",
hidden = true, hidden = true,
direction = "tab", direction = "tab",
} })
live_server:toggle() live_server:toggle()
end end
@ -159,7 +159,7 @@ end
-- if pcall(require, "dap") then -- if pcall(require, "dap") then
-- modified function keys found with `showkey -a` in the terminal to get key code -- 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 -- 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() map("n", "<F5>", function()
require("dap").continue() require("dap").continue()
end, "") end, "")

View file

@ -51,12 +51,12 @@ end
-- vim.opt.shortmess = "ilmnrx" -- flags to shorten vim messages, see :help 'shortmess' -- vim.opt.shortmess = "ilmnrx" -- flags to shorten vim messages, see :help 'shortmess'
-- vim.o.winbar = "%{%v:lua.require'nvim-navic'.get_location()%}" -- vim.o.winbar = "%{%v:lua.require'nvim-navic'.get_location()%}"
vim.opt.shortmess:append "c" -- don't give |ins-completion-menu| messages vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages
vim.opt.iskeyword:append "-" -- hyphenated words recognized by searches vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches
vim.opt.formatoptions:remove { "t", "c", "q", "j" } vim.opt.formatoptions:remove({ "t", "c", "q", "j" })
vim.opt.formatoptions = "croql" 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.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 -- config for blink cursor in normal, visual and insert mode
-- vim.opt.guicursor = { -- vim.opt.guicursor = {
-- "n-v-c:block-Cursor/lCursor-blinkwait1000-blinkon100-blinkoff100", -- "n-v-c:block-Cursor/lCursor-blinkwait1000-blinkon100-blinkoff100",

View file

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

View file

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

View file

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

View file

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

View file

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