1
0
Fork 0
This commit is contained in:
Luca Bilke 2022-09-21 21:49:29 +02:00
commit 6631175a6f
6 changed files with 319 additions and 0 deletions

4
.config/nvim/init.lua Normal file
View file

@ -0,0 +1,4 @@
require('plugins')
require('options')
require('keybinds')
require('autocmds')

View file

@ -0,0 +1,53 @@
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
]])

View file

@ -0,0 +1 @@
vim.g.mapleader = "space"

View file

@ -0,0 +1,10 @@
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.g.tokyonight_style = "night"

View file

@ -0,0 +1,56 @@
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
local packer_bootstrap = ensure_packer()
return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use 'williamboman/mason.nvim'
use { 'williamboman/mason-lspconfig.nvim',
requires = 'neovim/nvim-lspconfig'
}
use 'fladson/vim-kitty'
use 'folke/lua-dev.nvim'
use 'tpope/vim-surround'
use 'tpope/vim-repeat'
use 'folke/tokyonight.nvim'
use 'vimwiki/vimwiki'
use { 'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
}
use { 'felipec/vim-sanegx',
event = 'BufRead',
}
use { 'ptzz/lf.vim',
requires = 'voldikss/vim-floaterm',
}
use { 'sindrets/diffview.nvim',
requires = 'nvim-lua/plenary.nvim',
event = 'BufRead'
}
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,
}
if packer_bootstrap then
require('packer').sync()
end
end)

View file

@ -0,0 +1,195 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
end
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/home/luca/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/luca/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/luca/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/luca/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/luca/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
["diffview.nvim"] = {
loaded = false,
needs_bufread = false,
only_cond = false,
path = "/home/luca/.local/share/nvim/site/pack/packer/opt/diffview.nvim",
url = "https://github.com/sindrets/diffview.nvim"
},
["lf.vim"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/lf.vim",
url = "https://github.com/ptzz/lf.vim"
},
["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"
},
["mason-lspconfig.nvim"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
url = "https://github.com/williamboman/mason-lspconfig.nvim"
},
["mason.nvim"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/mason.nvim",
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"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-treesitter"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["packer.nvim"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
["plenary.nvim"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["tokyonight.nvim"] = {
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",
url = "https://github.com/fladson/vim-kitty"
},
["vim-repeat"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/vim-repeat",
url = "https://github.com/tpope/vim-repeat"
},
["vim-sanegx"] = {
loaded = false,
needs_bufread = false,
only_cond = false,
path = "/home/luca/.local/share/nvim/site/pack/packer/opt/vim-sanegx",
url = "https://github.com/felipec/vim-sanegx"
},
["vim-surround"] = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/vim-surround",
url = "https://github.com/tpope/vim-surround"
},
vimwiki = {
loaded = true,
path = "/home/luca/.local/share/nvim/site/pack/packer/start/vimwiki",
url = "https://github.com/vimwiki/vimwiki"
}
}
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)
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)]]
time([[Defining lazy-load event autocommands]], false)
vim.cmd("augroup END")
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end
end)
if not no_errors then
error_msg = error_msg:gsub('"', '\\"')
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end