Update 03.09.2023

Changed file structure (again);
Added some plugings
and more
This commit is contained in:
Kristofers Solo
2023-09-03 18:07:40 +03:00
parent 39d3cbc3cf
commit f1b78f5303
47 changed files with 976 additions and 2744 deletions

View File

@@ -1,43 +0,0 @@
local attach_on_buffer = function(output_bufnr, pattern, command)
vim.api.nvim_create_autocmd("BufWritePost", {
group = vim.api.nvim_create_augroup("autosave", { clear = true }),
pattern = pattern,
callback = function()
local append_data = function(_, data)
if data then
vim.api.nvim_buf_set_lines(output_bufnr, -1, -1, false, data)
end
end
local file_path = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf())
vim.api.nvim_buf_set_lines(output_bufnr, 0, -1, false, { file_path })
vim.fn.jobstart(command, {
stdout_buffered = true,
on_stdout = append_data,
on_stderr = append_data,
})
end,
})
end
-- vim.api.nvim_create_user_command("AutoRun", function()
-- print("AutoRun starts now...")
-- local bufnr = vim.api.nvim_get_current_buf()
-- local command = vim.fn.input("Command: ")
-- local pattern = vim.split(vim.fn.input("Pattern: "), " ")
-- attach_on_buffer(tonumber(bufnr), pattern, command)
-- end, {})
--
-- vim.api.nvim_create_user_command("AutoStop", function()
-- vim.api.nvim_create_augroup("autosave", { clear = true })
-- end, {})
vim.api.nvim_create_user_command("AutoRun", function()
local bufnr = vim.api.nvim_create_buf(true, true)
vim.api.nvim_buf_set_name(bufnr, "Test")
vim.cmd.vsplit(bufnr)
vim.api.nvim_win_set_width(0, 50)
-- local command = vim.fn.input("Command: ")
-- local pattern = vim.split(vim.fn.input("Pattern: "), " ")
-- attach_on_buffer(tonumber(bufnr), pattern, command)
end, {})

View File

@@ -1,7 +0,0 @@
require("config.options")
-- require("config.mappings")
require("config.keymaps")
require("config.vimwiki")
require("config.lazy")
require("config.autocmds")
require("config.autosave")

View File

