more work on vim
This commit is contained in:
parent
6631175a6f
commit
5b7c268d1c
3 changed files with 277 additions and 23 deletions
215
.config/nvim/lua/lualine-conf.lua
Normal file
215
.config/nvim/lua/lualine-conf.lua
Normal file
|
@ -0,0 +1,215 @@
|
||||||
|
local lualine = require('lualine')
|
||||||
|
local colors = require("tokyonight.colors").setup({ transform = true })
|
||||||
|
local config = require("tokyonight.config").options
|
||||||
|
local theme = {}
|
||||||
|
theme.normal = {
|
||||||
|
a = { bg = colors.blue, fg = colors.black },
|
||||||
|
b = { bg = colors.fg_gutter, fg = colors.blue },
|
||||||
|
c = { bg = colors.bg_statusline, fg = colors.fg_sidebar },
|
||||||
|
}
|
||||||
|
theme.insert = {
|
||||||
|
a = { bg = colors.green, fg = colors.black },
|
||||||
|
b = { bg = colors.fg_gutter, fg = colors.green },
|
||||||
|
}
|
||||||
|
theme.command = {
|
||||||
|
a = { bg = colors.yellow, fg = colors.black },
|
||||||
|
b = { bg = colors.fg_gutter, fg = colors.yellow },
|
||||||
|
}
|
||||||
|
theme.visual = {
|
||||||
|
a = { bg = colors.magenta, fg = colors.black },
|
||||||
|
b = { bg = colors.fg_gutter, fg = colors.magenta },
|
||||||
|
}
|
||||||
|
theme.replace = {
|
||||||
|
a = { bg = colors.red, fg = colors.black },
|
||||||
|
b = { bg = colors.fg_gutter, fg = colors.red },
|
||||||
|
}
|
||||||
|
theme.inactive = {
|
||||||
|
a = { bg = colors.bg_statusline, fg = colors.blue },
|
||||||
|
b = { bg = colors.bg_statusline, fg = colors.fg_gutter, gui = "bold" },
|
||||||
|
c = { bg = colors.bg_statusline, fg = colors.fg_gutter },
|
||||||
|
}
|
||||||
|
if config.lualine_bold then
|
||||||
|
for _, mode in pairs(theme) do
|
||||||
|
mode.a.gui = "bold"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local conditions = {
|
||||||
|
buffer_not_empty = function()
|
||||||
|
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
|
||||||
|
end,
|
||||||
|
hide_in_width = function()
|
||||||
|
return vim.fn.winwidth(0) > 80
|
||||||
|
end,
|
||||||
|
check_git_workspace = function()
|
||||||
|
local filepath = vim.fn.expand('%:p:h')
|
||||||
|
local gitdir = vim.fn.finddir('.git', filepath .. ';')
|
||||||
|
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
lualine.options = {
|
||||||
|
component_separators = '',
|
||||||
|
section_separators = '',
|
||||||
|
theme = theme
|
||||||
|
}
|
||||||
|
lualine.sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = {},
|
||||||
|
}
|
||||||
|
lualine.inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = {},
|
||||||
|
}
|
||||||
|
|
||||||
|
local function ins_left(component)
|
||||||
|
table.insert(lualine.sections.lualine_c, component)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function ins_right(component)
|
||||||
|
table.insert(lualine.sections.lualine_x, component)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function mode_color()
|
||||||
|
local color = {
|
||||||
|
n = colors.red,
|
||||||
|
i = colors.green,
|
||||||
|
v = colors.magenta,
|
||||||
|
[''] = colors.magenta,
|
||||||
|
V = colors.magenta,
|
||||||
|
c = colors.blue,
|
||||||
|
no = colors.red,
|
||||||
|
s = colors.orange,
|
||||||
|
S = colors.orange,
|
||||||
|
[''] = colors.orange,
|
||||||
|
ic = colors.yellow,
|
||||||
|
R = colors.violet,
|
||||||
|
Rv = colors.violet,
|
||||||
|
cv = colors.red,
|
||||||
|
ce = colors.red,
|
||||||
|
r = colors.cyan,
|
||||||
|
rm = colors.cyan,
|
||||||
|
['r?'] = colors.cyan,
|
||||||
|
['!'] = colors.red,
|
||||||
|
t = colors.red,
|
||||||
|
}
|
||||||
|
return { fg = color[vim.fn.mode()] }
|
||||||
|
end
|
||||||
|
|
||||||
|
ins_left {
|
||||||
|
function()
|
||||||
|
return '▊'
|
||||||
|
end,
|
||||||
|
color = function ()
|
||||||
|
return mode_color()
|
||||||
|
end,
|
||||||
|
padding = { right = 1 },
|
||||||
|
}
|
||||||
|
|
||||||
|
ins_left {
|
||||||
|
function()
|
||||||
|
local msg = 'No Active Lsp'
|
||||||
|
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||||
|
local clients = vim.lsp.get_active_clients()
|
||||||
|
if next(clients) == nil then
|
||||||
|
return msg
|
||||||
|
end
|
||||||
|
for _, client in ipairs(clients) do
|
||||||
|
local filetypes = client.config.filetypes
|
||||||
|
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||||
|
return client.name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return msg
|
||||||
|
end,
|
||||||
|
icon = ' LSP:',
|
||||||
|
color = { fg = colors.white },
|
||||||
|
}
|
||||||
|
|
||||||
|
ins_left {
|
||||||
|
'diagnostics',
|
||||||
|
sources = { 'nvim_diagnostic' },
|
||||||
|
symbols = { error = ' ', warn = ' ', info = ' ' },
|
||||||
|
diagnostics_color = {
|
||||||
|
color_error = { fg = colors.red },
|
||||||
|
color_warn = { fg = colors.yellow },
|
||||||
|
color_info = { fg = colors.cyan },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
ins_left {
|
||||||
|
function()
|
||||||
|
return '%='
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
ins_left {
|
||||||
|
'filename',
|
||||||
|
cond = conditions.buffer_not_empty,
|
||||||
|
color = { fg = colors.magenta, gui = 'bold' },
|
||||||
|
}
|
||||||
|
|
||||||
|
ins_left {
|
||||||
|
function()
|
||||||
|
local current_line = vim.fn.line "."
|
||||||
|
local total_lines = vim.fn.line "$"
|
||||||
|
local chars = { "", "", "", "", "", "", "", "", "", "", "", "", "" }
|
||||||
|
local line_ratio = current_line / total_lines
|
||||||
|
local index = math.ceil(line_ratio * #chars)
|
||||||
|
return chars[index]
|
||||||
|
end,
|
||||||
|
color = { fg = colors.yellow }
|
||||||
|
}
|
||||||
|
|
||||||
|
ins_left {
|
||||||
|
'%04l:%04c',
|
||||||
|
}
|
||||||
|
|
||||||
|
ins_right {
|
||||||
|
'o:encoding',
|
||||||
|
fmt = string.upper,
|
||||||
|
cond = conditions.hide_in_width,
|
||||||
|
color = { fg = colors.green, gui = 'bold' },
|
||||||
|
}
|
||||||
|
|
||||||
|
ins_right {
|
||||||
|
'fileformat',
|
||||||
|
fmt = string.upper,
|
||||||
|
icons_enabled = false,
|
||||||
|
color = { fg = colors.green, gui = 'bold' },
|
||||||
|
}
|
||||||
|
|
||||||
|
ins_right {
|
||||||
|
'branch',
|
||||||
|
icon = '',
|
||||||
|
color = { fg = colors.violet, gui = 'bold' },
|
||||||
|
}
|
||||||
|
|
||||||
|
ins_right {
|
||||||
|
'diff',
|
||||||
|
symbols = { added = ' ', modified = '柳 ', removed = ' ' },
|
||||||
|
diff_color = {
|
||||||
|
added = { fg = colors.green },
|
||||||
|
modified = { fg = colors.orange },
|
||||||
|
removed = { fg = colors.red },
|
||||||
|
},
|
||||||
|
cond = conditions.hide_in_width,
|
||||||
|
}
|
||||||
|
|
||||||
|
ins_right {
|
||||||
|
function()
|
||||||
|
return '▊'
|
||||||
|
end,
|
||||||
|
color = function ()
|
||||||
|
return mode_color()
|
||||||
|
end,
|
||||||
|
padding = { left = 1 },
|
||||||
|
}
|
|
@ -1,10 +1,14 @@
|
||||||
vim.opt.undodir = vim.fn.stdpath "cache" .. "/undo"
|
vim.g.loaded = 1
|
||||||
vim.opt.undofile = true
|
vim.g.loaded_netrwPlugin = 1
|
||||||
vim.opt.titlestring = " %t"
|
vim.g.tokyonight_style = "night"
|
||||||
vim.opt.termguicolors = true
|
|
||||||
vim.opt.timeoutlen = 500
|
|
||||||
vim.opt.foldmethod = "expr"
|
|
||||||
vim.opt.foldlevelstart = 99
|
|
||||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
|
||||||
|
|
||||||
vim.g.tokyonight_style = "night"
|
vim.opt.undodir = vim.fn.stdpath "cache" .. "/undo"
|
||||||
|
vim.opt.undofile = true
|
||||||
|
vim.opt.titlestring = " %t"
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
vim.opt.timeoutlen = 500
|
||||||
|
vim.opt.foldmethod = "expr"
|
||||||
|
vim.opt.foldlevelstart = 99
|
||||||
|
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||||
|
|
||||||
|
vim.cmd[[colorscheme tokyonight]]
|
||||||
|
|
|
@ -13,33 +13,59 @@ local packer_bootstrap = ensure_packer()
|
||||||
|
|
||||||
return require('packer').startup(function(use)
|
return require('packer').startup(function(use)
|
||||||
use 'wbthomason/packer.nvim'
|
use 'wbthomason/packer.nvim'
|
||||||
use 'williamboman/mason.nvim'
|
|
||||||
use { 'williamboman/mason-lspconfig.nvim',
|
|
||||||
requires = 'neovim/nvim-lspconfig'
|
|
||||||
}
|
|
||||||
|
|
||||||
use 'fladson/vim-kitty'
|
use 'fladson/vim-kitty'
|
||||||
use 'folke/lua-dev.nvim'
|
use 'folke/lua-dev.nvim'
|
||||||
use 'tpope/vim-surround'
|
use 'tpope/vim-surround'
|
||||||
use 'tpope/vim-repeat'
|
use 'tpope/vim-repeat'
|
||||||
use 'folke/tokyonight.nvim'
|
|
||||||
use 'vimwiki/vimwiki'
|
use 'vimwiki/vimwiki'
|
||||||
use { 'nvim-treesitter/nvim-treesitter',
|
use 'kyazdani42/nvim-web-devicons'
|
||||||
|
use 'nvim-lualine/lualine.nvim'
|
||||||
|
-- setup handled in lualine-conf.lua
|
||||||
|
use {
|
||||||
|
'akinsho/bufferline.nvim',
|
||||||
|
config = function()
|
||||||
|
require('bufferline').setup()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
run = ':TSUpdate'
|
run = ':TSUpdate'
|
||||||
}
|
}
|
||||||
use { 'felipec/vim-sanegx',
|
use {
|
||||||
|
'kyazdani42/nvim-tree.lua',
|
||||||
|
config = function()
|
||||||
|
require('nvim-tree').setup()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'felipec/vim-sanegx',
|
||||||
event = 'BufRead',
|
event = 'BufRead',
|
||||||
}
|
}
|
||||||
use { 'ptzz/lf.vim',
|
use {
|
||||||
requires = 'voldikss/vim-floaterm',
|
'sindrets/diffview.nvim',
|
||||||
}
|
|
||||||
use { 'sindrets/diffview.nvim',
|
|
||||||
requires = 'nvim-lua/plenary.nvim',
|
requires = 'nvim-lua/plenary.nvim',
|
||||||
event = 'BufRead'
|
event = 'BufRead'
|
||||||
}
|
}
|
||||||
use { 'norcalli/nvim-colorizer.lua',
|
use {
|
||||||
|
'williamboman/mason.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
require('colorizer').setup({ '*' }, {
|
require('mason').setup()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
requires = 'neovim/nvim-lspconfig'
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
|
config = function()
|
||||||
|
require('gitsigns').setup()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'norcalli/nvim-colorizer.lua',
|
||||||
|
config = function()
|
||||||
|
require('colorizer').setup({'*'}, {
|
||||||
RGB = true, -- #RGB hex codes
|
RGB = true, -- #RGB hex codes
|
||||||
RRGGBB = true, -- #RRGGBB hex codes
|
RRGGBB = true, -- #RRGGBB hex codes
|
||||||
RRGGBBAA = true, -- #RRGGBBAA hex codes
|
RRGGBBAA = true, -- #RRGGBBAA hex codes
|
||||||
|
@ -50,6 +76,15 @@ return require('packer').startup(function(use)
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
use {
|
||||||
|
'folke/tokyonight.nvim',
|
||||||
|
config = function()
|
||||||
|
require("tokyonight").setup({
|
||||||
|
style = "night",
|
||||||
|
transparent = true,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
if packer_bootstrap then
|
if packer_bootstrap then
|
||||||
require('packer').sync()
|
require('packer').sync()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue