improve config structure

This commit is contained in:
siduck76 2021-07-09 09:14:04 +05:30
parent e219b04e82
commit c6084220de
18 changed files with 485 additions and 449 deletions

View file

@ -1,7 +1,7 @@
-- load all plugins
require "pluginList"
require "misc-utils"
require "top-bufferline"
require "options"
require "plugins.bufferline"
local g = vim.g
@ -16,15 +16,5 @@ base16(base16.themes["onedark"], true)
require "highlights"
require "mappings"
require "file-icons"
require "statusline"
-- hide line numbers , statusline in specific buffers!
vim.api.nvim_exec(
[[
au BufEnter term://* setlocal nonumber
au BufEnter,BufWinEnter,WinEnter,CmdwinEnter * if bufname('%') == "NvimTree" | set laststatus=0 | else | set laststatus=2 | endif
au BufEnter term://* set laststatus=0
]],
false
)
require("utils").hideStuff()

View file

@ -1,117 +0,0 @@
local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme)
require "nvim-web-devicons".setup {
override = {
html = {
icon = "",
color = colors.baby_pink,
name = "html"
},
css = {
icon = "",
color = colors.blue,
name = "css"
},
js = {
icon = "",
color = colors.sun,
name = "js"
},
ts = {
icon = "",
color = colors.teal,
name = "ts"
},
kt = {
icon = "󱈙",
color = colors.orange,
name = "kt"
},
png = {
icon = "",
color = colors.dark_purple,
name = "png"
},
jpg = {
icon = "",
color = colors.dark_purple,
name = "jpg"
},
jpeg = {
icon = "",
color = "colors.dark_purple",
name = "jpeg"
},
mp3 = {
icon = "",
color = colors.white,
name = "mp3"
},
mp4 = {
icon = "",
color = colors.white,
name = "mp4"
},
out = {
icon = "",
color = colors.white,
name = "out"
},
Dockerfile = {
icon = "",
color = colors.cyan,
name = "Dockerfile"
},
rb = {
icon = "",
color = colors.pink,
name = "rb"
},
vue = {
icon = "",
color = colors.vibrant_green,
name = "vue"
},
py = {
icon = "",
color = colors.cyan,
name = "py"
},
toml = {
icon = "",
color = colors.blue,
name = "toml"
},
lock = {
icon = "",
color = colors.red,
name = "lock"
},
zip = {
icon = "",
color = colors.sun,
name = "zip"
},
xz = {
icon = "",
color = colors.sun,
name = "xz"
},
deb = {
icon = "",
color = colors.cyan,
name = "deb"
},
rpm = {
icon = "",
color = colors.orange,
name = "rpm"
},
lua = {
icon = "",
color = colors.blue,
name = "lua"
}
}
}

View file

@ -51,17 +51,4 @@ end
-- file extension specific tabbing
-- vim.cmd([[autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4]])
-- blankline config
M.blankline = function()
vim.g.indentLine_enabled = 1
vim.g.indent_blankline_char = ""
vim.g.indent_blankline_filetype_exclude = {"help", "terminal", "dashboard"}
vim.g.indent_blankline_buftype_exclude = {"terminal"}
vim.g.indent_blankline_show_trailing_blankline_indent = false
vim.g.indent_blankline_show_first_indent_level = false
end
return M

View file