@@ -1,16 +1,31 @@
return {
-- core
{ "folke/lazy.nvim" },
{ "nvim-lua/plenary.nvim" }, -- Useful lua functions used by lots of plugins
{ "nvim-lua/plenary.nvim" },
-- useful
{ "ThePrimeagen/harpoon" },
{ "preservim/tagbar" },
{ "alvan/vim-closetag" },
{ "mbbill/undotree" },
{
"doctorfree/cheatsheet.nvim",
event = "VeryLazy",
dependencies = {
{ "nvim-telescope/telescope.nvim" },
{ "nvim-lua/popup.nvim" },
{ "nvim-lua/plenary.nvim" },
},
},
{
"kylechui/nvim-surround",
event = "VeryLazy",
opts = true,
},
{ "christoomey/vim-tmux-navigator" },
{ "folke/todo-comments.nvim", opts = true },
{ "ahmedkhalf/project.nvim" },
{ "stevearc/oil.nvim", dependencies = { "nvim-tree/nvim-web-devicons" } },
{
"chipsenkbeil/distant.nvim",
branch = "v0.3",
@@ -21,6 +36,13 @@ return {
{ "laytan/cloak.nvim" },
{ "numToStr/Comment.nvim" },
{ "folke/which-key.nvim", lazy = true },
{
"MarcHamamji/runner.nvim",
dependencies = {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
},
-- lsp
{
@@ -76,6 +98,7 @@ return {
"rcarriga/nvim-dap-ui",
},
},
{ "elkowar/yuck.vim", ft = "yuck" },
{ "nanotee/sqls.nvim", lazy = true },
{ "p00f/clangd_extensions.nvim", ft = { "cpp", "c" } },
{ "Civitasv/cmake-tools.nvim", ft = { "cpp", "c", "cmake" }, dependencies = { "nvim-lua/plenary.nvim" } },
@@ -160,20 +183,28 @@ return {
{
"nvim-telescope/telescope.nvim",
dependencies = {
{ "nvim-tree/nvim-web-devicons" },
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
{ "nvim-telescope/telescope-media-files.nvim" },
{ "xiyaowong/telescope-emoji.nvim" },
{ "nvim-telescope/telescope-frecency.nvim" },
{ "nvim-telescope/telescope-ui-select.nvim" },
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
{ "nat-418/telescope-color-names.nvim" },
{ "nvim-telescope/telescope-dap.nvim", dependencies = {
"nvim-dap",
} },
{ "nvim-telescope/telescope-symbols.nvim" },
{ "nvim-telescope/telescope-bibtex.nvim" },
{ "tsakirist/telescope-lazy.nvim" },
{ "chip/telescope-software-licenses.nvim" },
{ "barrett-ruth/telescope-http.nvim" },
{ "crispgm/telescope-heading.nvim" },
{ "benfowler/telescope-luasnip.nvim" },
{ "paopaol/telescope-git-diffs.nvim" },
{ "debugloop/telescope-undo.nvim" },
{ "nvim-telescope/telescope-project.nvim" },
},
},
-- DB
{ "tpope/vim-dadbod" },
{ "kristijanhusak/vim-dadbod-ui" },
{ "kristijanhusak/vim-dadbod-completion" },
-- pretty
{ "uga-rosa/ccc.nvim" },
{ "lukas-reineke/indent-blankline.nvim" },
@@ -205,6 +236,7 @@ return {
vim.cmd.colorscheme("tokyonight")
end,
},
{ "nvim-tree/nvim-web-devicons" },
-- git
{ "kdheepak/lazygit.nvim" },

View File

@@ -25,11 +25,7 @@ vim.api.nvim_create_autocmd({ "TextYankPost" }, {
-- Format File on Save
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
callback = function()
if vim.lsp.buf.format then
vim.lsp.buf.format({ async = true })
else
vim.lsp.buf.format()
end
vim.lsp.buf.format()
end,
})

5
lua/solo/init.lua Normal file
View File

@@ -0,0 +1,5 @@
require("solo.options")
require("solo.keymaps")
require("solo.vimwiki")
require("solo.lazy")
require("solo.autocmds")

View File

@@ -1,7 +1,7 @@
local nmap = require("config.mappings").nmap
local xmap = require("config.mappings").xmap
local tmap = require("config.mappings").tmap
local vmap = require("config.mappings").vmap
local nmap = require("solo.mappings").nmap
local xmap = require("solo.mappings").xmap
local vmap = require("solo.mappings").vmap
local tmap = require("solo.mappings").tmap
vim.keymap.set("", "<space>", "<nop>")
nmap("Q", "<nop>")
@@ -29,21 +29,30 @@ 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("<A-s>", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>", "Substitute word")
nmap("<S-s>", ":%s/<C-r><C-w>/<C-r><C-w>/gI<Left><Left><Left>", "[S]ubstitute word")
-- nmap("<C-b>", "<cmd>w!<cr><cmd>!compiler '%:p'<cr>")
-- nmap("<C-o>", "<cmd>w!<cr><cmd>!opout '%:p'<cr>")
xmap("p", '"_dP')
vim.keymap.set("c", "<C-j>", 'pumvisible() ? "\\<C-n>" : "\\<C-j>"', { expr = true, noremap = true })
vim.keymap.set("c", "<C-k>", 'pumvisible() ? "\\<C-p>" : "\\<C-k>"', { expr = true, noremap = true })
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("<C-h>", "<C-\\><C-N><C-w>h")
-- tmap("<C-j>", "<C-\\><C-N><C-w>j")
-- tmap("<C-k>", "<C-\\><C-N><C-w>k")
-- tmap("<C-l>", "<C-\\><C-N><C-w>l")
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")

80
lua/solo/snips.lua Normal file
View File

@@ -0,0 +1,80 @@
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
]]
require("luasnip/loaders/from_vscode").lazy_load()
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