chore: stylua formatting update (#261)

* addded stylua config file

* chore: formatted with stylua
navigator
Galen Rowell 3 years ago committed by GitHub
parent 4abf43aa99
commit 86903ab982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 3
quote_style = "AutoPreferDouble"
no_call_parentheses = true

@ -1,6 +1,6 @@
local chad_modules = {
"options",
"mappings"
"mappings",
}
for i = 1, #chad_modules, 1 do

@ -1,13 +1,13 @@
local M = {
ui = {
theme = "onedark",
fav_themes = {"onedark", "gruvchad"}, -- for theme toggle
fav_themes = { "onedark", "gruvchad" }, -- for theme toggle
theme_toggler = false,
hidden_statusline = {
-- these are filetypes, not pattern matched
"NvimTree",
"toggleterm"
}
"toggleterm",
},
},
options = {
permanent_undo = true,
@ -26,7 +26,7 @@ local M = {
smartindent = true,
mapleader = " ",
autosave = false,
enable_insertNav = true -- navigation in insertmode
enable_insertNav = true, -- navigation in insertmode
},
-- enable and disable plugins (true for disable)
plugin_status = {
@ -50,30 +50,30 @@ local M = {
autosave_nvim = true,
nvim_comment = true,
neoscroll_nvim = true,
telescope_media = true
telescope_media = true,
},
-- make sure you dont use same keys twice
mappings = {
truezen = {
ataraxisMode = "<leader>zz",
minimalisticmode = "<leader>zm",
focusmode = "<leader>zf"
focusmode = "<leader>zf",
},
comment_nvim = {
comment_toggle = "<leader>/"
comment_toggle = "<leader>/",
},
nvimtree = {
treetoggle = "<C-n>"
treetoggle = "<C-n>",
},
neoformat = {
format = "<leader>fm"
format = "<leader>fm",
},
dashboard = {
open = "<leader>db",
newfile = "<leader>fn",
bookmarks = "<leader>bm",
sessionload = "<leader>l",
sessionsave = "<leader>s"
sessionsave = "<leader>s",
},
telescope = {
live_grep = "<leader>fw",
@ -83,29 +83,29 @@ local M = {
buffers = "<leader>fb",
help_tags = "<leader>fh",
oldfiles = "<leader>fo",
themes = "<leader>th"
themes = "<leader>th",
},
telescope_media = {
media_files = "<leader>fp"
media_files = "<leader>fp",
},
bufferline = {
new_buffer = "<S-t>",
newtab = "<C-t>b",
close = "<S-x>",
cycleNext = "<TAB>",
cyclePrev = "<S-Tab>"
cyclePrev = "<S-Tab>",
},
fugitive = {
Git = "<leader>gs",
diffget_2 = "<leader>gh",
diffget_3 = "<leader>gl",
git_blame = "<leader>gb"
git_blame = "<leader>gb",
},
toggleterm = {
toggle_window = "<leader>w",
toggle_vert = "<leader>v",
toggle_hori = "<leader>h",
hide_term = "JK"
hide_term = "JK",
},
insert_nav = {
forward = "<C-l>",
@ -113,15 +113,15 @@ local M = {
top_of_line = "<C-a>",
end_of_line = "<C-e>",
prev_line = "<C-j>",
next_line = "<C-k>"
next_line = "<C-k>",
},
misc = {
esc_Termmode = "jk",
copywhole_file = "<C-a>",
toggle_linenr = "<leader>n",
theme_toggle = "<leader>x"
}
}
theme_toggle = "<leader>x",
},
},
}
return M

@ -5,7 +5,7 @@ local M = {}
local cmd = vim.cmd
local function map(mode, lhs, rhs, opts)
local options = {noremap = true, silent = true}
local options = { noremap = true, silent = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
@ -30,10 +30,10 @@ map("v", "p", '"_dP', opt)
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
-- empty mode is same as using :map
map("", "j", 'v:count ? "j" : "gj"', {expr = true})
map("", "k", 'v:count ? "k" : "gk"', {expr = true})
map("", "<Down>", 'v:count ? "j" : "gj"', {expr = true})
map("", "<Up>", 'v:count ? "k" : "gk"', {expr = true})
map("", "j", 'v:count ? "j" : "gj"', { expr = true })
map("", "k", 'v:count ? "k" : "gk"', { expr = true })
map("", "<Down>", 'v:count ? "j" : "gj"', { expr = true })
map("", "<Up>", 'v:count ? "k" : "gk"', { expr = true })
-- copy whole file content
map("n", miscMap.copywhole_file, ":%y+<CR>", opt)
@ -131,11 +131,11 @@ end
map("n", "<Esc>", ":noh<CR>", opt)
-- Packer commands till because we are not loading it at startup
cmd("silent! command PackerCompile lua require 'pluginList' require('packer').compile()")
cmd("silent! command PackerInstall lua require 'pluginList' require('packer').install()")
cmd("silent! command PackerStatus lua require 'pluginList' require('packer').status()")
cmd("silent! command PackerSync lua require 'pluginList' require('packer').sync()")
cmd("silent! command PackerUpdate lua require 'pluginList' require('packer').update()")
cmd "silent! command PackerCompile lua require 'pluginList' require('packer').compile()"
cmd "silent! command PackerInstall lua require 'pluginList' require('packer').install()"
cmd "silent! command PackerStatus lua require 'pluginList' require('packer').status()"
cmd "silent! command PackerSync lua require 'pluginList' require('packer').sync()"
cmd "silent! command PackerUpdate lua require 'pluginList' require('packer').update()"
M.fugitive = function()
local m = user_map.fugitive

@ -2,7 +2,7 @@ local options = require("chadrc").options
local opt = vim.opt
local g = vim.g
opt.completeopt = {"menuone", "noselect"}
opt.completeopt = { "menuone", "noselect" }
opt.undofile = options.permanent_undo
opt.ruler = options.ruler
opt.hidden = options.hidden
@ -19,10 +19,10 @@ opt.timeoutlen = options.timeoutlen
opt.clipboard = options.clipboard
-- disable nvim intro
opt.shortmess:append("sI")
opt.shortmess:append "sI"
-- disable tilde on end of buffer: https://github.com/ neovim/neovim/pull/8546#issuecomment-643643758
opt.fillchars = {eob = " "}
opt.fillchars = { eob = " " }
-- Numbers
opt.number = options.number
@ -36,7 +36,7 @@ opt.smartindent = options.smartindent
-- go to previous/next line with h,l,left arrow and right arrow
-- when cursor reaches end/beginning of line
opt.whichwrap:append("<>hl")
opt.whichwrap:append "<>hl"
g.mapleader = options.mapleader
g.auto_save = options.autosave
@ -60,7 +60,7 @@ local disabled_built_ins = {
"logipat",
"rrhelper",
"spellfile_plugin",
"matchit"
"matchit",
}
for _, plugin in pairs(disabled_built_ins) do

@ -1,31 +1,29 @@
local cmd = vim.cmd
cmd("packadd packer.nvim")
cmd "packadd packer.nvim"
local present, packer = pcall(require, "packer")
if not present then
local packer_path = vim.fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim"
local packer_path = vim.fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim"
print("Cloning packer..")
print "Cloning packer.."
-- remove the dir before cloning
vim.fn.delete(packer_path, "rf")
vim.fn.system(
{
vim.fn.system {
"git",
"clone",
"https://github.com/wbthomason/packer.nvim",
"--depth",
"20",
packer_path
packer_path,
}
)
cmd("packadd packer.nvim")
cmd "packadd packer.nvim"
present, packer = pcall(require, "packer")
if present then
print("Packer cloned successfully.")
print "Packer cloned successfully."
else
error("Couldn't clone packer !\nPacker path: " .. packer_path)
end
@ -34,14 +32,14 @@ end
return packer.init {
display = {
open_fn = function()
return require("packer.util").float {border = "single"}
return require("packer.util").float { border = "single" }
end,
prompt_border = "single"
prompt_border = "single",
},
git = {
clone_timeout = 600 -- Timeout, in seconds, for git clones
clone_timeout = 600, -- Timeout, in seconds, for git clones
},
auto_clean = true,
compile_on_sync = true
compile_on_sync = true,
-- auto_reload_compiled = true
}

@ -11,11 +11,10 @@ end
local use = packer.use
return packer.startup(
function()
return packer.startup(function()
use {
"wbthomason/packer.nvim",
event = "VimEnter"
event = "VimEnter",
}
use {
@ -23,8 +22,8 @@ return packer.startup(
disable = not plugin_status.better_esc,
event = "InsertEnter",
config = function()
require "plugins.others".escape()
end
require("plugins.others").escape()
end,
}
use {
@ -35,8 +34,8 @@ return packer.startup(
require "plugins.bufferline"
end,
setup = function()
require "mappings".bufferline()
end
require("mappings").bufferline()
end,
}
use {
@ -45,7 +44,7 @@ return packer.startup(
after = "nvim-base16.lua",
config = function()
require "plugins.statusline"
end
end,
}
-- color related stuff
@ -54,7 +53,7 @@ return packer.startup(
after = "packer.nvim",
config = function()
require "theme"
end
end,
}
use {
@ -63,7 +62,7 @@ return packer.startup(
event = "BufRead",
config = function()
require("plugins.others").colorizer()
end
end,
}
-- lsp stuff
@ -72,12 +71,12 @@ return packer.startup(
event = "BufRead",
config = function()
require "plugins.treesitter"
end
end,
}
use {
"kabouzeid/nvim-lspinstall",
event = "BufRead"
event = "BufRead",
}
use {
@ -85,7 +84,7 @@ return packer.startup(
after = "nvim-lspinstall",
config = function()
require "plugins.lspconfig"
end
end,
}
use {
@ -94,7 +93,7 @@ return packer.startup(
event = "BufEnter",
config = function()
require("plugins.others").lspkind()
end
end,
}
use {
@ -103,7 +102,7 @@ return packer.startup(
after = "nvim-lspconfig",
config = function()
require("plugins.others").signature()
end
end,
}
-- load compe in insert mode only
@ -121,13 +120,13 @@ return packer.startup(
event = "InsertCharPre",
config = function()
require "plugins.luasnip"
end
end,
},
{
"rafamadriz/friendly-snippets",
event = "InsertCharPre"
}
}
event = "InsertCharPre",
},
},
}
use {
@ -135,8 +134,8 @@ return packer.startup(
disable = not plugin_status.neoformat,
cmd = "Neoformat",
setup = function()
require "mappings".neoformat()
end
require("mappings").neoformat()
end,
}
-- file managing , picker etc
@ -147,8 +146,8 @@ return packer.startup(
require "plugins.nvimtree"
end,
setup = function()
require "mappings".nvimtree()
end
require("mappings").nvimtree()
end,
}
use {
@ -156,16 +155,16 @@ return packer.startup(
after = "nvim-base16.lua",
config = function()
require "plugins.icons"
end
end,
}
use {
"nvim-lua/plenary.nvim",
event = "BufRead"
event = "BufRead",
}
use {
"nvim-lua/popup.nvim",
after = "plenary.nvim"
after = "plenary.nvim",
}
use {
@ -174,22 +173,22 @@ return packer.startup(
requires = {
{
"nvim-telescope/telescope-fzf-native.nvim",
run = "make"
run = "make",
},
{
"nvim-telescope/telescope-media-files.nvim",
disable = not plugin_status.telescope_media,
setup = function()
require "mappings".telescope_media()
end
}
require("mappings").telescope_media()
end,
},
},
config = function()
require "plugins.telescope"
end,
setup = function()
require "mappings".telescope()
end
require("mappings").telescope()
end,
}
-- git stuff
@ -199,7 +198,7 @@ return packer.startup(
after = "plenary.nvim",
config = function()
require "plugins.gitsigns"
end
end,
}
-- misc plugins
@ -210,21 +209,21 @@ return packer.startup(
require "plugins.toggleterm"
end,
setup = function()
require "mappings".toggleterm()
end
require("mappings").toggleterm()
end,
}
use {
"windwp/nvim-autopairs",
after = "nvim-compe",
config = function()
require "plugins.autopairs"
end
end,
}
use {
"andymass/vim-matchup",
disable = not plugin_status.vim_matchup,
event = "CursorMoved"
event = "CursorMoved",
}
use {
@ -235,8 +234,8 @@ return packer.startup(
require("plugins.others").comment()
end,
setup = function()
require "mappings".comment_nvim()
end
require("mappings").comment_nvim()
end,
}
use {
@ -247,12 +246,12 @@ return packer.startup(
"DashboardNewFile",
"DashboardJumpMarks",
"SessionLoad",
"SessionSave"
"SessionSave",
},
setup = function()
require "plugins.dashboard"
require "mappings".dashboard()
end
require("mappings").dashboard()
end,
}
-- load autosave only if its globally enabled
@ -264,7 +263,7 @@ return packer.startup(
end,
cond = function()
return vim.g.auto_save == true
end
end,
}
-- smooth scroll
@ -274,7 +273,7 @@ return packer.startup(
event = "WinScrolled",
config = function()
require("plugins.others").neoscroll()
end
end,
}
use {
@ -283,14 +282,14 @@ return packer.startup(
cmd = {
"TZAtaraxis",
"TZMinimalist",
"TZFocus"
"TZFocus",
},
config = function()
require "plugins.zenmode"
end,
setup = function()
require "mappings".truezen()
end
require("mappings").truezen()
end,
}
-- use "alvan/vim-closetag" -- for html autoclosing tag
@ -301,18 +300,17 @@ return packer.startup(
event = "BufRead",
setup = function()
require("plugins.others").blankline()
end
end,
}
use {
"tpope/vim-fugitive",
disable = not plugin_status.vim_fugitive,
cmd = {
"Git"
"Git",
},
setup = function()
require "mappings".fugitive()
end
require("mappings").fugitive()
end,
}
end
)
end)

@ -6,9 +6,7 @@ if not (present1 or present2) then
end
autopairs.setup()
autopairs_completion.setup(
{
autopairs_completion.setup {
map_cr = true,
map_complete = true -- insert () func completion
}
)
map_complete = true, -- insert () func completion
}

@ -4,18 +4,16 @@ if not present then
return
end
autosave.setup(
{
autosave.setup {
enabled = vim.g.auto_save, -- takes boolean value from init.lua
execution_message = "autosaved at : " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave", "TextChanged"},
execution_message = "autosaved at : " .. vim.fn.strftime "%H:%M:%S",
events = { "InsertLeave", "TextChanged" },
conditions = {
exists = true,
filetype_is_not = {},
modifiable = true
modifiable = true,
},
write_all_buffers = false,
on_off_commands = true,
clean_command_line_interval = 2500
}
)
clean_command_line_interval = 2500,
}

@ -8,7 +8,7 @@ end
bufferline.setup {
options = {
offsets = {{filetype = "NvimTree", text = "", padding = 1}},
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
buffer_close_icon = "",
modified_icon = "",
close_icon = "",
@ -23,83 +23,83 @@ bufferline.setup {
show_buffer_close_icons = true,
separator_style = "thin",
mappings = true,
always_show_bufferline = true
always_show_bufferline = true,
},
highlights = {
fill = {
guifg = colors.grey_fg,
guibg = colors.black2
guibg = colors.black2,
},
background = {
guifg = colors.grey_fg,
guibg = colors.black2
guibg = colors.black2,
},
-- buffers
buffer_visible = {
guifg = colors.light_grey,
guibg = colors.black2
guibg = colors.black2,
},
buffer_selected = {
guifg = colors.white,
guibg = colors.black,
gui = "bold"
gui = "bold",
},
-- tabs
tab = {
guifg = colors.light_grey,
guibg = colors.one_bg3
guibg = colors.one_bg3,
},
tab_selected = {
guifg = colors.black2,
guibg = colors.nord_blue
guibg = colors.nord_blue,
},
tab_close = {
guifg = colors.red,
guibg = colors.black
guibg = colors.black,
},
indicator_selected = {
guifg = colors.black,
guibg = colors.black
guibg = colors.black,
},
-- separators
separator = {
guifg = colors.black2,
guibg = colors.black2
guibg = colors.black2,
},
separator_visible = {
guifg = colors.black2,
guibg = colors.black2
guibg = colors.black2,
},
separator_selected = {
guifg = colors.black2,
guibg = colors.black2
guibg = colors.black2,
},
-- modified
modified = {
guifg = colors.red,
guibg = colors.black2
guibg = colors.black2,
},
modified_visible = {
guifg = colors.red,
guibg = colors.black2
guibg = colors.black2,
},
modified_selected = {
guifg = colors.green,
guibg = colors.black
guibg = colors.black,
},
-- close buttons
close_button = {
guifg = colors.light_grey,
guibg = colors.black2
guibg = colors.black2,
},
close_button_visible = {
guifg = colors.light_grey,
guibg = colors.black2
guibg = colors.black2,
},
close_button_selected = {
guifg = colors.red,
guibg = colors.black
}
}
guibg = colors.black,
},
},
}

@ -17,9 +17,9 @@ compe.setup {
max_menu_width = 100,
documentation = true,
source = {
buffer = {kind = "", true},
luasnip = {kind = "", true},
buffer = { kind = "", true },
luasnip = { kind = "", true },
nvim_lsp = true,
nvim_lua = true
}
nvim_lua = true,
},
}

@ -21,20 +21,20 @@ g.dashboard_custom_header = {
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
" "
" ",
}
g.dashboard_custom_section = {
a = {description = {" Find File SPC f f"}, command = "Telescope find_files"},
b = {description = {" Recents SPC f o"}, command = "Telescope oldfiles"},
c = {description = {" Find Word SPC f w"}, command = "Telescope live_grep"},
d = {description = {"洛 New File SPC f n"}, command = "DashboardNewFile"},
e = {description = {" Bookmarks SPC b m"}, command = "Telescope marks"},
f = {description = {" Load Last Session SPC s l"}, command = "SessionLoad"}
a = { description = { " Find File SPC f f" }, command = "Telescope find_files" },
b = { description = { " Recents SPC f o" }, command = "Telescope oldfiles" },
c = { description = { " Find Word SPC f w" }, command = "Telescope live_grep" },
d = { description = { "洛 New File SPC f n" }, command = "DashboardNewFile" },
e = { description = { " Bookmarks SPC b m" }, command = "Telescope marks" },
f = { description = { " Load Last Session SPC s l" }, command = "SessionLoad" },
}
g.dashboard_custom_footer = {
" ",
-- "NvChad Loaded " .. plugins_count .. " plugins",
"NvChad v0.5"
"NvChad v0.5",
}

@ -5,28 +5,28 @@ end
gitsigns.setup {
signs = {
add = {hl = "DiffAdd", text = "", numhl = "GitSignsAddNr"},
change = {hl = "DiffChange", text = "", numhl = "GitSignsChangeNr"},
delete = {hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr"},
topdelete = {hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr"},
changedelete = {hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr"}
add = { hl = "DiffAdd", text = "", numhl = "GitSignsAddNr" },
change = { hl = "DiffChange", text = "", numhl = "GitSignsChangeNr" },
delete = { hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr" },
topdelete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
changedelete = { hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr" },
},
numhl = false,
keymaps = {
-- Default keymap options
noremap = true,
buffer = true,
["n ]c"] = {expr = true, '&diff ? \']c\' : \'<cmd>lua require"gitsigns".next_hunk()<CR>\''},
["n [c"] = {expr = true, '&diff ? \'[c\' : \'<cmd>lua require"gitsigns".prev_hunk()<CR>\''},
["n ]c"] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'" },
["n [c"] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'" },
["n <leader>hs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
["n <leader>hu"] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
["n <leader>hr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>'
["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>',
},
watch_index = {
interval = 100
interval = 100,
},
sign_priority = 5,
status_formatter = nil -- Use default
status_formatter = nil, -- Use default
}

@ -11,112 +11,112 @@ icons.setup {
html = {
icon = "",
color = colors.baby_pink,
name = "html"
name = "html",
},
css = {
icon = "",
color = colors.blue,
name = "css"
name = "css",
},
js = {
icon = "",
color = colors.sun,
name = "js"
name = "js",
},
ts = {
icon = "",
color = colors.teal,
name = "ts"
name = "ts",
},
kt = {
icon = "󱈙",
color = colors.orange,
name = "kt"
name = "kt",
},
png = {
icon = "",
color = colors.dark_purple,
name = "png"
name = "png",
},
jpg = {
icon = "",
color = colors.dark_purple,
name = "jpg"
name = "jpg",
},
jpeg = {
icon = "",
color = colors.dark_purple,
name = "jpeg"
name = "jpeg",
},
mp3 = {
icon = "",
color = colors.white,
name = "mp3"
name = "mp3",
},
mp4 = {
icon = "",
color = colors.white,
name = "mp4"
name = "mp4",
},
out = {
icon = "",
color = colors.white,
name = "out"
name = "out",
},
Dockerfile = {
icon = "",
color = colors.cyan,
name = "Dockerfile"
name = "Dockerfile",
},
rb = {
icon = "",
color = colors.pink,
name = "rb"
name = "rb",
},
vue = {
icon = "",
color = colors.vibrant_green,
name = "vue"
name = "vue",
},
py = {
icon = "",
color = colors.cyan,
name = "py"
name = "py",
},
toml = {
icon = "",
color = colors.blue,
name = "toml"
name = "toml",
},
lock = {
icon = "",
color = colors.red,
name = "lock"
name = "lock",
},
zip = {
icon = "",
color = colors.sun,
name = "zip"
name = "zip",
},
xz = {
icon = "",
color = colors.sun,
name = "xz"
name = "xz",
},
deb = {
icon = "",
color = colors.cyan,
name = "deb"
name = "deb",
},
rpm = {
icon = "",
color = colors.orange,
name = "rpm"
name = "rpm",
},
lua = {
icon = "",
color = colors.blue,
name = "lua"
}
}
name = "lua",
},
},
}

@ -7,7 +7,7 @@ end
local function on_attach(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
local opts = {noremap = true, silent = true}
local opts = { noremap = true, silent = true }
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
@ -53,7 +53,7 @@ local function setup_servers()
lspconfig[lang].setup {
on_attach = on_attach,
capabilities = capabilities,
root_dir = vim.loop.cwd
root_dir = vim.loop.cwd,
}
elseif lang == "lua" then
lspconfig[lang].setup {
@ -61,21 +61,21 @@ local function setup_servers()
settings = {
Lua = {
diagnostics = {
globals = {"vim"}
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000
preloadFileSize = 10000,
},
telemetry = {
enable = false
}
}
}
enable = false,
},
},
},
}
end
end
@ -86,12 +86,12 @@ setup_servers()
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
lspinstall.post_install_hook = function()
setup_servers() -- reload installed servers
vim.cmd("bufdo e") -- triggers FileType autocmd that starts the server
vim.cmd "bufdo e"
end
-- replace the default lsp diagnostic symbols
function lspSymbol(name, icon)
vim.fn.sign_define("LspDiagnosticsSign" .. name, {text = icon, numhl = "LspDiagnosticsDefaul" .. name})
vim.fn.sign_define("LspDiagnosticsSign" .. name, { text = icon, numhl = "LspDiagnosticsDefaul" .. name })
end
lspSymbol("Error", "")
@ -99,29 +99,25 @@ lspSymbol("Warning", "")
lspSymbol("Information", "")
lspSymbol("Hint", "")
vim.lsp.handlers["textDocument/publishDiagnostics"] =
vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics,
{
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = {
prefix = "",
spacing = 0
spacing = 0,
},
signs = true,
underline = true,
-- set this to true if you want diagnostics to show in insert mode
update_in_insert = false
}
)
update_in_insert = false,
})
-- suppress error messages from lang servers
vim.notify = function(msg, log_level, _opts)
if msg:match("exit code") then
if msg:match "exit code" then
return
end
if log_level == vim.log.levels.ERROR then
vim.api.nvim_err_writeln(msg)
else
vim.api.nvim_echo({{msg}}, true, {})
vim.api.nvim_echo({ { msg } }, true, {})
end
end

@ -8,8 +8,8 @@ local t = function(str)
end
local check_back_space = function()
local col = vim.fn.col(".") - 1
if col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then
local col = vim.fn.col "." - 1
if col == 0 or vim.fn.getline("."):sub(col, col):match "%s" then
return true
else
return false
@ -39,34 +39,28 @@ end
_G.completions = function()
local npairs
if
not pcall(
function()
if not pcall(function()
npairs = require "nvim-autopairs"
end
)
then
end) then
return
end
if vim.fn.pumvisible() == 1 then
if vim.fn.complete_info()["selected"] ~= -1 then
return vim.fn["compe#confirm"]("<CR>")
return vim.fn["compe#confirm"] "<CR>"
end
end
return npairs.check_break_line_char()
end
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.api.nvim_set_keymap("i", "<CR>", "v:lua.completions()", {expr = true})
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", { expr = true })
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", { expr = true })
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true })
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true })
vim.api.nvim_set_keymap("i", "<CR>", "v:lua.completions()", { expr = true })
luasnip.config.set_config(
{
luasnip.config.set_config {
history = true,
updateevents = "TextChanged,TextChangedI"
}
)
updateevents = "TextChanged,TextChangedI",
}
require("luasnip/loaders/from_vscode").load()

@ -10,9 +10,9 @@ vim.o.termguicolors = true
g.nvim_tree_side = "left"
g.nvim_tree_width = 25
g.nvim_tree_ignore = {".git", "node_modules", ".cache"}
g.nvim_tree_ignore = { ".git", "node_modules", ".cache" }
g.nvim_tree_gitignore = 1
g.nvim_tree_auto_ignore_ft = {"dashboard"} -- don't open tree on specific fiypes.
g.nvim_tree_auto_ignore_ft = { "dashboard" } -- don't open tree on specific fiypes.
g.nvim_tree_auto_open = 0
g.nvim_tree_auto_close = 0 -- closes tree when it's the last window
g.nvim_tree_quit_on_open = 0 -- closes tree when file's opened
@ -21,7 +21,7 @@ g.nvim_tree_indent_markers = 1
g.nvim_tree_hide_dotfiles = 1
g.nvim_tree_git_hl = 1
g.nvim_tree_highlight_opened_files = 0
g.nvim_tree_root_folder_modifier = table.concat {":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??"}
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
g.nvim_tree_tab_open = 0
g.nvim_tree_allow_resize = 1
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
@ -32,7 +32,7 @@ g.nvim_tree_update_cwd = 1
g.nvim_tree_show_icons = {
git = 1,
folders = 1,
files = 1
files = 1,
-- folder_arrows= 1
}
g.nvim_tree_icons = {
@ -45,7 +45,7 @@ g.nvim_tree_icons = {
renamed = "",
untracked = "",
deleted = "",
ignored = ""
ignored = "",
},
folder = {
-- disable indent_markers option to get arrows working or if you want both arrows and indent then just add the arrow icons in front ofthe default and opened folders below!
@ -56,40 +56,40 @@ g.nvim_tree_icons = {
empty = "", -- 
empty_open = "",
symlink = "",
symlink_open = ""
}
symlink_open = "",
},
}
g.nvim_tree_bindings = {
{key = {"<CR>", "o", "<2-LeftMouse>"}, cb = tree_cb("edit")},
{key = {"<2-RightMouse>", "<C-]>"}, cb = tree_cb("cd")},
{key = "<C-v>", cb = tree_cb("vsplit")},
{key = "<C-x>", cb = tree_cb("split")},
{key = "<C-t>", cb = tree_cb("tabnew")},
{key = "<", cb = tree_cb("prev_sibling")},
{key = ">", cb = tree_cb("next_sibling")},
{key = "P", cb = tree_cb("parent_node")},
{key = "<BS>", cb = tree_cb("close_node")},
{key = "<S-CR>", cb = tree_cb("close_node")},
{key = "<Tab>", cb = tree_cb("preview")},
{key = "K", cb = tree_cb("first_sibling")},
{key = "J", cb = tree_cb("last_sibling")},
{key = "I", cb = tree_cb("toggle_ignored")},
{key = "H", cb = tree_cb("toggle_dotfiles")},
{key = "R", cb = tree_cb("refresh")},
{key = "a", cb = tree_cb("create")},
{key = "d", cb = tree_cb("remove")},
{key = "r", cb = tree_cb("rename")},
{key = "<C->", cb = tree_cb("full_rename")},
{key = "x", cb = tree_cb("cut")},
{key = "c", cb = tree_cb("copy")},
{key = "p", cb = tree_cb("paste")},
{key = "y", cb = tree_cb("copy_name")},
{key = "Y", cb = tree_cb("copy_path")},
{key = "gy", cb = tree_cb("copy_absolute_path")},
{key = "[c", cb = tree_cb("prev_git_item")},
{key = "}c", cb = tree_cb("next_git_item")},
{key = "-", cb = tree_cb("dir_up")},
{key = "q", cb = tree_cb("close")},
{key = "g?", cb = tree_cb("toggle_help")}
{ key = { "<CR>", "o", "<2-LeftMouse>" }, cb = tree_cb "edit" },
{ key = { "<2-RightMouse>", "<C-]>" }, cb = tree_cb "cd" },
{ key = "<C-v>", cb = tree_cb "vsplit" },
{ key = "<C-x>", cb = tree_cb "split" },
{ key = "<C-t>", cb = tree_cb "tabnew" },
{ key = "<", cb = tree_cb "prev_sibling" },
{ key = ">", cb = tree_cb "next_sibling" },
{ key = "P", cb = tree_cb "parent_node" },
{ key = "<BS>", cb = tree_cb "close_node" },
{ key = "<S-CR>", cb = tree_cb "close_node" },
{ key = "<Tab>", cb = tree_cb "preview" },
{ key = "K", cb = tree_cb "first_sibling" },
{ key = "J", cb = tree_cb "last_sibling" },
{ key = "I", cb = tree_cb "toggle_ignored" },
{ key = "H", cb = tree_cb "toggle_dotfiles" },
{ key = "R", cb = tree_cb "refresh" },
{ key = "a", cb = tree_cb "create" },
{ key = "d", cb = tree_cb "remove" },
{ key = "r", cb = tree_cb "rename" },
{ key = "<C->", cb = tree_cb "full_rename" },
{ key = "x", cb = tree_cb "cut" },
{ key = "c", cb = tree_cb "copy" },
{ key = "p", cb = tree_cb "paste" },
{ key = "y", cb = tree_cb "copy_name" },
{ key = "Y", cb = tree_cb "copy_path" },
{ key = "gy", cb = tree_cb "copy_absolute_path" },
{ key = "[c", cb = tree_cb "prev_git_item" },
{ key = "}c", cb = tree_cb "next_git_item" },
{ key = "-", cb = tree_cb "dir_up" },
{ key = "q", cb = tree_cb "close" },
{ key = "g?", cb = tree_cb "toggle_help" },
}

@ -4,7 +4,7 @@ M.colorizer = function()
local present, colorizer = pcall(require, "colorizer")
if present then
colorizer.setup()
vim.cmd("ColorizerReloadAllBuffers")
vim.cmd "ColorizerReloadAllBuffers"
end
end
@ -17,7 +17,7 @@ end
M.escape = function()
vim.g.better_escape_interval = 300
vim.g.better_escape_shortcut = {"jk"}
vim.g.better_escape_shortcut = { "jk" }
end
M.lspkind = function()
@ -28,19 +28,17 @@ M.lspkind = function()
end
M.neoscroll = function()
pcall(
function()
pcall(function()
require("neoscroll").setup()
end
)
end)
end
M.blankline = function()
vim.g.indentLine_enabled = 1
vim.g.indent_blankline_char = ""
vim.g.indent_blankline_filetype_exclude = {"help", "terminal", "dashboard", "packer"}
vim.g.indent_blankline_buftype_exclude = {"terminal"}
vim.g.indent_blankline_filetype_exclude = { "help", "terminal", "dashboard", "packer" }
vim.g.indent_blankline_buftype_exclude = { "terminal" }
vim.g.indent_blankline_show_trailing_blankline_indent = false
vim.g.indent_blankline_show_first_indent_level = false
@ -49,8 +47,7 @@ end
M.signature = function()
local present, lspsignature = pcall(require, "lsp_signature")
if present then
lspsignature.setup(
{
lspsignature.setup {
bind = true,
doc_lines = 2,
floating_window = true,
@ -63,12 +60,11 @@ M.signature = function()
max_height = 22,
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
handler_opts = {
border = "single" -- double, single, shadow, none
border = "single", -- double, single, shadow, none
},
zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom
padding = "" -- character to pad on left and right of signature can be ' ', or '|' etc
padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc
}
)
end
end

@ -6,7 +6,7 @@ end
local gls = gl.section
gl.short_line_list = {" "}
gl.short_line_list = { " " }
local left_separator = "" -- or " "
local right_separator = "" -- or ""
@ -19,8 +19,8 @@ gls.left[1] = {
provider = function()
return ""
end,
highlight = {colors.nord_blue, colors.nord_blue}
}
highlight = { colors.nord_blue, colors.nord_blue },
},
}
gls.left[2] = {
@ -28,31 +28,31 @@ gls.left[2] = {
provider = function()
return ""
end,
highlight = {colors.statusline_bg, colors.nord_blue},
highlight = { colors.statusline_bg, colors.nord_blue },
separator = right_separator .. " ",
separator_highlight = {colors.nord_blue, colors.lightbg}
}
separator_highlight = { colors.nord_blue, colors.lightbg },
},
}
gls.left[3] = {
FileIcon = {
provider = "FileIcon",
condition = condition.buffer_not_empty,
highlight = {colors.white, colors.lightbg}
}
highlight = { colors.white, colors.lightbg },
},
}
gls.left[4] = {
FileName = {
provider = function()
local fileinfo = require('galaxyline.provider_fileinfo')
local fileinfo = require "galaxyline.provider_fileinfo"
return fileinfo.get_current_file_name("", "")
end,
condition = condition.buffer_not_empty,
highlight = {colors.white, colors.lightbg},
highlight = { colors.white, colors.lightbg },
separator = right_separator,
separator_highlight = {colors.lightbg, colors.lightbg2}
}
separator_highlight = { colors.lightbg, colors.lightbg2 },
},
}
gls.left[5] = {
@ -61,10 +61,10 @@ gls.left[5] = {
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
return "" .. dir_name .. " "
end,
highlight = {colors.grey_fg2, colors.lightbg2},
highlight = { colors.grey_fg2, colors.lightbg2 },
separator = right_separator,
separator_highlight = {colors.lightbg2, colors.statusline_bg}
}
separator_highlight = { colors.lightbg2, colors.statusline_bg },
},
}
local checkwidth = function()
@ -80,8 +80,8 @@ gls.left[6] = {
provider = "DiffAdd",
condition = checkwidth,
icon = "",
highlight = {colors.white, colors.statusline_bg}
}
highlight = { colors.white, colors.statusline_bg },
},
}
gls.left[7] = {
@ -89,8 +89,8 @@ gls.left[7] = {
provider = "DiffModified",
condition = checkwidth,
icon = "",
highlight = {colors.grey_fg2, colors.statusline_bg}
}
highlight = { colors.grey_fg2, colors.statusline_bg },
},
}
gls.left[8] = {
@ -98,24 +98,24 @@ gls.left[8] = {
provider = "DiffRemove",
condition = checkwidth,
icon = "",
highlight = {colors.grey_fg2, colors.statusline_bg}
}
highlight = { colors.grey_fg2, colors.statusline_bg },
},
}
gls.left[9] = {
DiagnosticError = {
provider = "DiagnosticError",
icon = "",
highlight = {colors.red, colors.statusline_bg}
}
highlight = { colors.red, colors.statusline_bg },
},
}
gls.left[10] = {
DiagnosticWarn = {
provider = "DiagnosticWarn",
icon = "",
highlight = {colors.yellow, colors.statusline_bg}
}
highlight = { colors.yellow, colors.statusline_bg },
},
}
gls.right[1] = {
@ -135,8 +135,8 @@ gls.right[1] = {
return ""
end
end,
highlight = {colors.grey_fg2, colors.statusline_bg}
}
highlight = { colors.grey_fg2, colors.statusline_bg },
},
}
gls.right[2] = {
@ -145,31 +145,31 @@ gls.right[2] = {
return ""
end,
condition = require("galaxyline.condition").check_git_workspace,
highlight = {colors.grey_fg2, colors.statusline_bg},
highlight = { colors.grey_fg2, colors.statusline_bg },
separator = " ",
separator_highlight = {colors.statusline_bg, colors.statusline_bg}
}
separator_highlight = { colors.statusline_bg, colors.statusline_bg },
},
}
gls.right[3] = {
GitBranch = {
provider = "GitBranch",
condition = require("galaxyline.condition").check_git_workspace,
highlight = {colors.grey_fg2, colors.statusline_bg}
}
highlight = { colors.grey_fg2, colors.statusline_bg },
},
}
local mode_colors = {
[110] = {"NORMAL", colors.red},
[105] = {"INSERT", colors.dark_purple},
[99] = {"COMMAND", colors.pink},
[116] = {"TERMINAL", colors.green},
[118] = {"VISUAL", colors.cyan},
[22] = {"V-BLOCK", colors.cyan},
[86] = {"V_LINE", colors.cyan},
[82] = {"REPLACE", colors.orange},
[115] = {"SELECT", colors.nord_blue},
[83] = {"S-LINE", colors.nord_blue}
[110] = { "NORMAL", colors.red },
[105] = { "INSERT", colors.dark_purple },
[99] = { "COMMAND", colors.pink },
[116] = { "TERMINAL", colors.green },
[118] = { "VISUAL", colors.cyan },
[22] = { "V-BLOCK", colors.cyan },
[86] = { "V_LINE", colors.cyan },
[82] = { "REPLACE", colors.orange },
[115] = { "SELECT", colors.nord_blue },
[83] = { "S-LINE", colors.nord_blue },
}
local mode = function(n)
@ -183,9 +183,9 @@ gls.right[4] = {
return left_separator
end,
separator = " ",
separator_highlight = {colors.statusline_bg, colors.statusline_bg},
highlight = {"GalaxyViMode", colors.statusline_bg}
}
separator_highlight = { colors.statusline_bg, colors.statusline_bg },
highlight = { "GalaxyViMode", colors.statusline_bg },
},
}
gls.right[5] = {
@ -194,8 +194,8 @@ gls.right[5] = {
vim.cmd("hi GalaxyviMode_icon guibg=" .. mode(2))
return ""
end,
highlight = {colors.statusline_bg, colors.red}
}
highlight = { colors.statusline_bg, colors.red },
},
}
gls.right[6] = {
@ -204,8 +204,8 @@ gls.right[6] = {
vim.cmd("hi GalaxyViMode guifg=" .. mode(2))
return " " .. mode(1) .. " "
end,
highlight = {"GalaxyViMode", colors.lightbg}
}
highlight = { "GalaxyViMode", colors.lightbg },
},
}
gls.right[7] = {
@ -214,25 +214,25 @@ gls.right[7] = {
return ""
end,
separator = left_separator,
separator_highlight = {colors.green, colors.lightbg},
highlight = {colors.lightbg, colors.green}
}
separator_highlight = { colors.green, colors.lightbg },
highlight = { colors.lightbg, colors.green },
},
}
gls.right[8] = {
line_percentage = {
provider = function()
local current_line = vim.fn.line(".")
local total_line = vim.fn.line("$")
local current_line = vim.fn.line "."
local total_line = vim.fn.line "$"
if current_line == 1 then
return " Top "
elseif current_line == vim.fn.line("$") then
elseif current_line == vim.fn.line "$" then
return " Bot "
end
local result, _ = math.modf((current_line / total_line) * 100)
return " " .. result .. "% "
end,
highlight = {colors.green, colors.lightbg}
}
highlight = { colors.green, colors.lightbg },
},
}