@ -1,12 +1,26 @@
local packer = require("packer")
local use = packer.use
packer.init {
display = {
open_fn = function()
return require("packer.util").float {border = "single"}
end
}
}
return packer.startup(
function()
use "wbthomason/packer.nvim"
use "akinsho/nvim-bufferline.lua"
use "glepnir/galaxyline.nvim"
use {
"glepnir/galaxyline.nvim",
config = function()
require("plugins.statusline").config()
end
}
-- color related stuff
use "siduck76/nvim-base16.lua"
@ -25,7 +39,7 @@ return packer.startup(
"nvim-treesitter/nvim-treesitter",
event = "BufRead",
config = function()
require("treesitter-nvim").config()
require("plugins.treesitter").config()
end
}
@ -33,7 +47,7 @@ return packer.startup(
"neovim/nvim-lspconfig",
event = "BufRead",
config = function()
require("nvim-lspconfig").config()
require("plugins.lspconfig").config()
end
}
@ -52,7 +66,7 @@ return packer.startup(
"hrsh7th/nvim-compe",
event = "InsertEnter",
config = function()
require("compe-completion").config()
require("plugins.compe").config()
end,
wants = {"LuaSnip"},
requires = {
@ -61,7 +75,7 @@ return packer.startup(
wants = "friendly-snippets",
event = "InsertCharPre",
config = function()
require("compe-completion").snippets()
require("plugins.compe").snippets()
end
},
"rafamadriz/friendly-snippets"
@ -75,11 +89,17 @@ return packer.startup(
"kyazdani42/nvim-tree.lua",
cmd = "NvimTreeToggle",
config = function()
require("nvimTree").config()
require("plugins.nvimtree").config()
end
}
use {
"kyazdani42/nvim-web-devicons",
config = function()
require("plugins.icons").config()
end
}
use "kyazdani42/nvim-web-devicons"
use {
"nvim-telescope/telescope.nvim",
requires = {
@ -90,7 +110,7 @@ return packer.startup(
},
cmd = "Telescope",
config = function()
require("telescope-nvim").config()
require("plugins.telescope").config()
end
}
@ -99,7 +119,7 @@ return packer.startup(
"lewis6991/gitsigns.nvim",
event = "BufRead",
config = function()
require("gitsigns-nvim").config()
require("plugins.gitsigns").config()
end
}
@ -138,7 +158,7 @@ return packer.startup(
"SessionSave"
},
setup = function()
require("dashboard").config()
require("plugins.dashboard").config()
end
}
@ -148,7 +168,7 @@ return packer.startup(
use {
"Pocco81/AutoSave.nvim",
config = function()
require("zenmode").autoSave()
require("plugins.zenmode").autoSave()
end,
cond = function()
return vim.g.auto_save == true
@ -168,7 +188,7 @@ return packer.startup(
"Pocco81/TrueZen.nvim",
cmd = {"TZAtaraxis", "TZMinimalist", "TZFocus"},
config = function()
require("zenmode").config()
require("plugins.zenmode").config()
end
}
@ -178,13 +198,8 @@ return packer.startup(
"lukas-reineke/indent-blankline.nvim",
event = "BufRead",
setup = function()
require("misc-utils").blankline()
require("utils").blankline()
end
}
end,
{
display = {
border = {"", "", "", "", "", "", "", ""}
}
}
end
)

View file

@ -18,7 +18,7 @@ M.config = function()
buffer = {kind = "", true},
luasnip = {kind = "", true},
nvim_lsp = true,
nvim_lua = true,
nvim_lua = true
}
}
end

View file

@ -2,6 +2,9 @@ local M = {}
M.config = function()
local g = vim.g
local fn = vim.fn
local plugins_count = fn.len(fn.globpath("~/.local/share/nvim/site/pack/packer/start", "*", 0, 1))
g.dashboard_disable_at_vimenter = 1 -- dashboard is disabled by default
g.dashboard_disable_statusline = 1
@ -35,6 +38,7 @@ M.config = function()
g.dashboard_custom_footer = {
" ",
-- "NvChad Loaded " .. plugins_count .. " plugins",
"NvChad v0.5"
}
end

123
lua/plugins/icons.lua Normal file
View file

@ -0,0 +1,123 @@
local M = {}
M.config = function()
local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme)
require "nvim-web-devicons".setup {
override = {
html = {
icon = "",
color = colors.baby_pink,
name = "html"
},
css = {
icon = "",
color = colors.blue,
name = "css"
},
js = {
icon = "",
color = colors.sun,
name = "js"
},
ts = {
icon = "",
color = colors.teal,
name = "ts"
},
kt = {
icon = "󱈙",
color = colors.orange,
name = "kt"
},
png = {
icon = "",
color = colors.dark_purple,
name = "png"
},
jpg = {
icon = "",
color = colors.dark_purple,
name = "jpg"
},
jpeg = {
icon = "",
color = "colors.dark_purple",
name = "jpeg"
},
mp3 = {
icon = "",
color = colors.white,
name = "mp3"
},
mp4 = {
icon = "",
color = colors.white,
name = "mp4"
},
out = {
icon = "",
color = colors.white,
name = "out"
},
Dockerfile = {
icon = "",
color = colors.cyan,
name = "Dockerfile"
},
rb = {
icon = "",
color = colors.pink,
name = "rb"
},
vue = {
icon = "",
color = colors.vibrant_green,
name = "vue"
},
py = {
icon = "",
color = colors.cyan,
name = "py"
},
toml = {
icon = "",
color = colors.blue,
name = "toml"
},
lock = {
icon = "",
color = colors.red,
name = "lock"
},
zip = {
icon = "",
color = colors.sun,
name = "zip"
},
xz = {
icon = "",
color = colors.sun,
name = "xz"
},
deb = {
icon = "",
color = colors.cyan,
name = "deb"
},
rpm = {
icon = "",
color = colors.orange,
name = "rpm"
},
lua = {
icon = "",
color = colors.blue,
name = "lua"
}
}
}
end
return M

212
lua/plugins/statusline.lua Normal file
View file

@ -0,0 +1,212 @@
local M = {}
M.config = function()
local gl = require("galaxyline")
local gls = gl.section
local condition = require("galaxyline.condition")
gl.short_line_list = {" "}
local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme)
gls.left[1] = {
FirstElement = {
provider = function()
return ""
end,
highlight = {colors.nord_blue, colors.nord_blue}
}
}
gls.left[2] = {
statusIcon = {
provider = function()
return ""
end,
highlight = {colors.statusline_bg, colors.nord_blue},
separator = "",
separator_highlight = {colors.nord_blue, colors.lightbg}
}
}
gls.left[3] = {
FileIcon = {
provider = "FileIcon",
condition = condition.buffer_not_empty,
highlight = {colors.white, colors.lightbg}
}
}
gls.left[4] = {
FileName = {
provider = {"FileName"},
condition = condition.buffer_not_empty,
highlight = {colors.white, colors.lightbg},
separator = "",
separator_highlight = {colors.lightbg, colors.lightbg2}
}
}
gls.left[5] = {
current_dir = {
provider = function()
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
return "" .. dir_name .. " "
end,
highlight = {colors.grey_fg2, colors.lightbg2},
separator = "",
separator_highlight = {colors.lightbg2, colors.statusline_bg}
}
}
local checkwidth = function()
local squeeze_width = vim.fn.winwidth(0) / 2
if squeeze_width > 30 then
return true
end
return false
end
gls.left[6] = {
DiffAdd = {
provider = "DiffAdd",
condition = checkwidth,
icon = "",
highlight = {colors.white, colors.statusline_bg}
}
}
gls.left[7] = {
DiffModified = {
provider = "DiffModified",
condition = checkwidth,
icon = "",
highlight = {colors.grey_fg2, colors.statusline_bg}
}
}
gls.left[8] = {
DiffRemove = {
provider = "DiffRemove",
condition = checkwidth,
icon = "",
highlight = {colors.grey_fg2, colors.statusline_bg}
}
}
gls.left[9] = {
DiagnosticError = {
provider = "DiagnosticError",
icon = "",
highlight = {colors.red, colors.statusline_bg}
}
}
gls.left[10] = {
DiagnosticWarn = {
provider = "DiagnosticWarn",
icon = "",
highlight = {colors.yellow, colors.statusline_bg}
}
}
gls.right[1] = {
lsp_status = {
provider = function()
local clients = vim.lsp.get_active_clients()
if next(clients) ~= nil then
return " " .. "" .. " LSP "
else
return ""
end
end,
highlight = {colors.grey_fg2, colors.statusline_bg}
}
}
gls.right[2] = {
GitIcon = {
provider = function()
return ""
end,
condition = require("galaxyline.condition").check_git_workspace,
highlight = {colors.grey_fg2, colors.statusline_bg},
separator = " ",
separator_highlight = {colors.statusline_bg, colors.statusline_bg}
}
}
gls.right[3] = {
GitBranch = {
provider = "GitBranch",
condition = require("galaxyline.condition").check_git_workspace,
highlight = {colors.grey_fg2, colors.statusline_bg}
}
}
gls.right[4] = {
viMode_icon = {
provider = function()
return ""
end,
highlight = {colors.statusline_bg, colors.red},
separator = "",
separator_highlight = {colors.red, colors.statusline_bg}
}
}
gls.right[5] = {
ViMode = {
provider = function()
local alias = {
n = "Normal",
i = "Insert",
c = "Command",
V = "Visual",
[""] = "Visual",
v = "Visual",
R = "Replace"
}
local current_Mode = alias[vim.fn.mode()]
if current_Mode == nil then
return " Terminal "
else
return " " .. current_Mode .. " "
end
end,
highlight = {colors.red, colors.lightbg}
}
}
gls.right[6] = {
some_icon = {
provider = function()
return ""
end,
separator = "",
separator_highlight = {colors.green, colors.lightbg},
highlight = {colors.lightbg, colors.green}
}
}
gls.right[7] = {
line_percentage = {
provider = function()
local current_line = vim.fn.line(".")
local total_line = vim.fn.line("$")
if current_line == 1 then
return " Top "
elseif current_line == vim.fn.line("$") then
return " Bot "
end
local result, _ = math.modf((current_line / total_line) * 100)
return " " .. result .. "% "
end,
highlight = {colors.green, colors.lightbg}
}
}
end
return M

