1
0
Fork 0

more work on vim

This commit is contained in:
Luca Bilke 2022-10-04 19:02:51 +02:00
parent 692b047ec8
commit a4865630fc
8 changed files with 233 additions and 193 deletions

View file

@ -1,5 +1,51 @@
require('plugins')
vim.opt = require('options')
require('keybinds')
require('autocmds')
require('lualine-conf')
require('theme')
require('bufferline').setup()
require('mason').setup()
vim.opt.undodir = vim.fn.stdpath "cache" .. "/undo"
vim.opt.clipboard = "unnamedplus"
vim.opt.conceallevel = 0
vim.opt.numberwidth = 3
vim.opt.hlsearch = true
vim.opt.ignorecase = true
vim.opt.showmode = false
vim.opt.smartindent = true
vim.opt.splitbelow = true
vim.opt.splitbelow = true
vim.opt.splitbelow = true
vim.opt.updatetime = 300
vim.opt.writebackup = false
vim.opt.expandtab = true
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.cursorline = true
vim.opt.signcolumn = "yes"
vim.opt.wrap = false
vim.opt.scrolloff = 8
vim.opt.sidescrolloff = 8
vim.opt.undofile = true
vim.opt.title = 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.opt.number = true
vim.opt.relativenumber = true
-- set autocmds defined in autocmd.lua
for _, entry in ipairs(require('autocmds')) do
local event = entry[1]
local opts = entry[2]
if type(opts.group) == "string" and opts.group ~= "" then
local exists, _ = pcall(vim.api.nvim_get_autocmds, { group = opts.group })
if not exists then
vim.api.nvim_create_augroup(opts.group, {})
end
end
vim.api.nvim_create_autocmd(event, opts)
end

View file