@ -3,8 +3,7 @@ if not present then
return
end
telescope.setup(
{
telescope.setup {
defaults = {
vimgrep_arguments = {
"rg",
@ -13,7 +12,7 @@ telescope.setup(
"--with-filename",
"--line-number",
"--column",
"--smart-case"
"--smart-case",
},
prompt_prefix = "",
selection_caret = " ",
@ -26,60 +25,55 @@ telescope.setup(
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8
results_width = 0.8,
},
vertical = {
mirror = false
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = {},
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = {"absolute"},
path_display = { "absolute" },
winblend = 0,
border = {},
borderchars = {"", "", "", "", "", "", "", ""},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
use_less = true,
set_env = {["COLORTERM"] = "truecolor"}, -- default = nil,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
},
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = false, -- override the generic 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"
},
media_files = {
filetypes = {"png", "webp", "jpg", "jpeg"},
find_cmd = "rg" -- find command (defaults to `fd`)
}
}
}
)
filetypes = { "png", "webp", "jpg", "jpeg" },
find_cmd = "rg", -- find command (defaults to `fd`)
},
},
}
-- load the theme_switcher extension
require("telescope").load_extension("themes")
require("telescope").load_extension "themes"
if
not pcall(
function()
telescope.load_extension("fzf")
telescope.load_extension("media_files")
end
)
then
if not pcall(function()
telescope.load_extension "fzf"
telescope.load_extension "media_files"
end) then
-- This should only trigger when in need of PackerSync, so better do it
print("After completion of PackerCompile, restart neovim.")
print "After completion of PackerCompile, restart neovim."
-- Trigger packer compile on PackerComplete, so it properly waits for PackerSync
vim.cmd 'autocmd User PackerComplete ++once lua print "Waiting for PackerCompile.." require("packer").compile()'
vim.cmd 'autocmd User PackerCompileDone ++once echo "Packer Compile done, restart neovim."'