81
lua/plugins/zenmode.lua Normal file
View file

@ -0,0 +1,81 @@
-- plugins made by @Pocco81 =)
local M = {}
M.config = function()
local true_zen = require("true-zen")
true_zen.setup(
{
misc = {
on_off_commands = false,
ui_elements_commands = false,
cursor_by_mode = false,
before_minimalist_mode_shown = true,
before_minimalist_mode_hidden = true,
after_minimalist_mode_shown = true,
after_minimalist_mode_hidden = true
},
ui = {
bottom = {
laststatus = 0,
ruler = false,
showmode = false,
showcmd = false,
cmdheight = 1
},
top = {
showtabline = 0
},
left = {
number = false,
relativenumber = false,
signcolumn = "no"
}
},
modes = {
ataraxis = {
left_padding = 37,
right_padding = 37,
top_padding = 2,
bottom_padding = 2,
just_do_it_for_me = false,
ideal_writing_area_width = 0,
keep_default_fold_fillchars = true,
custome_bg = "#1e222a"
},
focus = {
margin_of_error = 5,
focus_method = "experimental"
}
},
integrations = {
galaxyline = true,
nvim_bufferline = true
}
}
)
end
-- autosave.nvim plugin disabled by default
M.autoSave = function()
local autosave = require("autosave")
autosave.setup(
{
enabled = vim.g.auto_save, -- takes boolean value from init.lua
execution_message = "autosaved at : " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave", "TextChanged"},
conditions = {
exists = true,
filetype_is_not = {},
modifiable = true
},
write_all_buffers = true,
on_off_commands = true,
clean_command_line_interval = 2500
}
)
end
return M

