From b56be935884b424a57db81ab4da3503b686cd8ec Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Mon, 29 Jan 2024 13:46:18 +0100 Subject: [PATCH 1/2] small configuration changes --- .config/nvim/lua/config/options.lua | 4 ++-- .config/nvim/lua/plugins/lazy.lua | 3 +++ .config/nvim/lua/plugins/misc/init.lua | 2 +- .config/nvim/lua/plugins/misc/lf.lua | 25 ------------------------- .gitignore | 1 + 5 files changed, 7 insertions(+), 28 deletions(-) delete mode 100644 .config/nvim/lua/plugins/misc/lf.lua diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua index 8b733597..347d4683 100644 --- a/.config/nvim/lua/config/options.lua +++ b/.config/nvim/lua/config/options.lua @@ -9,8 +9,8 @@ g.vim_json_conceal = 0 g.git_worktrees = { { toplevel = vim.env.HOME, gitdir = vim.env.XDG_DATA_HOME .. "/dots" }, } -g.max_lines = 1000 -g.max_size = 1024 * 100 +g.max_lines = 1000 +g.max_size = 1024 * 100 o.undodir = vim.fn.stdpath "cache" .. "/undo" o.clipboard = "unnamedplus" diff --git a/.config/nvim/lua/plugins/lazy.lua b/.config/nvim/lua/plugins/lazy.lua index bc18e377..2d6a6148 100644 --- a/.config/nvim/lua/plugins/lazy.lua +++ b/.config/nvim/lua/plugins/lazy.lua @@ -2,6 +2,9 @@ local M = { "folke/lazy.nvim" } local icons = require('config.icons') M.opts = { + dev = { + path = (os.getenv("XDG_DOCUMENTS_DIR") or "~/Documents") .. "/code/nvim-plugins", + }, install = { missing = true, colorscheme = { "tokyonight" }, diff --git a/.config/nvim/lua/plugins/misc/init.lua b/.config/nvim/lua/plugins/misc/init.lua index c1e3e147..3942edd5 100644 --- a/.config/nvim/lua/plugins/misc/init.lua +++ b/.config/nvim/lua/plugins/misc/init.lua @@ -11,7 +11,7 @@ return { require('plugins.misc.comment'), require('plugins.misc.gitsigns'), require('plugins.misc.indent-blankline'), - require('plugins.misc.lf'), + require('plugins.misc.taolf'), require('plugins.misc.lspkind'), require('plugins.misc.lualine'), require('plugins.misc.rustacean'), diff --git a/.config/nvim/lua/plugins/misc/lf.lua b/.config/nvim/lua/plugins/misc/lf.lua deleted file mode 100644 index 61b05a8a..00000000 --- a/.config/nvim/lua/plugins/misc/lf.lua +++ /dev/null @@ -1,25 +0,0 @@ -local M = { "lmburns/lf.nvim" } -local tt = require("plugins.misc.toggleterm").opts - -M.depends = { "toggleterm.nvim" } - -M.cmd = { "Lf" } - -M.opts = { - default_actions = { - [""] = "", - [""] = "", - [""] = "", - [""] = "", - }, - mappings = false, - width = tt.float_opts.width, - height = tt.float_opts.height, - winblend = tt.float_opts.winblend, - direction = tt.direction, - border = tt.float_opts.border, - highlights = tt.highlights, - float_opts = tt.float_opts, -} - -return M diff --git a/.gitignore b/.gitignore index 5605628b..71eee160 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ .config/nvim/spell/en.utf-8.add.spl .local/share/xkb/compiled/keymap .config/git/host-setup +.config/nvim/dev From 677125cbe1cb2fb3e88035cd1d966b5a9f2dc4f3 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Mon, 29 Jan 2024 13:47:28 +0100 Subject: [PATCH 2/2] bugfix + cleanup --- .config/nvim/lua/.luarc.json | 5 - .config/nvim/lua/config/dirs.lua | 16 - .config/nvim/lua/config/icons.lua | 2 +- .config/nvim/lua/funcs.lua | 1 - .config/nvim/lua/lazy-init.lua | 4 +- .config/nvim/lua/plugins/lazy.lua | 3 - .config/nvim/lua/plugins/lsp/lspconfig.lua | 2 +- .../lua/plugins/misc/{lf.lua => taolf.lua} | 0 .config/nvim/lua/snippets/c.lua | 331 ------------------ 9 files changed, 4 insertions(+), 360 deletions(-) delete mode 100644 .config/nvim/lua/.luarc.json delete mode 100644 .config/nvim/lua/config/dirs.lua rename .config/nvim/lua/plugins/misc/{lf.lua => taolf.lua} (100%) delete mode 100644 .config/nvim/lua/snippets/c.lua diff --git a/.config/nvim/lua/.luarc.json b/.config/nvim/lua/.luarc.json deleted file mode 100644 index 1e1765c6..00000000 --- a/.config/nvim/lua/.luarc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "diagnostics.globals": [ - "vim" - ] -} \ No newline at end of file diff --git a/.config/nvim/lua/config/dirs.lua b/.config/nvim/lua/config/dirs.lua deleted file mode 100644 index a45eab05..00000000 --- a/.config/nvim/lua/config/dirs.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - h = '/home/luca', - ch = '/home/luca/.cache', - cf = '/home/luca/.config', - dt = '/home/luca/.local/share', - sr = '/home/luca/.local/src', - it = '/home/luca/.local/src/git', - sc = '/home/luca/.local/bin', - mn = '/mnt', - dl = '/home/luca/Downloads', - dm = '/home/luca/Documents', - ms = '/home/luca/Music', - pc = '/home/luca/Pictures', - vd = '/home/luca/Videos', - dot = '/home/luca/.local/share/stow/dots', -} \ No newline at end of file diff --git a/.config/nvim/lua/config/icons.lua b/.config/nvim/lua/config/icons.lua index 4fd93f06..430c1580 100644 --- a/.config/nvim/lua/config/icons.lua +++ b/.config/nvim/lua/config/icons.lua @@ -68,7 +68,7 @@ return { Package = "󰏗", Property = "", Reference = "", - Snippet = "", + Snippet = "󰆐", String = "󰀬", Struct = "", Text = "", diff --git a/.config/nvim/lua/funcs.lua b/.config/nvim/lua/funcs.lua index 46dc84ec..7c9e3dba 100644 --- a/.config/nvim/lua/funcs.lua +++ b/.config/nvim/lua/funcs.lua @@ -132,7 +132,6 @@ end function M.file_worktree(file, worktrees) worktrees = worktrees or vim.g.git_worktrees - if not worktrees then return end file = file or vim.fn.expand "%" for _, worktree in ipairs(worktrees) do if diff --git a/.config/nvim/lua/lazy-init.lua b/.config/nvim/lua/lazy-init.lua index d9d71022..18ce3b18 100644 --- a/.config/nvim/lua/lazy-init.lua +++ b/.config/nvim/lua/lazy-init.lua @@ -5,9 +5,9 @@ if not vim.loop.fs_stat(lazypath) then "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release + "--branch=stable", lazypath, }) end vim.opt.rtp:prepend(lazypath) -require("lazy").setup('plugins', require('plugins.lazy').opts) +require("lazy").setup("plugins", require("plugins.lazy").opts) diff --git a/.config/nvim/lua/plugins/lazy.lua b/.config/nvim/lua/plugins/lazy.lua index b3f19294..2d6a6148 100644 --- a/.config/nvim/lua/plugins/lazy.lua +++ b/.config/nvim/lua/plugins/lazy.lua @@ -9,9 +9,6 @@ M.opts = { missing = true, colorscheme = { "tokyonight" }, }, - dev = { - path = os.getenv("XDG_DOCUMENTS_DIR") .. "/code/nvim-plugins" - }, ui = { border = "single", icons = { diff --git a/.config/nvim/lua/plugins/lsp/lspconfig.lua b/.config/nvim/lua/plugins/lsp/lspconfig.lua index bc95700a..dce64c22 100644 --- a/.config/nvim/lua/plugins/lsp/lspconfig.lua +++ b/.config/nvim/lua/plugins/lsp/lspconfig.lua @@ -1,6 +1,6 @@ local M = { "neovim/nvim-lspconfig" } -M.dependencies = { "mason-lspconfig.nvim" } +M.dependencies = { "mason-lspconfig.nvim", "neoconf.nvim", "neodev.nvim" } M.event = { "BufReadPost", "BufNewFile" } diff --git a/.config/nvim/lua/plugins/misc/lf.lua b/.config/nvim/lua/plugins/misc/taolf.lua similarity index 100% rename from .config/nvim/lua/plugins/misc/lf.lua rename to .config/nvim/lua/plugins/misc/taolf.lua diff --git a/.config/nvim/lua/snippets/c.lua b/.config/nvim/lua/snippets/c.lua deleted file mode 100644 index 04afe14b..00000000 --- a/.config/nvim/lua/snippets/c.lua +++ /dev/null @@ -1,331 +0,0 @@ ----@diagnostic disable: undefined-global -return { - s({ trig = "sst", name = "Standard Template" }, fmt([[ - #include - #include - - int main(int argc, char *argv[]) {{ - {} - return EXIT_SUCCESS; - }} - ]], { i(0) })), - s({ trig = "sstp", name = "Preprocessor Template" }, fmt([[ - // #define NDEBUG // disables assert() - #include - #include - #include - #include - #include - #include - - ]], {})), - s({ trig = "main", name = "main(int argc, char *argv[])" }, fmt([[ - int main(int argc, char *argv[]) {{ - {} - return EXIT_SUCCESS; - }} - ]], { i(0) })), - s({ trig = "mainn", name = "main(void)" }, fmt([[ - int main(void) {{ - {} - return EXIT_SUCCESS; - }} - ]], { i(0) })), - s({ trig = "#inc", name = "#include <...>" }, fmt([[ - #include <{}> - ]], { i(1) })), - s({ trig = "#inc", name = "#include \"...\"" }, fmt([[ - #include "{}" - ]], { i(1) })), - s({ trig = "#def", name = "#define macro" }, fmt([[ - #define {} - ]], { i(0) })), - s({ trig = "#deff", name = "#define macro()" }, fmt([[ - #define {}({}) ({}) - ]], { i(1), i(2), i(3) })), - s({ trig = "#if", name = "#if" }, fmt([[ - #if {} - {} - #endif /* if {} */ - ]], { i(1), i(0), reference(1) })), - s({ trig = "#ifdef", name = "#ifdef" }, fmt([[ - #ifdef {} - {} - #endif /* ifdef {} */ - ]], { i(1), i(0), reference(1) })), - s({ trig = "#ifndef", name = "#ifndef" }, fmt([[ - #ifndef {} - {} - #endif /* ifndef {} */ - ]], { i(1), i(0), reference(1) })), - s({ trig = "once", name = "Header Include Guard" }, fmt([[ - #ifndef {}_H - #define {}_H - {} - #endif /* end of include guard: {} */ - ]], { i(1), reference(1), i(0), reference(1) })), - s({ trig = "nocpp", name = "extern C", dscr = "Disable C++ name mangling in C headers" }, fmt([[ - #ifdef __cplusplus - extern "C" {{ - #endif - {} - #ifdef __cplusplus - }} /* extern "C" */ - #endif - ]], { i(0) })), - s({ trig = "#err", name = "#error" }, fmt([[ - #error "{}" - ]], { i(1) })), - s({ trig = "#warn", name = "#warning" }, fmt([[ - #warning "{}" - ]], { i(1) })), - s({ trig = "if", name = "if" }, fmt([[ - if ({}) {{ - {} - }} - ]], { i(1), i(0) })), - s({ trig = "ife", name = "if else" }, fmt([[ - if ({}) {{ - {} - }} else {{ - {} - }} - ]], { i(1), i(2), i(0) })), - s({ trig = "el", name = "else" }, fmt([[ - else {{ - {} - }} - ]], { i(0) })), - s({ trig = "elif", name = "else if" }, fmt([[ - else if ({}) {{ - {} - }} - ]], { i(1), i(0) })), - s({ trig = "t", name = "Ternary" }, fmt([[ - {} ? {} : {} - ]], { i(1), i(2), i(0) })), - s({ trig = "switch", name = "Switch" }, fmt([[ - switch ({}) {{ - {} - default: - {} - }} - ]], { i(1), i(0), i(2) })), - s({ trig = "switchn", name = "Switch Without Default" }, fmt([[ - switch ({}) {{ - {} - }} - ]], { i(1), i(0) })), - s({ trig = "case", name = "Case" }, fmt([[ - case {}: - {} - ]], { i(1), i(0) })), - s({ trig = "while", name = "While" }, fmt([[ - while ({}) {{ - {} - }} - ]], { i(1), i(0) })), - s({ trig = "do", name = "Do While" }, fmt([[ - do {{ - {} - }} while({}); - ]], { i(0), i(1) })), - s({ trig = "for", name = "For" }, fmt([[ - for ({}) {{ - {} - }} - ]], { i(1), i(0) })), - s({ trig = "ret", name = "return" }, fmt([[ - return {}; - ]], { i(1) })), - s({ trig = "ex", name = "exit()" }, fmt([[ - exit({}); - ]], { i(1) })), - s({ trig = "fund", name = "Function Declaration" }, fmt([[ - {}({}); - ]], { i(1), i(2) })), - s({ trig = "fun", name = "Function Definition" }, fmt([[ - {}({}) {{ - {} - }} - ]], { i(1), i(2), i(0) })), - s({ trig = "td", name = "typedef" }, fmt([[ - typedef {}; - ]], { i(1) })), - s({ trig = "tdst", name = "typedef struct" }, fmt([[ - typedef struct {} {}; - ]], { reference(1), i(1) })), - s({ trig = "tduo", name = "typedef union" }, fmt([[ - typedef union {} {}; - ]], { reference(1), i(1) })), - s({ trig = "tden", name = "typedef enum" }, fmt([[ - typedef enum {} {}; - ]], { reference(1), i(1) })), - s({ trig = "st", name = "Struct" }, fmt([[ - struct {} {{ - {} - }}; - ]], { i(1), i(0) })), - s({ trig = "stt", name = "Struct Type" }, fmt([[ - typedef struct {} {{ - {} - }} {}; - ]], { i(1), i(0), reference(1) })), - s({ trig = "uo", name = "Union" }, fmt([[ - union {} {{ - {} - }}; - ]], { i(1), i(0) })), - s({ trig = "uot", name = "Union Type" }, fmt([[ - typedef union {} {{ - {} - }} {}; - ]], { i(1), i(0), reference(1) })), - s({ trig = "enum", name = "Enum" }, fmt([[ - enum {} {{ - {} - }}; - ]], { i(1), i(0) })), - s({ trig = "enumt", name = "Enum Type" }, fmt([[ - typedef enum {} {{ - {} - }} {}; - ]], { i(1), i(0), reference(1) })), - s({ trig = "pri", name = "printf()" }, fmt([[ - printf("{}\n", {}); - ]], { i(1, "%s"), i(2) })), - s({ trig = "fpri", name = "fprintf()" }, fmt([[ - fprintf({}, "{}\n", {}); - ]], { i(1, "stderr"), i(2, "%s"), i(3) })), - s({ trig = "spri", name = "sprintf()" }, fmt([[ - sprintf({}, "{}\n", {}); - ]], { i(1, "buf"), i(2, "%s"), i(3) })), - s({ trig = "snpri", name = "snprintf()" }, fmt([[ - snprintf({}, {}, "{}\n", {}); - ]], { i(1, "buf"), i(2, "max"), i(3, "%s"), i(4) })), - s({ trig = "sca", name = "scanf()" }, fmt([[ - scanf("{}", {}); - ]], { i(1, "%i"), i(2) })), - s({ trig = "fsca", name = "fscanf()" }, fmt([[ - fscanf({}, "{}", {}); - ]], { i(1, "stdin"), i(2, "%i"), i(3) })), - s({ trig = "ssca", name = "sscanf()" }, fmt([[ - sscanf({}, "{}", {}); - ]], { i(1, "buf"), i(2, "%i"), i(3) })), - s({ trig = "priv", name = "Print Variable" }, fmt([[ - printf("{} = {}\n", {}); - ]], { reference(2), i(1, "%i"), i(2) })), - s({ trig = "warn", name = "warn()" }, fmt([[ - warn("{}"{}); - ]], { i(1, "%s"), i(2) })), - s({ trig = "warnx", name = "warnx()" }, fmt([[ - warnx("{}"{}); - ]], { i(1, "%s"), i(2) })), - s({ trig = "err", name = "err()" }, fmt([[ - err("{}"{}); - ]], { i(1, "%s"), i(2) })), - s({ trig = "errx", name = "errx()" }, fmt([[ - errx("{}"{}); - ]], { i(1, "%s"), i(2) })), - s({ trig = "asr", name = "assert()" }, fmt([[ - assert({}); - ]], { i(1) })), - s({ trig = "stasr", name = "static_assert()" }, fmt([[ - static_assert({}, "{}"); - ]], { i(1), i(2, "Fuck!") })), - s({ trig = "Stasr", name = "static_assert() 1 Parameter" }, fmt([[ - static_assert({}); - ]], { i(1) })), - s({ trig = "mlc", name = "malloc()" }, fmt([[ - {} = malloc(sizeof({}[{}]){}); - ]], { i(1, "ptr"), i(2, "int"), i(3), i(4) })), - s({ trig = "clc", name = "calloc()" }, fmt([[ - {} = calloc({}, sizeof({}){}); - ]], { i(1, "ptr"), i(2), i(3, "int"), i(4) })), - s({ trig = "rlc", name = "realloc()" }, fmt([[ - {} = realloc({}, sizeof({}[{}]){}); - ]], { i(1, "ptr"), i(2), i(3, "int"), i(4), i(5) })), - s({ trig = "fre", name = "free()" }, fmt([[ - free({}); - ]], { i(1, "ptr") })), - s({ trig = "mlcd", name = "Malloc Declaration" }, fmt([[ - {} *{} = malloc(sizeof({}[{}]){}); - ]], { i(1, "int"), i(2, "ptr"), reference(1), i(3), i(4) })), - s({ trig = "clcd", name = "Calloc Declaration" }, fmt([[ - {} *{} = calloc({}, sizeof({}){}); - ]], { i(1, "int"), i(2, "ptr"), i(3), reference(1), i(4) })), - s({ trig = "mlct", name = "Malloc Template" }, fmt([[ - {} *{} = malloc(sizeof({}[{}])); - if (!{}) {{ - printf(stderr, "{}\n"{}); - {} - }} - {} - free({}); - ]], { i(1, "int"), i(2, "ptr"), reference(1), i(3), reference(2), i(4, "Failed to malloc!"), i(5), - i(6, "exit(EXIT_FAILURE);"), i(0), reference(2) })), - s({ trig = "clct", name = "Calloc Template" }, fmt([[ - {} *{} = calloc({}, sizeof({})); - if (!{}) {{ - printf(stderr, "{}\n"{}); - {} - }} - {} - free({}); - ]], { i(1, "int"), i(2, "ptr"), i(3), reference(1), reference(2), i(4, "Failed to calloc!"), i(5), - i(6, "exit(EXIT_FAILURE);"), i(0), reference(2) })), - s({ trig = "/", name = "Comment" }, fmt([[ - /* {} */ - ]], { i(1) })), - s({ trig = "//", name = "Multiline Comment" }, fmt([[ - /* - * {} - */ - ]], { i(1) })), - s({ trig = "///", name = "Multiline Double-Star Comment" }, fmt([[ - /** - ** {} - **/ - ]], { i(1) })), - s({ trig = "dox", name = "Doxygen Template" }, fmt([[ - /*! {} - * @brief {} - * - * {} - */ - ]], { i(1), i(2, "This is something undocumented."), i(3, "Nothing to say here...") })), - s({ trig = "dfun", name = "Doxygen Function" }, fmt([[ - /*! - * @brief {} - * - * {} - * - * @return {} - */ - {}({}); - ]], { i(3, "This function is undocumented."), i(4, "Nothing to say here..."), i(5, "Nothing."), i(1), i(2) })), - s({ trig = "todo", name = "Doxygen Todo" }, fmt([[ - /*! TODO: {} - * - * @todo {} - */ - ]], { i(1), i(2) })), - s({ trig = "dgr", name = "Doxygen Group" }, fmt([[ - /*! @name {} - * {} - * @{{ - */ - {} - /*! @}} - */ - ]], { i(1, "Undocumented Group"), i(2, "This group is undocumented."), i(0) })), - s({ trig = "alen", name = "Array Length" }, fmt([[ - (sizeof {} / sizeof {}[0]) - ]], { i(1), reference(1) })), - s({ trig = "lls", name = "Linked List" }, fmt([[ - struct {} {{ - {} - {} *{}; - }} {}; - ]], { i(1, "Node"), i(0), reference(1), i(2, "Next"), reference(1) })), -}