chore: stylua formatting update (#261)
* addded stylua config file * chore: formatted with stylua
This commit is contained in:
parent
4abf43aa99
commit
86903ab982
6
.stylua.toml
Normal file
6
.stylua.toml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
column_width = 120
|
||||||
|
line_endings = "Unix"
|
||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 3
|
||||||
|
quote_style = "AutoPreferDouble"
|
||||||
|
no_call_parentheses = true
|
6
init.lua
6
init.lua
@ -1,8 +1,8 @@
|
|||||||
local chad_modules = {
|
local chad_modules = {
|
||||||
"options",
|
"options",
|
||||||
"mappings"
|
"mappings",
|
||||||
}
|
}
|
||||||
|
|
||||||
for i = 1, #chad_modules, 1 do
|
for i = 1, #chad_modules, 1 do
|
||||||
pcall(require, chad_modules[i])
|
pcall(require, chad_modules[i])
|
||||||
end
|
end
|
||||||
|
246
lua/chadrc.lua
246
lua/chadrc.lua
@ -1,127 +1,127 @@
|
|||||||
local M = {
|
local M = {
|
||||||
ui = {
|
ui = {
|
||||||
theme = "onedark",
|
theme = "onedark",
|
||||||
fav_themes = {"onedark", "gruvchad"}, -- for theme toggle
|
fav_themes = { "onedark", "gruvchad" }, -- for theme toggle
|
||||||
theme_toggler = false,
|
theme_toggler = false,
|
||||||
hidden_statusline = {
|
hidden_statusline = {
|
||||||
-- these are filetypes, not pattern matched
|
-- these are filetypes, not pattern matched
|
||||||
"NvimTree",
|
"NvimTree",
|
||||||
"toggleterm"
|
"toggleterm",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
options = {
|
options = {
|
||||||
permanent_undo = true,
|
permanent_undo = true,
|
||||||
ruler = false,
|
ruler = false,
|
||||||
hidden = true,
|
hidden = true,
|
||||||
ignorecase = true,
|
ignorecase = true,
|
||||||
mouse = "a",
|
mouse = "a",
|
||||||
cmdheight = 1,
|
cmdheight = 1,
|
||||||
updatetime = 250,
|
updatetime = 250,
|
||||||
timeoutlen = 400,
|
timeoutlen = 400,
|
||||||
clipboard = "unnamedplus",
|
clipboard = "unnamedplus",
|
||||||
number = true,
|
number = true,
|
||||||
numberwidth = 2,
|
numberwidth = 2,
|
||||||
expandtab = true,
|
expandtab = true,
|
||||||
shiftwidth = 2,
|
shiftwidth = 2,
|
||||||
smartindent = true,
|
smartindent = true,
|
||||||
mapleader = " ",
|
mapleader = " ",
|
||||||
autosave = false,
|
autosave = false,
|
||||||
enable_insertNav = true -- navigation in insertmode
|
enable_insertNav = true, -- navigation in insertmode
|
||||||
},
|
},
|
||||||
-- enable and disable plugins (true for disable)
|
-- enable and disable plugins (true for disable)
|
||||||
plugin_status = {
|
plugin_status = {
|
||||||
-- UI
|
-- UI
|
||||||
nvim_bufferline = true,
|
nvim_bufferline = true,
|
||||||
galaxyline = true,
|
galaxyline = true,
|
||||||
nvim_colorizer = true,
|
nvim_colorizer = true,
|
||||||
dashboard_nvim = true,
|
dashboard_nvim = true,
|
||||||
blankline = true,
|
blankline = true,
|
||||||
truezen_nvim = true,
|
truezen_nvim = true,
|
||||||
better_esc = true,
|
better_esc = true,
|
||||||
-- lsp stuff
|
-- lsp stuff
|
||||||
lspkind = true,
|
lspkind = true,
|
||||||
lspsignature = true,
|
lspsignature = true,
|
||||||
-- git stuff
|
-- git stuff
|
||||||
gitsigns = true,
|
gitsigns = true,
|
||||||
vim_fugitive = true,
|
vim_fugitive = true,
|
||||||
-- misc
|
-- misc
|
||||||
neoformat = true,
|
neoformat = true,
|
||||||
vim_matchup = true,
|
vim_matchup = true,
|
||||||
autosave_nvim = true,
|
autosave_nvim = true,
|
||||||
nvim_comment = true,
|
nvim_comment = true,
|
||||||
neoscroll_nvim = true,
|
neoscroll_nvim = true,
|
||||||
telescope_media = true
|
telescope_media = true,
|
||||||
},
|
},
|
||||||
-- make sure you dont use same keys twice
|
-- make sure you dont use same keys twice
|
||||||
mappings = {
|
mappings = {
|
||||||
truezen = {
|
truezen = {
|
||||||
ataraxisMode = "<leader>zz",
|
ataraxisMode = "<leader>zz",
|
||||||
minimalisticmode = "<leader>zm",
|
minimalisticmode = "<leader>zm",
|
||||||
focusmode = "<leader>zf"
|
focusmode = "<leader>zf",
|
||||||
},
|
},
|
||||||
comment_nvim = {
|
comment_nvim = {
|
||||||
comment_toggle = "<leader>/"
|
comment_toggle = "<leader>/",
|
||||||
},
|
},
|
||||||
nvimtree = {
|
nvimtree = {
|
||||||
treetoggle = "<C-n>"
|
treetoggle = "<C-n>",
|
||||||
},
|
},
|
||||||
neoformat = {
|
neoformat = {
|
||||||
format = "<leader>fm"
|
format = "<leader>fm",
|
||||||
},
|
},
|
||||||
dashboard = {
|
dashboard = {
|
||||||
open = "<leader>db",
|
open = "<leader>db",
|
||||||
newfile = "<leader>fn",
|
newfile = "<leader>fn",
|
||||||
bookmarks = "<leader>bm",
|
bookmarks = "<leader>bm",
|
||||||
sessionload = "<leader>l",
|
sessionload = "<leader>l",
|
||||||
sessionsave = "<leader>s"
|
sessionsave = "<leader>s",
|
||||||
},
|
},
|
||||||
telescope = {
|
telescope = {
|
||||||
live_grep = "<leader>fw",
|
live_grep = "<leader>fw",
|
||||||
git_status = "<leader>gt",
|
git_status = "<leader>gt",
|
||||||
git_commits = "<leader>cm",
|
git_commits = "<leader>cm",
|
||||||
find_files = "<leader>ff",
|
find_files = "<leader>ff",
|
||||||
buffers = "<leader>fb",
|
buffers = "<leader>fb",
|
||||||
help_tags = "<leader>fh",
|
help_tags = "<leader>fh",
|
||||||
oldfiles = "<leader>fo",
|
oldfiles = "<leader>fo",
|
||||||
themes = "<leader>th"
|
themes = "<leader>th",
|
||||||
},
|
},
|
||||||
telescope_media = {
|
telescope_media = {
|
||||||
media_files = "<leader>fp"
|
media_files = "<leader>fp",
|
||||||
},
|
},
|
||||||
bufferline = {
|
bufferline = {
|
||||||
new_buffer = "<S-t>",
|
new_buffer = "<S-t>",
|
||||||
newtab = "<C-t>b",
|
newtab = "<C-t>b",
|
||||||
close = "<S-x>",
|
close = "<S-x>",
|
||||||
cycleNext = "<TAB>",
|
cycleNext = "<TAB>",
|
||||||
cyclePrev = "<S-Tab>"
|
cyclePrev = "<S-Tab>",
|
||||||
},
|
},
|
||||||
fugitive = {
|
fugitive = {
|
||||||
Git = "<leader>gs",
|
Git = "<leader>gs",
|
||||||
diffget_2 = "<leader>gh",
|
diffget_2 = "<leader>gh",
|
||||||
diffget_3 = "<leader>gl",
|
diffget_3 = "<leader>gl",
|
||||||
git_blame = "<leader>gb"
|
git_blame = "<leader>gb",
|
||||||
},
|
},
|
||||||
toggleterm = {
|
toggleterm = {
|
||||||
toggle_window = "<leader>w",
|
toggle_window = "<leader>w",
|
||||||
toggle_vert = "<leader>v",
|
toggle_vert = "<leader>v",
|
||||||
toggle_hori = "<leader>h",
|
toggle_hori = "<leader>h",
|
||||||
hide_term = "JK"
|
hide_term = "JK",
|
||||||
},
|
},
|
||||||
insert_nav = {
|
insert_nav = {
|
||||||
forward = "<C-l>",
|
forward = "<C-l>",
|
||||||
backward = "<C-h>",
|
backward = "<C-h>",
|
||||||
top_of_line = "<C-a>",
|
top_of_line = "<C-a>",
|
||||||
end_of_line = "<C-e>",
|
end_of_line = "<C-e>",
|
||||||
prev_line = "<C-j>",
|
prev_line = "<C-j>",
|
||||||
next_line = "<C-k>"
|
next_line = "<C-k>",
|
||||||
},
|
},
|
||||||
misc = {
|
misc = {
|
||||||
esc_Termmode = "jk",
|
esc_Termmode = "jk",
|
||||||
copywhole_file = "<C-a>",
|
copywhole_file = "<C-a>",
|
||||||
toggle_linenr = "<leader>n",
|
toggle_linenr = "<leader>n",
|
||||||
theme_toggle = "<leader>x"
|
theme_toggle = "<leader>x",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -25,15 +25,15 @@ local purple = colors.purple
|
|||||||
-- for guifg , bg
|
-- for guifg , bg
|
||||||
|
|
||||||
local function fg(group, color)
|
local function fg(group, color)
|
||||||
cmd("hi " .. group .. " guifg=" .. color)
|
cmd("hi " .. group .. " guifg=" .. color)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function bg(group, color)
|
local function bg(group, color)
|
||||||
cmd("hi " .. group .. " guibg=" .. color)
|
cmd("hi " .. group .. " guibg=" .. color)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fg_bg(group, fgcol, bgcol)
|
local function fg_bg(group, fgcol, bgcol)
|
||||||
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
|
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- blankline
|
-- blankline
|
||||||
|
144
lua/mappings.lua
144
lua/mappings.lua
@ -5,11 +5,11 @@ local M = {}
|
|||||||
local cmd = vim.cmd
|
local cmd = vim.cmd
|
||||||
|
|
||||||
local function map(mode, lhs, rhs, opts)
|
local function map(mode, lhs, rhs, opts)
|
||||||
local options = {noremap = true, silent = true}
|
local options = { noremap = true, silent = true }
|
||||||
if opts then
|
if opts then
|
||||||
options = vim.tbl_extend("force", options, opts)
|
options = vim.tbl_extend("force", options, opts)
|
||||||
end
|
end
|
||||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
local opt = {}
|
local opt = {}
|
||||||
@ -30,10 +30,10 @@ map("v", "p", '"_dP', opt)
|
|||||||
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
-- 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/
|
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
||||||
-- empty mode is same as using :map
|
-- empty mode is same as using :map
|
||||||
map("", "j", 'v:count ? "j" : "gj"', {expr = true})
|
map("", "j", 'v:count ? "j" : "gj"', { expr = true })
|
||||||
map("", "k", 'v:count ? "k" : "gk"', {expr = true})
|
map("", "k", 'v:count ? "k" : "gk"', { expr = true })
|
||||||
map("", "<Down>", 'v:count ? "j" : "gj"', {expr = true})
|
map("", "<Down>", 'v:count ? "j" : "gj"', { expr = true })
|
||||||
map("", "<Up>", 'v:count ? "k" : "gk"', {expr = true})
|
map("", "<Up>", 'v:count ? "k" : "gk"', { expr = true })
|
||||||
|
|
||||||
-- copy whole file content
|
-- copy whole file content
|
||||||
map("n", miscMap.copywhole_file, ":%y+<CR>", opt)
|
map("n", miscMap.copywhole_file, ":%y+<CR>", opt)
|
||||||
@ -46,125 +46,125 @@ map("n", miscMap.toggle_linenr, ":set nu!<CR>", opt)
|
|||||||
map("t", miscMap.esc_Termmode, "<C-\\><C-n>", opt)
|
map("t", miscMap.esc_Termmode, "<C-\\><C-n>", opt)
|
||||||
|
|
||||||
M.toggleterm = function()
|
M.toggleterm = function()
|
||||||
local m = user_map.toggleterm
|
local m = user_map.toggleterm
|
||||||
|
|
||||||
-- Open terminals
|
-- Open terminals
|
||||||
map("n", m.toggle_window, ":lua termW:toggle() <CR>", opt)
|
map("n", m.toggle_window, ":lua termW:toggle() <CR>", opt)
|
||||||
map("n", m.toggle_vert, ":lua termV:toggle() <CR>", opt)
|
map("n", m.toggle_vert, ":lua termV:toggle() <CR>", opt)
|
||||||
map("n", m.toggle_hori, ":lua termH:toggle() <CR>", opt)
|
map("n", m.toggle_hori, ":lua termH:toggle() <CR>", opt)
|
||||||
|
|
||||||
-- toggle(HIDE) a term from within terminal edit mode
|
-- toggle(HIDE) a term from within terminal edit mode
|
||||||
map("t", m.hide_term, "<C-\\><C-n> :ToggleTerm <CR>", opt)
|
map("t", m.hide_term, "<C-\\><C-n> :ToggleTerm <CR>", opt)
|
||||||
map("t", m.hide_term, "<C-\\><C-n> :ToggleTerm <CR>", opt)
|
map("t", m.hide_term, "<C-\\><C-n> :ToggleTerm <CR>", opt)
|
||||||
map("t", m.hide_term, "<C-\\><C-n> :ToggleTerm <CR>", opt)
|
map("t", m.hide_term, "<C-\\><C-n> :ToggleTerm <CR>", opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.truezen = function()
|
M.truezen = function()
|
||||||
local m = user_map.truezen
|
local m = user_map.truezen
|
||||||
|
|
||||||
map("n", m.ataraxisMode, ":TZAtaraxis<CR>", opt)
|
map("n", m.ataraxisMode, ":TZAtaraxis<CR>", opt)
|
||||||
map("n", m.minimalisticmode, ":TZMinimalist<CR>", opt)
|
map("n", m.minimalisticmode, ":TZMinimalist<CR>", opt)
|
||||||
map("n", m.focusmode, ":TZFocus<CR>", opt)
|
map("n", m.focusmode, ":TZFocus<CR>", opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
map("n", "<C-s>", ":w <CR>", opt)
|
map("n", "<C-s>", ":w <CR>", opt)
|
||||||
|
|
||||||
M.comment_nvim = function()
|
M.comment_nvim = function()
|
||||||
local m = user_map.comment_nvim.comment_toggle
|
local m = user_map.comment_nvim.comment_toggle
|
||||||
map("n", m, ":CommentToggle<CR>", opt)
|
map("n", m, ":CommentToggle<CR>", opt)
|
||||||
map("v", m, ":CommentToggle<CR>", opt)
|
map("v", m, ":CommentToggle<CR>", opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.nvimtree = function()
|
M.nvimtree = function()
|
||||||
local m = user_map.nvimtree.treetoggle
|
local m = user_map.nvimtree.treetoggle
|
||||||
|
|
||||||
map("n", m, ":NvimTreeToggle<CR>", opt)
|
map("n", m, ":NvimTreeToggle<CR>", opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.neoformat = function()
|
M.neoformat = function()
|
||||||
local m = user_map.neoformat.format
|
local m = user_map.neoformat.format
|
||||||
map("n", m, ":Neoformat<CR>", opt)
|
map("n", m, ":Neoformat<CR>", opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.dashboard = function()
|
M.dashboard = function()
|
||||||
local m = user_map.dashboard
|
local m = user_map.dashboard
|
||||||
|
|
||||||
map("n", m.open, ":Dashboard<CR>", opt)
|
map("n", m.open, ":Dashboard<CR>", opt)
|
||||||
map("n", m.newfile, ":DashboardNewFile<CR>", opt)
|
map("n", m.newfile, ":DashboardNewFile<CR>", opt)
|
||||||
map("n", m.bookmarks, ":DashboardJumpMarks<CR>", opt)
|
map("n", m.bookmarks, ":DashboardJumpMarks<CR>", opt)
|
||||||
map("n", m.sessionload, ":SessionLoad<CR>", opt)
|
map("n", m.sessionload, ":SessionLoad<CR>", opt)
|
||||||
map("n", m.sessionsave, ":SessionSave<CR>", opt)
|
map("n", m.sessionsave, ":SessionSave<CR>", opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.telescope = function()
|
M.telescope = function()
|
||||||
local m = user_map.telescope
|
local m = user_map.telescope
|
||||||
|
|
||||||
map("n", m.live_grep, ":Telescope live_grep<CR>", opt)
|
map("n", m.live_grep, ":Telescope live_grep<CR>", opt)
|
||||||
map("n", m.git_status, ":Telescope git_status <CR>", opt)
|
map("n", m.git_status, ":Telescope git_status <CR>", opt)
|
||||||
map("n", m.git_commits, ":Telescope git_commits <CR>", opt)
|
map("n", m.git_commits, ":Telescope git_commits <CR>", opt)
|
||||||
map("n", m.find_files, ":Telescope find_files <CR>", opt)
|
map("n", m.find_files, ":Telescope find_files <CR>", opt)
|
||||||
map("n", m.buffers, ":Telescope buffers<CR>", opt)
|
map("n", m.buffers, ":Telescope buffers<CR>", opt)
|
||||||
map("n", m.help_tags, ":Telescope help_tags<CR>", opt)
|
map("n", m.help_tags, ":Telescope help_tags<CR>", opt)
|
||||||
map("n", m.oldfiles, ":Telescope oldfiles<CR>", opt)
|
map("n", m.oldfiles, ":Telescope oldfiles<CR>", opt)
|
||||||
map("n", m.themes, ":Telescope themes<CR>", opt)
|
map("n", m.themes, ":Telescope themes<CR>", opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.telescope_media = function()
|
M.telescope_media = function()
|
||||||
local m = user_map.telescope_media
|
local m = user_map.telescope_media
|
||||||
map("n", m.media_files, ":Telescope media_files <CR>", opt)
|
map("n", m.media_files, ":Telescope media_files <CR>", opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.bufferline = function()
|
M.bufferline = function()
|
||||||
local m = user_map.bufferline
|
local m = user_map.bufferline
|
||||||
|
|
||||||
map("n", m.new_buffer, ":enew<CR>", opt) -- new buffer
|
map("n", m.new_buffer, ":enew<CR>", opt) -- new buffer
|
||||||
map("n", m.newtab, ":tabnew<CR>", opt) -- new tab
|
map("n", m.newtab, ":tabnew<CR>", opt) -- new tab
|
||||||
map("n", m.close, ":bd!<CR>", opt) -- close buffer
|
map("n", m.close, ":bd!<CR>", opt) -- close buffer
|
||||||
|
|
||||||
-- move between tabs
|
-- move between tabs
|
||||||
|
|
||||||
map("n", m.cycleNext, ":BufferLineCycleNext<CR>", opt)
|
map("n", m.cycleNext, ":BufferLineCycleNext<CR>", opt)
|
||||||
map("n", m.cyclePrev, ":BufferLineCyclePrev<CR>", opt)
|
map("n", m.cyclePrev, ":BufferLineCyclePrev<CR>", opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- use ESC to turn off search highlighting
|
-- use ESC to turn off search highlighting
|
||||||
map("n", "<Esc>", ":noh<CR>", opt)
|
map("n", "<Esc>", ":noh<CR>", opt)
|
||||||
|
|
||||||
-- Packer commands till because we are not loading it at startup
|
-- Packer commands till because we are not loading it at startup
|
||||||
cmd("silent! command PackerCompile lua require 'pluginList' require('packer').compile()")
|
cmd "silent! command PackerCompile lua require 'pluginList' require('packer').compile()"
|
||||||
cmd("silent! command PackerInstall lua require 'pluginList' require('packer').install()")
|
cmd "silent! command PackerInstall lua require 'pluginList' require('packer').install()"
|
||||||
cmd("silent! command PackerStatus lua require 'pluginList' require('packer').status()")
|
cmd "silent! command PackerStatus lua require 'pluginList' require('packer').status()"
|
||||||
cmd("silent! command PackerSync lua require 'pluginList' require('packer').sync()")
|
cmd "silent! command PackerSync lua require 'pluginList' require('packer').sync()"
|
||||||
cmd("silent! command PackerUpdate lua require 'pluginList' require('packer').update()")
|
cmd "silent! command PackerUpdate lua require 'pluginList' require('packer').update()"
|
||||||
|
|
||||||
M.fugitive = function()
|
M.fugitive = function()
|
||||||
local m = user_map.fugitive
|
local m = user_map.fugitive
|
||||||
|
|
||||||
map("n", m.Git, ":Git<CR>", opt)
|
map("n", m.Git, ":Git<CR>", opt)
|
||||||
map("n", m.diffget_2, ":diffget //2<CR>", opt)
|
map("n", m.diffget_2, ":diffget //2<CR>", opt)
|
||||||
map("n", m.diffget_3, ":diffget //3<CR>", opt)
|
map("n", m.diffget_3, ":diffget //3<CR>", opt)
|
||||||
map("n", m.git_blame, ":Git blame<CR>", opt)
|
map("n", m.git_blame, ":Git blame<CR>", opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- navigation within insert mode
|
-- navigation within insert mode
|
||||||
local check_insertNav = require("chadrc").options.enable_insertNav
|
local check_insertNav = require("chadrc").options.enable_insertNav
|
||||||
|
|
||||||
if check_insertNav == true then
|
if check_insertNav == true then
|
||||||
local m = user_map.insert_nav
|
local m = user_map.insert_nav
|
||||||
|
|
||||||
map("i", m.forward, "<Right>", opt)
|
map("i", m.forward, "<Right>", opt)
|
||||||
map("i", m.backward, "<Left>", opt)
|
map("i", m.backward, "<Left>", opt)
|
||||||
map("i", m.top_of_line, "<ESC>^i", opt)
|
map("i", m.top_of_line, "<ESC>^i", opt)
|
||||||
map("i", m.end_of_line, "<End>", opt)
|
map("i", m.end_of_line, "<End>", opt)
|
||||||
map("i", m.next_line, "<Up>", opt)
|
map("i", m.next_line, "<Up>", opt)
|
||||||
map("i", m.prev_line, "<Down>", opt)
|
map("i", m.prev_line, "<Down>", opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
local theme_toggler = require("chadrc").ui.theme_toggler
|
local theme_toggler = require("chadrc").ui.theme_toggler
|
||||||
|
|
||||||
if theme_toggler == true then
|
if theme_toggler == true then
|
||||||
local m = user_map.misc.theme_toggle
|
local m = user_map.misc.theme_toggle
|
||||||
|
|
||||||
map("n", m, ":lua require('utils').toggle_theme(require('chadrc').ui.fav_themes)<CR>", opt)
|
map("n", m, ":lua require('utils').toggle_theme(require('chadrc').ui.fav_themes)<CR>", opt)
|
||||||
end
|
end
|
||||||
return M
|
return M
|
||||||
|
@ -2,7 +2,7 @@ local options = require("chadrc").options
|
|||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
|
||||||
opt.completeopt = {"menuone", "noselect"}
|
opt.completeopt = { "menuone", "noselect" }
|
||||||
opt.undofile = options.permanent_undo
|
opt.undofile = options.permanent_undo
|
||||||
opt.ruler = options.ruler
|
opt.ruler = options.ruler
|
||||||
opt.hidden = options.hidden
|
opt.hidden = options.hidden
|
||||||
@ -19,10 +19,10 @@ opt.timeoutlen = options.timeoutlen
|
|||||||
opt.clipboard = options.clipboard
|
opt.clipboard = options.clipboard
|
||||||
|
|
||||||
-- disable nvim intro
|
-- 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
|
-- disable tilde on end of buffer: https://github.com/ neovim/neovim/pull/8546#issuecomment-643643758
|
||||||
opt.fillchars = {eob = " "}
|
opt.fillchars = { eob = " " }
|
||||||
|
|
||||||
-- Numbers
|
-- Numbers
|
||||||
opt.number = options.number
|
opt.number = options.number
|
||||||
@ -36,35 +36,35 @@ opt.smartindent = options.smartindent
|
|||||||
|
|
||||||
-- go to previous/next line with h,l,left arrow and right arrow
|
-- go to previous/next line with h,l,left arrow and right arrow
|
||||||
-- when cursor reaches end/beginning of line
|
-- when cursor reaches end/beginning of line
|
||||||
opt.whichwrap:append("<>hl")
|
opt.whichwrap:append "<>hl"
|
||||||
|
|
||||||
g.mapleader = options.mapleader
|
g.mapleader = options.mapleader
|
||||||
g.auto_save = options.autosave
|
g.auto_save = options.autosave
|
||||||
|
|
||||||
-- disable builtin vim plugins
|
-- disable builtin vim plugins
|
||||||
local disabled_built_ins = {
|
local disabled_built_ins = {
|
||||||
"netrw",
|
"netrw",
|
||||||
"netrwPlugin",
|
"netrwPlugin",
|
||||||
"netrwSettings",
|
"netrwSettings",
|
||||||
"netrwFileHandlers",
|
"netrwFileHandlers",
|
||||||
"gzip",
|
"gzip",
|
||||||
"zip",
|
"zip",
|
||||||
"zipPlugin",
|
"zipPlugin",
|
||||||
"tar",
|
"tar",
|
||||||
"tarPlugin",
|
"tarPlugin",
|
||||||
"getscript",
|
"getscript",
|
||||||
"getscriptPlugin",
|
"getscriptPlugin",
|
||||||
"vimball",
|
"vimball",
|
||||||
"vimballPlugin",
|
"vimballPlugin",
|
||||||
"2html_plugin",
|
"2html_plugin",
|
||||||
"logipat",
|
"logipat",
|
||||||
"rrhelper",
|
"rrhelper",
|
||||||
"spellfile_plugin",
|
"spellfile_plugin",
|
||||||
"matchit"
|
"matchit",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, plugin in pairs(disabled_built_ins) do
|
for _, plugin in pairs(disabled_built_ins) do
|
||||||
g["loaded_" .. plugin] = 1
|
g["loaded_" .. plugin] = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Don't show status line on certain windows
|
-- Don't show status line on certain windows
|
||||||
|
@ -1,47 +1,45 @@
|
|||||||
local cmd = vim.cmd
|
local cmd = vim.cmd
|
||||||
|
|
||||||
cmd("packadd packer.nvim")
|
cmd "packadd packer.nvim"
|
||||||
|
|
||||||
local present, packer = pcall(require, "packer")
|
local present, packer = pcall(require, "packer")
|
||||||
|
|
||||||
if not present then
|
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
|
-- remove the dir before cloning
|
||||||
vim.fn.delete(packer_path, "rf")
|
vim.fn.delete(packer_path, "rf")
|
||||||
vim.fn.system(
|
vim.fn.system {
|
||||||
{
|
"git",
|
||||||
"git",
|
"clone",
|
||||||
"clone",
|
"https://github.com/wbthomason/packer.nvim",
|
||||||
"https://github.com/wbthomason/packer.nvim",
|
"--depth",
|
||||||
"--depth",
|
"20",
|
||||||
"20",
|
packer_path,
|
||||||
packer_path
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
cmd("packadd packer.nvim")
|
cmd "packadd packer.nvim"
|
||||||
present, packer = pcall(require, "packer")
|
present, packer = pcall(require, "packer")
|
||||||
|
|
||||||
if present then
|
if present then
|
||||||
print("Packer cloned successfully.")
|
print "Packer cloned successfully."
|
||||||
else
|
else
|
||||||
error("Couldn't clone packer !\nPacker path: " .. packer_path)
|
error("Couldn't clone packer !\nPacker path: " .. packer_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return packer.init {
|
return packer.init {
|
||||||
display = {
|
display = {
|
||||||
open_fn = function()
|
open_fn = function()
|
||||||
return require("packer.util").float {border = "single"}
|
return require("packer.util").float { border = "single" }
|
||||||
end,
|
end,
|
||||||
prompt_border = "single"
|
prompt_border = "single",
|
||||||
},
|
},
|
||||||
git = {
|
git = {
|
||||||
clone_timeout = 600 -- Timeout, in seconds, for git clones
|
clone_timeout = 600, -- Timeout, in seconds, for git clones
|
||||||
},
|
},
|
||||||
auto_clean = true,
|
auto_clean = true,
|
||||||
compile_on_sync = true
|
compile_on_sync = true,
|
||||||
-- auto_reload_compiled = true
|
-- auto_reload_compiled = true
|
||||||
}
|
}
|
||||||
|
@ -4,315 +4,313 @@ local present, _ = pcall(require, "packerInit")
|
|||||||
local packer
|
local packer
|
||||||
|
|
||||||
if present then
|
if present then
|
||||||
packer = require "packer"
|
packer = require "packer"
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local use = packer.use
|
local use = packer.use
|
||||||
|
|
||||||
return packer.startup(
|
return packer.startup(function()
|
||||||
function()
|
use {
|
||||||
use {
|
"wbthomason/packer.nvim",
|
||||||
"wbthomason/packer.nvim",
|
event = "VimEnter",
|
||||||
event = "VimEnter"
|
}
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"jdhao/better-escape.vim",
|
"jdhao/better-escape.vim",
|
||||||
disable = not plugin_status.better_esc,
|
disable = not plugin_status.better_esc,
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.others".escape()
|
require("plugins.others").escape()
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"akinsho/nvim-bufferline.lua",
|
"akinsho/nvim-bufferline.lua",
|
||||||
disable = not plugin_status.nvim_bufferline,
|
disable = not plugin_status.nvim_bufferline,
|
||||||
after = "nvim-base16.lua",
|
after = "nvim-base16.lua",
|
||||||
|
config = function()
|
||||||
|
require "plugins.bufferline"
|
||||||
|
end,
|
||||||
|
setup = function()
|
||||||
|
require("mappings").bufferline()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"glepnir/galaxyline.nvim",
|
||||||
|
disable = not plugin_status.galaxyline,
|
||||||
|
after = "nvim-base16.lua",
|
||||||
|
config = function()
|
||||||
|
require "plugins.statusline"
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- color related stuff
|
||||||
|
use {
|
||||||
|
"NvChad/nvim-base16.lua",
|
||||||
|
after = "packer.nvim",
|
||||||
|
config = function()
|
||||||
|
require "theme"
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"norcalli/nvim-colorizer.lua",
|
||||||
|
disable = not plugin_status.nvim_colorizer,
|
||||||
|
event = "BufRead",
|
||||||
|
config = function()
|
||||||
|
require("plugins.others").colorizer()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- lsp stuff
|
||||||
|
use {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
event = "BufRead",
|
||||||
|
config = function()
|
||||||
|
require "plugins.treesitter"
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"kabouzeid/nvim-lspinstall",
|
||||||
|
event = "BufRead",
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
after = "nvim-lspinstall",
|
||||||
|
config = function()
|
||||||
|
require "plugins.lspconfig"
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"onsails/lspkind-nvim",
|
||||||
|
disable = not plugin_status.lspkind,
|
||||||
|
event = "BufEnter",
|
||||||
|
config = function()
|
||||||
|
require("plugins.others").lspkind()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"ray-x/lsp_signature.nvim",
|
||||||
|
disable = not plugin_status.lspsignature,
|
||||||
|
after = "nvim-lspconfig",
|
||||||
|
config = function()
|
||||||
|
require("plugins.others").signature()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- load compe in insert mode only
|
||||||
|
use {
|
||||||
|
"hrsh7th/nvim-compe",
|
||||||
|
event = "InsertEnter",
|
||||||
|
config = function()
|
||||||
|
require "plugins.compe"
|
||||||
|
end,
|
||||||
|
wants = "LuaSnip",
|
||||||
|
requires = {
|
||||||
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
wants = "friendly-snippets",
|
||||||
|
event = "InsertCharPre",
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.bufferline"
|
require "plugins.luasnip"
|
||||||
end,
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
|
event = "InsertCharPre",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"sbdchd/neoformat",
|
||||||
|
disable = not plugin_status.neoformat,
|
||||||
|
cmd = "Neoformat",
|
||||||
|
setup = function()
|
||||||
|
require("mappings").neoformat()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- file managing , picker etc
|
||||||
|
use {
|
||||||
|
"kyazdani42/nvim-tree.lua",
|
||||||
|
cmd = "NvimTreeToggle",
|
||||||
|
config = function()
|
||||||
|
require "plugins.nvimtree"
|
||||||
|
end,
|
||||||
|
setup = function()
|
||||||
|
require("mappings").nvimtree()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"kyazdani42/nvim-web-devicons",
|
||||||
|
after = "nvim-base16.lua",
|
||||||
|
config = function()
|
||||||
|
require "plugins.icons"
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
event = "BufRead",
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
"nvim-lua/popup.nvim",
|
||||||
|
after = "plenary.nvim",
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
cmd = "Telescope",
|
||||||
|
requires = {
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
|
run = "make",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-media-files.nvim",
|
||||||
|
disable = not plugin_status.telescope_media,
|
||||||
setup = function()
|
setup = function()
|
||||||
require "mappings".bufferline()
|
require("mappings").telescope_media()
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
"glepnir/galaxyline.nvim",
|
|
||||||
disable = not plugin_status.galaxyline,
|
|
||||||
after = "nvim-base16.lua",
|
|
||||||
config = function()
|
|
||||||
require "plugins.statusline"
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
-- color related stuff
|
|
||||||
use {
|
|
||||||
"NvChad/nvim-base16.lua",
|
|
||||||
after = "packer.nvim",
|
|
||||||
config = function()
|
|
||||||
require "theme"
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
"norcalli/nvim-colorizer.lua",
|
|
||||||
disable = not plugin_status.nvim_colorizer,
|
|
||||||
event = "BufRead",
|
|
||||||
config = function()
|
|
||||||
require("plugins.others").colorizer()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
-- lsp stuff
|
|
||||||
use {
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
event = "BufRead",
|
|
||||||
config = function()
|
|
||||||
require "plugins.treesitter"
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
"kabouzeid/nvim-lspinstall",
|
|
||||||
event = "BufRead"
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
after = "nvim-lspinstall",
|
|
||||||
config = function()
|
|
||||||
require "plugins.lspconfig"
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
"onsails/lspkind-nvim",
|
|
||||||
disable = not plugin_status.lspkind,
|
|
||||||
event = "BufEnter",
|
|
||||||
config = function()
|
|
||||||
require("plugins.others").lspkind()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
"ray-x/lsp_signature.nvim",
|
|
||||||
disable = not plugin_status.lspsignature,
|
|
||||||
after = "nvim-lspconfig",
|
|
||||||
config = function()
|
|
||||||
require("plugins.others").signature()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
-- load compe in insert mode only
|
|
||||||
use {
|
|
||||||
"hrsh7th/nvim-compe",
|
|
||||||
event = "InsertEnter",
|
|
||||||
config = function()
|
|
||||||
require "plugins.compe"
|
|
||||||
end,
|
end,
|
||||||
wants = "LuaSnip",
|
},
|
||||||
requires = {
|
},
|
||||||
{
|
config = function()
|
||||||
"L3MON4D3/LuaSnip",
|
require "plugins.telescope"
|
||||||
wants = "friendly-snippets",
|
end,
|
||||||
event = "InsertCharPre",
|
setup = function()
|
||||||
config = function()
|
require("mappings").telescope()
|
||||||
require "plugins.luasnip"
|
end,
|
||||||
end
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"rafamadriz/friendly-snippets",
|
|
||||||
event = "InsertCharPre"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
-- git stuff
|
||||||
"sbdchd/neoformat",
|
use {
|
||||||
disable = not plugin_status.neoformat,
|
"lewis6991/gitsigns.nvim",
|
||||||
cmd = "Neoformat",
|
disable = not plugin_status.gitsigns,
|
||||||
setup = function()
|
after = "plenary.nvim",
|
||||||
require "mappings".neoformat()
|
config = function()
|
||||||
end
|
require "plugins.gitsigns"
|
||||||
}
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
-- file managing , picker etc
|
-- misc plugins
|
||||||
use {
|
use {
|
||||||
"kyazdani42/nvim-tree.lua",
|
"akinsho/nvim-toggleterm.lua",
|
||||||
cmd = "NvimTreeToggle",
|
event = "BufWinEnter",
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.nvimtree"
|
require "plugins.toggleterm"
|
||||||
end,
|
end,
|
||||||
setup = function()
|
setup = function()
|
||||||
require "mappings".nvimtree()
|
require("mappings").toggleterm()
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
|
use {
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
after = "nvim-compe",
|
||||||
|
config = function()
|
||||||
|
require "plugins.autopairs"
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"kyazdani42/nvim-web-devicons",
|
"andymass/vim-matchup",
|
||||||
after = "nvim-base16.lua",
|
disable = not plugin_status.vim_matchup,
|
||||||
config = function()
|
event = "CursorMoved",
|
||||||
require "plugins.icons"
|
}
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"nvim-lua/plenary.nvim",
|
"terrortylor/nvim-comment",
|
||||||
event = "BufRead"
|
disable = not plugin_status.nvim_comment,
|
||||||
}
|
cmd = "CommentToggle",
|
||||||
use {
|
config = function()
|
||||||
"nvim-lua/popup.nvim",
|
require("plugins.others").comment()
|
||||||
after = "plenary.nvim"
|
end,
|
||||||
}
|
setup = function()
|
||||||
|
require("mappings").comment_nvim()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"nvim-telescope/telescope.nvim",
|
"glepnir/dashboard-nvim",
|
||||||
cmd = "Telescope",
|
disable = not plugin_status.dashboard_nvim,
|
||||||
requires = {
|
cmd = {
|
||||||
{
|
"Dashboard",
|
||||||
"nvim-telescope/telescope-fzf-native.nvim",
|
"DashboardNewFile",
|
||||||
run = "make"
|
"DashboardJumpMarks",
|
||||||
},
|
"SessionLoad",
|
||||||
{
|
"SessionSave",
|
||||||
"nvim-telescope/telescope-media-files.nvim",
|
},
|
||||||
disable = not plugin_status.telescope_media,
|
setup = function()
|
||||||
setup = function()
|
require "plugins.dashboard"
|
||||||
require "mappings".telescope_media()
|
require("mappings").dashboard()
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require "plugins.telescope"
|
|
||||||
end,
|
|
||||||
setup = function()
|
|
||||||
require "mappings".telescope()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
-- git stuff
|
-- load autosave only if its globally enabled
|
||||||
use {
|
use {
|
||||||
"lewis6991/gitsigns.nvim",
|
disable = not plugin_status.autosave_nvim,
|
||||||
disable = not plugin_status.gitsigns,
|
"Pocco81/AutoSave.nvim",
|
||||||
after = "plenary.nvim",
|
config = function()
|
||||||
config = function()
|
require "plugins.autosave"
|
||||||
require "plugins.gitsigns"
|
end,
|
||||||
end
|
cond = function()
|
||||||
}
|
return vim.g.auto_save == true
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
-- misc plugins
|
-- smooth scroll
|
||||||
use {
|
use {
|
||||||
"akinsho/nvim-toggleterm.lua",
|
"karb94/neoscroll.nvim",
|
||||||
event = "BufWinEnter",
|
disable = not plugin_status.neoscroll_nvim,
|
||||||
config = function()
|
event = "WinScrolled",
|
||||||
require "plugins.toggleterm"
|
config = function()
|
||||||
end,
|
require("plugins.others").neoscroll()
|
||||||
setup = function()
|
end,
|
||||||
require "mappings".toggleterm()
|
}
|
||||||
end
|
|
||||||
}
|
|
||||||
use {
|
|
||||||
"windwp/nvim-autopairs",
|
|
||||||
after = "nvim-compe",
|
|
||||||
config = function()
|
|
||||||
require "plugins.autopairs"
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"andymass/vim-matchup",
|
"Pocco81/TrueZen.nvim",
|
||||||
disable = not plugin_status.vim_matchup,
|
disable = not plugin_status.truezen_nvim,
|
||||||
event = "CursorMoved"
|
cmd = {
|
||||||
}
|
"TZAtaraxis",
|
||||||
|
"TZMinimalist",
|
||||||
|
"TZFocus",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require "plugins.zenmode"
|
||||||
|
end,
|
||||||
|
setup = function()
|
||||||
|
require("mappings").truezen()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
use {
|
-- use "alvan/vim-closetag" -- for html autoclosing tag
|
||||||
"terrortylor/nvim-comment",
|
|
||||||
disable = not plugin_status.nvim_comment,
|
|
||||||
cmd = "CommentToggle",
|
|
||||||
config = function()
|
|
||||||
require("plugins.others").comment()
|
|
||||||
end,
|
|
||||||
setup = function()
|
|
||||||
require "mappings".comment_nvim()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"glepnir/dashboard-nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
disable = not plugin_status.dashboard_nvim,
|
disable = not plugin_status.blankline,
|
||||||
cmd = {
|
event = "BufRead",
|
||||||
"Dashboard",
|
setup = function()
|
||||||
"DashboardNewFile",
|
require("plugins.others").blankline()
|
||||||
"DashboardJumpMarks",
|
end,
|
||||||
"SessionLoad",
|
}
|
||||||
"SessionSave"
|
|
||||||
},
|
|
||||||
setup = function()
|
|
||||||
require "plugins.dashboard"
|
|
||||||
require "mappings".dashboard()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
-- load autosave only if its globally enabled
|
use {
|
||||||
use {
|
"tpope/vim-fugitive",
|
||||||
disable = not plugin_status.autosave_nvim,
|
disable = not plugin_status.vim_fugitive,
|
||||||
"Pocco81/AutoSave.nvim",
|
cmd = {
|
||||||
config = function()
|
"Git",
|
||||||
require "plugins.autosave"
|
},
|
||||||
end,
|
setup = function()
|
||||||
cond = function()
|
require("mappings").fugitive()
|
||||||
return vim.g.auto_save == true
|
end,
|
||||||
end
|
}
|
||||||
}
|
end)
|
||||||
|
|
||||||
-- smooth scroll
|
|
||||||
use {
|
|
||||||
"karb94/neoscroll.nvim",
|
|
||||||
disable = not plugin_status.neoscroll_nvim,
|
|
||||||
event = "WinScrolled",
|
|
||||||
config = function()
|
|
||||||
require("plugins.others").neoscroll()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
"Pocco81/TrueZen.nvim",
|
|
||||||
disable = not plugin_status.truezen_nvim,
|
|
||||||
cmd = {
|
|
||||||
"TZAtaraxis",
|
|
||||||
"TZMinimalist",
|
|
||||||
"TZFocus"
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require "plugins.zenmode"
|
|
||||||
end,
|
|
||||||
setup = function()
|
|
||||||
require "mappings".truezen()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
-- use "alvan/vim-closetag" -- for html autoclosing tag
|
|
||||||
|
|
||||||
use {
|
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
|
||||||
disable = not plugin_status.blankline,
|
|
||||||
event = "BufRead",
|
|
||||||
setup = function()
|
|
||||||
require("plugins.others").blankline()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
"tpope/vim-fugitive",
|
|
||||||
disable = not plugin_status.vim_fugitive,
|
|
||||||
cmd = {
|
|
||||||
"Git"
|
|
||||||
},
|
|
||||||
setup = function()
|
|
||||||
require "mappings".fugitive()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
@ -2,13 +2,11 @@ local present1, autopairs = pcall(require, "nvim-autopairs")
|
|||||||
local present2, autopairs_completion = pcall(require, "nvim-autopairs.completion.compe")
|
local present2, autopairs_completion = pcall(require, "nvim-autopairs.completion.compe")
|
||||||
|
|
||||||
if not (present1 or present2) then
|
if not (present1 or present2) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
autopairs.setup()
|
autopairs.setup()
|
||||||
autopairs_completion.setup(
|
autopairs_completion.setup {
|
||||||
{
|
map_cr = true,
|
||||||
map_cr = true,
|
map_complete = true, -- insert () func completion
|
||||||
map_complete = true -- insert () func completion
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
-- autosave.nvim plugin disabled by default
|
-- autosave.nvim plugin disabled by default
|
||||||
local present, autosave = pcall(require, "autosave")
|
local present, autosave = pcall(require, "autosave")
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
autosave.setup(
|
autosave.setup {
|
||||||
{
|
enabled = vim.g.auto_save, -- takes boolean value from init.lua
|
||||||
enabled = vim.g.auto_save, -- takes boolean value from init.lua
|
execution_message = "autosaved at : " .. vim.fn.strftime "%H:%M:%S",
|
||||||
execution_message = "autosaved at : " .. vim.fn.strftime("%H:%M:%S"),
|
events = { "InsertLeave", "TextChanged" },
|
||||||
events = {"InsertLeave", "TextChanged"},
|
conditions = {
|
||||||
conditions = {
|
exists = true,
|
||||||
exists = true,
|
filetype_is_not = {},
|
||||||
filetype_is_not = {},
|
modifiable = true,
|
||||||
modifiable = true
|
},
|
||||||
},
|
write_all_buffers = false,
|
||||||
write_all_buffers = false,
|
on_off_commands = true,
|
||||||
on_off_commands = true,
|
clean_command_line_interval = 2500,
|
||||||
clean_command_line_interval = 2500
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
|
@ -3,103 +3,103 @@ local colors = require(global_theme)
|
|||||||
|
|
||||||
local present, bufferline = pcall(require, "bufferline")
|
local present, bufferline = pcall(require, "bufferline")
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
bufferline.setup {
|
bufferline.setup {
|
||||||
options = {
|
options = {
|
||||||
offsets = {{filetype = "NvimTree", text = "", padding = 1}},
|
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
||||||
buffer_close_icon = "",
|
buffer_close_icon = "",
|
||||||
modified_icon = "",
|
modified_icon = "",
|
||||||
close_icon = "",
|
close_icon = "",
|
||||||
left_trunc_marker = "",
|
left_trunc_marker = "",
|
||||||
right_trunc_marker = "",
|
right_trunc_marker = "",
|
||||||
max_name_length = 14,
|
max_name_length = 14,
|
||||||
max_prefix_length = 13,
|
max_prefix_length = 13,
|
||||||
tab_size = 20,
|
tab_size = 20,
|
||||||
show_tab_indicators = true,
|
show_tab_indicators = true,
|
||||||
enforce_regular_tabs = false,
|
enforce_regular_tabs = false,
|
||||||
view = "multiwindow",
|
view = "multiwindow",
|
||||||
show_buffer_close_icons = true,
|
show_buffer_close_icons = true,
|
||||||
separator_style = "thin",
|
separator_style = "thin",
|
||||||
mappings = true,
|
mappings = true,
|
||||||
always_show_bufferline = true
|
always_show_bufferline = true,
|
||||||
},
|
},
|
||||||
highlights = {
|
highlights = {
|
||||||
fill = {
|
fill = {
|
||||||
guifg = colors.grey_fg,
|
guifg = colors.grey_fg,
|
||||||
guibg = colors.black2
|
guibg = colors.black2,
|
||||||
},
|
},
|
||||||
background = {
|
background = {
|
||||||
guifg = colors.grey_fg,
|
guifg = colors.grey_fg,
|
||||||
guibg = colors.black2
|
guibg = colors.black2,
|
||||||
},
|
},
|
||||||
-- buffers
|
-- buffers
|
||||||
buffer_visible = {
|
buffer_visible = {
|
||||||
guifg = colors.light_grey,
|
guifg = colors.light_grey,
|
||||||
guibg = colors.black2
|
guibg = colors.black2,
|
||||||
},
|
},
|
||||||
buffer_selected = {
|
buffer_selected = {
|
||||||
guifg = colors.white,
|
guifg = colors.white,
|
||||||
guibg = colors.black,
|
guibg = colors.black,
|
||||||
gui = "bold"
|
gui = "bold",
|
||||||
},
|
},
|
||||||
-- tabs
|
-- tabs
|
||||||
tab = {
|
tab = {
|
||||||
guifg = colors.light_grey,
|
guifg = colors.light_grey,
|
||||||
guibg = colors.one_bg3
|
guibg = colors.one_bg3,
|
||||||
},
|
},
|
||||||
tab_selected = {
|
tab_selected = {
|
||||||
guifg = colors.black2,
|
guifg = colors.black2,
|
||||||
guibg = colors.nord_blue
|
guibg = colors.nord_blue,
|
||||||
},
|
},
|
||||||
tab_close = {
|
tab_close = {
|
||||||
guifg = colors.red,
|
guifg = colors.red,
|
||||||
guibg = colors.black
|
guibg = colors.black,
|
||||||
},
|
},
|
||||||
indicator_selected = {
|
indicator_selected = {
|
||||||
guifg = colors.black,
|
guifg = colors.black,
|
||||||
guibg = colors.black
|
guibg = colors.black,
|
||||||
},
|
},
|
||||||
-- separators
|
-- separators
|
||||||
separator = {
|
separator = {
|
||||||
guifg = colors.black2,
|
guifg = colors.black2,
|
||||||
guibg = colors.black2
|
guibg = colors.black2,
|
||||||
},
|
},
|
||||||
separator_visible = {
|
separator_visible = {
|
||||||
guifg = colors.black2,
|
guifg = colors.black2,
|
||||||
guibg = colors.black2
|
guibg = colors.black2,
|
||||||
},
|
},
|
||||||
separator_selected = {
|
separator_selected = {
|
||||||
guifg = colors.black2,
|
guifg = colors.black2,
|
||||||
guibg = colors.black2
|
guibg = colors.black2,
|
||||||
},
|
},
|
||||||
-- modified
|
-- modified
|
||||||
modified = {
|
modified = {
|
||||||
guifg = colors.red,
|
guifg = colors.red,
|
||||||
guibg = colors.black2
|
guibg = colors.black2,
|
||||||
},
|
},
|
||||||
modified_visible = {
|
modified_visible = {
|
||||||
guifg = colors.red,
|
guifg = colors.red,
|
||||||
guibg = colors.black2
|
guibg = colors.black2,
|
||||||
},
|
},
|
||||||
modified_selected = {
|
modified_selected = {
|
||||||
guifg = colors.green,
|
guifg = colors.green,
|
||||||
guibg = colors.black
|
guibg = colors.black,
|
||||||
},
|
},
|
||||||
-- close buttons
|
-- close buttons
|
||||||
|
|
||||||
close_button = {
|
close_button = {
|
||||||
guifg = colors.light_grey,
|
guifg = colors.light_grey,
|
||||||
guibg = colors.black2
|
guibg = colors.black2,
|
||||||
},
|
},
|
||||||
close_button_visible = {
|
close_button_visible = {
|
||||||
guifg = colors.light_grey,
|
guifg = colors.light_grey,
|
||||||
guibg = colors.black2
|
guibg = colors.black2,
|
||||||
},
|
},
|
||||||
close_button_selected = {
|
close_button_selected = {
|
||||||
guifg = colors.red,
|
guifg = colors.red,
|
||||||
guibg = colors.black
|
guibg = colors.black,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
local present, compe = pcall(require, "compe")
|
local present, compe = pcall(require, "compe")
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
compe.setup {
|
compe.setup {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
autocomplete = true,
|
autocomplete = true,
|
||||||
debug = false,
|
debug = false,
|
||||||
min_length = 1,
|
min_length = 1,
|
||||||
preselect = "enable",
|
preselect = "enable",
|
||||||
throttle_time = 80,
|
throttle_time = 80,
|
||||||
source_timeout = 200,
|
source_timeout = 200,
|
||||||
incomplete_delay = 400,
|
incomplete_delay = 400,
|
||||||
max_abbr_width = 100,
|
max_abbr_width = 100,
|
||||||
max_kind_width = 100,
|
max_kind_width = 100,
|
||||||
max_menu_width = 100,
|
max_menu_width = 100,
|
||||||
documentation = true,
|
documentation = true,
|
||||||
source = {
|
source = {
|
||||||
buffer = {kind = "", true},
|
buffer = { kind = "", true },
|
||||||
luasnip = {kind = "", true},
|
luasnip = { kind = "", true },
|
||||||
nvim_lsp = true,
|
nvim_lsp = true,
|
||||||
nvim_lua = true
|
nvim_lua = true,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
@ -7,34 +7,34 @@ g.dashboard_disable_at_vimenter = 1 -- dashboard is disabled by default
|
|||||||
g.dashboard_disable_statusline = 1
|
g.dashboard_disable_statusline = 1
|
||||||
g.dashboard_default_executive = "telescope"
|
g.dashboard_default_executive = "telescope"
|
||||||
g.dashboard_custom_header = {
|
g.dashboard_custom_header = {
|
||||||
" ",
|
" ",
|
||||||
" ",
|
" ",
|
||||||
" ",
|
" ",
|
||||||
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
|
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
|
||||||
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
|
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
|
||||||
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
|
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
|
||||||
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
|
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
|
||||||
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
|
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
|
||||||
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
|
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
|
||||||
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
|
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
|
||||||
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
|
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
|
||||||
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
|
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
|
||||||
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
|
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
|
||||||
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
|
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
|
||||||
" "
|
" ",
|
||||||
}
|
}
|
||||||
|
|
||||||
g.dashboard_custom_section = {
|
g.dashboard_custom_section = {
|
||||||
a = {description = {" Find File SPC f f"}, command = "Telescope find_files"},
|
a = { description = { " Find File SPC f f" }, command = "Telescope find_files" },
|
||||||
b = {description = {" Recents SPC f o"}, command = "Telescope oldfiles"},
|
b = { description = { " Recents SPC f o" }, command = "Telescope oldfiles" },
|
||||||
c = {description = {" Find Word SPC f w"}, command = "Telescope live_grep"},
|
c = { description = { " Find Word SPC f w" }, command = "Telescope live_grep" },
|
||||||
d = {description = {"洛 New File SPC f n"}, command = "DashboardNewFile"},
|
d = { description = { "洛 New File SPC f n" }, command = "DashboardNewFile" },
|
||||||
e = {description = {" Bookmarks SPC b m"}, command = "Telescope marks"},
|
e = { description = { " Bookmarks SPC b m" }, command = "Telescope marks" },
|
||||||
f = {description = {" Load Last Session SPC s l"}, command = "SessionLoad"}
|
f = { description = { " Load Last Session SPC s l" }, command = "SessionLoad" },
|
||||||
}
|
}
|
||||||
|
|
||||||
g.dashboard_custom_footer = {
|
g.dashboard_custom_footer = {
|
||||||
" ",
|
" ",
|
||||||
-- "NvChad Loaded " .. plugins_count .. " plugins",
|
-- "NvChad Loaded " .. plugins_count .. " plugins",
|
||||||
"NvChad v0.5"
|
"NvChad v0.5",
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
local present, gitsigns = pcall(require, "gitsigns")
|
local present, gitsigns = pcall(require, "gitsigns")
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
gitsigns.setup {
|
gitsigns.setup {
|
||||||
signs = {
|
signs = {
|
||||||
add = {hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr"},
|
add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" },
|
||||||
change = {hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr"},
|
change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" },
|
||||||
delete = {hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr"},
|
delete = { hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr" },
|
||||||
topdelete = {hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr"},
|
topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" },
|
||||||
changedelete = {hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr"}
|
changedelete = { hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr" },
|
||||||
},
|
},
|
||||||
numhl = false,
|
numhl = false,
|
||||||
keymaps = {
|
keymaps = {
|
||||||
-- Default keymap options
|
-- Default keymap options
|
||||||
noremap = true,
|
noremap = true,
|
||||||
buffer = 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\".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\".prev_hunk()<CR>'" },
|
||||||
["n <leader>hs"] = '<cmd>lua require"gitsigns".stage_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>hu"] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
|
||||||
["n <leader>hr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
|
["n <leader>hr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
|
||||||
["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_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 = {
|
watch_index = {
|
||||||
interval = 100
|
interval = 100,
|
||||||
},
|
},
|
||||||
sign_priority = 5,
|
sign_priority = 5,
|
||||||
status_formatter = nil -- Use default
|
status_formatter = nil, -- Use default
|
||||||
}
|
}
|
||||||
|
@ -1,122 +1,122 @@
|
|||||||
local present, icons = pcall(require, "nvim-web-devicons")
|
local present, icons = pcall(require, "nvim-web-devicons")
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local global_theme = "themes/" .. vim.g.nvchad_theme
|
local global_theme = "themes/" .. vim.g.nvchad_theme
|
||||||
local colors = require(global_theme)
|
local colors = require(global_theme)
|
||||||
|
|
||||||
icons.setup {
|
icons.setup {
|
||||||
override = {
|
override = {
|
||||||
html = {
|
html = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.baby_pink,
|
color = colors.baby_pink,
|
||||||
name = "html"
|
name = "html",
|
||||||
},
|
},
|
||||||
css = {
|
css = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.blue,
|
color = colors.blue,
|
||||||
name = "css"
|
name = "css",
|
||||||
},
|
},
|
||||||
js = {
|
js = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.sun,
|
color = colors.sun,
|
||||||
name = "js"
|
name = "js",
|
||||||
},
|
},
|
||||||
ts = {
|
ts = {
|
||||||
icon = "ﯤ",
|
icon = "ﯤ",
|
||||||
color = colors.teal,
|
color = colors.teal,
|
||||||
name = "ts"
|
name = "ts",
|
||||||
},
|
},
|
||||||
kt = {
|
kt = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.orange,
|
color = colors.orange,
|
||||||
name = "kt"
|
name = "kt",
|
||||||
},
|
},
|
||||||
png = {
|
png = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.dark_purple,
|
color = colors.dark_purple,
|
||||||
name = "png"
|
name = "png",
|
||||||
},
|
},
|
||||||
jpg = {
|
jpg = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.dark_purple,
|
color = colors.dark_purple,
|
||||||
name = "jpg"
|
name = "jpg",
|
||||||
},
|
},
|
||||||
jpeg = {
|
jpeg = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.dark_purple,
|
color = colors.dark_purple,
|
||||||
name = "jpeg"
|
name = "jpeg",
|
||||||
},
|
},
|
||||||
mp3 = {
|
mp3 = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.white,
|
color = colors.white,
|
||||||
name = "mp3"
|
name = "mp3",
|
||||||
},
|
},
|
||||||
mp4 = {
|
mp4 = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.white,
|
color = colors.white,
|
||||||
name = "mp4"
|
name = "mp4",
|
||||||
},
|
},
|
||||||
out = {
|
out = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.white,
|
color = colors.white,
|
||||||
name = "out"
|
name = "out",
|
||||||
},
|
},
|
||||||
Dockerfile = {
|
Dockerfile = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.cyan,
|
color = colors.cyan,
|
||||||
name = "Dockerfile"
|
name = "Dockerfile",
|
||||||
},
|
},
|
||||||
rb = {
|
rb = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.pink,
|
color = colors.pink,
|
||||||
name = "rb"
|
name = "rb",
|
||||||
},
|
},
|
||||||
vue = {
|
vue = {
|
||||||
icon = "﵂",
|
icon = "﵂",
|
||||||
color = colors.vibrant_green,
|
color = colors.vibrant_green,
|
||||||
name = "vue"
|
name = "vue",
|
||||||
},
|
},
|
||||||
py = {
|
py = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.cyan,
|
color = colors.cyan,
|
||||||
name = "py"
|
name = "py",
|
||||||
},
|
},
|
||||||
toml = {
|
toml = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.blue,
|
color = colors.blue,
|
||||||
name = "toml"
|
name = "toml",
|
||||||
},
|
},
|
||||||
lock = {
|
lock = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.red,
|
color = colors.red,
|
||||||
name = "lock"
|
name = "lock",
|
||||||
},
|
},
|
||||||
zip = {
|
zip = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.sun,
|
color = colors.sun,
|
||||||
name = "zip"
|
name = "zip",
|
||||||
},
|
},
|
||||||
xz = {
|
xz = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.sun,
|
color = colors.sun,
|
||||||
name = "xz"
|
name = "xz",
|
||||||
},
|
},
|
||||||
deb = {
|
deb = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.cyan,
|
color = colors.cyan,
|
||||||
name = "deb"
|
name = "deb",
|
||||||
},
|
},
|
||||||
rpm = {
|
rpm = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.orange,
|
color = colors.orange,
|
||||||
name = "rpm"
|
name = "rpm",
|
||||||
},
|
},
|
||||||
lua = {
|
lua = {
|
||||||
icon = "",
|
icon = "",
|
||||||
color = colors.blue,
|
color = colors.blue,
|
||||||
name = "lua"
|
name = "lua",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,42 +1,42 @@
|
|||||||
local present1, lspconfig = pcall(require, "lspconfig")
|
local present1, lspconfig = pcall(require, "lspconfig")
|
||||||
local present2, lspinstall = pcall(require, "lspinstall")
|
local present2, lspinstall = pcall(require, "lspinstall")
|
||||||
if not (present1 or present2) then
|
if not (present1 or present2) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_attach(client, bufnr)
|
local function on_attach(client, bufnr)
|
||||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
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(...)
|
local function buf_set_keymap(...)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
|
|
||||||
buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||||
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||||
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||||
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||||
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||||
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||||
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
||||||
buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||||
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||||
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||||
buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||||
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
||||||
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
||||||
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
||||||
|
|
||||||
-- Set some keybinds conditional on server capabilities
|
-- Set some keybinds conditional on server capabilities
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.resolved_capabilities.document_formatting then
|
||||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||||
elseif client.resolved_capabilities.document_range_formatting then
|
elseif client.resolved_capabilities.document_range_formatting then
|
||||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
@ -45,53 +45,53 @@ capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|||||||
-- lspInstall + lspconfig stuff
|
-- lspInstall + lspconfig stuff
|
||||||
|
|
||||||
local function setup_servers()
|
local function setup_servers()
|
||||||
lspinstall.setup()
|
lspinstall.setup()
|
||||||
local servers = lspinstall.installed_servers()
|
local servers = lspinstall.installed_servers()
|
||||||
|
|
||||||
for _, lang in pairs(servers) do
|
for _, lang in pairs(servers) do
|
||||||
if lang ~= "lua" then
|
if lang ~= "lua" then
|
||||||
lspconfig[lang].setup {
|
lspconfig[lang].setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
root_dir = vim.loop.cwd
|
root_dir = vim.loop.cwd,
|
||||||
}
|
}
|
||||||
elseif lang == "lua" then
|
elseif lang == "lua" then
|
||||||
lspconfig[lang].setup {
|
lspconfig[lang].setup {
|
||||||
root_dir = vim.loop.cwd,
|
root_dir = vim.loop.cwd,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
globals = {"vim"}
|
globals = { "vim" },
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
library = {
|
library = {
|
||||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
|
||||||
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true
|
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
|
||||||
},
|
},
|
||||||
maxPreload = 100000,
|
maxPreload = 100000,
|
||||||
preloadFileSize = 10000
|
preloadFileSize = 10000,
|
||||||
},
|
},
|
||||||
telemetry = {
|
telemetry = {
|
||||||
enable = false
|
enable = false,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
setup_servers()
|
setup_servers()
|
||||||
|
|
||||||
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
|
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
|
||||||
lspinstall.post_install_hook = function()
|
lspinstall.post_install_hook = function()
|
||||||
setup_servers() -- reload installed servers
|
setup_servers() -- reload installed servers
|
||||||
vim.cmd("bufdo e") -- triggers FileType autocmd that starts the server
|
vim.cmd "bufdo e"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- replace the default lsp diagnostic symbols
|
-- replace the default lsp diagnostic symbols
|
||||||
function lspSymbol(name, icon)
|
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
|
end
|
||||||
|
|
||||||
lspSymbol("Error", "")
|
lspSymbol("Error", "")
|
||||||
@ -99,29 +99,25 @@ lspSymbol("Warning", "")
|
|||||||
lspSymbol("Information", "")
|
lspSymbol("Information", "")
|
||||||
lspSymbol("Hint", "")
|
lspSymbol("Hint", "")
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] =
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
vim.lsp.with(
|
virtual_text = {
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics,
|
prefix = "",
|
||||||
{
|
spacing = 0,
|
||||||
virtual_text = {
|
},
|
||||||
prefix = "",
|
signs = true,
|
||||||
spacing = 0
|
underline = true,
|
||||||
},
|
-- set this to true if you want diagnostics to show in insert mode
|
||||||
signs = true,
|
update_in_insert = false,
|
||||||
underline = true,
|
})
|
||||||
-- set this to true if you want diagnostics to show in insert mode
|
|
||||||
update_in_insert = false
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- suppress error messages from lang servers
|
-- suppress error messages from lang servers
|
||||||
vim.notify = function(msg, log_level, _opts)
|
vim.notify = function(msg, log_level, _opts)
|
||||||
if msg:match("exit code") then
|
if msg:match "exit code" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if log_level == vim.log.levels.ERROR then
|
if log_level == vim.log.levels.ERROR then
|
||||||
vim.api.nvim_err_writeln(msg)
|
vim.api.nvim_err_writeln(msg)
|
||||||
else
|
else
|
||||||
vim.api.nvim_echo({{msg}}, true, {})
|
vim.api.nvim_echo({ { msg } }, true, {})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,72 +1,66 @@
|
|||||||
local present, luasnip = pcall(require, "luasnip")
|
local present, luasnip = pcall(require, "luasnip")
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local t = function(str)
|
local t = function(str)
|
||||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
local check_back_space = function()
|
local check_back_space = function()
|
||||||
local col = vim.fn.col(".") - 1
|
local col = vim.fn.col "." - 1
|
||||||
if col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then
|
if col == 0 or vim.fn.getline("."):sub(col, col):match "%s" then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
_G.tab_complete = function()
|
_G.tab_complete = function()
|
||||||
if vim.fn.pumvisible() == 1 then
|
if vim.fn.pumvisible() == 1 then
|
||||||
return t "<C-n>"
|
return t "<C-n>"
|
||||||
elseif luasnip and luasnip.expand_or_jumpable() then
|
elseif luasnip and luasnip.expand_or_jumpable() then
|
||||||
return t "<Plug>luasnip-expand-or-jump"
|
return t "<Plug>luasnip-expand-or-jump"
|
||||||
elseif check_back_space() then
|
elseif check_back_space() then
|
||||||
return t "<Tab>"
|
return t "<Tab>"
|
||||||
else
|
else
|
||||||
return vim.fn["compe#complete"]()
|
return vim.fn["compe#complete"]()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
_G.s_tab_complete = function()
|
_G.s_tab_complete = function()
|
||||||
if vim.fn.pumvisible() == 1 then
|
if vim.fn.pumvisible() == 1 then
|
||||||
return t "<C-p>"
|
return t "<C-p>"
|
||||||
elseif luasnip and luasnip.jumpable(-1) then
|
elseif luasnip and luasnip.jumpable(-1) then
|
||||||
return t "<Plug>luasnip-jump-prev"
|
return t "<Plug>luasnip-jump-prev"
|
||||||
else
|
else
|
||||||
return t "<S-Tab>"
|
return t "<S-Tab>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
_G.completions = function()
|
_G.completions = function()
|
||||||
local npairs
|
local npairs
|
||||||
if
|
if not pcall(function()
|
||||||
not pcall(
|
npairs = require "nvim-autopairs"
|
||||||
function()
|
end) then
|
||||||
npairs = require "nvim-autopairs"
|
return
|
||||||
end
|
end
|
||||||
)
|
|
||||||
then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if vim.fn.pumvisible() == 1 then
|
if vim.fn.pumvisible() == 1 then
|
||||||
if vim.fn.complete_info()["selected"] ~= -1 then
|
if vim.fn.complete_info()["selected"] ~= -1 then
|
||||||
return vim.fn["compe#confirm"]("<CR>")
|
return vim.fn["compe#confirm"] "<CR>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return npairs.check_break_line_char()
|
return npairs.check_break_line_char()
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {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("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("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("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", "<CR>", "v:lua.completions()", { expr = true })
|
||||||
|
|
||||||
luasnip.config.set_config(
|
luasnip.config.set_config {
|
||||||
{
|
history = true,
|
||||||
history = true,
|
updateevents = "TextChanged,TextChangedI",
|
||||||
updateevents = "TextChanged,TextChangedI"
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
require("luasnip/loaders/from_vscode").load()
|
require("luasnip/loaders/from_vscode").load()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
local present, tree_c = pcall(require, "nvim-tree.config")
|
local present, tree_c = pcall(require, "nvim-tree.config")
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local tree_cb = tree_c.nvim_tree_callback
|
local tree_cb = tree_c.nvim_tree_callback
|
||||||
@ -10,9 +10,9 @@ vim.o.termguicolors = true
|
|||||||
|
|
||||||
g.nvim_tree_side = "left"
|
g.nvim_tree_side = "left"
|
||||||
g.nvim_tree_width = 25
|
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_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_open = 0
|
||||||
g.nvim_tree_auto_close = 0 -- closes tree when it's the last window
|
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
|
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_hide_dotfiles = 1
|
||||||
g.nvim_tree_git_hl = 1
|
g.nvim_tree_git_hl = 1
|
||||||
g.nvim_tree_highlight_opened_files = 0
|
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_tab_open = 0
|
||||||
g.nvim_tree_allow_resize = 1
|
g.nvim_tree_allow_resize = 1
|
||||||
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
|
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
|
||||||
@ -30,66 +30,66 @@ g.nvim_tree_hijack_netrw = 0
|
|||||||
g.nvim_tree_update_cwd = 1
|
g.nvim_tree_update_cwd = 1
|
||||||
|
|
||||||
g.nvim_tree_show_icons = {
|
g.nvim_tree_show_icons = {
|
||||||
git = 1,
|
git = 1,
|
||||||
folders = 1,
|
folders = 1,
|
||||||
files = 1
|
files = 1,
|
||||||
-- folder_arrows= 1
|
-- folder_arrows= 1
|
||||||
}
|
}
|
||||||
g.nvim_tree_icons = {
|
g.nvim_tree_icons = {
|
||||||
default = "",
|
default = "",
|
||||||
symlink = "",
|
symlink = "",
|
||||||
git = {
|
git = {
|
||||||
unstaged = "✗",
|
unstaged = "✗",
|
||||||
staged = "✓",
|
staged = "✓",
|
||||||
unmerged = "",
|
unmerged = "",
|
||||||
renamed = "➜",
|
renamed = "➜",
|
||||||
untracked = "★",
|
untracked = "★",
|
||||||
deleted = "",
|
deleted = "",
|
||||||
ignored = "◌"
|
ignored = "◌",
|
||||||
},
|
},
|
||||||
folder = {
|
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!
|
-- 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!
|
||||||
-- arrow_open = "",
|
-- arrow_open = "",
|
||||||
-- arrow_closed = "",
|
-- arrow_closed = "",
|
||||||
default = "",
|
default = "",
|
||||||
open = "",
|
open = "",
|
||||||
empty = "", --
|
empty = "", --
|
||||||
empty_open = "",
|
empty_open = "",
|
||||||
symlink = "",
|
symlink = "",
|
||||||
symlink_open = ""
|
symlink_open = "",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
g.nvim_tree_bindings = {
|
g.nvim_tree_bindings = {
|
||||||
{key = {"<CR>", "o", "<2-LeftMouse>"}, cb = tree_cb("edit")},
|
{ key = { "<CR>", "o", "<2-LeftMouse>" }, cb = tree_cb "edit" },
|
||||||
{key = {"<2-RightMouse>", "<C-]>"}, cb = tree_cb("cd")},
|
{ key = { "<2-RightMouse>", "<C-]>" }, cb = tree_cb "cd" },
|
||||||
{key = "<C-v>", cb = tree_cb("vsplit")},
|
{ key = "<C-v>", cb = tree_cb "vsplit" },
|
||||||
{key = "<C-x>", cb = tree_cb("split")},
|
{ key = "<C-x>", cb = tree_cb "split" },
|
||||||
{key = "<C-t>", cb = tree_cb("tabnew")},
|
{ key = "<C-t>", cb = tree_cb "tabnew" },
|
||||||
{key = "<", cb = tree_cb("prev_sibling")},
|
{ key = "<", cb = tree_cb "prev_sibling" },
|
||||||
{key = ">", cb = tree_cb("next_sibling")},
|
{ key = ">", cb = tree_cb "next_sibling" },
|
||||||
{key = "P", cb = tree_cb("parent_node")},
|
{ key = "P", cb = tree_cb "parent_node" },
|
||||||
{key = "<BS>", cb = tree_cb("close_node")},
|
{ key = "<BS>", cb = tree_cb "close_node" },
|
||||||
{key = "<S-CR>", cb = tree_cb("close_node")},
|
{ key = "<S-CR>", cb = tree_cb "close_node" },
|
||||||
{key = "<Tab>", cb = tree_cb("preview")},
|
{ key = "<Tab>", cb = tree_cb "preview" },
|
||||||
{key = "K", cb = tree_cb("first_sibling")},
|
{ key = "K", cb = tree_cb "first_sibling" },
|
||||||
{key = "J", cb = tree_cb("last_sibling")},
|
{ key = "J", cb = tree_cb "last_sibling" },
|
||||||
{key = "I", cb = tree_cb("toggle_ignored")},
|
{ key = "I", cb = tree_cb "toggle_ignored" },
|
||||||
{key = "H", cb = tree_cb("toggle_dotfiles")},
|
{ key = "H", cb = tree_cb "toggle_dotfiles" },
|
||||||
{key = "R", cb = tree_cb("refresh")},
|
{ key = "R", cb = tree_cb "refresh" },
|
||||||
{key = "a", cb = tree_cb("create")},
|
{ key = "a", cb = tree_cb "create" },
|
||||||
{key = "d", cb = tree_cb("remove")},
|
{ key = "d", cb = tree_cb "remove" },
|
||||||
{key = "r", cb = tree_cb("rename")},
|
{ key = "r", cb = tree_cb "rename" },
|
||||||
{key = "<C->", cb = tree_cb("full_rename")},
|
{ key = "<C->", cb = tree_cb "full_rename" },
|
||||||
{key = "x", cb = tree_cb("cut")},
|
{ key = "x", cb = tree_cb "cut" },
|
||||||
{key = "c", cb = tree_cb("copy")},
|
{ key = "c", cb = tree_cb "copy" },
|
||||||
{key = "p", cb = tree_cb("paste")},
|
{ key = "p", cb = tree_cb "paste" },
|
||||||
{key = "y", cb = tree_cb("copy_name")},
|
{ key = "y", cb = tree_cb "copy_name" },
|
||||||
{key = "Y", cb = tree_cb("copy_path")},
|
{ key = "Y", cb = tree_cb "copy_path" },
|
||||||
{key = "gy", cb = tree_cb("copy_absolute_path")},
|
{ key = "gy", cb = tree_cb "copy_absolute_path" },
|
||||||
{key = "[c", cb = tree_cb("prev_git_item")},
|
{ key = "[c", cb = tree_cb "prev_git_item" },
|
||||||
{key = "}c", cb = tree_cb("next_git_item")},
|
{ key = "}c", cb = tree_cb "next_git_item" },
|
||||||
{key = "-", cb = tree_cb("dir_up")},
|
{ key = "-", cb = tree_cb "dir_up" },
|
||||||
{key = "q", cb = tree_cb("close")},
|
{ key = "q", cb = tree_cb "close" },
|
||||||
{key = "g?", cb = tree_cb("toggle_help")}
|
{ key = "g?", cb = tree_cb "toggle_help" },
|
||||||
}
|
}
|
||||||
|
@ -1,75 +1,71 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.colorizer = function()
|
M.colorizer = function()
|
||||||
local present, colorizer = pcall(require, "colorizer")
|
local present, colorizer = pcall(require, "colorizer")
|
||||||
if present then
|
if present then
|
||||||
colorizer.setup()
|
colorizer.setup()
|
||||||
vim.cmd("ColorizerReloadAllBuffers")
|
vim.cmd "ColorizerReloadAllBuffers"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
M.comment = function()
|
M.comment = function()
|
||||||
local present, nvim_comment = pcall(require, "nvim_comment")
|
local present, nvim_comment = pcall(require, "nvim_comment")
|
||||||
if present then
|
if present then
|
||||||
nvim_comment.setup()
|
nvim_comment.setup()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
M.escape = function()
|
M.escape = function()
|
||||||
vim.g.better_escape_interval = 300
|
vim.g.better_escape_interval = 300
|
||||||
vim.g.better_escape_shortcut = {"jk"}
|
vim.g.better_escape_shortcut = { "jk" }
|
||||||
end
|
end
|
||||||
|
|
||||||
M.lspkind = function()
|
M.lspkind = function()
|
||||||
local present, lspkind = pcall(require, "lspkind")
|
local present, lspkind = pcall(require, "lspkind")
|
||||||
if present then
|
if present then
|
||||||
lspkind.init()
|
lspkind.init()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
M.neoscroll = function()
|
M.neoscroll = function()
|
||||||
pcall(
|
pcall(function()
|
||||||
function()
|
require("neoscroll").setup()
|
||||||
require("neoscroll").setup()
|
end)
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
M.blankline = function()
|
M.blankline = function()
|
||||||
vim.g.indentLine_enabled = 1
|
vim.g.indentLine_enabled = 1
|
||||||
vim.g.indent_blankline_char = "▏"
|
vim.g.indent_blankline_char = "▏"
|
||||||
|
|
||||||
vim.g.indent_blankline_filetype_exclude = {"help", "terminal", "dashboard", "packer"}
|
vim.g.indent_blankline_filetype_exclude = { "help", "terminal", "dashboard", "packer" }
|
||||||
vim.g.indent_blankline_buftype_exclude = {"terminal"}
|
vim.g.indent_blankline_buftype_exclude = { "terminal" }
|
||||||
|
|
||||||
vim.g.indent_blankline_show_trailing_blankline_indent = false
|
vim.g.indent_blankline_show_trailing_blankline_indent = false
|
||||||
vim.g.indent_blankline_show_first_indent_level = false
|
vim.g.indent_blankline_show_first_indent_level = false
|
||||||
end
|
end
|
||||||
|
|
||||||
M.signature = function()
|
M.signature = function()
|
||||||
local present, lspsignature = pcall(require, "lsp_signature")
|
local present, lspsignature = pcall(require, "lsp_signature")
|
||||||
if present then
|
if present then
|
||||||
lspsignature.setup(
|
lspsignature.setup {
|
||||||
{
|
bind = true,
|
||||||
bind = true,
|
doc_lines = 2,
|
||||||
doc_lines = 2,
|
floating_window = true,
|
||||||
floating_window = true,
|
fix_pos = true,
|
||||||
fix_pos = true,
|
hint_enable = true,
|
||||||
hint_enable = true,
|
hint_prefix = " ",
|
||||||
hint_prefix = " ",
|
hint_scheme = "String",
|
||||||
hint_scheme = "String",
|
use_lspsaga = false,
|
||||||
use_lspsaga = false,
|
hi_parameter = "Search",
|
||||||
hi_parameter = "Search",
|
max_height = 22,
|
||||||
max_height = 22,
|
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
|
||||||
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
|
handler_opts = {
|
||||||
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
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
local present1, gl = pcall(require, "galaxyline")
|
local present1, gl = pcall(require, "galaxyline")
|
||||||
local present2, condition = pcall(require, "galaxyline.condition")
|
local present2, condition = pcall(require, "galaxyline.condition")
|
||||||
if not (present1 or present2) then
|
if not (present1 or present2) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local gls = gl.section
|
local gls = gl.section
|
||||||
|
|
||||||
gl.short_line_list = {" "}
|
gl.short_line_list = { " " }
|
||||||
|
|
||||||
local left_separator = "" -- or " "
|
local left_separator = "" -- or " "
|
||||||
local right_separator = " " -- or ""
|
local right_separator = " " -- or ""
|
||||||
@ -15,224 +15,224 @@ local global_theme = "themes/" .. vim.g.nvchad_theme
|
|||||||
local colors = require(global_theme)
|
local colors = require(global_theme)
|
||||||
|
|
||||||
gls.left[1] = {
|
gls.left[1] = {
|
||||||
FirstElement = {
|
FirstElement = {
|
||||||
provider = function()
|
provider = function()
|
||||||
return "▋"
|
return "▋"
|
||||||
end,
|
end,
|
||||||
highlight = {colors.nord_blue, colors.nord_blue}
|
highlight = { colors.nord_blue, colors.nord_blue },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.left[2] = {
|
gls.left[2] = {
|
||||||
statusIcon = {
|
statusIcon = {
|
||||||
provider = function()
|
provider = function()
|
||||||
return " "
|
return " "
|
||||||
end,
|
end,
|
||||||
highlight = {colors.statusline_bg, colors.nord_blue},
|
highlight = { colors.statusline_bg, colors.nord_blue },
|
||||||
separator = right_separator .. " ",
|
separator = right_separator .. " ",
|
||||||
separator_highlight = {colors.nord_blue, colors.lightbg}
|
separator_highlight = { colors.nord_blue, colors.lightbg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.left[3] = {
|
gls.left[3] = {
|
||||||
FileIcon = {
|
FileIcon = {
|
||||||
provider = "FileIcon",
|
provider = "FileIcon",
|
||||||
condition = condition.buffer_not_empty,
|
condition = condition.buffer_not_empty,
|
||||||
highlight = {colors.white, colors.lightbg}
|
highlight = { colors.white, colors.lightbg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.left[4] = {
|
gls.left[4] = {
|
||||||
FileName = {
|
FileName = {
|
||||||
provider = function()
|
provider = function()
|
||||||
local fileinfo = require('galaxyline.provider_fileinfo')
|
local fileinfo = require "galaxyline.provider_fileinfo"
|
||||||
return fileinfo.get_current_file_name("", "")
|
return fileinfo.get_current_file_name("", "")
|
||||||
end,
|
end,
|
||||||
condition = condition.buffer_not_empty,
|
condition = condition.buffer_not_empty,
|
||||||
highlight = {colors.white, colors.lightbg},
|
highlight = { colors.white, colors.lightbg },
|
||||||
separator = right_separator,
|
separator = right_separator,
|
||||||
separator_highlight = {colors.lightbg, colors.lightbg2}
|
separator_highlight = { colors.lightbg, colors.lightbg2 },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.left[5] = {
|
gls.left[5] = {
|
||||||
current_dir = {
|
current_dir = {
|
||||||
provider = function()
|
provider = function()
|
||||||
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
||||||
return " " .. dir_name .. " "
|
return " " .. dir_name .. " "
|
||||||
end,
|
end,
|
||||||
highlight = {colors.grey_fg2, colors.lightbg2},
|
highlight = { colors.grey_fg2, colors.lightbg2 },
|
||||||
separator = right_separator,
|
separator = right_separator,
|
||||||
separator_highlight = {colors.lightbg2, colors.statusline_bg}
|
separator_highlight = { colors.lightbg2, colors.statusline_bg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local checkwidth = function()
|
local checkwidth = function()
|
||||||
local squeeze_width = vim.fn.winwidth(0) / 2
|
local squeeze_width = vim.fn.winwidth(0) / 2
|
||||||
if squeeze_width > 30 then
|
if squeeze_width > 30 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
gls.left[6] = {
|
gls.left[6] = {
|
||||||
DiffAdd = {
|
DiffAdd = {
|
||||||
provider = "DiffAdd",
|
provider = "DiffAdd",
|
||||||
condition = checkwidth,
|
condition = checkwidth,
|
||||||
icon = " ",
|
icon = " ",
|
||||||
highlight = {colors.white, colors.statusline_bg}
|
highlight = { colors.white, colors.statusline_bg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.left[7] = {
|
gls.left[7] = {
|
||||||
DiffModified = {
|
DiffModified = {
|
||||||
provider = "DiffModified",
|
provider = "DiffModified",
|
||||||
condition = checkwidth,
|
condition = checkwidth,
|
||||||
icon = " ",
|
icon = " ",
|
||||||
highlight = {colors.grey_fg2, colors.statusline_bg}
|
highlight = { colors.grey_fg2, colors.statusline_bg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.left[8] = {
|
gls.left[8] = {
|
||||||
DiffRemove = {
|
DiffRemove = {
|
||||||
provider = "DiffRemove",
|
provider = "DiffRemove",
|
||||||
condition = checkwidth,
|
condition = checkwidth,
|
||||||
icon = " ",
|
icon = " ",
|
||||||
highlight = {colors.grey_fg2, colors.statusline_bg}
|
highlight = { colors.grey_fg2, colors.statusline_bg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.left[9] = {
|
gls.left[9] = {
|
||||||
DiagnosticError = {
|
DiagnosticError = {
|
||||||
provider = "DiagnosticError",
|
provider = "DiagnosticError",
|
||||||
icon = " ",
|
icon = " ",
|
||||||
highlight = {colors.red, colors.statusline_bg}
|
highlight = { colors.red, colors.statusline_bg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.left[10] = {
|
gls.left[10] = {
|
||||||
DiagnosticWarn = {
|
DiagnosticWarn = {
|
||||||
provider = "DiagnosticWarn",
|
provider = "DiagnosticWarn",
|
||||||
icon = " ",
|
icon = " ",
|
||||||
highlight = {colors.yellow, colors.statusline_bg}
|
highlight = { colors.yellow, colors.statusline_bg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.right[1] = {
|
gls.right[1] = {
|
||||||
lsp_status = {
|
lsp_status = {
|
||||||
provider = function()
|
provider = function()
|
||||||
local clients = vim.lsp.get_active_clients()
|
local clients = vim.lsp.get_active_clients()
|
||||||
if next(clients) ~= nil then
|
if next(clients) ~= nil then
|
||||||
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
||||||
for _, client in ipairs(clients) do
|
for _, client in ipairs(clients) do
|
||||||
local filetypes = client.config.filetypes
|
local filetypes = client.config.filetypes
|
||||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||||
return " " .. " " .. " LSP"
|
return " " .. " " .. " LSP"
|
||||||
end
|
end
|
||||||
end
|
|
||||||
return ""
|
|
||||||
else
|
|
||||||
return ""
|
|
||||||
end
|
end
|
||||||
end,
|
return ""
|
||||||
highlight = {colors.grey_fg2, colors.statusline_bg}
|
else
|
||||||
}
|
return ""
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
highlight = { colors.grey_fg2, colors.statusline_bg },
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.right[2] = {
|
gls.right[2] = {
|
||||||
GitIcon = {
|
GitIcon = {
|
||||||
provider = function()
|
provider = function()
|
||||||
return " "
|
return " "
|
||||||
end,
|
end,
|
||||||
condition = require("galaxyline.condition").check_git_workspace,
|
condition = require("galaxyline.condition").check_git_workspace,
|
||||||
highlight = {colors.grey_fg2, colors.statusline_bg},
|
highlight = { colors.grey_fg2, colors.statusline_bg },
|
||||||
separator = " ",
|
separator = " ",
|
||||||
separator_highlight = {colors.statusline_bg, colors.statusline_bg}
|
separator_highlight = { colors.statusline_bg, colors.statusline_bg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.right[3] = {
|
gls.right[3] = {
|
||||||
GitBranch = {
|
GitBranch = {
|
||||||
provider = "GitBranch",
|
provider = "GitBranch",
|
||||||
condition = require("galaxyline.condition").check_git_workspace,
|
condition = require("galaxyline.condition").check_git_workspace,
|
||||||
highlight = {colors.grey_fg2, colors.statusline_bg}
|
highlight = { colors.grey_fg2, colors.statusline_bg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local mode_colors = {
|
local mode_colors = {
|
||||||
[110] = {"NORMAL", colors.red},
|
[110] = { "NORMAL", colors.red },
|
||||||
[105] = {"INSERT", colors.dark_purple},
|
[105] = { "INSERT", colors.dark_purple },
|
||||||
[99] = {"COMMAND", colors.pink},
|
[99] = { "COMMAND", colors.pink },
|
||||||
[116] = {"TERMINAL", colors.green},
|
[116] = { "TERMINAL", colors.green },
|
||||||
[118] = {"VISUAL", colors.cyan},
|
[118] = { "VISUAL", colors.cyan },
|
||||||
[22] = {"V-BLOCK", colors.cyan},
|
[22] = { "V-BLOCK", colors.cyan },
|
||||||
[86] = {"V_LINE", colors.cyan},
|
[86] = { "V_LINE", colors.cyan },
|
||||||
[82] = {"REPLACE", colors.orange},
|
[82] = { "REPLACE", colors.orange },
|
||||||
[115] = {"SELECT", colors.nord_blue},
|
[115] = { "SELECT", colors.nord_blue },
|
||||||
[83] = {"S-LINE", colors.nord_blue}
|
[83] = { "S-LINE", colors.nord_blue },
|
||||||
}
|
}
|
||||||
|
|
||||||
local mode = function(n)
|
local mode = function(n)
|
||||||
return mode_colors[vim.fn.mode():byte()][n]
|
return mode_colors[vim.fn.mode():byte()][n]
|
||||||
end
|
end
|
||||||
|
|
||||||
gls.right[4] = {
|
gls.right[4] = {
|
||||||
left_round = {
|
left_round = {
|
||||||
provider = function()
|
provider = function()
|
||||||
vim.cmd("hi Galaxyleft_round guifg=" .. mode(2))
|
vim.cmd("hi Galaxyleft_round guifg=" .. mode(2))
|
||||||
return left_separator
|
return left_separator
|
||||||
end,
|
end,
|
||||||
separator = " ",
|
separator = " ",
|
||||||
separator_highlight = {colors.statusline_bg, colors.statusline_bg},
|
separator_highlight = { colors.statusline_bg, colors.statusline_bg },
|
||||||
highlight = {"GalaxyViMode", colors.statusline_bg}
|
highlight = { "GalaxyViMode", colors.statusline_bg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.right[5] = {
|
gls.right[5] = {
|
||||||
viMode_icon = {
|
viMode_icon = {
|
||||||
provider = function()
|
provider = function()
|
||||||
vim.cmd("hi GalaxyviMode_icon guibg=" .. mode(2))
|
vim.cmd("hi GalaxyviMode_icon guibg=" .. mode(2))
|
||||||
return " "
|
return " "
|
||||||
end,
|
end,
|
||||||
highlight = {colors.statusline_bg, colors.red}
|
highlight = { colors.statusline_bg, colors.red },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.right[6] = {
|
gls.right[6] = {
|
||||||
ViMode = {
|
ViMode = {
|
||||||
provider = function()
|
provider = function()
|
||||||
vim.cmd("hi GalaxyViMode guifg=" .. mode(2))
|
vim.cmd("hi GalaxyViMode guifg=" .. mode(2))
|
||||||
return " " .. mode(1) .. " "
|
return " " .. mode(1) .. " "
|
||||||
end,
|
end,
|
||||||
highlight = {"GalaxyViMode", colors.lightbg}
|
highlight = { "GalaxyViMode", colors.lightbg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.right[7] = {
|
gls.right[7] = {
|
||||||
some_RoundIcon = {
|
some_RoundIcon = {
|
||||||
provider = function()
|
provider = function()
|
||||||
return " "
|
return " "
|
||||||
end,
|
end,
|
||||||
separator = left_separator,
|
separator = left_separator,
|
||||||
separator_highlight = {colors.green, colors.lightbg},
|
separator_highlight = { colors.green, colors.lightbg },
|
||||||
highlight = {colors.lightbg, colors.green}
|
highlight = { colors.lightbg, colors.green },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
gls.right[8] = {
|
gls.right[8] = {
|
||||||
line_percentage = {
|
line_percentage = {
|
||||||
provider = function()
|
provider = function()
|
||||||
local current_line = vim.fn.line(".")
|
local current_line = vim.fn.line "."
|
||||||
local total_line = vim.fn.line("$")
|
local total_line = vim.fn.line "$"
|
||||||
|
|
||||||
if current_line == 1 then
|
if current_line == 1 then
|
||||||
return " Top "
|
return " Top "
|
||||||
elseif current_line == vim.fn.line("$") then
|
elseif current_line == vim.fn.line "$" then
|
||||||
return " Bot "
|
return " Bot "
|
||||||
end
|
end
|
||||||
local result, _ = math.modf((current_line / total_line) * 100)
|
local result, _ = math.modf((current_line / total_line) * 100)
|
||||||
return " " .. result .. "% "
|
return " " .. result .. "% "
|
||||||
end,
|
end,
|
||||||
highlight = {colors.green, colors.lightbg}
|
highlight = { colors.green, colors.lightbg },
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,88 +1,82 @@
|
|||||||
local present, telescope = pcall(require, "telescope")
|
local present, telescope = pcall(require, "telescope")
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
telescope.setup(
|
telescope.setup {
|
||||||
{
|
defaults = {
|
||||||
defaults = {
|
vimgrep_arguments = {
|
||||||
vimgrep_arguments = {
|
"rg",
|
||||||
"rg",
|
"--color=never",
|
||||||
"--color=never",
|
"--no-heading",
|
||||||
"--no-heading",
|
"--with-filename",
|
||||||
"--with-filename",
|
"--line-number",
|
||||||
"--line-number",
|
"--column",
|
||||||
"--column",
|
"--smart-case",
|
||||||
"--smart-case"
|
},
|
||||||
},
|
prompt_prefix = " ",
|
||||||
prompt_prefix = " ",
|
selection_caret = " ",
|
||||||
selection_caret = " ",
|
entry_prefix = " ",
|
||||||
entry_prefix = " ",
|
initial_mode = "insert",
|
||||||
initial_mode = "insert",
|
selection_strategy = "reset",
|
||||||
selection_strategy = "reset",
|
sorting_strategy = "descending",
|
||||||
sorting_strategy = "descending",
|
layout_strategy = "horizontal",
|
||||||
layout_strategy = "horizontal",
|
layout_config = {
|
||||||
layout_config = {
|
horizontal = {
|
||||||
horizontal = {
|
prompt_position = "top",
|
||||||
prompt_position = "top",
|
preview_width = 0.55,
|
||||||
preview_width = 0.55,
|
results_width = 0.8,
|
||||||
results_width = 0.8
|
},
|
||||||
},
|
vertical = {
|
||||||
vertical = {
|
mirror = false,
|
||||||
mirror = false
|
},
|
||||||
},
|
width = 0.87,
|
||||||
width = 0.87,
|
height = 0.80,
|
||||||
height = 0.80,
|
preview_cutoff = 120,
|
||||||
preview_cutoff = 120
|
},
|
||||||
},
|
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||||
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
file_ignore_patterns = {},
|
||||||
file_ignore_patterns = {},
|
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
path_display = { "absolute" },
|
||||||
path_display = {"absolute"},
|
winblend = 0,
|
||||||
winblend = 0,
|
border = {},
|
||||||
border = {},
|
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||||
borderchars = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"},
|
color_devicons = true,
|
||||||
color_devicons = true,
|
use_less = 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,
|
||||||
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
|
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
||||||
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
||||||
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
-- Developer configurations: Not meant for general override
|
||||||
-- 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 = {
|
||||||
extensions = {
|
fzf = {
|
||||||
fzf = {
|
fuzzy = true, -- false will only do exact matching
|
||||||
fuzzy = true, -- false will only do exact matching
|
override_generic_sorter = false, -- override the generic sorter
|
||||||
override_generic_sorter = false, -- override the generic sorter
|
override_file_sorter = true, -- override the file sorter
|
||||||
override_file_sorter = true, -- override the file sorter
|
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||||
case_mode = "smart_case" -- or "ignore_case" or "respect_case"
|
-- the default case_mode is "smart_case"
|
||||||
-- the default case_mode is "smart_case"
|
},
|
||||||
},
|
media_files = {
|
||||||
media_files = {
|
filetypes = { "png", "webp", "jpg", "jpeg" },
|
||||||
filetypes = {"png", "webp", "jpg", "jpeg"},
|
find_cmd = "rg", -- find command (defaults to `fd`)
|
||||||
find_cmd = "rg" -- find command (defaults to `fd`)
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- load the theme_switcher extension
|
-- load the theme_switcher extension
|
||||||
require("telescope").load_extension("themes")
|
require("telescope").load_extension "themes"
|
||||||
|
|
||||||
if
|
if not pcall(function()
|
||||||
not pcall(
|
telescope.load_extension "fzf"
|
||||||
function()
|
telescope.load_extension "media_files"
|
||||||
telescope.load_extension("fzf")
|
end) then
|
||||||
telescope.load_extension("media_files")
|
-- This should only trigger when in need of PackerSync, so better do it
|
||||||
end
|
print "After completion of PackerCompile, restart neovim."
|
||||||
)
|
-- Trigger packer compile on PackerComplete, so it properly waits for PackerSync
|
||||||
then
|
vim.cmd 'autocmd User PackerComplete ++once lua print "Waiting for PackerCompile.." require("packer").compile()'
|
||||||
-- This should only trigger when in need of PackerSync, so better do it
|
vim.cmd 'autocmd User PackerCompileDone ++once echo "Packer Compile done, restart neovim."'
|
||||||
print("After completion of PackerCompile, restart neovim.")
|
require "pluginList"
|
||||||
-- Trigger packer compile on PackerComplete, so it properly waits for PackerSync
|
require("packer").update("telescope-fzf-native.nvim", "telescope-media-files.nvim")
|
||||||
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."'
|
|
||||||
require "pluginList"
|
|
||||||
require("packer").update("telescope-fzf-native.nvim", "telescope-media-files.nvim")
|
|
||||||
end
|
end
|
||||||
|
@ -1,47 +1,47 @@
|
|||||||
local present, toggleterm = pcall(require, "toggleterm")
|
local present, toggleterm = pcall(require, "toggleterm")
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
toggleterm.setup {
|
toggleterm.setup {
|
||||||
-- size can be a number or function which is passed the current terminal
|
-- size can be a number or function which is passed the current terminal
|
||||||
size = function(term)
|
size = function(term)
|
||||||
if term.direction == "horizontal" then
|
if term.direction == "horizontal" then
|
||||||
return 15
|
return 15
|
||||||
elseif term.direction == "vertical" then
|
elseif term.direction == "vertical" then
|
||||||
return vim.o.columns * 0.4
|
return vim.o.columns * 0.4
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
-- open_mapping = [[<C-\>]], -- mapping set in mappings.lua
|
-- open_mapping = [[<C-\>]], -- mapping set in mappings.lua
|
||||||
hide_numbers = true, -- hide the number column in toggleterm buffers
|
hide_numbers = true, -- hide the number column in toggleterm buffers
|
||||||
shade_terminals = false,
|
shade_terminals = false,
|
||||||
start_in_insert = true,
|
start_in_insert = true,
|
||||||
-- insert_mappings = true, -- see 'open_mapping', not set on purpose
|
-- insert_mappings = true, -- see 'open_mapping', not set on purpose
|
||||||
-- whether or not the open mapping applies in insert mode
|
-- whether or not the open mapping applies in insert mode
|
||||||
persist_size = true,
|
persist_size = true,
|
||||||
direction = 'vertical',
|
direction = "vertical",
|
||||||
close_on_exit = true, -- close the terminal window when the process exits
|
close_on_exit = true, -- close the terminal window when the process exits
|
||||||
-- This field is only relevant if direction is set to 'float'
|
-- This field is only relevant if direction is set to 'float'
|
||||||
float_opts = {
|
float_opts = {
|
||||||
border = 'single',
|
border = "single",
|
||||||
winblend = 0,
|
winblend = 0,
|
||||||
highlights = {
|
highlights = {
|
||||||
border = "Normal",
|
border = "Normal",
|
||||||
background = "Normal",
|
background = "Normal",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local Terminal = require("toggleterm.terminal").Terminal
|
local Terminal = require("toggleterm.terminal").Terminal
|
||||||
|
|
||||||
_G.termW = Terminal:new {
|
_G.termW = Terminal:new {
|
||||||
direction = "window",
|
direction = "window",
|
||||||
}
|
}
|
||||||
|
|
||||||
_G.termV = Terminal:new {
|
_G.termV = Terminal:new {
|
||||||
direction = "vertical",
|
direction = "vertical",
|
||||||
}
|
}
|
||||||
|
|
||||||
_G.termH = Terminal:new {
|
_G.termH = Terminal:new {
|
||||||
direction = "horizontal",
|
direction = "horizontal",
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
local present, ts_config = pcall(require, "nvim-treesitter.configs")
|
local present, ts_config = pcall(require, "nvim-treesitter.configs")
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
ts_config.setup {
|
ts_config.setup {
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"bash",
|
"bash",
|
||||||
"lua"
|
"lua",
|
||||||
},
|
},
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
use_languagetree = true
|
use_languagetree = true,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,70 +1,68 @@
|
|||||||
local present, true_zen = pcall(require, "true-zen")
|
local present, true_zen = pcall(require, "true-zen")
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
true_zen.setup(
|
true_zen.setup {
|
||||||
{
|
ui = {
|
||||||
ui = {
|
bottom = {
|
||||||
bottom = {
|
laststatus = 0,
|
||||||
laststatus = 0,
|
ruler = false,
|
||||||
ruler = false,
|
showmode = false,
|
||||||
showmode = false,
|
showcmd = false,
|
||||||
showcmd = false,
|
cmdheight = 1,
|
||||||
cmdheight = 1
|
},
|
||||||
},
|
top = {
|
||||||
top = {
|
showtabline = 0,
|
||||||
showtabline = 0
|
},
|
||||||
},
|
left = {
|
||||||
left = {
|
number = false,
|
||||||
number = false,
|
relativenumber = false,
|
||||||
relativenumber = false,
|
signcolumn = "no",
|
||||||
signcolumn = "no"
|
},
|
||||||
}
|
},
|
||||||
},
|
modes = {
|
||||||
modes = {
|
ataraxis = {
|
||||||
ataraxis = {
|
left_padding = 32,
|
||||||
left_padding = 32,
|
right_padding = 32,
|
||||||
right_padding = 32,
|
top_padding = 1,
|
||||||
top_padding = 1,
|
bottom_padding = 1,
|
||||||
bottom_padding = 1,
|
ideal_writing_area_width = { 0 },
|
||||||
ideal_writing_area_width = {0},
|
auto_padding = true,
|
||||||
auto_padding = true,
|
keep_default_fold_fillchars = true,
|
||||||
keep_default_fold_fillchars = true,
|
custome_bg = "",
|
||||||
custome_bg = "",
|
bg_configuration = true,
|
||||||
bg_configuration = true,
|
affected_higroups = {
|
||||||
affected_higroups = {
|
NonText = {},
|
||||||
NonText = {},
|
FoldColumn = {},
|
||||||
FoldColumn = {},
|
ColorColumn = {},
|
||||||
ColorColumn = {},
|
VertSplit = {},
|
||||||
VertSplit = {},
|
StatusLine = {},
|
||||||
StatusLine = {},
|
StatusLineNC = {},
|
||||||
StatusLineNC = {},
|
SignColumn = {},
|
||||||
SignColumn = {}
|
},
|
||||||
}
|
},
|
||||||
},
|
focus = {
|
||||||
focus = {
|
margin_of_error = 5,
|
||||||
margin_of_error = 5,
|
focus_method = "experimental",
|
||||||
focus_method = "experimental"
|
},
|
||||||
}
|
},
|
||||||
},
|
integrations = {
|
||||||
integrations = {
|
vim_gitgutter = false,
|
||||||
vim_gitgutter = false,
|
galaxyline = true,
|
||||||
galaxyline = true,
|
tmux = false,
|
||||||
tmux = false,
|
gitsigns = false,
|
||||||
gitsigns = false,
|
nvim_bufferline = true,
|
||||||
nvim_bufferline = true,
|
limelight = false,
|
||||||
limelight = false,
|
vim_airline = false,
|
||||||
vim_airline = false,
|
vim_powerline = false,
|
||||||
vim_powerline = false,
|
vim_signify = false,
|
||||||
vim_signify = false,
|
express_line = false,
|
||||||
express_line = false,
|
lualine = false,
|
||||||
lualine = false
|
},
|
||||||
},
|
misc = {
|
||||||
misc = {
|
on_off_commands = false,
|
||||||
on_off_commands = false,
|
ui_elements_commands = false,
|
||||||
ui_elements_commands = false,
|
cursor_by_mode = false,
|
||||||
cursor_by_mode = false
|
},
|
||||||
}
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
|
@ -4,144 +4,139 @@ local M = {}
|
|||||||
-- Custom theme picker
|
-- Custom theme picker
|
||||||
-- Most of the code is copied from telescope colorscheme plugin, mostly for preview creation
|
-- Most of the code is copied from telescope colorscheme plugin, mostly for preview creation
|
||||||
M.theme_switcher = function(opts)
|
M.theme_switcher = function(opts)
|
||||||
local pickers, finders, previewers, actions, action_state, utils, conf
|
local pickers, finders, previewers, actions, action_state, utils, conf
|
||||||
if pcall(require, "telescope") then
|
if pcall(require, "telescope") then
|
||||||
pickers = require "telescope.pickers"
|
pickers = require "telescope.pickers"
|
||||||
finders = require "telescope.finders"
|
finders = require "telescope.finders"
|
||||||
previewers = require "telescope.previewers"
|
previewers = require "telescope.previewers"
|
||||||
|
|
||||||
actions = require "telescope.actions"
|
actions = require "telescope.actions"
|
||||||
action_state = require "telescope.actions.state"
|
action_state = require "telescope.actions.state"
|
||||||
utils = require "telescope.utils"
|
utils = require "telescope.utils"
|
||||||
conf = require("telescope.config").values
|
conf = require("telescope.config").values
|
||||||
else
|
else
|
||||||
error "Cannot find telescope!"
|
error "Cannot find telescope!"
|
||||||
end
|
end
|
||||||
|
|
||||||
local local_utils = require "utils"
|
local local_utils = require "utils"
|
||||||
local reload_theme = local_utils.reload_theme
|
local reload_theme = local_utils.reload_theme
|
||||||
|
|
||||||
-- get a table of available themes
|
-- get a table of available themes
|
||||||
local themes = local_utils.list_themes()
|
local themes = local_utils.list_themes()
|
||||||
if next(themes) ~= nil then
|
if next(themes) ~= nil then
|
||||||
-- save this to use it for later to restore if theme not changed
|
-- save this to use it for later to restore if theme not changed
|
||||||
local current_theme = vim.g.nvchad_theme
|
local current_theme = vim.g.nvchad_theme
|
||||||
local new_theme = ""
|
local new_theme = ""
|
||||||
local change = false
|
local change = false
|
||||||
|
|
||||||
-- buffer number and name
|
-- buffer number and name
|
||||||
local bufnr = vim.api.nvim_get_current_buf()
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
|
||||||
local previewer
|
local previewer
|
||||||
|
|
||||||
-- in case its not a normal buffer
|
-- in case its not a normal buffer
|
||||||
if vim.fn.buflisted(bufnr) ~= 1 then
|
if vim.fn.buflisted(bufnr) ~= 1 then
|
||||||
local deleted = false
|
local deleted = false
|
||||||
local function del_win(win_id)
|
local function del_win(win_id)
|
||||||
if win_id and vim.api.nvim_win_is_valid(win_id) then
|
if win_id and vim.api.nvim_win_is_valid(win_id) then
|
||||||
utils.buf_delete(vim.api.nvim_win_get_buf(win_id))
|
utils.buf_delete(vim.api.nvim_win_get_buf(win_id))
|
||||||
pcall(vim.api.nvim_win_close, win_id, true)
|
pcall(vim.api.nvim_win_close, win_id, true)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
previewer =
|
previewer = previewers.new {
|
||||||
previewers.new {
|
preview_fn = function(_, entry, status)
|
||||||
preview_fn = function(_, entry, status)
|
if not deleted then
|
||||||
if not deleted then
|
deleted = true
|
||||||
deleted = true
|
del_win(status.preview_win)
|
||||||
del_win(status.preview_win)
|
del_win(status.preview_border_win)
|
||||||
del_win(status.preview_border_win)
|
end
|
||||||
end
|
reload_theme(entry.value)
|
||||||
reload_theme(entry.value)
|
end,
|
||||||
end
|
}
|
||||||
}
|
else
|
||||||
else
|
-- show current buffer content in previewer
|
||||||
-- show current buffer content in previewer
|
previewer = previewers.new_buffer_previewer {
|
||||||
previewer =
|
get_buffer_by_name = function()
|
||||||
previewers.new_buffer_previewer {
|
return bufname
|
||||||
get_buffer_by_name = function()
|
end,
|
||||||
return bufname
|
define_preview = function(self, entry)
|
||||||
end,
|
if vim.loop.fs_stat(bufname) then
|
||||||
define_preview = function(self, entry)
|
conf.buffer_previewer_maker(bufname, self.state.bufnr, { bufname = self.state.bufname })
|
||||||
if vim.loop.fs_stat(bufname) then
|
else
|
||||||
conf.buffer_previewer_maker(bufname, self.state.bufnr, {bufname = self.state.bufname})
|
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||||
else
|
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
|
||||||
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
end
|
||||||
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
|
reload_theme(entry.value)
|
||||||
end
|
end,
|
||||||
reload_theme(entry.value)
|
}
|
||||||
end
|
end
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local picker =
|
local picker = pickers.new {
|
||||||
pickers.new(
|
prompt_title = "Set NvChad color",
|
||||||
{
|
finder = finders.new_table(themes),
|
||||||
prompt_title = "Set NvChad color",
|
previewer = previewer,
|
||||||
finder = finders.new_table(themes),
|
sorter = conf.generic_sorter(opts),
|
||||||
previewer = previewer,
|
attach_mappings = function()
|
||||||
sorter = conf.generic_sorter(opts),
|
actions.select_default:replace(
|
||||||
attach_mappings = function()
|
-- if a entry is selected, change current_theme to that
|
||||||
actions.select_default:replace(
|
function(prompt_bufnr)
|
||||||
-- if a entry is selected, change current_theme to that
|
local selection = action_state.get_selected_entry()
|
||||||
function(prompt_bufnr)
|
new_theme = selection.value
|
||||||
local selection = action_state.get_selected_entry()
|
change = true
|
||||||
new_theme = selection.value
|
actions.close(prompt_bufnr)
|
||||||
change = true
|
end
|
||||||
actions.close(prompt_bufnr)
|
)
|
||||||
end
|
return true
|
||||||
)
|
end,
|
||||||
return true
|
}
|
||||||
end
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- rewrite picker.close_windows
|
-- rewrite picker.close_windows
|
||||||
local close_windows = picker.close_windows
|
local close_windows = picker.close_windows
|
||||||
picker.close_windows = function(status)
|
picker.close_windows = function(status)
|
||||||
close_windows(status)
|
close_windows(status)
|
||||||
-- now apply the theme, if success, then ask for default theme change
|
-- now apply the theme, if success, then ask for default theme change
|
||||||
local final_theme
|
local final_theme
|
||||||
|
if change then
|
||||||
|
final_theme = new_theme
|
||||||
|
else
|
||||||
|
final_theme = current_theme
|
||||||
|
end
|
||||||
|
|
||||||
|
if reload_theme(final_theme) then
|
||||||
if change then
|
if change then
|
||||||
final_theme = new_theme
|
-- ask for confirmation to set as default theme
|
||||||
else
|
local ans = string.lower(vim.fn.input("Set " .. new_theme .. " as default theme ? [y/N] ")) == "y"
|
||||||
final_theme = current_theme
|
local_utils.clear_cmdline()
|
||||||
|
if ans then
|
||||||
|
local_utils.change_theme(current_theme, final_theme)
|
||||||
|
else
|
||||||
|
-- will be used in restoring nvchad theme var
|
||||||
|
final_theme = current_theme
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
if reload_theme(final_theme) then
|
final_theme = current_theme
|
||||||
if change then
|
end
|
||||||
-- ask for confirmation to set as default theme
|
-- set nvchad_theme global var
|
||||||
local ans = string.lower(vim.fn.input("Set " .. new_theme .. " as default theme ? [y/N] ")) == "y"
|
vim.g.nvchad_theme = final_theme
|
||||||
local_utils.clear_cmdline()
|
end
|
||||||
if ans then
|
-- launch the telescope picker
|
||||||
local_utils.change_theme(current_theme, final_theme)
|
picker:find()
|
||||||
else
|
else
|
||||||
-- will be used in restoring nvchad theme var
|
print("No themes found in " .. vim.fn.stdpath "config" .. "/lua/themes")
|
||||||
final_theme = current_theme
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
final_theme = current_theme
|
|
||||||
end
|
|
||||||
-- set nvchad_theme global var
|
|
||||||
vim.g.nvchad_theme = final_theme
|
|
||||||
end
|
|
||||||
-- launch the telescope picker
|
|
||||||
picker:find()
|
|
||||||
else
|
|
||||||
print("No themes found in " .. vim.fn.stdpath("config") .. "/lua/themes")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- register theme swticher as themes to telescope
|
-- register theme swticher as themes to telescope
|
||||||
local present, telescope = pcall(require, "telescope")
|
local present, telescope = pcall(require, "telescope")
|
||||||
if present then
|
if present then
|
||||||
return telescope.register_extension {
|
return telescope.register_extension {
|
||||||
exports = {
|
exports = {
|
||||||
themes = M.theme_switcher
|
themes = M.theme_switcher,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error "Cannot find telescope!"
|
error "Cannot find telescope!"
|
||||||
end
|
end
|
||||||
|
@ -4,9 +4,9 @@ vim.g.nvchad_theme = chad_theme
|
|||||||
local present, base16 = pcall(require, "base16")
|
local present, base16 = pcall(require, "base16")
|
||||||
|
|
||||||
if present then
|
if present then
|
||||||
base16(base16.themes(chad_theme), true)
|
base16(base16.themes(chad_theme), true)
|
||||||
require "highlights"
|
require "highlights"
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
local colors = {
|
local colors = {
|
||||||
white = "#F8F8F2",
|
white = "#F8F8F2",
|
||||||
darker_black = "#232531",
|
darker_black = "#232531",
|
||||||
black = "#282A36", -- nvim bg
|
black = "#282A36", -- nvim bg
|
||||||
black2 = "#303341",
|
black2 = "#303341",
|
||||||
one_bg = "#373844", -- real bg of onedark
|
one_bg = "#373844", -- real bg of onedark
|
||||||
one_bg2 = "#44475a",
|
one_bg2 = "#44475a",
|
||||||
one_bg3 = "#565761",
|
one_bg3 = "#565761",
|
||||||
grey = "#41434f",
|
grey = "#41434f",
|
||||||
grey_fg = "#5a5c68",
|
grey_fg = "#5a5c68",
|
||||||
grey_fg2 = "#5a5c68",
|
grey_fg2 = "#5a5c68",
|
||||||
light_grey = "#636571",
|
light_grey = "#636571",
|
||||||
red = "#FF5555",
|
red = "#FF5555",
|
||||||
baby_pink = "#DE8C92",
|
baby_pink = "#DE8C92",
|
||||||
pink = "#FF79C6",
|
pink = "#FF79C6",
|
||||||
line = "#373844", -- for lines like vertsplit
|
line = "#373844", -- for lines like vertsplit
|
||||||
green = "#50FA7B",
|
green = "#50FA7B",
|
||||||
vibrant_green = "#69FF94",
|
vibrant_green = "#69FF94",
|
||||||
nord_blue = "#b389ef",
|
nord_blue = "#b389ef",
|
||||||
blue = "#BD93F9",
|
blue = "#BD93F9",
|
||||||
yellow = "#F1FA8C",
|
yellow = "#F1FA8C",
|
||||||
sun = "#FFFFA5",
|
sun = "#FFFFA5",
|
||||||
purple = "#BD93F9",
|
purple = "#BD93F9",
|
||||||
dark_purple = "#BD93F9",
|
dark_purple = "#BD93F9",
|
||||||
teal = "#0088cc",
|
teal = "#0088cc",
|
||||||
orange = "#FFB86C",
|
orange = "#FFB86C",
|
||||||
cyan = "#8BE9FD",
|
cyan = "#8BE9FD",
|
||||||
statusline_bg = "#2b2d39",
|
statusline_bg = "#2b2d39",
|
||||||
lightbg = "#343642",
|
lightbg = "#343642",
|
||||||
lightbg2 = "#2f313d"
|
lightbg2 = "#2f313d",
|
||||||
}
|
}
|
||||||
|
|
||||||
return colors
|
return colors
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
local colors = {
|
local colors = {
|
||||||
white = "#fff9e8",
|
white = "#fff9e8",
|
||||||
darker_black = "#272f35",
|
darker_black = "#272f35",
|
||||||
black = "#2b3339", -- nvim bg
|
black = "#2b3339", -- nvim bg
|
||||||
black2 = "#323a40",
|
black2 = "#323a40",
|
||||||
one_bg = "#333b41",
|
one_bg = "#333b41",
|
||||||
one_bg2 = "#363e44",
|
one_bg2 = "#363e44",
|
||||||
one_bg3 = "#3a4248",
|
one_bg3 = "#3a4248",
|
||||||
grey = "#4a5258",
|
grey = "#4a5258",
|
||||||
grey_fg = "#50585e",
|
grey_fg = "#50585e",
|
||||||
grey_fg2 = "#545c62",
|
grey_fg2 = "#545c62",
|
||||||
light_grey = "#586066",
|
light_grey = "#586066",
|
||||||
red = "#e67e80",
|
red = "#e67e80",
|
||||||
baby_pink = "#ce8196",
|
baby_pink = "#ce8196",
|
||||||
pink = "#ff75a0",
|
pink = "#ff75a0",
|
||||||
line = "#3a4248", -- for lines like vertsplit
|
line = "#3a4248", -- for lines like vertsplit
|
||||||
green = "#83c092",
|
green = "#83c092",
|
||||||
vibrant_green = "#a7c080",
|
vibrant_green = "#a7c080",
|
||||||
nord_blue = "#78b4ac",
|
nord_blue = "#78b4ac",
|
||||||
blue = "#7fbbb3",
|
blue = "#7fbbb3",
|
||||||
yellow = "#dbbc7f",
|
yellow = "#dbbc7f",
|
||||||
sun = "#d1b171",
|
sun = "#d1b171",
|
||||||
purple = "#b4bbc8",
|
purple = "#b4bbc8",
|
||||||
dark_purple = "#d699b6",
|
dark_purple = "#d699b6",
|
||||||
teal = "#69a59d",
|
teal = "#69a59d",
|
||||||
orange = "#e69875",
|
orange = "#e69875",
|
||||||
cyan = "#95d1c9",
|
cyan = "#95d1c9",
|
||||||
statusline_bg = "#2e363c",
|
statusline_bg = "#2e363c",
|
||||||
lightbg = "#3d454b",
|
lightbg = "#3d454b",
|
||||||
lightbg2 = "#333b41"
|
lightbg2 = "#333b41",
|
||||||
}
|
}
|
||||||
|
|
||||||
return colors
|
return colors
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
local colors = {
|
local colors = {
|
||||||
white = "#c7b89d",
|
white = "#c7b89d",
|
||||||
darker_black = "#1e2122",
|
darker_black = "#1e2122",
|
||||||
black = "#222526", -- nvim bg
|
black = "#222526", -- nvim bg
|
||||||
black2 = "#26292a",
|
black2 = "#26292a",
|
||||||
one_bg = "#2b2e2f",
|
one_bg = "#2b2e2f",
|
||||||
one_bg2 = "#2f3233",
|
one_bg2 = "#2f3233",
|
||||||
one_bg3 = "#313435",
|
one_bg3 = "#313435",
|
||||||
grey = "#46494a",
|
grey = "#46494a",
|
||||||
grey_fg = "#5d6061",
|
grey_fg = "#5d6061",
|
||||||
grey_fg2 = "#5b5e5f",
|
grey_fg2 = "#5b5e5f",
|
||||||
light_grey = "#585b5c",
|
light_grey = "#585b5c",
|
||||||
red = "#ec6b64",
|
red = "#ec6b64",
|
||||||
baby_pink = "#ce8196",
|
baby_pink = "#ce8196",
|
||||||
pink = "#ff75a0",
|
pink = "#ff75a0",
|
||||||
line = "#2c2f30", -- for lines like vertsplit
|
line = "#2c2f30", -- for lines like vertsplit
|
||||||
green = "#89b482",
|
green = "#89b482",
|
||||||
vibrant_green = "#a9b665",
|
vibrant_green = "#a9b665",
|
||||||
nord_blue = "#6f8faf",
|
nord_blue = "#6f8faf",
|
||||||
blue = "#6d8dad",
|
blue = "#6d8dad",
|
||||||
yellow = "#d6b676",
|
yellow = "#d6b676",
|
||||||
sun = "#d1b171",
|
sun = "#d1b171",
|
||||||
purple = "#b4bbc8",
|
purple = "#b4bbc8",
|
||||||
dark_purple = "#cc7f94",
|
dark_purple = "#cc7f94",
|
||||||
teal = "#749689",
|
teal = "#749689",
|
||||||
orange = "#e78a4e",
|
orange = "#e78a4e",
|
||||||
cyan = "#82b3a8",
|
cyan = "#82b3a8",
|
||||||
statusline_bg = "#252829",
|
statusline_bg = "#252829",
|
||||||
lightbg = "#2d3139",
|
lightbg = "#2d3139",
|
||||||
lightbg2 = "#262a32"
|
lightbg2 = "#262a32",
|
||||||
}
|
}
|
||||||
|
|
||||||
return colors
|
return colors
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
local colors = {
|
local colors = {
|
||||||
white = "#b5bcc9",
|
white = "#b5bcc9",
|
||||||
darker_black = "#10171e",
|
darker_black = "#10171e",
|
||||||
black = "#131a21", -- nvim bg
|
black = "#131a21", -- nvim bg
|
||||||
black2 = "#1a2128",
|
black2 = "#1a2128",
|
||||||
one_bg = "#1e252c",
|
one_bg = "#1e252c",
|
||||||
one_bg2 = "#272e35",
|
one_bg2 = "#272e35",
|
||||||
one_bg3 = "#2a3138",
|
one_bg3 = "#2a3138",
|
||||||
grey = "#363d44",
|
grey = "#363d44",
|
||||||
grey_fg = "#4e555c",
|
grey_fg = "#4e555c",
|
||||||
grey_fg2 = "#51585f",
|
grey_fg2 = "#51585f",
|
||||||
light_grey = "#545b62",
|
light_grey = "#545b62",
|
||||||
red = "#ef8891",
|
red = "#ef8891",
|
||||||
baby_pink = "#fca2aa",
|
baby_pink = "#fca2aa",
|
||||||
pink = "#fca2af",
|
pink = "#fca2af",
|
||||||
line = "#20272e", -- for lines like vertsplit
|
line = "#20272e", -- for lines like vertsplit
|
||||||
green = "#9ce5c0",
|
green = "#9ce5c0",
|
||||||
vibrant_green = "#a5d4af",
|
vibrant_green = "#a5d4af",
|
||||||
blue = "#99aee5",
|
blue = "#99aee5",
|
||||||
nord_blue = "#9aa8cf",
|
nord_blue = "#9aa8cf",
|
||||||
yellow = "#fbdf90",
|
yellow = "#fbdf90",
|
||||||
sun = "#fbdf9a",
|
sun = "#fbdf9a",
|
||||||
purple = "#d7c1ed",
|
purple = "#d7c1ed",
|
||||||
dark_purple = "#ccaced",
|
dark_purple = "#ccaced",
|
||||||
teal = "#92dbb6",
|
teal = "#92dbb6",
|
||||||
orange = "#EDA685",
|
orange = "#EDA685",
|
||||||
cyan = "#b5c3ea",
|
cyan = "#b5c3ea",
|
||||||
statusline_bg = "#181f26",
|
statusline_bg = "#181f26",
|
||||||
lightbg = "#222930",
|
lightbg = "#222930",
|
||||||
lightbg2 = "#1d242b"
|
lightbg2 = "#1d242b",
|
||||||
}
|
}
|
||||||
|
|
||||||
return colors
|
return colors
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
local colors = {
|
local colors = {
|
||||||
white = "#b0b0b0",
|
white = "#b0b0b0",
|
||||||
darker_black = "#171d23",
|
darker_black = "#171d23",
|
||||||
black = "#1a2026", -- nvim bg
|
black = "#1a2026", -- nvim bg
|
||||||
black2 = "#20262c",
|
black2 = "#20262c",
|
||||||
one_bg = "#242a30",
|
one_bg = "#242a30",
|
||||||
one_bg2 = "#292f35",
|
one_bg2 = "#292f35",
|
||||||
one_bg3 = "#2e343a",
|
one_bg3 = "#2e343a",
|
||||||
grey = "#42484e",
|
grey = "#42484e",
|
||||||
grey_fg = "#474d53",
|
grey_fg = "#474d53",
|
||||||
grey_fg2 = "#50565c",
|
grey_fg2 = "#50565c",
|
||||||
light_grey = "#565c62",
|
light_grey = "#565c62",
|
||||||
red = "#ac8a8c",
|
red = "#ac8a8c",
|
||||||
baby_pink = "#de878f",
|
baby_pink = "#de878f",
|
||||||
pink = "#e89199",
|
pink = "#e89199",
|
||||||
line = "#2d3339", -- for lines like vertsplit
|
line = "#2d3339", -- for lines like vertsplit
|
||||||
green = "#8aac8b",
|
green = "#8aac8b",
|
||||||
vibrant_green = "#9ec49f",
|
vibrant_green = "#9ec49f",
|
||||||
blue = "#6b8bab",
|
blue = "#6b8bab",
|
||||||
nord_blue = "#7797b7",
|
nord_blue = "#7797b7",
|
||||||
yellow = "#c4c19e",
|
yellow = "#c4c19e",
|
||||||
sun = "#aca98a",
|
sun = "#aca98a",
|
||||||
purple = "#a39ec4",
|
purple = "#a39ec4",
|
||||||
dark_purple = "#8f8aac",
|
dark_purple = "#8f8aac",
|
||||||
teal = "#7c9cbc",
|
teal = "#7c9cbc",
|
||||||
orange = "#e39a83",
|
orange = "#e39a83",
|
||||||
cyan = "#9aafe6",
|
cyan = "#9aafe6",
|
||||||
statusline_bg = "#1e242a",
|
statusline_bg = "#1e242a",
|
||||||
lightbg = "#2d3339",
|
lightbg = "#2d3339",
|
||||||
lightbg2 = "#252b31"
|
lightbg2 = "#252b31",
|
||||||
}
|
}
|
||||||
|
|
||||||
return colors
|
return colors
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
local colors = {
|
local colors = {
|
||||||
white = "#abb2bf",
|
white = "#abb2bf",
|
||||||
darker_black = "#2a303c",
|
darker_black = "#2a303c",
|
||||||
black = "#2E3440", -- nvim bg
|
black = "#2E3440", -- nvim bg
|
||||||
black2 = "#343a46",
|
black2 = "#343a46",
|
||||||
one_bg = "#373d49",
|
one_bg = "#373d49",
|
||||||
one_bg2 = "#3a404c",
|
one_bg2 = "#3a404c",
|
||||||
one_bg3 = "#3d434f",
|
one_bg3 = "#3d434f",
|
||||||
grey = "#474d59",
|
grey = "#474d59",
|
||||||
grey_fg = "#565c68",
|
grey_fg = "#565c68",
|
||||||
grey_fg2 = "#606672",
|
grey_fg2 = "#606672",
|
||||||
light_grey = "#646a76",
|
light_grey = "#646a76",
|
||||||
red = "#BF616A",
|
red = "#BF616A",
|
||||||
baby_pink = "#de878f",
|
baby_pink = "#de878f",
|
||||||
pink = "#d57780",
|
pink = "#d57780",
|
||||||
line = "#3a404c", -- for lines like vertsplit
|
line = "#3a404c", -- for lines like vertsplit
|
||||||
green = "#A3BE8C",
|
green = "#A3BE8C",
|
||||||
vibrant_green = "#afca98",
|
vibrant_green = "#afca98",
|
||||||
blue = "#7797b7",
|
blue = "#7797b7",
|
||||||
nord_blue = "#81A1C1",
|
nord_blue = "#81A1C1",
|
||||||
yellow = "#EBCB8B",
|
yellow = "#EBCB8B",
|
||||||
sun = "#e1c181",
|
sun = "#e1c181",
|
||||||
purple = "#aab1be",
|
purple = "#aab1be",
|
||||||
dark_purple = "#B48EAD",
|
dark_purple = "#B48EAD",
|
||||||
teal = "#6484a4",
|
teal = "#6484a4",
|
||||||
orange = "#e39a83",
|
orange = "#e39a83",
|
||||||
cyan = "#9aafe6",
|
cyan = "#9aafe6",
|
||||||
statusline_bg = "#333945",
|
statusline_bg = "#333945",
|
||||||
lightbg = "#3f4551",
|
lightbg = "#3f4551",
|
||||||
lightbg2 = "#393f4b"
|
lightbg2 = "#393f4b",
|
||||||
}
|
}
|
||||||
|
|
||||||
return colors
|
return colors
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
local colors = {
|
local colors = {
|
||||||
white = "#abb2bf",
|
white = "#abb2bf",
|
||||||
darker_black = "#1b1f27",
|
darker_black = "#1b1f27",
|
||||||
black = "#1e222a", -- nvim bg
|
black = "#1e222a", -- nvim bg
|
||||||
black2 = "#252931",
|
black2 = "#252931",
|
||||||
one_bg = "#282c34", -- real bg of onedark
|
one_bg = "#282c34", -- real bg of onedark
|
||||||
one_bg2 = "#353b45",
|
one_bg2 = "#353b45",
|
||||||
one_bg3 = "#30343c",
|
one_bg3 = "#30343c",
|
||||||
grey = "#42464e",
|
grey = "#42464e",
|
||||||
grey_fg = "#565c64",
|
grey_fg = "#565c64",
|
||||||
grey_fg2 = "#6f737b",
|
grey_fg2 = "#6f737b",
|
||||||
light_grey = "#6f737b",
|
light_grey = "#6f737b",
|
||||||
red = "#d47d85",
|
red = "#d47d85",
|
||||||
baby_pink = "#DE8C92",
|
baby_pink = "#DE8C92",
|
||||||
pink = "#ff75a0",
|
pink = "#ff75a0",
|
||||||
line = "#2a2e36", -- for lines like vertsplit
|
line = "#2a2e36", -- for lines like vertsplit
|
||||||
green = "#A3BE8C",
|
green = "#A3BE8C",
|
||||||
vibrant_green = "#7eca9c",
|
vibrant_green = "#7eca9c",
|
||||||
nord_blue = "#81A1C1",
|
nord_blue = "#81A1C1",
|
||||||
blue = "#61afef",
|
blue = "#61afef",
|
||||||
yellow = "#e7c787",
|
yellow = "#e7c787",
|
||||||
sun = "#EBCB8B",
|
sun = "#EBCB8B",
|
||||||
purple = "#b4bbc8",
|
purple = "#b4bbc8",
|
||||||
dark_purple = "#c882e7",
|
dark_purple = "#c882e7",
|
||||||
teal = "#519ABA",
|
teal = "#519ABA",
|
||||||
orange = "#fca2aa",
|
orange = "#fca2aa",
|
||||||
cyan = "#a3b8ef",
|
cyan = "#a3b8ef",
|
||||||
statusline_bg = "#22262e",
|
statusline_bg = "#22262e",
|
||||||
lightbg = "#2d3139",
|
lightbg = "#2d3139",
|
||||||
lightbg2 = "#262a32"
|
lightbg2 = "#262a32",
|
||||||
}
|
}
|
||||||
|
|
||||||
return colors
|
return colors
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
local colors = {
|
local colors = {
|
||||||
white = "#c0caf5",
|
white = "#c0caf5",
|
||||||
darker_black = "#151621",
|
darker_black = "#151621",
|
||||||
black = "#171823", -- nvim bg
|
black = "#171823", -- nvim bg
|
||||||
black2 = "#20212c",
|
black2 = "#20212c",
|
||||||
one_bg = "#242530",
|
one_bg = "#242530",
|
||||||
one_bg2 = "#292a35",
|
one_bg2 = "#292a35",
|
||||||
one_bg3 = "#353b45",
|
one_bg3 = "#353b45",
|
||||||
grey = "#40486a",
|
grey = "#40486a",
|
||||||
grey_fg = "#4a5274",
|
grey_fg = "#4a5274",
|
||||||
grey_fg2 = "#4f5779",
|
grey_fg2 = "#4f5779",
|
||||||
light_grey = "#545c7e",
|
light_grey = "#545c7e",
|
||||||
red = "#f7768e",
|
red = "#f7768e",
|
||||||
baby_pink = "#DE8C92",
|
baby_pink = "#DE8C92",
|
||||||
pink = "#ff75a0",
|
pink = "#ff75a0",
|
||||||
line = "#242530", -- for lines like vertsplit
|
line = "#242530", -- for lines like vertsplit
|
||||||
green = "#9ece6a",
|
green = "#9ece6a",
|
||||||
vibrant_green = "#73daca",
|
vibrant_green = "#73daca",
|
||||||
nord_blue = "#80a8fd",
|
nord_blue = "#80a8fd",
|
||||||
blue = "#7aa2f7",
|
blue = "#7aa2f7",
|
||||||
yellow = "#e7c787",
|
yellow = "#e7c787",
|
||||||
sun = "#EBCB8B",
|
sun = "#EBCB8B",
|
||||||
purple = "#bb9af7",
|
purple = "#bb9af7",
|
||||||
dark_purple = "#9d7cd8",
|
dark_purple = "#9d7cd8",
|
||||||
teal = "#0db9d7",
|
teal = "#0db9d7",
|
||||||
orange = "#ff9e64",
|
orange = "#ff9e64",
|
||||||
cyan = "#7dcfff",
|
cyan = "#7dcfff",
|
||||||
statusline_bg = "#1d1e29",
|
statusline_bg = "#1d1e29",
|
||||||
lightbg = "#252631",
|
lightbg = "#252631",
|
||||||
lightbg2 = "#22232e"
|
lightbg2 = "#22232e",
|
||||||
}
|
}
|
||||||
|
|
||||||
return colors
|
return colors
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
local colors = {
|
local colors = {
|
||||||
white = "#C5C8C2",
|
white = "#C5C8C2",
|
||||||
darker_black = "#191b1d",
|
darker_black = "#191b1d",
|
||||||
black = "#1d1f21", -- nvim bg
|
black = "#1d1f21", -- nvim bg
|
||||||
black2 = "#232527",
|
black2 = "#232527",
|
||||||
one_bg = "#363a41",
|
one_bg = "#363a41",
|
||||||
one_bg2 = "#353b45",
|
one_bg2 = "#353b45",
|
||||||
one_bg3 = "#30343c",
|
one_bg3 = "#30343c",
|
||||||
grey = "#434547",
|
grey = "#434547",
|
||||||
grey_fg = "#545B68",
|
grey_fg = "#545B68",
|
||||||
grey_fg2 = "#616875",
|
grey_fg2 = "#616875",
|
||||||
light_grey = "#676e7b",
|
light_grey = "#676e7b",
|
||||||
red = "#cc6666",
|
red = "#cc6666",
|
||||||
baby_pink = "#FF6E79",
|
baby_pink = "#FF6E79",
|
||||||
pink = "#ff9ca3",
|
pink = "#ff9ca3",
|
||||||
line = "#27292b", -- for lines like vertsplit
|
line = "#27292b", -- for lines like vertsplit
|
||||||
green = "#a4b595",
|
green = "#a4b595",
|
||||||
vibrant_green = "#a3b991",
|
vibrant_green = "#a3b991",
|
||||||
nord_blue = "#728da8",
|
nord_blue = "#728da8",
|
||||||
blue = "#6f8dab",
|
blue = "#6f8dab",
|
||||||
yellow = "#d7bd8d",
|
yellow = "#d7bd8d",
|
||||||
sun = "#e4c180",
|
sun = "#e4c180",
|
||||||
purple = "#b4bbc8",
|
purple = "#b4bbc8",
|
||||||
dark_purple = "#b290ac",
|
dark_purple = "#b290ac",
|
||||||
teal = "#8abdb6",
|
teal = "#8abdb6",
|
||||||
orange = "#DE935F",
|
orange = "#DE935F",
|
||||||
cyan = "#70c0b1",
|
cyan = "#70c0b1",
|
||||||
statusline_bg = "#212326",
|
statusline_bg = "#212326",
|
||||||
lightbg = "#373B41",
|
lightbg = "#373B41",
|
||||||
lightbg2 = "#2D3035"
|
lightbg2 = "#2D3035",
|
||||||
}
|
}
|
||||||
|
|
||||||
return colors
|
return colors
|
||||||
|
317
lua/utils.lua
317
lua/utils.lua
@ -2,39 +2,36 @@ local M = {}
|
|||||||
|
|
||||||
-- 1st arg as current theme, 2nd as new theme
|
-- 1st arg as current theme, 2nd as new theme
|
||||||
M.change_theme = function(current_theme, new_theme)
|
M.change_theme = function(current_theme, new_theme)
|
||||||
if current_theme == nil or new_theme == nil then
|
if current_theme == nil or new_theme == nil then
|
||||||
print "Error: Provide current and new theme name"
|
print "Error: Provide current and new theme name"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if current_theme == new_theme then
|
if current_theme == new_theme then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local file = vim.fn.stdpath("config") .. "/lua/chadrc.lua"
|
local file = vim.fn.stdpath "config" .. "/lua/chadrc.lua"
|
||||||
-- store in data variable
|
-- store in data variable
|
||||||
local data = assert(M.file("r", file))
|
local data = assert(M.file("r", file))
|
||||||
-- escape characters which can be parsed as magic chars
|
-- escape characters which can be parsed as magic chars
|
||||||
current_theme = current_theme:gsub("%p", "%%%0")
|
current_theme = current_theme:gsub("%p", "%%%0")
|
||||||
new_theme = new_theme:gsub("%p", "%%%0")
|
new_theme = new_theme:gsub("%p", "%%%0")
|
||||||
local find = "theme = .?" .. current_theme .. ".?"
|
local find = "theme = .?" .. current_theme .. ".?"
|
||||||
local replace = 'theme = "' .. new_theme .. '"'
|
local replace = 'theme = "' .. new_theme .. '"'
|
||||||
local content = string.gsub(data, find, replace)
|
local content = string.gsub(data, find, replace)
|
||||||
-- see if the find string exists in file
|
-- see if the find string exists in file
|
||||||
if content == data then
|
if content == data then
|
||||||
print("Error: Cannot change default theme with " .. new_theme .. ", edit " .. file .. " manually")
|
print("Error: Cannot change default theme with " .. new_theme .. ", edit " .. file .. " manually")
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
assert(M.file("w", file, content))
|
assert(M.file("w", file, content))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
M.clear_cmdline = function()
|
M.clear_cmdline = function()
|
||||||
vim.defer_fn(
|
vim.defer_fn(function()
|
||||||
function()
|
vim.cmd "echo"
|
||||||
vim.cmd("echo")
|
end, 0)
|
||||||
end,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 1st arg - r or w
|
-- 1st arg - r or w
|
||||||
@ -42,167 +39,167 @@ end
|
|||||||
-- 3rd arg - content if 1st arg is w
|
-- 3rd arg - content if 1st arg is w
|
||||||
-- return file data on read, nothing on write
|
-- return file data on read, nothing on write
|
||||||
M.file = function(mode, filepath, content)
|
M.file = function(mode, filepath, content)
|
||||||
local data
|
local data
|
||||||
local fd = assert(vim.loop.fs_open(filepath, mode, 438))
|
local fd = assert(vim.loop.fs_open(filepath, mode, 438))
|
||||||
local stat = assert(vim.loop.fs_fstat(fd))
|
local stat = assert(vim.loop.fs_fstat(fd))
|
||||||
if stat.type ~= "file" then
|
if stat.type ~= "file" then
|
||||||
data = false
|
data = false
|
||||||
else
|
else
|
||||||
if mode == "r" then
|
if mode == "r" then
|
||||||
data = assert(vim.loop.fs_read(fd, stat.size, 0))
|
data = assert(vim.loop.fs_read(fd, stat.size, 0))
|
||||||
else
|
else
|
||||||
assert(vim.loop.fs_write(fd, content, 0))
|
assert(vim.loop.fs_write(fd, content, 0))
|
||||||
data = true
|
data = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
assert(vim.loop.fs_close(fd))
|
assert(vim.loop.fs_close(fd))
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
-- return a table of available themes
|
-- return a table of available themes
|
||||||
M.list_themes = function(return_type)
|
M.list_themes = function(return_type)
|
||||||
local themes = {}
|
local themes = {}
|
||||||
-- folder where theme files are stored
|
-- 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
|
-- 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)
|
local fd = vim.loop.fs_scandir(themes_folder)
|
||||||
if fd then
|
if fd then
|
||||||
while true do
|
while true do
|
||||||
local name, typ = vim.loop.fs_scandir_next(fd)
|
local name, typ = vim.loop.fs_scandir_next(fd)
|
||||||
if name == nil then
|
if name == nil then
|
||||||
break
|
break
|
||||||
|
end
|
||||||
|
if typ ~= "directory" and string.find(name, ".lua") then
|
||||||
|
-- return the table values as keys if specified
|
||||||
|
if return_type == "keys_as_value" then
|
||||||
|
themes[vim.fn.fnamemodify(name, ":r")] = true
|
||||||
|
else
|
||||||
|
table.insert(themes, vim.fn.fnamemodify(name, ":r"))
|
||||||
end
|
end
|
||||||
if typ ~= "directory" and string.find(name, ".lua") then
|
end
|
||||||
-- return the table values as keys if specified
|
end
|
||||||
if return_type == "keys_as_value" then
|
end
|
||||||
themes[vim.fn.fnamemodify(name, ":r")] = true
|
return themes
|
||||||
else
|
|
||||||
table.insert(themes, vim.fn.fnamemodify(name, ":r"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return themes
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- reload a plugin ( will try to load even if not loaded)
|
-- reload a plugin ( will try to load even if not loaded)
|
||||||
-- can take a string or list ( table )
|
-- can take a string or list ( table )
|
||||||
-- return true or false
|
-- return true or false
|
||||||
M.reload_plugin = function(plugins)
|
M.reload_plugin = function(plugins)
|
||||||
local status = true
|
local status = true
|
||||||
local function _reload_plugin(plugin)
|
local function _reload_plugin(plugin)
|
||||||
local loaded = package.loaded[plugin]
|
local loaded = package.loaded[plugin]
|
||||||
if loaded then
|
if loaded then
|
||||||
package.loaded[plugin] = nil
|
package.loaded[plugin] = nil
|
||||||
end
|
end
|
||||||
if not pcall(require, plugin) then
|
if not pcall(require, plugin) then
|
||||||
print("Error: Cannot load " .. plugin .. " plugin!")
|
print("Error: Cannot load " .. plugin .. " plugin!")
|
||||||
status = false
|
status = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if type(plugins) == "string" then
|
if type(plugins) == "string" then
|
||||||
_reload_plugin(plugins)
|
_reload_plugin(plugins)
|
||||||
elseif type(plugins) == "table" then
|
elseif type(plugins) == "table" then
|
||||||
for _, plugin in ipairs(plugins) do
|
for _, plugin in ipairs(plugins) do
|
||||||
_reload_plugin(plugin)
|
_reload_plugin(plugin)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return status
|
return status
|
||||||
end
|
end
|
||||||
|
|
||||||
-- reload themes without restarting vim
|
-- reload themes without restarting vim
|
||||||
-- if no theme name given then reload the current theme
|
-- if no theme name given then reload the current theme
|
||||||
M.reload_theme = function(theme_name)
|
M.reload_theme = function(theme_name)
|
||||||
local reload_plugin = require("utils").reload_plugin
|
local reload_plugin = require("utils").reload_plugin
|
||||||
|
|
||||||
-- if theme name is empty or nil, then reload the current theme
|
-- 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
|
theme_name = vim.g.nvchad_theme
|
||||||
end
|
end
|
||||||
|
|
||||||
if not pcall(require, "themes/" .. theme_name) then
|
if not pcall(require, "themes/" .. theme_name) then
|
||||||
print("No such theme ( " .. theme_name .. " )")
|
print("No such theme ( " .. theme_name .. " )")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.g.nvchad_theme = theme_name
|
vim.g.nvchad_theme = theme_name
|
||||||
|
|
||||||
-- reload the base16 theme
|
-- reload the base16 theme
|
||||||
local ok, base16 = pcall(require, "base16")
|
local ok, base16 = pcall(require, "base16")
|
||||||
if not ok then
|
if not ok then
|
||||||
print("Error: Cannot load base16 plugin!")
|
print "Error: Cannot load base16 plugin!"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
base16(base16.themes(theme_name), true)
|
base16(base16.themes(theme_name), true)
|
||||||
|
|
||||||
if
|
if
|
||||||
not reload_plugin {
|
not reload_plugin {
|
||||||
"highlights",
|
"highlights",
|
||||||
"plugins.bufferline",
|
"plugins.bufferline",
|
||||||
"galaxyline",
|
"galaxyline",
|
||||||
"plugins.statusline"
|
"plugins.statusline",
|
||||||
}
|
}
|
||||||
then
|
then
|
||||||
print "Error: Not able to reload all plugins."
|
print "Error: Not able to reload all plugins."
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- yes, this is very hacky, but due to new_async in
|
-- 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
|
-- https://github.com/glepnir/galaxyline.nvim/blob/main/lua/galaxyline/provider.lua#L5-L36
|
||||||
-- it doesn't work properly and some statusline stuff dissapears
|
-- it doesn't work properly and some statusline stuff dissapears
|
||||||
local vcs = require("galaxyline.provider_vcs")
|
local vcs = require "galaxyline.provider_vcs"
|
||||||
local fileinfo = require("galaxyline.provider_fileinfo")
|
local fileinfo = require "galaxyline.provider_fileinfo"
|
||||||
local buffer = require("galaxyline.provider_buffer")
|
local buffer = require "galaxyline.provider_buffer"
|
||||||
local extension = require("galaxyline.provider_extensions")
|
local extension = require "galaxyline.provider_extensions"
|
||||||
local whitespace = require("galaxyline.provider_whitespace")
|
local whitespace = require "galaxyline.provider_whitespace"
|
||||||
local lspclient = require("galaxyline.provider_lsp")
|
local lspclient = require "galaxyline.provider_lsp"
|
||||||
_G.galaxyline_providers = {
|
_G.galaxyline_providers = {
|
||||||
BufferIcon = buffer.get_buffer_type_icon,
|
BufferIcon = buffer.get_buffer_type_icon,
|
||||||
BufferNumber = buffer.get_buffer_number,
|
BufferNumber = buffer.get_buffer_number,
|
||||||
FileTypeName = buffer.get_buffer_filetype,
|
FileTypeName = buffer.get_buffer_filetype,
|
||||||
GitBranch = vcs.get_git_branch,
|
GitBranch = vcs.get_git_branch,
|
||||||
DiffAdd = vcs.diff_add,
|
DiffAdd = vcs.diff_add,
|
||||||
DiffModified = vcs.diff_modified,
|
DiffModified = vcs.diff_modified,
|
||||||
DiffRemove = vcs.diff_remove,
|
DiffRemove = vcs.diff_remove,
|
||||||
LineColumn = fileinfo.line_column,
|
LineColumn = fileinfo.line_column,
|
||||||
FileFormat = fileinfo.get_file_format,
|
FileFormat = fileinfo.get_file_format,
|
||||||
FileEncode = fileinfo.get_file_encode,
|
FileEncode = fileinfo.get_file_encode,
|
||||||
FileSize = fileinfo.get_file_size,
|
FileSize = fileinfo.get_file_size,
|
||||||
FileIcon = fileinfo.get_file_icon,
|
FileIcon = fileinfo.get_file_icon,
|
||||||
FileName = fileinfo.get_current_file_name,
|
FileName = fileinfo.get_current_file_name,
|
||||||
SFileName = fileinfo.filename_in_special_buffer,
|
SFileName = fileinfo.filename_in_special_buffer,
|
||||||
LinePercent = fileinfo.current_line_percent,
|
LinePercent = fileinfo.current_line_percent,
|
||||||
ScrollBar = extension.scrollbar_instance,
|
ScrollBar = extension.scrollbar_instance,
|
||||||
VistaPlugin = extension.vista_nearest,
|
VistaPlugin = extension.vista_nearest,
|
||||||
WhiteSpace = whitespace.get_item,
|
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.DiagnosticError = diagnostic.get_diagnostic_error
|
||||||
_G.galaxyline_providers.DiagnosticWarn = diagnostic.get_diagnostic_warn
|
_G.galaxyline_providers.DiagnosticWarn = diagnostic.get_diagnostic_warn
|
||||||
_G.galaxyline_providers.DiagnosticHint = diagnostic.get_diagnostic_hint
|
_G.galaxyline_providers.DiagnosticHint = diagnostic.get_diagnostic_hint
|
||||||
_G.galaxyline_providers.DiagnosticInfo = diagnostic.get_diagnostic_info
|
_G.galaxyline_providers.DiagnosticInfo = diagnostic.get_diagnostic_info
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- toggle between 2 themes
|
-- toggle between 2 themes
|
||||||
-- argument should be a table with 2 theme names
|
-- argument should be a table with 2 theme names
|
||||||
M.toggle_theme = function(themes)
|
M.toggle_theme = function(themes)
|
||||||
local current_theme = vim.g.current_nvchad_theme or vim.g.nvchad_theme
|
local current_theme = vim.g.current_nvchad_theme or vim.g.nvchad_theme
|
||||||
for _, name in ipairs(themes) do
|
for _, name in ipairs(themes) do
|
||||||
if name ~= current_theme then
|
if name ~= current_theme then
|
||||||
if require("utils").reload_theme(name) then
|
if require("utils").reload_theme(name) then
|
||||||
-- open a buffer and close it to reload the statusline
|
-- open a buffer and close it to reload the statusline
|
||||||
vim.cmd("new|bwipeout")
|
vim.cmd "new|bwipeout"
|
||||||
vim.g.current_nvchad_theme = name
|
vim.g.current_nvchad_theme = name
|
||||||
if M.change_theme(vim.g.nvchad_theme, name) then
|
if M.change_theme(vim.g.nvchad_theme, name) then
|
||||||
vim.g.nvchad_theme = name
|
vim.g.nvchad_theme = name
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
Loading…
Reference in New Issue
Block a user