View file

@ -1,207 +0,0 @@
local gl = require("galaxyline")
local gls = gl.section
local condition = require("galaxyline.condition")
gl.short_line_list = {" "}
local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme)
gls.left[1] = {
FirstElement = {
provider = function()
return ""
end,
highlight = {colors.nord_blue, colors.nord_blue}
}
}
gls.left[2] = {
statusIcon = {
provider = function()
return ""
end,
highlight = {colors.statusline_bg, colors.nord_blue},
separator = "",
separator_highlight = {colors.nord_blue, colors.lightbg}
}
}
gls.left[3] = {
FileIcon = {
provider = "FileIcon",
condition = condition.buffer_not_empty,
highlight = {colors.white, colors.lightbg}
}
}
gls.left[4] = {
FileName = {
provider = {"FileName"},
condition = condition.buffer_not_empty,
highlight = {colors.white, colors.lightbg},
separator = "",
separator_highlight = {colors.lightbg, colors.lightbg2}
}
}
gls.left[5] = {
current_dir = {
provider = function()
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
return "" .. dir_name .. " "
end,
highlight = {colors.grey_fg2, colors.lightbg2},
separator = "",
separator_highlight = {colors.lightbg2, colors.statusline_bg}
}
}
local checkwidth = function()
local squeeze_width = vim.fn.winwidth(0) / 2
if squeeze_width > 30 then
return true
end
return false
end
gls.left[6] = {
DiffAdd = {
provider = "DiffAdd",
condition = checkwidth,
icon = "",
highlight = {colors.white, colors.statusline_bg}
}
}
gls.left[7] = {
DiffModified = {
provider = "DiffModified",
condition = checkwidth,
icon = "",
highlight = {colors.grey_fg2, colors.statusline_bg}
}
}
gls.left[8] = {
DiffRemove = {
provider = "DiffRemove",
condition = checkwidth,
icon = "",
highlight = {colors.grey_fg2, colors.statusline_bg}
}
}
gls.left[9] = {
DiagnosticError = {
provider = "DiagnosticError",
icon = "",
highlight = {colors.red, colors.statusline_bg}
}
}
gls.left[10] = {
DiagnosticWarn = {
provider = "DiagnosticWarn",
icon = "",
highlight = {colors.yellow, colors.statusline_bg}
}
}
gls.right[1] = {
lsp_status = {
provider = function()
local clients = vim.lsp.get_active_clients()
if next(clients) ~= nil then
return " " .. "" .. " LSP "
else
return ""
end
end,
highlight = {colors.grey_fg2, colors.statusline_bg}
}
}
gls.right[2] = {
GitIcon = {
provider = function()
return ""
end,
condition = require("galaxyline.condition").check_git_workspace,
highlight = {colors.grey_fg2, colors.statusline_bg},
separator = " ",
separator_highlight = {colors.statusline_bg, colors.statusline_bg}
}
}
gls.right[3] = {
GitBranch = {
provider = "GitBranch",
condition = require("galaxyline.condition").check_git_workspace,
highlight = {colors.grey_fg2, colors.statusline_bg}
}
}
gls.right[4] = {
viMode_icon = {
provider = function()
return ""
end,
highlight = {colors.statusline_bg, colors.red},
separator = "",
separator_highlight = {colors.red, colors.statusline_bg}
}
}
gls.right[5] = {
ViMode = {
provider = function()
local alias = {
n = "Normal",
i = "Insert",
c = "Command",
V = "Visual",
[""] = "Visual",
v = "Visual",
R = "Replace"
}
local current_Mode = alias[vim.fn.mode()]
if current_Mode == nil then
return " Terminal "
else
return " " .. current_Mode .. " "
end
end,
highlight = {colors.red, colors.lightbg}
}
}
gls.right[6] = {
some_icon = {
provider = function()
return ""
end,
separator = "",
separator_highlight = {colors.green, colors.lightbg},
highlight = {colors.lightbg, colors.green}
}
}
gls.right[7] = {
line_percentage = {
provider = function()
local current_line = vim.fn.line(".")
local total_line = vim.fn.line("$")
if current_line == 1 then
return " Top "
elseif current_line == vim.fn.line("$") then
return " Bot "
end
local result, _ = math.modf((current_line / total_line) * 100)
return " " .. result .. "% "
end,
highlight = {colors.green, colors.lightbg}
}
}