@ -19,17 +19,17 @@ toggleterm.setup {
-- insert_mappings = true, -- see 'open_mapping', not set on purpose
-- whether or not the open mapping applies in insert mode
persist_size = true,
direction = 'vertical',
direction = "vertical",
close_on_exit = true, -- close the terminal window when the process exits
-- This field is only relevant if direction is set to 'float'
float_opts = {
border = 'single',
border = "single",
winblend = 0,
highlights = {
border = "Normal",
background = "Normal",
}
}
},
},
}
local Terminal = require("toggleterm.terminal").Terminal

@ -6,10 +6,10 @@ end
ts_config.setup {
ensure_installed = {
"bash",
"lua"
"lua",
},
highlight = {
enable = true,
use_languagetree = true
}
use_languagetree = true,
},
}

@ -3,24 +3,23 @@ if not present then
return
end
true_zen.setup(
{
true_zen.setup {
ui = {
bottom = {
laststatus = 0,
ruler = false,
showmode = false,
showcmd = false,
cmdheight = 1
cmdheight = 1,
},
top = {
showtabline = 0
showtabline = 0,
},
left = {
number = false,
relativenumber = false,
signcolumn = "no"
}
signcolumn = "no",
},
},
modes = {
ataraxis = {
@ -28,7 +27,7 @@ true_zen.setup(
right_padding = 32,
top_padding = 1,
bottom_padding = 1,
ideal_writing_area_width = {0},
ideal_writing_area_width = { 0 },
auto_padding = true,
keep_default_fold_fillchars = true,
custome_bg = "",
@ -40,13 +39,13 @@ true_zen.setup(
VertSplit = {},
StatusLine = {},
StatusLineNC = {},
SignColumn = {}
}
SignColumn = {},
},
},
focus = {
margin_of_error = 5,
focus_method = "experimental"
}
focus_method = "experimental",
},
},
integrations = {
vim_gitgutter = false,
@ -59,12 +58,11 @@ true_zen.setup(
vim_powerline = false,
vim_signify = false,
express_line = false,
lualine = false
lualine = false,
},
misc = {
on_off_commands = false,
ui_elements_commands = false,
cursor_by_mode = false
}
}
)
cursor_by_mode = false,
},
}

