Rename "solo" to "config" dir

This commit is contained in:
2025-01-22 13:40:35 +02:00
parent e73c3b0732
commit 02035c0466
16 changed files with 16 additions and 16 deletions

117
lua/config/autocmds.lua Normal file
View File

@@ -0,0 +1,117 @@
-- Use 'q' to quit from common pluginscmd
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = {
"qf",
"help",
"man",
"lspinfo",
"spectre_panel",
"lir",
"git",
"dap-float",
"fugitive",
"gitcommit",
"startuptime",
},
callback = function()
vim.cmd([[ nnoremap <silent> <buffer> q :close<cr>
set nobuflisted
]])
end,
})
-- Fixes Autocomment
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
callback = function()
vim.cmd("set formatoptions-=cro")
end,
})
-- Highlight Yanked Text
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
callback = function()
vim.highlight.on_yank({ higroup = "Visual", timeout = 100 })
end,
})
-- Format File on Save
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
callback = function()
vim.lsp.buf.format()
end,
})
-- Center on InsertEnter
vim.api.nvim_create_autocmd({ "InsertEnter" }, {
callback = function()
vim.cmd("normal! zz")
end,
})
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
pattern = "**/Codnity/**",
callback = function()
vim.opt.colorcolumn = "79"
end,
})
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
pattern = "requirements*.txt",
callback = function()
vim.cmd("setf requirements")
end,
})
--[[ vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
pattern = "**/Codnity/**/*.html",
callback = function()
vim.cmd("setf htmldjango")
end,
}) ]]
-- Autocommand that sources neovim files on save
--[[ vim.api.nvim_create_autocmd({ "BufWritePost" }, {
group = vim.api.nvim_create_augroup("AutoReloadConfig", { clear = true }),
pattern = { "**/nvim/**/*.lua", "**/SoloVim/**/*.lua" },
callback = function()
local file_path = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf())
vim.cmd.source(file_path)
end,
}) ]]
vim.filetype.add({
pattern = {
[".*/hypr/.*%.conf"] = "hyprlang",
},
})
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function()
if vim.env.TMUX_PLUGIN_MANAGER_PATH then
vim.loop.spawn(
vim.env.TMUX_PLUGIN_MANAGER_PATH .. "/tmux-window-name/scripts/rename_session_windows.py",
{}
)
end
end,
})
--[[ local function setup_soft_wrap()
vim.opt_local.wrap = true
vim.opt_local.linebreak = true
vim.opt_local.columns = 85
vim.api.nvim_create_autocmd({ "VimResized" }, {
buffer = 0,
callback = function()
if vim.opt.columns:get() > 85 then
vim.opt.columns = 85
end
end,
})
vim.opt_local.colorcolumn = "80"
end
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "markdown", "norg", "typst", "tex" },
callback = setup_soft_wrap,
}) ]]

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

@@ -0,0 +1,4 @@
require("config.keymaps")
require("config.options")
require("config.lazy")
require("config.autocmds")

71
lua/config/keymaps.lua Normal file
View File