@ -1,53 +1,75 @@
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, {
pattern = "*",
command="if &nu && mode() != \"i\" | set rnu | endif"
})
vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" }, {
pattern = "*",
command="if &nu | set nornu | endif"
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "zsh",
callback = function()
require("nvim-treesitter.highlight").attach(0, "bash")
end
})
vim.api.nvim_create_autocmd("ColorScheme", {
pattern = "*",
command = "hi FloatermBorder guibg=none"
})
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = { "bm-files", "bm-dirs" },
command = "!shortcuts"
})
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "set filetype=xdefaults"
})
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "!xrdb %"
})
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "~/.local/src/dwmblocks/config.h",
command = "!cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }"
})
vim.api.nvim_create_autocmd({ "BufDelete", "VimLeave" }, {
pattern = "*.tex",
command = "!texclear \"%:p\""
})
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerCompile
augroup end
]])
return {
{
{ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" },
{
pattern = "*",
command="if &nu && mode() != \"i\" | set rnu | endif"
}
},
{
{ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" },
{
pattern = "*",
command="if &nu | set nornu | endif"
}
},
{
"FileType",
{
pattern = "zsh",
callback = function()
require("nvim-treesitter.highlight").attach(0, "bash")
end
}
},
{
"ColorScheme",
{
pattern = "*",
command = "hi FloatermBorder guibg=none"
}
},
{
"BufWritePost",
{
pattern = { "bm-files", "bm-dirs" },
command = "!shortcuts"
}
},
{
{ "BufRead", "BufNewFile" },
{
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "set filetype=xdefaults"
}
},
{
"BufWritePost",
{
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
command = "!xrdb %"
}
},
{
"BufWritePost",
{
pattern = "~/.local/src/dwmblocks/config.h",
command = "!cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }"
}
},
{
{ "BufDelete", "VimLeave" },
{
pattern = "*.tex",
command = "!texclear \"%:p\""
}
},
{
'BufWritePost',
{
group = 'packer_user_config',
pattern = "plugins.lua",
command = "source <afile> | PackerCompile"
}
}
}

View file

@ -1,2 +1,12 @@
local M = {}
vim.g.mapleader = "space"
function M.wk_setup()
end
function M.kb_setup()
end
return M

View file

@ -1,38 +1,4 @@
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()
@ -48,34 +14,39 @@ local conditions = {
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 config = {
options = {
component_separators = '',
section_separators = '',
theme = {
normal = { c = { fg = colors.fg, bg = colors.bg } },
inactive = { c = { fg = colors.fg, bg = colors.bg } },
},
},
sections = {
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {},
},
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)
table.insert(config.sections.lualine_c, component)
end
local function ins_right(component)
table.insert(lualine.sections.lualine_x, component)
table.insert(config.sections.lualine_x, component)
end
local function mode_color()
@ -213,3 +184,5 @@ ins_right {
end,
padding = { left = 1 },
}
return require('lualine').setup(config)

View file

@ -1,12 +0,0 @@
local opt = vim.opt
opt.undodir = vim.fn.stdpath "cache" .. "/undo"
opt.undofile = true
opt.titlestring = " %t"
opt.termguicolors = true
opt.timeoutlen = 500
opt.foldmethod = "expr"
opt.foldlevelstart = 99
opt.foldexpr = "nvim_treesitter#foldexpr()"
return opt

View file

@ -17,36 +17,48 @@ return require('packer').startup(function(use)
use 'folke/lua-dev.nvim'
use 'tpope/vim-surround'
use 'tpope/vim-repeat'
use { 'folke/tokyonight.nvim',
config = function()
require("tokyonight").setup({
transparent = true, -- Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
dim_inactive = true, -- dims inactive windows
lualine_bold = true, -- When `true`, section headers in the lualine theme will be bold
})
end,
}
use 'norcalli/nvim-colorizer.lua'
use 'folke/tokyonight.nvim'
use 'vimwiki/vimwiki'
use 'kyazdani42/nvim-web-devicons'
use 'nvim-lualine/lualine.nvim'
-- setup handled in lualine-conf.lua
use 'williamboman/mason.nvim'
use 'kyazdani42/nvim-tree.lua'
use 'mfussenegger/nvim-dap'
use {
'jose-elias-alvarez/null-ls.nvim'
}
use {
'akinsho/bufferline.nvim',
config = function()
config = function ()
require('bufferline').setup()
end,
requires = 'kyazdani42/nvim-web-devicons'
}
use {
'folke/which-key.nvim',
config = function()
require('which-key').setup()
require('keybinds').wk_setup()
end
}
use {
'nvim-telescope/telescope.nvim',
requires = 'nvim-lua/plenary.nvim'
}
use {
'nvim-lualine/lualine.nvim',
config = require('lualine-conf')
}
use {
'lewis6991/gitsigns.nvim',
config = function()
require('gitsigns').setup()
end
}
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
}
use {
'kyazdani42/nvim-tree.lua',
config = function()
require('nvim-tree').setup()
end
}
use {
'felipec/vim-sanegx',
event = 'BufRead',
@ -56,45 +68,10 @@ return require('packer').startup(function(use)
requires = 'nvim-lua/plenary.nvim',
event = 'BufRead'
}
use {
'williamboman/mason.nvim',
config = function()
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
RRGGBB = true, -- #RRGGBB hex codes
RRGGBBAA = true, -- #RRGGBBAA hex codes
rgb_fn = true, -- CSS rgb() and rgba() functions
hsl_fn = true, -- CSS hsl() and hsla() functions
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
})
end,
}
use {
'folke/tokyonight.nvim',
config = function()
require("tokyonight").setup({
style = "night",
transparent = true,
})
end,
}
if packer_bootstrap then
require('packer').sync()
end

View file

@ -0,0 +1,9 @@
return function()
require("tokyonight").setup({
transparent = true,
terminal_colors = true,
dim_inactive = true,
lualine_bold = true,
})
vim.cmd[[colorscheme tokyonight]]
end

View file

@ -74,6 +74,11 @@ end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
["bufferline.nvim"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/bufferline.nvim",
url = "https://github.com/akinsho/bufferline.nvim"
},
["diffview.nvim"] = {
loaded = false,
needs_bufread = false,
@ -81,16 +86,21 @@ _G.packer_plugins = {
path = "/home/luca/.local/share/nvim/site/pack/packer/opt/diffview.nvim",
url = "https://github.com/sindrets/diffview.nvim"
},
["lf.vim"] = {
["gitsigns.nvim"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/lf.vim",
url = "https://github.com/ptzz/lf.vim"
path = "/home/luca/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
url = "https://github.com/lewis6991/gitsigns.nvim"
},
["lua-dev.nvim"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/lua-dev.nvim",
url = "https://github.com/folke/lua-dev.nvim"
},
["lualine.nvim"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/lualine.nvim",
url = "https://github.com/nvim-lualine/lualine.nvim"
},
["mason-lspconfig.nvim"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
@ -102,7 +112,6 @@ _G.packer_plugins = {
url = "https://github.com/williamboman/mason.nvim"
},
["nvim-colorizer.lua"] = {
config = { "\27LJ\2\n|\0\0\4\0\5\0\b6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0005\3\4\0B\0\3\1K\0\1\0\1\0\a\bRGB\2\vcss_fn\2\bcss\2\vhsl_fn\2\vrgb_fn\2\rRRGGBBAA\2\vRRGGBB\2\1\2\0\0\6*\nsetup\14colorizer\frequire\0" },
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua",
url = "https://github.com/norcalli/nvim-colorizer.lua"
@ -112,11 +121,21 @@ _G.packer_plugins = {
path = "/home/luca/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-tree.lua"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
url = "https://github.com/kyazdani42/nvim-tree.lua"
},
["nvim-treesitter"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["nvim-web-devicons"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
url = "https://github.com/kyazdani42/nvim-web-devicons"
},
["packer.nvim"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/packer.nvim",
@ -128,15 +147,11 @@ _G.packer_plugins = {
url = "https://github.com/nvim-lua/plenary.nvim"
},
["tokyonight.nvim"] = {
config = { "\27LJ\2\n¨\1\0\0\3\0\a\0\v6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\0016\0\4\0009\0\5\0'\2\6\0B\0\2\1K\0\1\0\27colorscheme tokyonight\bcmd\bvim\1\0\4\17lualine_bold\2\17dim_inactive\2\20terminal_colors\2\16transparent\2\nsetup\15tokyonight\frequire\0" },
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
url = "https://github.com/folke/tokyonight.nvim"
},
["vim-floaterm"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/vim-floaterm",
url = "https://github.com/voldikss/vim-floaterm"
},
["vim-kitty"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/vim-kitty",
@ -167,15 +182,15 @@ _G.packer_plugins = {
}
time([[Defining packer_plugins]], false)
-- Config for: nvim-colorizer.lua
time([[Config for nvim-colorizer.lua]], true)
try_loadstring("\27LJ\2\n|\0\0\4\0\5\0\b6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0005\3\4\0B\0\3\1K\0\1\0\1\0\a\bRGB\2\vcss_fn\2\bcss\2\vhsl_fn\2\vrgb_fn\2\rRRGGBBAA\2\vRRGGBB\2\1\2\0\0\6*\nsetup\14colorizer\frequire\0", "config", "nvim-colorizer.lua")
time([[Config for nvim-colorizer.lua]], false)
-- Config for: tokyonight.nvim
time([[Config for tokyonight.nvim]], true)
try_loadstring("\27LJ\2\n¨\1\0\0\3\0\a\0\v6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\0016\0\4\0009\0\5\0'\2\6\0B\0\2\1K\0\1\0\27colorscheme tokyonight\bcmd\bvim\1\0\4\17lualine_bold\2\17dim_inactive\2\20terminal_colors\2\16transparent\2\nsetup\15tokyonight\frequire\0", "config", "tokyonight.nvim")
time([[Config for tokyonight.nvim]], false)
vim.cmd [[augroup packer_load_aucmds]]
vim.cmd [[au!]]
-- Event lazy-loads
time([[Defining lazy-load event autocommands]], true)
vim.cmd [[au BufRead * ++once lua require("packer.load")({'diffview.nvim', 'vim-sanegx'}, { event = "BufRead *" }, _G.packer_plugins)]]
vim.cmd [[au BufRead * ++once lua require("packer.load")({'vim-sanegx', 'diffview.nvim'}, { event = "BufRead *" }, _G.packer_plugins)]]
time([[Defining lazy-load event autocommands]], false)
vim.cmd("augroup END")