@ -45,8 +45,7 @@ M.theme_switcher = function(opts)
end
end
previewer =
previewers.new {
previewer = previewers.new {
preview_fn = function(_, entry, status)
if not deleted then
deleted = true
@ -54,30 +53,27 @@ M.theme_switcher = function(opts)
del_win(status.preview_border_win)
end
reload_theme(entry.value)
end
end,
}
else
-- show current buffer content in previewer
previewer =
previewers.new_buffer_previewer {
previewer = previewers.new_buffer_previewer {
get_buffer_by_name = function()
return bufname
end,
define_preview = function(self, entry)
if vim.loop.fs_stat(bufname) then
conf.buffer_previewer_maker(bufname, self.state.bufnr, {bufname = self.state.bufname})
conf.buffer_previewer_maker(bufname, self.state.bufnr, { bufname = self.state.bufname })
else
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
end
reload_theme(entry.value)
end
end,
}
end
local picker =
pickers.new(
{
local picker = pickers.new {
prompt_title = "Set NvChad color",
finder = finders.new_table(themes),
previewer = previewer,
@ -93,9 +89,8 @@ M.theme_switcher = function(opts)
end
)
return true
end
end,
}
)
-- rewrite picker.close_windows
local close_windows = picker.close_windows
@ -130,7 +125,7 @@ M.theme_switcher = function(opts)
-- launch the telescope picker
picker:find()
else
print("No themes found in " .. vim.fn.stdpath("config") .. "/lua/themes")
print("No themes found in " .. vim.fn.stdpath "config" .. "/lua/themes")
end
end
@ -139,8 +134,8 @@ local present, telescope = pcall(require, "telescope")
if present then
return telescope.register_extension {
exports = {
themes = M.theme_switcher
}
themes = M.theme_switcher,
},
}
else
error "Cannot find telescope!"

@ -27,7 +27,7 @@ local colors = {
cyan = "#8BE9FD",
statusline_bg = "#2b2d39",
lightbg = "#343642",
lightbg2 = "#2f313d"
lightbg2 = "#2f313d",
}
return colors

@ -27,7 +27,7 @@ local colors = {
cyan = "#95d1c9",
statusline_bg = "#2e363c",
lightbg = "#3d454b",
lightbg2 = "#333b41"
lightbg2 = "#333b41",
}
return colors

@ -27,7 +27,7 @@ local colors = {
cyan = "#82b3a8",
statusline_bg = "#252829",
lightbg = "#2d3139",
lightbg2 = "#262a32"
lightbg2 = "#262a32",
}
return colors

@ -27,7 +27,7 @@ local colors = {
cyan = "#b5c3ea",
statusline_bg = "#181f26",
lightbg = "#222930",
lightbg2 = "#1d242b"
lightbg2 = "#1d242b",
}
return colors

@ -27,7 +27,7 @@ local colors = {
cyan = "#9aafe6",
statusline_bg = "#1e242a",
lightbg = "#2d3339",
lightbg2 = "#252b31"
lightbg2 = "#252b31",
}
return colors

@ -27,7 +27,7 @@ local colors = {
cyan = "#9aafe6",
statusline_bg = "#333945",
lightbg = "#3f4551",
lightbg2 = "#393f4b"
lightbg2 = "#393f4b",
}
return colors

@ -27,7 +27,7 @@ local colors = {
cyan = "#a3b8ef",
statusline_bg = "#22262e",
lightbg = "#2d3139",
lightbg2 = "#262a32"
lightbg2 = "#262a32",
}
return colors

@ -27,7 +27,7 @@ local colors = {
cyan = "#7dcfff",
statusline_bg = "#1d1e29",
lightbg = "#252631",
lightbg2 = "#22232e"
lightbg2 = "#22232e",
}
return colors

@ -27,7 +27,7 @@ local colors = {
cyan = "#70c0b1",
statusline_bg = "#212326",
lightbg = "#373B41",
lightbg2 = "#2D3035"
lightbg2 = "#2D3035",
}
return colors

@ -10,7 +10,7 @@ M.change_theme = function(current_theme, new_theme)
return
end
local file = vim.fn.stdpath("config") .. "/lua/chadrc.lua"
local file = vim.fn.stdpath "config" .. "/lua/chadrc.lua"
-- store in data variable
local data = assert(M.file("r", file))
-- escape characters which can be parsed as magic chars
@ -29,12 +29,9 @@ M.change_theme = function(current_theme, new_theme)
end
M.clear_cmdline = function()
vim.defer_fn(
function()
vim.cmd("echo")
end,
0
)
vim.defer_fn(function()
vim.cmd "echo"
end, 0)
end
-- 1st arg - r or w
@ -63,7 +60,7 @@ end
M.list_themes = function(return_type)
local themes = {}
-- folder where theme files are stored
local themes_folder = vim.fn.stdpath("config") .. "/lua/themes"
local themes_folder = vim.fn.stdpath "config" .. "/lua/themes"
-- list all the contents of the folder and filter out files with .lua extension, then append to themes table
local fd = vim.loop.fs_scandir(themes_folder)
if fd then
@ -117,7 +114,7 @@ M.reload_theme = function(theme_name)
local reload_plugin = require("utils").reload_plugin
-- if theme name is empty or nil, then reload the current theme
if (theme_name == nil or theme_name == "") then
if theme_name == nil or theme_name == "" then
theme_name = vim.g.nvchad_theme
end
@ -131,7 +128,7 @@ M.reload_theme = function(theme_name)
-- reload the base16 theme
local ok, base16 = pcall(require, "base16")
if not ok then
print("Error: Cannot load base16 plugin!")
print "Error: Cannot load base16 plugin!"
return false
end
base16(base16.themes(theme_name), true)
@ -141,7 +138,7 @@ M.reload_theme = function(theme_name)
"highlights",
"plugins.bufferline",
"galaxyline",
"plugins.statusline"
"plugins.statusline",
}
then
print "Error: Not able to reload all plugins."
@ -151,12 +148,12 @@ M.reload_theme = function(theme_name)
-- yes, this is very hacky, but due to new_async in
-- https://github.com/glepnir/galaxyline.nvim/blob/main/lua/galaxyline/provider.lua#L5-L36
-- it doesn't work properly and some statusline stuff dissapears
local vcs = require("galaxyline.provider_vcs")
local fileinfo = require("galaxyline.provider_fileinfo")
local buffer = require("galaxyline.provider_buffer")
local extension = require("galaxyline.provider_extensions")
local whitespace = require("galaxyline.provider_whitespace")
local lspclient = require("galaxyline.provider_lsp")
local vcs = require "galaxyline.provider_vcs"
local fileinfo = require "galaxyline.provider_fileinfo"
local buffer = require "galaxyline.provider_buffer"
local extension = require "galaxyline.provider_extensions"
local whitespace = require "galaxyline.provider_whitespace"
local lspclient = require "galaxyline.provider_lsp"
_G.galaxyline_providers = {
BufferIcon = buffer.get_buffer_type_icon,
BufferNumber = buffer.get_buffer_number,
@ -176,9 +173,9 @@ M.reload_theme = function(theme_name)
ScrollBar = extension.scrollbar_instance,
VistaPlugin = extension.vista_nearest,
WhiteSpace = whitespace.get_item,
GetLspClient = lspclient.get_lsp_client
GetLspClient = lspclient.get_lsp_client,
}
local diagnostic = require("galaxyline.provider_diagnostic")
local diagnostic = require "galaxyline.provider_diagnostic"
_G.galaxyline_providers.DiagnosticError = diagnostic.get_diagnostic_error
_G.galaxyline_providers.DiagnosticWarn = diagnostic.get_diagnostic_warn
_G.galaxyline_providers.DiagnosticHint = diagnostic.get_diagnostic_hint
@ -195,7 +192,7 @@ M.toggle_theme = function(themes)
if name ~= current_theme then
if require("utils").reload_theme(name) then
-- open a buffer and close it to reload the statusline
vim.cmd("new|bwipeout")
vim.cmd "new|bwipeout"
vim.g.current_nvchad_theme = name
if M.change_theme(vim.g.nvchad_theme, name) then
vim.g.nvchad_theme = name

Loading…
Cancel
Save