@@ -0,0 +1,71 @@
local nmap = require("config.mappings").nmap
local xmap = require("config.mappings").xmap
local vmap = require("config.mappings").vmap
local tmap = require("config.mappings").tmap
local imap = require("config.mappings").imap
-- Unpam keys
vim.keymap.set("", "<space>", "<nop>")
nmap("Q", "<nop>")
nmap("<C-space>", "<nop>")
nmap("<F1>", "<nop>")
nmap("<F2>", "<nop>")
nmap("<F3>", "<nop>")
nmap("<F4>", "<nop>")
nmap("<leader>v", "<nop>")
nmap("<leader>p", "<nop>")
nmap("J", "mzJ`z")
nmap("<C-d>", "<C-d>zz")
nmap("<C-u>", "<C-u>zz")
nmap("n", "nzzzv")
nmap("N", "Nzzzv")
nmap("*", "*zz")
nmap("#", "#zz")
nmap("g*", "g*zz")
nmap("g#", "g#zz")
vim.keymap.set("n", ";", ";", { silent = false })
vim.keymap.set({ "n" }, "j", "gj", { desc = "Allows to navigate though wrapped lines", noremap = true })
vim.keymap.set({ "n" }, "k", "gk", { desc = "Allows to navigate though wrapped lines", noremap = true })
nmap("<C-Up>", "<cmd>resize -2<cr>", "Resize window up")
nmap("<C-Down>", "<cmd>resize +2<cr>", "Resize window down")
nmap("<C-Left>", "<cmd>vertical resize -2<cr>", "Resize window left")
nmap("<C-Right>", "<cmd>vertical resize +2<cr>", "Resize window right")
nmap("<C-f>", "<cmd>!tmux neww tmux-sessionizer<cr>", "Open tmux sessionizer")
nmap("<A-k>", "<cmd>m .-2<cr>==", "Move line up")
nmap("<A-j>", "<cmd>m .+1<cr>==", "Move line down")
-- nmap("<S-s>", ":%s/<C-r><C-w>/<C-r><C-w>/gI<Left><Left><Left>", "[S]ubstitute word")
nmap("<S-s>", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], "[S]ubstitute word")
nmap("Q", "@qj", "Run macro")
xmap("Q", ":norm @q<CR>", "Run macro")
xmap("p", '"_dP')
vim.keymap.set(
"c",
"<C-j>",
'pumvisible() ? "\\<C-n>" : "\\<C-j>"',
{ expr = true, noremap = true, desc = "Prev command" }
)
vim.keymap.set(
"c",
"<C-k>",
'pumvisible() ? "\\<C-p>" : "\\<C-k>"',
{ expr = true, noremap = true, desc = "Next command" }
)
vmap(">", ">gv", "Right Indent")
vmap("<", "<gv", "Left Indent")
vmap("<A-k>", ":m '<-2<cr>gv=gv", "Move lines up")
vmap("<A-j>", ":m '>+1<cr>gv=gv", "Move lines down")
-- tmap("t", "<C-h>", "<C-\\><C-N><C-w>h")
-- tmap("t", "<C-j>", "<C-\\><C-N><C-w>j")
-- tmap("t", "<C-k>", "<C-\\><C-N><C-w>k")
-- tmap("t", "<C-l>", "<C-\\><C-N><C-w>l")

36
lua/config/lazy.lua Normal file
View File

@@ -0,0 +1,36 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
vim.g.mapleader = " "
vim.g.maplocalleader = " "
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
local opts = {
ui = {
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
border = "rounded",
},
change_detection = {
-- automatically check for config file changes and reload the ui
enabled = false,
notify = true, -- get a notification when changes are found
},
install = {
-- try to load one of these colorschemes when starting an installation during startup
colorscheme = { "rose-pine" },
},
rocks = {
hererocks = true, -- recommended if you do not have global installation of Lua 5.1.
},
}
require("lazy").setup("plugins", opts)

View File