27
lua/utils.lua Normal file
View file

@ -0,0 +1,27 @@
local M = {}
-- blankline config
M.blankline = function()
vim.g.indentLine_enabled = 1
vim.g.indent_blankline_char = ""
vim.g.indent_blankline_filetype_exclude = {"help", "terminal", "dashboard"}
vim.g.indent_blankline_buftype_exclude = {"terminal"}
vim.g.indent_blankline_show_trailing_blankline_indent = false
vim.g.indent_blankline_show_first_indent_level = false
end
-- hide line numbers , statusline in specific buffers!
M.hideStuff = function()
vim.api.nvim_exec(
[[
au BufEnter term://* setlocal nonumber
au BufEnter,BufWinEnter,WinEnter,CmdwinEnter * if bufname('%') == "NvimTree" | set laststatus=0 | else | set laststatus=2 | endif
au BufEnter term://* set laststatus=0
]],
false
)
end
return M

View file

@ -1,79 +0,0 @@
-- plugins made by @Pocco81 =)
local M = {}
M.config = function()
local true_zen = require("true-zen")
true_zen.setup({
misc = {
on_off_commands = false,
ui_elements_commands = false,
cursor_by_mode = false,
before_minimalist_mode_shown = true,
before_minimalist_mode_hidden = true,
after_minimalist_mode_shown = true,
after_minimalist_mode_hidden = true,
},
ui = {
bottom = {
laststatus = 0,
ruler = false,
showmode = false,
showcmd = false,
cmdheight = 1,
},
top = {
showtabline = 0,
},
left = {
number = false,
relativenumber = false,
signcolumn = "no",
},
},
modes = {
ataraxis = {
left_padding = 37,
right_padding = 37,
top_padding = 2,
bottom_padding = 2,
just_do_it_for_me = false,
ideal_writing_area_width = 0,
keep_default_fold_fillchars = true,
custome_bg = "#1e222a",
},
focus = {
margin_of_error = 5,
focus_method = "experimental"
},
},
integrations = {
galaxyline = true,
nvim_bufferline = true,
}
})
end
-- autosave.nvim plugin disabled by default
M.autoSave = function()
local autosave = require("autosave")
autosave.setup(
{
enabled = vim.g.auto_save, -- takes boolean value from init.lua
execution_message = "autosaved at : " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave", "TextChanged"},
conditions = {
exists = true,
filetype_is_not = {},
modifiable = true
},
write_all_buffers = true,
on_off_commands = true,
clean_command_line_interval = 2500
}
)
end
return M