diff options
author | Squibid <me@zacharyscheiman.com> | 2023-02-15 23:11:33 -0500 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2023-02-15 23:11:33 -0500 |
commit | 70abc1f30f772757088b13d97256423385156080 (patch) | |
tree | 15d71d3973c41d8566304e5943a966e2d1e10d91 | |
parent | 74c846a7b6461c2be572c3778d67d5df682a34e9 (diff) | |
download | nvim-70abc1f30f772757088b13d97256423385156080.tar.gz nvim-70abc1f30f772757088b13d97256423385156080.tar.bz2 nvim-70abc1f30f772757088b13d97256423385156080.zip |
Major changes including better ui and more keybinds :)
Diffstat (limited to '')
-rw-r--r-- | init.lua | 8 | ||||
-rw-r--r-- | lazy-lock.json | 61 | ||||
-rw-r--r-- | lua/core/auto.lua | 4 | ||||
-rw-r--r-- | lua/core/maps.lua | 73 | ||||
-rw-r--r-- | lua/core/opts.lua | 64 | ||||
-rw-r--r-- | lua/core/overrides/alpha.lua | 260 | ||||
-rw-r--r-- | lua/core/overrides/cmp.lua | 28 | ||||
-rw-r--r-- | lua/core/overrides/codewindow.lua | 1 | ||||
-rw-r--r-- | lua/core/overrides/hover.lua | 18 | ||||
-rw-r--r-- | lua/core/overrides/init.lua | 6 | ||||
-rw-r--r-- | lua/core/overrides/lualine.lua | 29 | ||||
-rw-r--r-- | lua/core/overrides/modicator.lua | 27 | ||||
-rw-r--r-- | lua/core/overrides/noneckpain.lua | 6 | ||||
-rw-r--r-- | lua/core/overrides/notify.lua | 14 | ||||
-rw-r--r-- | lua/core/overrides/snip.lua | 9 | ||||
-rw-r--r-- | lua/core/overrides/telescope.lua | 4 | ||||
-rw-r--r-- | lua/core/overrides/treesitter.lua | 3 | ||||
-rw-r--r-- | lua/core/overrides/treesittercontext.lua | 9 | ||||
-rw-r--r-- | lua/core/overrides/treesj.lua | 3 | ||||
-rw-r--r-- | lua/core/plugins.lua | 36 | ||||
-rw-r--r-- | lua/core/snippets/c.lua | 29 | ||||
-rw-r--r-- | lua/core/snippets/init.lua | 35 | ||||
-rw-r--r-- | lua/core/snippets/lua.lua | 14 | ||||
-rw-r--r-- | lua/core/snippets/makefile.lua | 41 |
24 files changed, 664 insertions, 118 deletions
@@ -1 +1,9 @@ +-- global shorthands +o = vim.opt +g = vim.g +a = vim.api +cmd = vim.cmd +g.mapleader = " " + +-- load config require('core.init') diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..8cadc3a --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,61 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "418d3117dab2f54c4340ea73e0070dd78fc81753" }, + "LuaSnip": { "branch": "master", "commit": "500981ff6cefc7343e3959ef0f939bd0bfd49ba9" }, + "alpha-nvim": { "branch": "main", "commit": "d35b99e36e32040ba06c48a25b5bd3e75be2a566" }, + "barbecue.nvim": { "branch": "main", "commit": "39a6c2970bc6b5d2d61e36e95002c43bc27450b8" }, + "bufresize.nvim": { "branch": "master", "commit": "3b19527ab936d6910484dcc20fb59bdb12322d8b" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-calc": { "branch": "main", "commit": "50792f34a628ea6eb31d2c90e8df174671e4e7a0" }, + "cmp-luasnip-choice": { "branch": "master", "commit": "97a367851bc17984b56164b5427a53919aed873a" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f3491638d123cfd2c8048aefaf66d246ff250ca6" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "codewindow.nvim": { "branch": "master", "commit": "94d84e1a15b94248f205b854e70cb95f0b615b38" }, + "duckytype.nvim": { "branch": "main", "commit": "da3b08a98db3b18942a39dff085ddde7f007df63" }, + "essentials.nvim": { "branch": "main", "commit": "c88e6aca0e252a0551a6b2c198dcb2a702d0b354" }, + "friendly-snippets": { "branch": "main", "commit": "1645e7cd98ed99e766c84ab3cf13a1612c77dcee" }, + "gitsigns.nvim": { "branch": "main", "commit": "5f1451ea7d9a9005b3f0bedeab20cef7a4c65993" }, + "glow.nvim": { "branch": "main", "commit": "2bb4afb6e9dbc93993a1d7d4168dac08c74590ac" }, + "high-str.nvim": { "branch": "main", "commit": "1cb5e030bb16df52c8428b53dc235466a4eb1d01" }, + "hlargs.nvim": { "branch": "main", "commit": "88b925d699fb39633cdda02c24f0b3ba5d0e6964" }, + "hover.nvim": { "branch": "main", "commit": "3ff39c31ca6ea2a64e3a8c65dfe63aa3f5ea117b" }, + "indent-blankline.nvim": { "branch": "master", "commit": "8299fe7703dfff4b1752aeed271c3b95281a952d" }, + "intellitab.nvim": { "branch": "main", "commit": "a6c1a505865f6131866d609c52440306e9914b16" }, + "jellybeans-nvim": { "branch": "main", "commit": "f77b75443adf6461ded30de0243f49771f933d06" }, + "lazy.nvim": { "branch": "main", "commit": "e916f41df26e33b01f1b3ebe28881090da3a7281" }, + "lsp-zero.nvim": { "branch": "main", "commit": "d6af8aebb8b64877323f859d842eabdd79d021c3" }, + "lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, + "lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" }, + "lush.nvim": { "branch": "main", "commit": "b1e8eb1da3fee95ef31515a73c9eff9bf251088d" }, + "marks.nvim": { "branch": "master", "commit": "c3b18b97912720a6586fb537c5c0dfc9e06a68f1" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "93e58e100f37ef4fb0f897deeed20599dae9d128" }, + "mason.nvim": { "branch": "main", "commit": "fecabaff94c34bf8ed9c3b2a45d42a5906ea251c" }, + "maximize.nvim": { "branch": "master", "commit": "97bfc171775c404396f8248776347ebe64474fe7" }, + "modicator.nvim": { "branch": "main", "commit": "3bb2e948edccb5d1563342f5ee241491fa6286e8" }, + "murmur.lua": { "branch": "main", "commit": "bd63fc7d3122aececc9fe960660d1e4df2cf7550" }, + "neorg": { "branch": "main", "commit": "36cc15300c0dfc19d483b0a4176cb89e94f4730a" }, + "no-neck-pain.nvim": { "branch": "main", "commit": "734612a143e99d4783ec649a12810a2a112fbfb8" }, + "nvim-autopairs": { "branch": "master", "commit": "45ae3122a4c7744db41298b41f9f5a3f092123e6" }, + "nvim-cmp": { "branch": "main", "commit": "208d69f233d65526a22c6497ed57d0c80d99fa5f" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "760e27df4dd966607e8fb7fd8b6b93e3c7d2e193" }, + "nvim-lspconfig": { "branch": "master", "commit": "649137cbc53a044bffde36294ce3160cb18f32c7" }, + "nvim-navic": { "branch": "master", "commit": "7e9d2b2b601149fecdccd11b516acb721e571fe6" }, + "nvim-neoclip.lua": { "branch": "main", "commit": "5b9286a40ea2020352280caeb713515badb03d99" }, + "nvim-notify": { "branch": "master", "commit": "bdd647f61a05c9b8a57c83b78341a0690e9c29d7" }, + "nvim-rooter.lua": { "branch": "main", "commit": "833e6a37fafb9b2acb6228b9005c680face2a20f" }, + "nvim-tetris": { "branch": "master", "commit": "d17c99fb527ada98ffb0212ffc87ccda6fd4f7d9" }, + "nvim-treesitter": { "branch": "master", "commit": "b44871afb59e456bbff4113e416405c06c991cf5" }, + "pantran.nvim": { "branch": "main", "commit": "e53eb4238cea124f8a585c6dc245161b29def275" }, + "plenary.nvim": { "branch": "master", "commit": "9a0d3bf7b832818c042aaf30f692b081ddd58bd9" }, + "smart-splits.nvim": { "branch": "master", "commit": "b38431f1f68bc43d6bf9d1edb21c2bcb06b1197c" }, + "telescope-file-browser.nvim": { "branch": "master", "commit": "4a7a7d2746c1c11d0e26b9dd638a62df08692ae5" }, + "telescope-undo.nvim": { "branch": "main", "commit": "b5e31b358095074b60d87690bd1dc0a020a2afab" }, + "telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" }, + "todo-comments.nvim": { "branch": "main", "commit": "74c7d28cb50b0713c881ef69bcb6cdd77d8907d1" }, + "treesj": { "branch": "main", "commit": "7d397fddf9eb15e5d8e8cb0539beb6f6312a768e" }, + "trouble.nvim": { "branch": "main", "commit": "556ef3089709a6e253df1e500381fec5eb48e48a" }, + "venn.nvim": { "branch": "main", "commit": "c114563960b8fb1197695d42798d1f3e7190b798" }, + "which-key.nvim": { "branch": "main", "commit": "5224c261825263f46f6771f1b644cae33cd06995" } +}
\ No newline at end of file diff --git a/lua/core/auto.lua b/lua/core/auto.lua index e68032e..81270bf 100644 --- a/lua/core/auto.lua +++ b/lua/core/auto.lua @@ -68,9 +68,7 @@ a.nvim_create_autocmd('FileType', { -- disable extra tildas in certain files a.nvim_create_autocmd('FileType', { - pattern = { - 'alpha' - }, + pattern = '*', command = 'hi NonText guifg=bg' }) diff --git a/lua/core/maps.lua b/lua/core/maps.lua index bd4367e..d616e8f 100644 --- a/lua/core/maps.lua +++ b/lua/core/maps.lua @@ -9,17 +9,11 @@ a.nvim_set_keymap("n", "<leader>to", "<C-w>v<C-w>w:term<CR>", opts) -- esc to go to normal mode in term bufers a.nvim_set_keymap("t", "<ESC>", "<C-\\><C-n>", opts) --- open Trouble buffer -a.nvim_set_keymap("n", "<leader>tt", - "<cmd>TroubleToggle document_diagnostics<CR>", opts) -a.nvim_set_keymap("n", "<leader>td", "<cmd>TodoTrouble<CR>", opts) - --- dismiss notifications -a.nvim_set_keymap("n", "<leader>nd", "", { callback = require('notify').dismiss }) - -- open file viewer a.nvim_set_keymap("n", "<leader>fo", ":Ex<CR>", opts) a.nvim_set_keymap("n", "<leader>fs", ":Sex<CR>", opts) +a.nvim_set_keymap("n", "<leader>fh", ":Hex<CR>", opts) +a.nvim_set_keymap("n", "<leader>fv", ":Vex<CR>", opts) -- clear search a.nvim_set_keymap("n", "<ESC>", ":nohlsearch<Bar>:echo<CR>", opts) @@ -38,6 +32,33 @@ a.nvim_set_keymap("n", "<C-u>", "<C-u>zz", opts) -- execute order 111 a.nvim_set_keymap("n", "<leader>x", "<cmd>!chmod +x %<CR>", opts) +-- add some keybinds to the file view +a.nvim_create_autocmd('FileType', { + pattern = 'netrw', + callback = function() + local bind = function(lhs, rhs) + vim.keymap.set('n', lhs, rhs, { remap = true, buffer = true }) + end + bind('h', '-^') -- Go up a directory + bind('l', '<CR>') -- Go down a directory / open a file + bind('.', 'gh') -- Toggle dotfiles + bind('P', '<C-w>z') -- Close preview window + bind('<ESC>', '<cmd>q<CR>') -- Close netrw + end +}) + +-- plugin related binds +-- better indenting +a.nvim_set_keymap('i', '<tab>', '<cmd>lua require("intellitab").indent()<CR>', opts) + +-- open Trouble buffer +a.nvim_set_keymap("n", "<leader>tt", +"<cmd>TroubleToggle document_diagnostics<CR>", opts) +a.nvim_set_keymap("n", "<leader>td", "<cmd>TodoTrouble<CR>", opts) + +-- dismiss notifications +a.nvim_set_keymap("n", "<leader>nd", "", { callback = require('notify').dismiss }) + -- resizing splits a.nvim_set_keymap("n", '<C-h>', "<cmd>SmartResizeLeft<CR>", opts) a.nvim_set_keymap("n", '<C-j>', "<cmd>SmartResizeDown<CR>", opts) @@ -58,24 +79,28 @@ a.nvim_set_keymap('n', '<leader>su', '<cmd>Telescope undo<CR>', opts) a.nvim_set_keymap('n', '<leader>sd', '<cmd>Telescope diagnostics<CR>', opts) a.nvim_set_keymap('n', '<leader>sn', '<cmd>Telescope notify<CR>', opts) --- resource snippets +-- treesitter +a.nvim_set_keymap('n', '<leader>j', '<cmd>TSJToggle<CR>', opts) + +-- re-source snippets a.nvim_set_keymap('n', '<leader><leader>s', '<cmd>source ~/.config/nvim/lua/core/snippets/init.lua<CR>', opts) --- auto comand keybinds --- add some keybinds to the file view -a.nvim_create_autocmd('FileType', { - pattern = 'netrw', - callback = function() - local bind = function(lhs, rhs) - vim.keymap.set('n', lhs, rhs, {remap = true, buffer = true}) - end - bind('h', '-^') -- Go up a directory - bind('l', '<CR>') -- Go down a directory / open a file - bind('.', 'gh') -- Toggle dotfiles - bind('P', '<C-w>z') -- Close preview window - bind('<ESC>', '<cmd>q<CR>') -- Close netrw - end -}) +-- hover +vim.keymap.set('n', '<S-tab>', require("hover").hover_select, opts) + +-- lsp diagnostics float +a.nvim_set_keymap('n', '<tab>', '<cmd>lua vim.diagnostic.open_float()<CR>', opts) + +-- essentials +a.nvim_set_keymap('n', '<leader>eu', '<cmd>lua require("essentials").go_to_url()<CR>', opts) +a.nvim_set_keymap('n', '<leader>ec', '<cmd>lua require("essentials").cheat_sh()<CR>', opts) + +-- return to home screen +a.nvim_set_keymap('n', '<leader>gh', '<cmd>Alpha<CR>', opts) + +-- highlighting +a.nvim_set_keymap("v", "<leader>ha", ":<c-u>HSHighlight 1<CR>", opts) +a.nvim_set_keymap("v", "<leader>hc", ":<c-u>HSRmHighlight<CR>", opts) -- vbox note taking function _G.Toggle_venn() diff --git a/lua/core/opts.lua b/lua/core/opts.lua index d08bc0c..38ba762 100644 --- a/lua/core/opts.lua +++ b/lua/core/opts.lua @@ -1,10 +1,3 @@ -o = vim.opt -g = vim.g -a = vim.api -cmd = vim.cmd - -g.mapleader = " " - --------------- -- better ui -- --------------- @@ -33,18 +26,18 @@ o.tabstop = 2 o.shiftwidth = 2 o.softtabstop = -1 -- If negative, shiftwidth value is used +-- spelling +o.spelllang = { 'en_us' } + -- colors o.termguicolors = true cmd('colorscheme jellybeans-nvim') --- diagnostics -vim.lsp.handlers["textDocument/publishDiagnostics"] = - vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, - { - virtual_text = { prefix = '*' }, - } -) +-- diagnostics w/o virtual text +vim.diagnostic.config({ + underline = true, + virtual_text = false +}) colors = { black = '#000000', @@ -62,6 +55,34 @@ colors = { purple = '#C678DD', } +lspicons = { + Text = 'Tx', + Snippet = '<>', + Method = ' ', + Function = '{}', + Constructor = ' ', + Field = '""', + Variable = 'x=', + Class = '~{', + Interface = '.h', + Module = ' ', + Property = '@p', + Unit = ' ', + Value = ' ', + Enum = 'E#', + Keyword = '$1', + Color = ' ', + File = '#`', + Reference = ' ', + Folder = '[/', + EnumMember = ' ', + Constant = ' ', + Struct = ' ', + Event = ' ', + Operator = '%*', + TypeParameter = ' ', +} + -- width line o.colorcolumn = { 80 } @@ -104,9 +125,18 @@ g.netrw_localcopydircmd = 'cp -r' g.netrw_winsize = 30 g.netrw_liststyle = 1 +----------------------- +-- language settings -- +----------------------- +g.c_syntax_for_h = true -- treat c header files as c files instead of c++ files + ---------------- -- highlights -- ---------------- +-- transparent background +-- a.nvim_set_hl(0, "Normal", { bg = "" }) + +-- a.nvim_set_hl(0, "ColorColumn", { bg = colors.grey }) -- color column a.nvim_set_hl(0, "Pmenu", { bg = colors.black2 }) a.nvim_set_hl(0, "PmenuSel", { bg = colors.grey2 }) @@ -151,8 +181,8 @@ a.nvim_set_hl(0, "CmpItemKindProperty", { bg = "#4FBF63", bold = true }) a.nvim_set_hl(0, "CmpItemKindInterface", { bg = "#1e90ff", bold = true }) a.nvim_set_hl(0, "CmpItemKindClass", { bg = "#4D4C5C", bold = true }) a.nvim_set_hl(0, "CmpItemKindFile", { bg = "#E8D01C", bold = true }) - -a.nvim_set_hl(0, "TreesitterContext", { bg = colors.grey }) +a.nvim_set_hl(0, "CmpItemKindFolder", { bg = "#E8D01C", bold = true }) +a.nvim_set_hl(0, "CmpItemKindOperator", { bg = "#E06C75", bold = true }) -- telescope a.nvim_set_hl(0, "TelescopeMatching", { bg = colors.black3 }) diff --git a/lua/core/overrides/alpha.lua b/lua/core/overrides/alpha.lua new file mode 100644 index 0000000..373eeff --- /dev/null +++ b/lua/core/overrides/alpha.lua @@ -0,0 +1,260 @@ +local present, alpha = pcall(require, "alpha") +if not present then + return +end + +local pepe = { + { + [[⠄⠄⠄⠄⠄⠄⠄⢀⣠⣶⣾⣿⣶⣦⣤⣀⠄⢀⣀⣤⣤⣤⣤⣄⠄⠄⠄⠄⠄⠄]], + [[⠄⠄⠄⠄⠄⢀⣴⣿⣿⣿⡿⠿⠿⠿⠿⢿⣷⡹⣿⣿⣿⣿⣿⣿⣷⠄⠄⠄⠄⠄]], + [[⠄⠄⠄⠄⠄⣾⣿⣿⣿⣯⣵⣾⣿⣿⡶⠦⠭⢁⠩⢭⣭⣵⣶⣶⡬⣄⣀⡀⠄⠄]], + [[⠄⠄⠄⡀⠘⠻⣿⣿⣿⣿⡿⠟⠩⠶⠚⠻⠟⠳⢶⣮⢫⣥⠶⠒⠒⠒⠒⠆⠐⠒]], + [[⠄⢠⣾⢇⣿⣿⣶⣦⢠⠰⡕⢤⠆⠄⠰⢠⢠⠄⠰⢠⠠⠄⡀⠄⢊⢯⠄⡅⠂⠄]], + [[⢠⣿⣿⣿⣿⣿⣿⣿⣏⠘⢼⠬⠆⠄⢘⠨⢐⠄⢘⠈⣼⡄⠄⠄⡢⡲⠄⠂⠠⠄]], + [[⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣥⣀⡁⠄⠘⠘⠘⢀⣠⣾⣿⢿⣦⣁⠙⠃⠄⠃⠐⣀]], + [[⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣋⣵⣾⣿⣿⣿⣿⣦⣀⣶⣾⣿⣿⡉⠉⠉]], + [[⣿⣿⣿⣿⣿⣿⣿⠟⣫⣥⣬⣭⣛⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄]], + [[⣿⣿⣿⣿⣿⣿⣿⠸⣿⣏⣙⠿⣿⣿⣶⣦⣍⣙⠿⠿⠿⠿⠿⠿⠿⠿⣛⣩⣶⠄]], + [[⣛⣛⣛⠿⠿⣿⣿⣿⣮⣙⠿⢿⣶⣶⣭⣭⣛⣛⣛⣛⠛⠛⠻⣛⣛⣛⣛⣋⠁⢀]], + [[⣿⣿⣿⣿⣿⣶⣬⢙⡻⠿⠿⣷⣤⣝⣛⣛⣛⣛⣛⣛⣛⣛⠛⠛⣛⣛⠛⣡⣴⣿]], + [[⣛⣛⠛⠛⠛⣛⡑⡿⢻⢻⠲⢆⢹⣿⣿⣿⣿⣿⣿⠿⠿⠟⡴⢻⢋⠻⣟⠈⠿⠿]], + [[⣿⡿⡿⣿⢷⢤⠄⡔⡘⣃⢃⢰⡦⡤⡤⢤⢤⢤⠒⠞⠳⢸⠃⡆⢸⠄⠟⠸⠛⢿]], + [[⡟⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸]], + }, + { + [[⠄⠄⠄⠄⠄⠄⠄⠄⠄⣾⣿⣿⣿⣿⡄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄]], + [[⠄⠄⠄⠄⠄⠄⠄⠄⣼⣿⣿⣿⣿⣿⣿⣧⠄⠄⠄⠄⠄⣀⣀⠄⠄⠄⠄⠄⠄⠄]], + [[⠄⠄⠄⠄⠄⠄⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣧⠄⠄⠄⣾⠛⠛⣷⢀⣾⠟⠻⣦⠄]], + [[⠄⠄⠄⠄⠄⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠄⠄⢰⡿⠋⠄⠄⣠⡾⠋⠄]], + [[⠄⠄⠄⠄⠄⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡄⠄⣬⡄⠄⠄⠄⣭⡅⠄⠄]], + [[⠄⠄⠄⠄⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠄⠄]], + [[⠄⠄⠄⠄⢛⣛⣛⣛⣛⣛⣛⣛⣛⡛⢋⣉⣭⣭⣥⣬⣤⣤⣀⠄⠄⠄⠄⠄⠄⠄]], + [[⠄⠄⣴⣵⣿⣟⡉⣥⣶⣶⠶⠶⠬⣉⡂⠹⣟⡫⠽⠟⢒⣒⠒⠆⠄⠄⠄⠄⠄⠄]], + [[⠄⣼⣿⣿⣿⣿⣿⣶⣭⣃⡈⠄⠄⠘⠃⡰⢶⣶⣿⠏⠄⠄⠙⡛⠄⠄⠄⠄⠄⠄]], + [[⢰⣿⣿⣿⣿⣿⣿⣿⣯⣉⣉⣩⣭⣶⣿⡿⠶⠶⠶⠶⠶⠾⣋⠄⠄⠄⠄⠄⠄⠄]], + [[⢾⣿⣿⣿⣿⣿⣿⣿⢩⣶⣒⠒⠶⢖⣒⣚⡛⠭⠭⠭⠍⠉⠁⠄⠄⠄⣀⣀⡀⠄]], + [[⠘⢿⣿⣿⣿⣿⣿⣿⣧⣬⣭⣭⣭⣤⡤⠤⠶⠟⣋⣀⣀⡀⢀⣤⣾⠟⠋⠈⢳⠄]], + [[⣴⣦⡒⠬⠭⣭⣭⣭⣙⣛⠋⠭⡍⠁⠈⠙⠛⠛⠛⠛⢻⠛⠉⢻⠁⠄⠄⠄⢸⡀]], + [[⣿⣿⣿⣿⣷⣦⣤⠤⢬⢍⣼⣦⡾⠛⠄⠄⠄⠄⠄⠄⠈⡇⠄⢸⠄⠄⠄⢦⣄⣇]], + [[⣿⣿⡿⣋⣭⣭⣶⣿⣶⣿⣿⣿⠟⠛⠃⠄⠄⠄⠄⠄⢠⠃⠄⡜⠄⠄⠄⠔⣿⣿]], + }, + { + [[⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠔⠊⠉⠉⠉⠉⠉⠐⢦⡄⠄⠄⠄⠄⠄⠄⠄⠄]], + [[⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡐⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⣆⠄⠄⠄⠄⠄⠄⠄]], + [[⠄⠄⠄⠄⠄⠄⠄⠄⢀⠖⠁⢀⣾⣆⡰⠶⡷⠶⣀⣾⣄⠄⠈⣆⠄⠄⠄⠄⠄⠄]], + [[⠄⠄⡄⠄⠠⢤⣤⠔⠃⠄⠄⠄⠄⠘⢧⣤⢣⣤⠋⠄⠄⠄⠄⠈⠣⢤⡠⠄⠄⠄]], + [[⠄⠄⠘⠦⡀⠄⠄⠄⠄⠄⠄⠄⢻⡟⠻⣿⣿⡿⠻⡟⠃⠄⠄⠄⠄⠄⠄⠄⡀⠞]], + [[⠄⠄⠄⠄⠉⢢⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⡠⠊⠄⠄]], + [[⠄⠄⠄⠄⠄⠄⠈⠢⣤⣤⣴⣶⡶⢶⣶⣶⣶⣆⢒⣤⣤⠄⢠⠤⠤⠚⠄⠄⠄⠄]], + [[⠄⠄⠄⠄⠄⢀⣠⣾⣿⣿⣿⣿⣎⢻⣿⠁⡀⣿⡎⣿⣿⣀⣃⠧⡀⠄⠄⠄⠄⠄]], + [[⠄⠄⣠⣶⣾⣿⣿⣿⣿⣿⣿⣿⡹⡼⢿⣠⠵⠿⣑⢿⣟⣛⠤⣩⡁⠄⠄⠄⠄⠄]], + [[⢠⣿⣿⣿⢏⡜⡻⣷⡽⣿⣷⣭⣿⣮⣽⣯⣽⣿⣿⣷⣤⣾⡿⠟⠃⠄⠄⠄⠄⠄]], + [[⠻⣿⣿⣿⣌⢷⣙⠾⠯⣒⡿⠭⣝⣛⣛⣛⣛⠛⠭⠭⠟⢣⠌⠄⠄⠄⠄⠄⠄⠄]], + [[⠄⠻⣿⣿⣿⣮⣟⠷⣦⣤⣝⣛⠲⠶⠶⠒⢂⣀⠠⠄⠐⠁⠄⠄⠄⠄⠄⠄⠄⠄]], + [[⠄⠄⠄⠙⠿⠿⢿⣿⡷⠶⠭⠭⠭⠵⠶⠒⠋⠉⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄]], + }, + { + [[⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿]], + [[⣿⣿⣿⣿⣿⣿⣿⠛⢩⣴⣶⣶⣶⣌⠙⠫⠛⢋⣭⣤⣤⣤⣤⡙⣿⣿⣿⣿⣿⣿]], + [[⣿⣿⣿⣿⣿⡟⢡⣾⣿⠿⣛⣛⣛⣛⣛⡳⠆⢻⣿⣿⣿⠿⠿⠷⡌⠻⣿⣿⣿⣿]], + [[⣿⣿⣿⣿⠏⣰⣿⣿⣴⣿⣿⣿⡿⠟⠛⠛⠒⠄⢶⣶⣶⣾⡿⠶⠒⠲⠌⢻⣿⣿]], + [[⣿⣿⠏⣡⢨⣝⡻⠿⣿⢛⣩⡵⠞⡫⠭⠭⣭⠭⠤⠈⠭⠒⣒⠩⠭⠭⣍⠒⠈⠛]], + [[⡿⢁⣾⣿⣸⣿⣿⣷⣬⡉⠁⠄⠁⠄⠄⠄⠄⠄⠄⠄⣶⠄⠄⠄⠄⠄⠄⠄⠄⢀]], + [[⢡⣾⣿⣿⣿⣿⣿⣿⣿⣧⡀⠄⠄⠄⠄⠄⠄⠄⢀⣠⣿⣦⣤⣀⣀⣀⣀⠄⣤⣾]], + [[⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⡶⢇⣰⣿⣿⣟⠿⠿⠿⠿⠟⠁⣾⣿⣿]], + [[⣿⣿⣿⣿⣿⣿⣿⡟⢛⡛⠿⠿⣿⣧⣶⣶⣿⣿⣿⣿⣿⣷⣼⣿⣿⣿⣧⠸⣿⣿]], + [[⠘⢿⣿⣿⣿⣿⣿⡇⢿⡿⠿⠦⣤⣈⣙⡛⠿⠿⠿⣿⣿⣿⣿⠿⠿⠟⠛⡀⢻⣿]], + [[⠄⠄⠉⠻⢿⣿⣿⣷⣬⣙⠳⠶⢶⣤⣍⣙⡛⠓⠒⠶⠶⠶⠶⠖⢒⣛⣛⠁⣾⣿]], + [[⠄⠄⠄⠄⠄⠈⠛⠛⠿⠿⣿⣷⣤⣤⣈⣉⣛⣛⣛⡛⠛⠛⠿⠿⠿⠟⢋⣼⣿⣿]], + [[⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠉⠉⣻⣿⣿⣿⣿⡿⠿⠛⠃⠄⠙⠛⠿⢿⣿]], + [[⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢬⣭⣭⡶⠖⣢⣦⣀⠄⠄⠄⠄⢀⣤⣾⣿]], + [[⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢰⣶⣶⣶⣾⣿⣿⣿⣿⣷⡄⠄⢠⣾⣿⣿⣿]], + }, +} + +-- dynamic header padding +local fn = vim.fn +local marginTopPercent = 0.2 +local Padding = fn.max { 2, fn.floor(fn.winheight(0) * marginTopPercent) } + +local header = { + type = "text", + val = pepe[math.random(#pepe)], + opts = { + position = "center", + hl = "AlphaAscii", + }, +} + +local plugins = require('lazy').stats().count +local date = os.date("%d/%m/%y(%a)%X") + +math.randomseed(os.time()) +local id = math.random(10000000, 99999999) +local id1 = math.random(10000000, 99999999) +local id2 = math.random(10000000, 99999999) + +local chan = { + [[based!!!]], + [[in other words, 4chan is better because + everyone gets to be an idiot.]], + [[NOOOOOOO YOU CAN’T PUBLISH BENCHMARKS FOR + OUR ANCIENT OS]], + [[This is the beginning of the end. AI has + finally won. Tech is no longer a viable job.]], + [[And Wikipedia is bloat because of html, + mathml, rich text, etc. Using modern codecs + and a simpler form of wiki we could store + the entire "human knowledge-base" and plain + text references (books, papers, articles, + websites) inside a single μSD card]], + [[My arch install broke again]], + [[Why are stdout, stderr and stdin already + opened when I start my program? Who opened + them and what is he doing in my computer?]], + [[YES BOYCOTT! + SPREAD THIS MESSAGE + EVERYONE QUIT USING THE SITE, THEY CANNOT + IGNORE US ANYMORE. FROM THIS DAY ONWARDS + THEIR PRODUCT WILL NOT BE ABLE TO HOLD UP + WITHOUT US]], + [[COMPANY A BETTER THAN COMPANY B]], + [[Nah, ignore this anon. If you want to + REALLY learn programming, you need to + learn with punch cards. Once you've + got that under your belt, move on + up to assembly.]], +} +local phrase = chan[math.random(#chan)] + +local heading = { + type = "text", + val = " Anonymous " .. date .. " No." .. id .. " ", + opts = { + position = "center", + hl = "AlphaButtons", + }, +} + +local post_buttons = { + type = "text", + val = "They don't get it. For me, it's nvim. ", + opts = { + position = "center", + hl = "AlphaFooter", + }, +} + +local pre_foot = { + type = "text", + val = ">>" .. id2 .. "(OP) ", + opts = { + position = "center", + hl = "AlphaEmphasis", + }, +} + +local footer = { + type = "text", + val = " I've " .. plugins .. " plugins, it launches instantly kek.", + opts = { + position = "center", + hl = "AlphaFooter", + }, +} + +local pre_foot_2 = { + type = "text", + val = ">>" .. id1 .. " ", + opts = { + position = "center", + hl = "AlphaEmphasis", + }, +} + +local footer_2 = { + type = "text", + val = " " .. phrase, + opts = { + position = "left", + hl = "AlphaFooter", + }, +} + +local function button(sc, txt, keybind) + local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>") + + local opts = { + position = "center", + text = txt, + shortcut = sc, + cursor = 0, + width = 44, + align_shortcut = "right", + hl_shortcut = "AlphaShortcuts", + hl = "AlphaHeader", + } + if keybind then + opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } } + end + + return { + type = "button", + val = txt, + on_press = function() + local key = vim.api.nvim_replace_termcodes(sc_, true, false, true) + vim.api.nvim_feedkeys(key, "normal", false) + end, + opts = opts, + } +end + +local buttons = { + type = "group", + val = { + button("LDR e", " >open new file", ":ene<CR>"), + button("LDR h", " >open oldfiles", ":Telescope oldfiles<CR>"), + button("LDR f", " >fuzzy search", ":Telescope find_files<CR>"), + button("LDR y", " >browse folders" , ":Telescope file_browser path=%:p:h<CR>"), + button("LDR /", " >regex search", ":Telescope live_grep<CR>"), + button("LDR u", " >update plugins", ":lua require('lazy').update()<CR>"), + }, + opts = { + spacing = 0, + }, +} + +local section = { + header = header, + buttons = buttons, + heading = heading, + post_buttons = post_buttons, + pre_foot = pre_foot, + footer = footer, + pre_foot_2 = pre_foot_2, + footer_2 = footer_2, +} + +local opts = { + layout = { + { type = "padding", val = Padding}, + { type = "padding", val = 1 }, + section.header, + { type = "padding", val = 1 }, + section.heading, + { type = "padding", val = 1 }, + section.buttons, + section.post_buttons, + { type = "padding", val = 1 }, + section.pre_foot, + section.footer, + { type = "padding", val = 1 }, + section.pre_foot_2, + section.footer_2, + { type = "padding", val = Padding }, + }, + opts = { + margin = 50, + }, +} +alpha.setup(opts) diff --git a/lua/core/overrides/cmp.lua b/lua/core/overrides/cmp.lua index c904d1e..5fbb2a5 100644 --- a/lua/core/overrides/cmp.lua +++ b/lua/core/overrides/cmp.lua @@ -34,33 +34,7 @@ cmp.setup { formatting = { fields = { "kind", "abbr", "menu" }, format = function(entry, vim_item) - local kind_icons = { - Text = 'Tx', - Snippet = '<>', - Method = ' ', - Function = '{}', - Constructor = ' ', - Field = '""', - Variable = 'x=', - Class = '~{', - Interface = '.h', - Module = ' ', - Property = '@p', - Unit = ' ', - Value = ' ', - Enum = 'E#', - Keyword = '$1', - Color = ' ', - File = '#`', - Reference = ' ', - Folder = ' ', - EnumMember = ' ', - Constant = ' ', - Struct = ' ', - Event = ' ', - Operator = ' ', - TypeParameter = ' ', - } + local kind_icons = lspicons local menu_items = { buffer = "buffer", nvim_lsp = "LSP", diff --git a/lua/core/overrides/codewindow.lua b/lua/core/overrides/codewindow.lua index c5f7195..9703143 100644 --- a/lua/core/overrides/codewindow.lua +++ b/lua/core/overrides/codewindow.lua @@ -12,6 +12,7 @@ codewindow.setup({ "vim", "Trouble", "alpha", + "NvimTree", }, }) codewindow.apply_default_keybinds() diff --git a/lua/core/overrides/hover.lua b/lua/core/overrides/hover.lua new file mode 100644 index 0000000..9e8a684 --- /dev/null +++ b/lua/core/overrides/hover.lua @@ -0,0 +1,18 @@ +require("hover").setup { + init = function() + -- Require providers + require("hover.providers.lsp") + -- require('hover.providers.gh') + -- require('hover.providers.gh_user') + -- require('hover.providers.jira') + require('hover.providers.man') + require('hover.providers.dictionary') + end, + preview_opts = { + border = 'single' + }, + -- Whether the contents of a currently open hover window should be moved + -- to a :h preview-window when pressing the hover keymap. + preview_window = true, + title = true +} diff --git a/lua/core/overrides/init.lua b/lua/core/overrides/init.lua index 4492f93..23e02cf 100644 --- a/lua/core/overrides/init.lua +++ b/lua/core/overrides/init.lua @@ -8,15 +8,15 @@ require('core.overrides.whichkey') require('core.overrides.neoclip') require('core.overrides.smartsplits') require('core.overrides.treesitter') -require('core.overrides.treesittercontext') +require('core.overrides.treesj') require('core.overrides.colorizer') require('core.overrides.trouble') require('core.overrides.lspzero') require('core.overrides.cmp') -require('core.overrides.luasnip') +require('core.overrides.snip') require('core.overrides.lspkind') require('core.overrides.cmpluasnipchoice') require('core.overrides.noneckpain') require('core.overrides.alpha') require('core.overrides.notify') -require('core.overrides.nvim-lsp-notify') +require('core.overrides.hover') diff --git a/lua/core/overrides/lualine.lua b/lua/core/overrides/lualine.lua index 597c3fe..19162eb 100644 --- a/lua/core/overrides/lualine.lua +++ b/lua/core/overrides/lualine.lua @@ -68,6 +68,10 @@ local function diff_source() end end +local function maximize_status() + return vim.t.maximized and '[M]' or '[]=' +end + require('lualine').setup { options = { icons_enabled = false, @@ -85,20 +89,20 @@ require('lualine').setup { always_divide_middle = false, globalstatus = true, refresh = { - statusline = 100, + statusline = 500, tabline = 1000, winbar = 1000, } }, sections = { - lualine_a = {'mode'}, - lualine_b = { + lualine_a = { + { 'mode' }, { 'filetype', color = { fg = colors.white, bg = colors.grey }, }, { 'filename', filestatus = true, - path = 1, + path = 0, symbols = { modified = '[+]', @@ -108,18 +112,21 @@ require('lualine').setup { } } }, - lualine_c = { { 'diff', source = diff_source } }, + lualine_b = {}, + lualine_c = { + { 'diff', + source = diff_source, + }, + }, lualine_x = { { 'fileformat', color = { gui = 'bold' } } }, - lualine_y = {'progress'}, - lualine_z = { - { 'location', - padding = 1, - } - } + lualine_y = { + { maximize_status }, + }, + lualine_z = { 'progress' } }, inactive_sections = { lualine_x = {'location'}, diff --git a/lua/core/overrides/modicator.lua b/lua/core/overrides/modicator.lua index 5cc6925..dc978de 100644 --- a/lua/core/overrides/modicator.lua +++ b/lua/core/overrides/modicator.lua @@ -1,15 +1,18 @@ -require('modicator').setup { +require('modicator').setup({ show_warnings = true, highlights = { + defaults = { + bold = true, + }, modes = { - ['i'] = colors.green, - ['v'] = colors.purple, - ['V'] = colors.purple, - ['�'] = colors.purple, - ['s'] = colors.yellow, - ['S'] = colors.yellow, - ['R'] = colors.orange, - ['c'] = colors.red, - } - } -} + ['i'] = { foreground = colors.green, }, + ['v'] = { foreground = colors.purple, }, + ['V'] = { foreground = colors.purple, }, + [''] = { foreground = colors.purple, }, + ['s'] = { foreground = colors.purple, }, + ['S'] = { foreground = colors.yellow, }, + ['R'] = { foreground = colors.orange, }, + ['c'] = { foreground = colors.red, }, + }, + }, +}) diff --git a/lua/core/overrides/noneckpain.lua b/lua/core/overrides/noneckpain.lua new file mode 100644 index 0000000..2944208 --- /dev/null +++ b/lua/core/overrides/noneckpain.lua @@ -0,0 +1,6 @@ +require('no-neck-pain').setup({ + width = 120, + buffers = { + blend = -1, + }, +}) diff --git a/lua/core/overrides/notify.lua b/lua/core/overrides/notify.lua new file mode 100644 index 0000000..f816d86 --- /dev/null +++ b/lua/core/overrides/notify.lua @@ -0,0 +1,14 @@ +require('notify').setup( + { + icons = { + DEBUG = "B", + ERROR = "x", + INFO = "i", + TRACE = "t", + WARN = "!" + }, + minimum_width = 35, + max_width = 80, + render = "compact", + } +) diff --git a/lua/core/overrides/snip.lua b/lua/core/overrides/snip.lua new file mode 100644 index 0000000..c11236e --- /dev/null +++ b/lua/core/overrides/snip.lua @@ -0,0 +1,9 @@ +local ls = require('luasnip') + +ls.config.set_config { + -- return back into snippet + history = true, + + -- update on text insert + updateevents = "TextChanged,TextChangedI" +} diff --git a/lua/core/overrides/telescope.lua b/lua/core/overrides/telescope.lua index f1745f6..54a105f 100644 --- a/lua/core/overrides/telescope.lua +++ b/lua/core/overrides/telescope.lua @@ -1,8 +1,6 @@ local telescope = require('telescope') local actions = require('telescope.actions') -telescope.load_extension('undo') -telescope.load_extension('file_browser') telescope.setup { defaults = { borderchars = { " ", " ", " ", " ", " ", " ", " ", " " }, @@ -27,6 +25,8 @@ telescope.setup { }, } } +telescope.load_extension('undo') +telescope.load_extension('file_browser') a.nvim_create_autocmd('User', { pattern = 'TelescopePreviewerLoaded', diff --git a/lua/core/overrides/treesitter.lua b/lua/core/overrides/treesitter.lua index a4d2dfe..e74af0d 100644 --- a/lua/core/overrides/treesitter.lua +++ b/lua/core/overrides/treesitter.lua @@ -1,5 +1,6 @@ require('nvim-treesitter.configs').setup { - ensure_installed = { 'help', + ensure_installed = { + 'help', 'c', 'lua', 'norg', diff --git a/lua/core/overrides/treesittercontext.lua b/lua/core/overrides/treesittercontext.lua deleted file mode 100644 index 8a60704..0000000 --- a/lua/core/overrides/treesittercontext.lua +++ /dev/null @@ -1,9 +0,0 @@ -require('treesitter-context').setup { - enable = true, - max_lines = 1, - patterns = { - default = { - 'function', - }, - }, -} diff --git a/lua/core/overrides/treesj.lua b/lua/core/overrides/treesj.lua new file mode 100644 index 0000000..dc618de --- /dev/null +++ b/lua/core/overrides/treesj.lua @@ -0,0 +1,3 @@ +require('treesj').setup({ + use_default_keymaps = false, +}) diff --git a/lua/core/plugins.lua b/lua/core/plugins.lua index bcdab7d..b1c4b4c 100644 --- a/lua/core/plugins.lua +++ b/lua/core/plugins.lua @@ -9,8 +9,9 @@ if not vim.loop.fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) -require('lazy').setup({ - { 'rcarriga/nvim-notify' }, +require('lazy').setup{ + { 'notjedi/nvim-rooter.lua', config = true }, + { 'tamton-aquib/essentials.nvim' }, -- only the most useless plugins (some of these are also ui related) { 'goolord/alpha-nvim' }, @@ -19,6 +20,7 @@ require('lazy').setup({ { 'kwakzalver/duckytype.nvim', config = true }, -- like monkey type { 'melkster/modicator.nvim' }, { 'nyngwang/murmur.lua', config = true }, + { 'potamides/pantran.nvim' }, -- -- colorscheme / ui @@ -28,6 +30,13 @@ require('lazy').setup({ priority = 1000, }, { 'nvim-lualine/lualine.nvim' }, + { 'utilyre/barbecue.nvim', + version = '*', + dependencies = { + 'SmiteshP/nvim-navic', + }, + config = true, + }, { 'lukas-reineke/indent-blankline.nvim' }, { 'lewis6991/gitsigns.nvim', config = true, }, { 'chentoast/marks.nvim', config = true, }, @@ -35,9 +44,11 @@ require('lazy').setup({ { 'mrjones2014/smart-splits.nvim', dependencies = { 'kwkarlwang/bufresize.nvim', config = true, }, }, + { 'rcarriga/nvim-notify' }, + { 'declancm/maximize.nvim', config = true, }, -- - -- careful the following plugins might be considered useful procede with caution + -- careful the following plugins might be considered useful proceed with caution -- muh fzf { 'nvim-telescope/telescope.nvim', version = '0.1.*', @@ -45,16 +56,19 @@ require('lazy').setup({ 'nvim-telescope/telescope-file-browser.nvim', 'nvim-lua/plenary.nvim', 'debugloop/telescope-undo.nvim', - 'AckslD/nvim-neoclip.lua' + 'AckslD/nvim-neoclip.lua', } }, -- + -- movement + { 'pta2002/intellitab.nvim' }, + -- + -- debugging { 'numToStr/Comment.nvim', config = true, }, { 'folke/trouble.nvim' }, { 'folke/todo-comments.nvim', config = true, }, - { 'andrewferrier/debugprint.nvim', config = true }, -- -- notes @@ -63,17 +77,22 @@ require('lazy').setup({ version = '*', ft = 'norg', build = ':Neorg sync-parsers', - dependencies = 'nvim-lua/plenary.nvim', }, { 'shortcuts/no-neck-pain.nvim', version = '*', }, + { 'ellisonleao/glow.nvim' }, + { 'Pocco81/high-str.nvim' }, -- -- cmp, lsp and syntax { 'nvim-treesitter/nvim-treesitter', - dependencies = 'nvim-treesitter/nvim-treesitter-context' + dependencies = { + { 'm-demare/hlargs.nvim', config = true }, + 'Wansmer/treesj', + } }, + { 'lewis6991/hover.nvim' }, { 'nvchad/nvim-colorizer.lua' }, { 'VonHeikemen/lsp-zero.nvim' }, { 'hrsh7th/nvim-cmp', @@ -86,7 +105,6 @@ require('lazy').setup({ 'hrsh7th/cmp-nvim-lsp', 'lukas-reineke/cmp-under-comparator', 'onsails/lspkind.nvim', - 'mrded/nvim-lsp-notify', }, }, { 'L3MON4D3/LuaSnip', @@ -99,4 +117,4 @@ require('lazy').setup({ { 'williamboman/mason-lspconfig.nvim' }, { 'windwp/nvim-autopairs', config = true, }, -- -}) +} diff --git a/lua/core/snippets/c.lua b/lua/core/snippets/c.lua new file mode 100644 index 0000000..c45f556 --- /dev/null +++ b/lua/core/snippets/c.lua @@ -0,0 +1,29 @@ +ls.add_snippets('c', { + s('trip', { + -- cond ? then : else statment + i(1, 'cond'), t(' ? '), i(2, 'then'), t(' : '), i(3, 'else') + }), + s('stdlibs', { + -- cond ? then : else statment + t('#include <stdio.h>'), + t({'', '#include <stdlib.h>'}) + }), + s('die', { + t({ + 'void die(const char *fmt, ...) {', '', + 'va_list ap;', + '', + 'va_start(ap, fmt);', + 'vfprintf(stderr, fmt, ap);', + 'va_end(ap);', + '', + [[if (fmt[0] && fmt[strlen(fmt)-1] == ':') {]], + [[ fputc(' ', stderr);]], + ' perror(NULL);', + '} else', + [[ fputc('\n', stderr);]], + ' exit(1);', + '}', + }) + }) +}) diff --git a/lua/core/snippets/init.lua b/lua/core/snippets/init.lua new file mode 100644 index 0000000..a7824e2 --- /dev/null +++ b/lua/core/snippets/init.lua @@ -0,0 +1,35 @@ +ls = require("luasnip") +s = ls.snippet +sn = ls.snippet_node +isn = ls.indent_snippet_node +t = ls.text_node +i = ls.insert_node +f = ls.function_node +c = ls.choice_node +d = ls.dynamic_node +r = ls.restore_node +events = require("luasnip.util.events") +ai = require("luasnip.nodes.absolute_indexer") +extras = require("luasnip.extras") +l = extras.lambda +rep = extras.rep +p = extras.partial +m = extras.match +n = extras.nonempty +dl = extras.dynamic_lambda +fmt = require("luasnip.extras.fmt").fmt +fmta = require("luasnip.extras.fmt").fmta +conds = require("luasnip.extras.expand_conditions") +postfix = require("luasnip.extras.postfix").postfix +types = require("luasnip.util.types") +parse = require("luasnip.util.parser").parse_snippet + +-- Repeat Insernode text +-- @param insert_node_id The id of the insert node to repeat (the first line from) +ri = function (insert_node_id) + return f(function (args) return args[1][1] end, insert_node_id) +end + +require('core.snippets.c') +require('core.snippets.makefile') +require('core.snippets.lua') diff --git a/lua/core/snippets/lua.lua b/lua/core/snippets/lua.lua new file mode 100644 index 0000000..c5466ff --- /dev/null +++ b/lua/core/snippets/lua.lua @@ -0,0 +1,14 @@ +ls.add_snippets('lua', { + s({ + name = "local require", + trig = "req", + dscr = "simple lua require" + }, + fmt("local {} = require('{}')", + { + i(1, "default"), + ri(1), + } + ) + ) +}) diff --git a/lua/core/snippets/makefile.lua b/lua/core/snippets/makefile.lua new file mode 100644 index 0000000..d15ef8d --- /dev/null +++ b/lua/core/snippets/makefile.lua @@ -0,0 +1,41 @@ +ls.add_snippets('make', { + s({ + name = "Start Makefile", + trig = "make", + dscr = "simple starter make file" + }, + fmta( + [[ + # flags and incs + CFLAGS = <FLAGS> + INCS = <MAIN>.c + + PREFIX = <PREFIX> + + # compiler and linker + CC = cc + + all: <MAINA> + <MAINA>: <MAINA>.o + $(CC) <MAINA>.o $(CFLAGS) -o $@ + <MAINA>.o: $(INCS) + + clean: + rm -f <MAINA> *.o + + install: <MAINA> + mkdir -p $(PREFIX)/bin + cp -f <MAINA> $(PREFIX)/bin + chmod 755 $(PREFIX)/bin/<MAINA> + uninstall: <MAINA> + rm -f $(PREFIX)/bin/<MAINA> + ]], + { + FLAGS = i(1, "-Wall"), + MAIN = i(2, "main"), + PREFIX = i(3, "/usr/local"), + MAINA = ri(2), + } + ) + ), +}) |