@@ -0,0 +1,179 @@
return {
servers = {
gopls = {
settings = {
hints = {
rangeVariableTypes = true,
parameterNames = true,
constantValues = true,
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
functionTypeParameters = true,
},
},
},
lua_ls = {
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { "vim", "awesome", "client" },
},
-- workspace = {
-- Make the server aware of Neovim runtime files
-- library = vim.api.nvim_get_runtime_file("", true),
-- },
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
root_pattern = {
".stylua.toml",
".luarc.json",
".luarc.jsonc",
".luacheckrc",
"stylua.toml",
"selene.toml",
"selene.yml",
".git",
},
format = {
enable = false,
},
hint = {
enable = true,
},
},
},
},
clangd = {
capabilities = {
offsetEncoding = { "utf-16" },
},
settings = {
clangd = {
InlayHints = {
Designators = true,
Enabled = true,
ParameterNames = true,
DeducedTypes = true,
},
fallbackFlags = { "-std=c++20" },
},
},
},
bashls = {
filetypes = {
"sh",
"bash",
"zsh",
},
},
emmet_ls = {
filetypes = {
"html",
"htmldjango",
"typescriptreact",
"javascriptreact",
"css",
"sass",
"scss",
"less",
"eruby",
},
},
texlab = {
texlab = {
auxDirectory = ".",
bibtexFormatter = "texlab",
build = {
args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
executable = "xelatex",
forwardSearchAfter = false,
onSave = false,
},
chktex = {
onEdit = false,
onOpenAndSave = false,
},
diagnosticsDelay = 0,
formatterLineLength = 120,
forwardSearch = {
args = {},
},
latexFormatter = "latexindent",
latexindent = {
modifyLineBreaks = false,
},
},
},
htmx = {
filetypes = { "html", "htmldjango", "templ" },
},
--[[ pylyzer = {
settings = {
python = {
diagnostics = true,
inlayHints = true,
smartCompletion = true,
checkOnType = true,
},
},
}, ]]
--[[ basedpyright = {
analysis = {
autoSearchPaths = true,
diagnosticMode = "openFilesOnly",
useLibraryCodeForTypes = true,
},
}, ]]
--[[ pylsp = {
settings = {
pylsp = {
plugins = {
autopep8 = { enabled = false },
flake8 = { enabled = false },
pylint = { enabled = false },
yapf = { enabled = false },
pydocstyle = { enabled = false },
mccabe = { enabled = false },
rope_autoimport = { enabled = true },
rope_completion = {
enabled = true,
eager = true,
},
pycodestyle = {
maxLineLength = nil,
},
},
},
},
}, ]]
jinja_lsp = {
filetypes = { "html", "htmldjango", "templ" },
},
html = {
filetypes = {
"html",
"htmldjango",
"templ",
},
init_options = {
provideFormatter = false,
},
},
tinymist = {
offset_encoding = "utf-8",
settings = {
exportPdf = "onType",
outputPath = "$root/target/$dir/$name",
},
},
ts_ls = {},
},
}

35
lua/config/mappings.lua Normal file
View File

@@ -0,0 +1,35 @@
local M = {}
-- Modes
-- normal_mode = "n",
-- insert_mode = "i",
-- visual_mode = "v",
-- visual_block_mode = "x",
-- term_mode = "t",
-- command_mode = "c",
--
M.nmap = function(keys, func, desc)
vim.keymap.set("n", keys, func, { desc = desc })
end
M.imap = function(keys, func, desc)
vim.keymap.set("i", keys, func, { desc = desc })
end
M.vmap = function(keys, func, desc)
vim.keymap.set("v", keys, func, { desc = desc })
end
M.xmap = function(keys, func, desc)
vim.keymap.set("x", keys, func, { desc = desc })
end
M.tmap = function(keys, func, desc)
vim.keymap.set("t", keys, func, { desc = desc })
end
M.cmap = function(keys, func, desc)
vim.keymap.set("c", keys, func, { desc = desc })
end
return M

68
lua/config/options.lua Normal file
View File

@@ -0,0 +1,68 @@
vim.opt.backup = false -- creates a backup file
vim.opt.breakindent = true -- Enable break indent
vim.opt.clipboard = "unnamedplus" -- allows neovim to access the system clipboard
vim.opt.cmdheight = 1 -- more space in the neovim command line for displaying messages
vim.opt.colorcolumn = "120"
vim.opt.completeopt = { "menuone", "noselect" } -- mostly just for cmp
vim.opt.conceallevel = 2 -- so that `` is visible in markdown files
vim.opt.cursorcolumn = true -- highlight the current column
vim.opt.cursorline = true -- highlight the current line
vim.opt.expandtab = true -- convert tabs to spaces
vim.opt.fileencoding = "utf-8" -- the encoding written to a file
vim.opt.fillchars.eob = " "
vim.opt.foldmethod = "manual"
vim.opt.foldenable = true
vim.opt.foldlevelstart = 99
vim.opt.foldcolumn = "1" -- '0' is not bad
vim.opt.guifont = "JetBrainsMono NF:h11" -- the font used in graphical neovim applications
vim.opt.hlsearch = false -- highlight all matches on previous search pattern
vim.opt.ignorecase = true -- ignore case in search patterns
vim.opt.incsearch = true
vim.opt.isfname:append("@-@")
vim.opt.iskeyword:append("-")
vim.opt.laststatus = 3
vim.opt.mouse = "a" -- allow the mouse to be used in neovim
vim.opt.number = true -- set numbered lines
vim.opt.numberwidth = 4 -- set number column width to 4 {default 4}
vim.opt.pumheight = 10 -- pop up menu height
vim.opt.relativenumber = true -- set relative numbered lines
vim.opt.ruler = false
vim.opt.scrolloff = 8 -- is one of my fav
vim.opt.shiftwidth = 4 -- the number of spaces inserted for each indentation
vim.opt.shortmess:append("c")
vim.opt.showcmd = false
vim.opt.showmode = false -- we don't need to see things like -- INSERT -- anymore
vim.opt.showtabline = 0 -- disable tabs
vim.opt.sidescrolloff = 8
vim.opt.signcolumn = "yes" -- always show the sign column otherwise it would shift the text each time
vim.opt.smartcase = true -- smart case
vim.opt.smartindent = true -- make indenting smarter again
vim.opt.softtabstop = 4
vim.opt.spell = false
vim.opt.spelloptions:append("camel")
vim.opt.splitbelow = true -- force all horizontal splits to go below current window
vim.opt.splitright = true -- force all vertical splits to go to the right of current window
vim.opt.swapfile = false -- creates a swapfile
vim.opt.tabstop = 4 -- insert 4 spaces for a tab
vim.opt.termguicolors = true -- set term gui colors (most terminals support this)
vim.opt.timeoutlen = 250 -- time to wait for a mapped sequence to complete (in milliseconds)
vim.opt.undodir = vim.fn.stdpath("data") .. "/nvim/undodir"
vim.opt.undofile = true -- enable persistent undo
vim.opt.updatetime = 50 -- faster completion (4000ms default)
vim.opt.whichwrap:append("<,>,[,],h,l")
vim.opt.wrap = false -- display lines as one long line
vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program) it is not allowed to be edit
vim.opt_local.path:prepend(vim.fn.stdpath("config") .. "/lua")
vim.opt_local.suffixesadd:prepend(".lua")
vim.opt_local.suffixesadd:prepend("init.lua")
vim.opt.list = true
vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("tab:▎ ")
vim.opt.listchars:append("eol:↴")
vim.g.netrw_banner = 0
vim.g.netrw_browse_split = 0
vim.g.netrw_keepdir = 0
vim.g.netrw_localcopydircmd = "cp -r"
vim.g.netrw_winsize = 30

78
lua/config/snips.lua Normal file
View File

@@ -0,0 +1,78 @@
if not pcall(require, "luasnip") then
return
end
local ls = require("luasnip")
local f = ls.function_node
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
--[[
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local isn = ls.indent_snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local r = ls.restore_node
local events = require("luasnip.util.events")
local ai = require("luasnip.nodes.absolute_indexer")
local extras = require("luasnip.extras")
local l = extras.lambda
local rep = extras.rep
local p = extras.partial
local m = extras.match
local n = extras.nonempty
local dl = extras.dynamic_lambda
local fmt = require("luasnip.extras.fmt").fmt
local fmta = require("luasnip.extras.fmt").fmta
local conds = require("luasnip.extras.expand_conditions")
local postfix = require("luasnip.extras.postfix").postfix
local types = require("luasnip.util.types")
local parse = require("luasnip.util.parser").parse_snippet
local ms = ls.multi_snippet
]]
local shortcut = function(val)
if type(val) == "string" then
return { t({ val }), i(0) }
end
if type(val) == "table" then
for k, v in ipairs(val) do
if type(v) == "string" then
val[k] = t({ v })
end
end
end
return val
end
local M = {}
M.same = function(index)
return f(function(args)
return args[1]
end, { index })
end
M.year = function()
return os.date("%Y")
end
M.date = function()
return os.date("%d.%m.%Y")
end
M.make = function(tbl)
local result = {}
for k, v in pairs(tbl) do
table.insert(result, (s({ trig = k, desc = v.desc }, shortcut(v))))
end
return result
end
return M