From d6a9959456157da0a8bb1e21326c5e0153ae3892 Mon Sep 17 00:00:00 2001 From: Tovi Jaeschke-Rogers Date: Sun, 24 Sep 2023 15:10:38 +0930 Subject: [PATCH] Update neovim to use folke/lazy.nvim and remove unused plugins Add alacritty config --- .config/alacritty/alacritty.yml | 24 ++ .config/alacritty/themes/Nightfly.yml | 36 +++ .config/nvim/init.lua | 10 +- .config/nvim/lazy-lock.json | 44 ++++ .config/nvim/lua/.luarc.json | 6 - .config/nvim/lua/config/copilot.lua | 2 - .config/nvim/lua/config/dadbod.lua | 3 - .config/nvim/lua/config/dashboard.lua | 38 --- .config/nvim/lua/config/fugitive.lua | 7 - .config/nvim/lua/config/general/init.lua | 4 - .config/nvim/lua/config/general/remaps.lua | 63 ----- .config/nvim/lua/config/gitsigns.lua | 42 ---- .config/nvim/lua/config/go.lua | 88 ------- .config/nvim/lua/config/harpoon.lua | 14 -- .config/nvim/lua/config/lsp.lua | 128 ---------- .config/nvim/lua/config/lualine.lua | 40 --- .config/nvim/lua/config/luasnip.lua | 14 -- .config/nvim/lua/config/neoclip.lua | 60 ----- .config/nvim/lua/config/neotest.lua | 22 -- .config/nvim/lua/config/noice.lua | 18 -- .config/nvim/lua/config/nvim-neo-tree.lua | 205 --------------- .config/nvim/lua/config/osc52.lua | 3 - .config/nvim/lua/config/php-doc.lua | 7 - .config/nvim/lua/config/prettier.lua | 19 -- .config/nvim/lua/config/telescope.lua | 106 -------- .config/nvim/lua/config/tmux.lua | 13 - .../nvim/lua/config/treesitter-context.lua | 12 - .config/nvim/lua/config/treesitter.lua | 24 -- .config/nvim/lua/config/undotree.lua | 1 - .config/nvim/lua/helper/toggle-tab-width.lua | 19 -- .config/nvim/lua/packer-plugins.lua | 235 ------------------ .../{config/general => tovi/core}/autocmd.lua | 14 +- .config/nvim/lua/tovi/core/init.lua | 4 + .../{config/general => tovi/core}/options.lua | 1 + .config/nvim/lua/tovi/core/remaps.lua | 95 +++++++ .config/nvim/lua/tovi/lazy.lua | 28 +++ .config/nvim/lua/tovi/plugins/colorizer.lua | 5 + .config/nvim/lua/tovi/plugins/colorscheme.lua | 9 + .config/nvim/lua/tovi/plugins/comment.lua | 5 + .config/nvim/lua/tovi/plugins/copilot.lua | 7 + .config/nvim/lua/tovi/plugins/dressing.lua | 4 + .config/nvim/lua/tovi/plugins/fugitive.lua | 13 + .config/nvim/lua/tovi/plugins/gitsigns.lua | 5 + .config/nvim/lua/tovi/plugins/harpoon.lua | 41 +++ .config/nvim/lua/tovi/plugins/init.lua | 8 + .../nvim/lua/tovi/plugins/lsp/lspconfig.lua | 167 +++++++++++++ .config/nvim/lua/tovi/plugins/lsp/mason.lua | 58 +++++ .config/nvim/lua/tovi/plugins/lsp/null-ls.lua | 56 +++++ .config/nvim/lua/tovi/plugins/lualine.lua | 71 ++++++ .config/nvim/lua/tovi/plugins/minintro.lua | 4 + .config/nvim/lua/tovi/plugins/neotest.lua | 52 ++++ .config/nvim/lua/tovi/plugins/nvim-cmp.lua | 90 +++++++ .config/nvim/lua/tovi/plugins/nvim-tree.lua | 64 +++++ .../nvim/lua/tovi/plugins/nvim-treesitter.lua | 53 ++++ .config/nvim/lua/tovi/plugins/telescope.lua | 118 +++++++++ .config/nvim/lua/tovi/plugins/undotree.lua | 6 + .config/nvim/lua/tovi/plugins/which-key.lua | 13 + .config/nvim/lua/utils/init.lua | 37 --- 58 files changed, 1093 insertions(+), 1242 deletions(-) create mode 100644 .config/alacritty/alacritty.yml create mode 100644 .config/alacritty/themes/Nightfly.yml create mode 100644 .config/nvim/lazy-lock.json delete mode 100644 .config/nvim/lua/.luarc.json delete mode 100644 .config/nvim/lua/config/copilot.lua delete mode 100644 .config/nvim/lua/config/dadbod.lua delete mode 100644 .config/nvim/lua/config/dashboard.lua delete mode 100644 .config/nvim/lua/config/fugitive.lua delete mode 100644 .config/nvim/lua/config/general/init.lua delete mode 100644 .config/nvim/lua/config/general/remaps.lua delete mode 100644 .config/nvim/lua/config/gitsigns.lua delete mode 100644 .config/nvim/lua/config/go.lua delete mode 100644 .config/nvim/lua/config/harpoon.lua delete mode 100644 .config/nvim/lua/config/lsp.lua delete mode 100644 .config/nvim/lua/config/lualine.lua delete mode 100644 .config/nvim/lua/config/luasnip.lua delete mode 100644 .config/nvim/lua/config/neoclip.lua delete mode 100644 .config/nvim/lua/config/neotest.lua delete mode 100644 .config/nvim/lua/config/noice.lua delete mode 100644 .config/nvim/lua/config/nvim-neo-tree.lua delete mode 100644 .config/nvim/lua/config/osc52.lua delete mode 100644 .config/nvim/lua/config/php-doc.lua delete mode 100644 .config/nvim/lua/config/prettier.lua delete mode 100644 .config/nvim/lua/config/telescope.lua delete mode 100644 .config/nvim/lua/config/tmux.lua delete mode 100644 .config/nvim/lua/config/treesitter-context.lua delete mode 100644 .config/nvim/lua/config/treesitter.lua delete mode 100644 .config/nvim/lua/config/undotree.lua delete mode 100644 .config/nvim/lua/helper/toggle-tab-width.lua delete mode 100644 .config/nvim/lua/packer-plugins.lua rename .config/nvim/lua/{config/general => tovi/core}/autocmd.lua (81%) create mode 100644 .config/nvim/lua/tovi/core/init.lua rename .config/nvim/lua/{config/general => tovi/core}/options.lua (99%) create mode 100644 .config/nvim/lua/tovi/core/remaps.lua create mode 100644 .config/nvim/lua/tovi/lazy.lua create mode 100644 .config/nvim/lua/tovi/plugins/colorizer.lua create mode 100644 .config/nvim/lua/tovi/plugins/colorscheme.lua create mode 100644 .config/nvim/lua/tovi/plugins/comment.lua create mode 100644 .config/nvim/lua/tovi/plugins/copilot.lua create mode 100644 .config/nvim/lua/tovi/plugins/dressing.lua create mode 100644 .config/nvim/lua/tovi/plugins/fugitive.lua create mode 100644 .config/nvim/lua/tovi/plugins/gitsigns.lua create mode 100644 .config/nvim/lua/tovi/plugins/harpoon.lua create mode 100644 .config/nvim/lua/tovi/plugins/init.lua create mode 100644 .config/nvim/lua/tovi/plugins/lsp/lspconfig.lua create mode 100644 .config/nvim/lua/tovi/plugins/lsp/mason.lua create mode 100644 .config/nvim/lua/tovi/plugins/lsp/null-ls.lua create mode 100644 .config/nvim/lua/tovi/plugins/lualine.lua create mode 100644 .config/nvim/lua/tovi/plugins/minintro.lua create mode 100644 .config/nvim/lua/tovi/plugins/neotest.lua create mode 100644 .config/nvim/lua/tovi/plugins/nvim-cmp.lua create mode 100644 .config/nvim/lua/tovi/plugins/nvim-tree.lua create mode 100644 .config/nvim/lua/tovi/plugins/nvim-treesitter.lua create mode 100644 .config/nvim/lua/tovi/plugins/telescope.lua create mode 100644 .config/nvim/lua/tovi/plugins/undotree.lua create mode 100644 .config/nvim/lua/tovi/plugins/which-key.lua delete mode 100644 .config/nvim/lua/utils/init.lua diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml new file mode 100644 index 0000000..1d14c7c --- /dev/null +++ b/.config/alacritty/alacritty.yml @@ -0,0 +1,24 @@ +font: + normal: + family: Liberation Mono + style: Regular + + bold: + family: Liberation Mono + style: Bold + + italic: + family: Liberation Mono + style: Italic + + bold_italic: + family: Liberation Mono + style: Bold Italic + + size: 11 + +import: + - ~/.config/alacritty/themes/Nightfly.yml + +key_bindings: + - { key: Return, mods: Control|Shift, action: SpawnNewInstance } diff --git a/.config/alacritty/themes/Nightfly.yml b/.config/alacritty/themes/Nightfly.yml new file mode 100644 index 0000000..69091ec --- /dev/null +++ b/.config/alacritty/themes/Nightfly.yml @@ -0,0 +1,36 @@ +# Colors (Nightfly) +colors: + # Default colors + primary: + background: '#011627' + foreground: '#acb4c2' + + cursor: + text: '#fafafa' + cursor: '#9ca1aa' + + selection: + text: '#080808' + background: '#b2ceee' + + # Normal colors + normal: + black: '#1d3b53' + red: '#fc514e' + green: '#a1cd5e' + yellow: '#e3d18a' + blue: '#82aaff' + magenta: '#c792ea' + cyan: '#7fdbca' + white: '#a1aab8' + + # Bright colors + bright: + black: '#7c8f8f' + red: '#ff5874' + green: '#21c7a8' + yellow: '#ecc48d' + blue: '#82aaff' + magenta: '#ae81ff' + cyan: '#7fdbca' + white: '#d6deeb' diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 8a3e3ea..ff25da5 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,9 +1,3 @@ --- General options and remaps -require('config.general') - --- Helper functions -require('helper.toggle-tab-width') - --- Plugins -require('packer-plugins') +require('tovi.core') +require('tovi.lazy') diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..5804a21 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,44 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, + "LuaSnip": { "branch": "master", "commit": "c5fb16a934892086d4ba01bac48b77c65435025e" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "copilot.vim": { "branch": "release", "commit": "998cf5ab1b85e844c7e8edb864a997e590df7182" }, + "dart-vim-plugin": { "branch": "master", "commit": "928302ec931caf0dcf21835cca284ccd2b192f7b" }, + "dressing.nvim": { "branch": "master", "commit": "c1e1d5fa44fe08811b6ef4aadac2b50e602f9504" }, + "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" }, + "fugitive-gitlab.vim": { "branch": "master", "commit": "55fed481c0309b3405dd3d72921d687bf36873a8" }, + "gitsigns.nvim": { "branch": "main", "commit": "9bec6e1ef5542e33974e5b4f982c8c063b981974" }, + "go.nvim": { "branch": "master", "commit": "019936780060efc64c0f22a47afd08fbbe82e026" }, + "guihua.lua": { "branch": "master", "commit": "5ad8dba19ce9b9fd8965598984dfdc9c119f97e4" }, + "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, + "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, + "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, + "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2451adb9bdb0fd32140bf3aa8dbc17ff60050db3" }, + "mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" }, + "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, + "minintro.nvim": { "branch": "master", "commit": "b150254b4ae85a896175c65debdd25ce7b5fd106" }, + "neotest": { "branch": "master", "commit": "1e67a504d03def3a6a1125d934cb511680f72555" }, + "neotest-go": { "branch": "main", "commit": "1a15e1136db43775214a3e7a598f8930c29c94b7" }, + "neotest-phpunit": { "branch": "main", "commit": "e2dfa3280d2a33495a3f710bc364d2cfd1f40c83" }, + "nightfly": { "branch": "master", "commit": "2737ba5b8d22ad6803bb0f51099f90c61bab566c" }, + "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, + "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "2abe934ab00a18932f55edfd881555934622fe36" }, + "nvim-lspconfig": { "branch": "master", "commit": "ede4114e1fd41acb121c70a27e1b026ac68c42d6" }, + "nvim-tree.lua": { "branch": "master", "commit": "07eb5b4059aa0a6366c46d5546ff6239dfdc1f03" }, + "nvim-treesitter": { "branch": "master", "commit": "af6b3ecea9b3cff18b9244027e23e7f2c34ebdd5" }, + "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, + "nvim-web-devicons": { "branch": "master", "commit": "480a756df82a0c231622c9bf2173bb6634713716" }, + "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, + "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" }, + "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, + "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" } +} \ No newline at end of file diff --git a/.config/nvim/lua/.luarc.json b/.config/nvim/lua/.luarc.json deleted file mode 100644 index 6afb79e..0000000 --- a/.config/nvim/lua/.luarc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "diagnostics.globals": [ - "vim", - "use" - ] -} \ No newline at end of file diff --git a/.config/nvim/lua/config/copilot.lua b/.config/nvim/lua/config/copilot.lua deleted file mode 100644 index 7ed6db6..0000000 --- a/.config/nvim/lua/config/copilot.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.api.nvim_set_keymap('i', ',,', 'copilot#Accept("")', { expr = true, silent = true }) -vim.api.nvim_set_keymap('n', 'cs', 'Copilot panel', { noremap = true }) diff --git a/.config/nvim/lua/config/dadbod.lua b/.config/nvim/lua/config/dadbod.lua deleted file mode 100644 index 5843a7b..0000000 --- a/.config/nvim/lua/config/dadbod.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.cmd[[ let g:db_ui_winwidth = 30 ]] - -vim.keymap.set('n', 'db', ':DBUIToggle', { noremap = true }) diff --git a/.config/nvim/lua/config/dashboard.lua b/.config/nvim/lua/config/dashboard.lua deleted file mode 100644 index 32e0663..0000000 --- a/.config/nvim/lua/config/dashboard.lua +++ /dev/null @@ -1,38 +0,0 @@ -require('dashboard').setup({ - theme = 'hyper', - config = { - week_header = { - enable = true, - }, - shortcut = { - { - desc = 'New', - action = 'enew', - key = 'e', - }, - { - desc = 'Update', - action = 'PackerSync', - key = 'u', - }, - { - icon_hl = '@variable', - desc = 'Files', - action = 'Telescope find_files', - key = 'f', - }, - { - icon_hl = '@variable', - desc = 'Git Files', - action = 'Telescope git_files', - key = 'g', - }, - { - icon_hl = '@variable', - desc = 'Quit', - action = 'quit', - key = 'q', - }, - }, - }, -}) diff --git a/.config/nvim/lua/config/fugitive.lua b/.config/nvim/lua/config/fugitive.lua deleted file mode 100644 index 96ddcab..0000000 --- a/.config/nvim/lua/config/fugitive.lua +++ /dev/null @@ -1,7 +0,0 @@ - -vim.opt.diffopt = vim.opt.diffopt + "vertical" -vim.opt.display = vim.opt.display + 'lastline' - -vim.api.nvim_set_keymap('n', 'gl', ':GBrowse', { noremap = true }) - -vim.cmd([[ let g:fugitive_gitlab_domains = {"ssh://code.codium.com.au": "https://code.codium.com.au"} ]]) diff --git a/.config/nvim/lua/config/general/init.lua b/.config/nvim/lua/config/general/init.lua deleted file mode 100644 index 495f387..0000000 --- a/.config/nvim/lua/config/general/init.lua +++ /dev/null @@ -1,4 +0,0 @@ - -require('config.general.options') -require('config.general.remaps') -require('config.general.autocmd') diff --git a/.config/nvim/lua/config/general/remaps.lua b/.config/nvim/lua/config/general/remaps.lua deleted file mode 100644 index 20d54ea..0000000 --- a/.config/nvim/lua/config/general/remaps.lua +++ /dev/null @@ -1,63 +0,0 @@ -local options = { noremap = true } - --- Don't copy "c" changes to primary register -vim.keymap.set('n', 'c', '"_c', options) - --- Easily open splits -vim.keymap.set('n', 'hs', 'split', options) -vim.keymap.set('n', 'vs', 'vsplit', options) - --- Copy the entire file -vim.keymap.set('n', 'y', 'ggyG', options) - -vim.keymap.set('n', '', function() vim.cmd('mksession! ~/.cache//nvim/session/manual_session.vim') end, options) -vim.keymap.set('n', '', function() vim.cmd('source ~/.cache/nvim/session/manual_session.vim') end, options) -vim.keymap.set('n', '', function() vim.cmd('source ~/.cache/nvim/session/shutdown_session.vim') end, options) - --- Navigating with guides -vim.keymap.set('n', '', '/<++>"_c4l', options) -vim.keymap.set('v', '', '/<++>"_c4l', options) - --- Spell-check -vim.keymap.set('n', 'o', 'setlocal spell! spelllang=en_au', options) - --- Keep highlight when indenting -vim.keymap.set('v', '<', '', '>gv', options) - -vim.keymap.set('n', '', '1gt', options) -vim.keymap.set('n', '', '2gt', options) -vim.keymap.set('n', '', '3gt', options) -vim.keymap.set('n', '', '4gt', options) -vim.keymap.set('n', '', '5gt', options) -vim.keymap.set('n', '', '6gt', options) -vim.keymap.set('n', '', '7gt', options) -vim.keymap.set('n', '', '8gt', options) -vim.keymap.set('n', '', '9gt', options) - -vim.keymap.set('n', 'gp', 'Git push', options) -vim.keymap.set('n', 'gP', 'Git pull', options) -vim.keymap.set('n', 'ga', 'Git add .', options) -vim.keymap.set('n', 'gA', 'Git add', options) -vim.keymap.set('n', 'gc', 'Git commit', options) -vim.keymap.set('n', 'gC', 'Git commit -a', options) - -vim.keymap.set("x", "p", "\"_dP", options) -vim.keymap.set("n", "d", "\"_d", options) -vim.keymap.set("v", "d", "\"_d", options) - -vim.keymap.set('v', 'J', ":m '>+1gv=gv") -vim.keymap.set('v', 'K', ":m '<-2gv=gv") - -vim.keymap.set('n', '', 'zz') -vim.keymap.set('n', '', 'zz') - -vim.keymap.set('n', 'n', 'nzzzv') -vim.keymap.set('n', 'N', 'Nzzzv') - -vim.keymap.set('n', '', 'cnextzz') -vim.keymap.set('n', '', 'cprevzz') -vim.keymap.set('n', 'k', 'lnextzz') -vim.keymap.set('n', 'j', 'cprevzz') - -vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) diff --git a/.config/nvim/lua/config/gitsigns.lua b/.config/nvim/lua/config/gitsigns.lua deleted file mode 100644 index b1e7ec6..0000000 --- a/.config/nvim/lua/config/gitsigns.lua +++ /dev/null @@ -1,42 +0,0 @@ -require('gitsigns').setup { - signs = { - add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - }, - - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - watch_gitdir = { - interval = 1000, - follow_files = true - }, - attach_to_untracked = true, - current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' - delay = 0, - ignore_whitespace = false, - }, - current_line_blame_formatter = ', - ', - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, -- Disable if file is longer than this (in lines) - preview_config = { - -- Options passed to nvim_open_win - border = 'single', - style = 'minimal', - relative = 'cursor', - row = 0, - col = 1 - }, - yadm = { - enable = false - }, -} diff --git a/.config/nvim/lua/config/go.lua b/.config/nvim/lua/config/go.lua deleted file mode 100644 index 97f427d..0000000 --- a/.config/nvim/lua/config/go.lua +++ /dev/null @@ -1,88 +0,0 @@ -require('go').setup({ - - disable_defaults = false, -- true|false when true set false to all boolean settings and replace all table - -- settings with {} - go = 'go', -- go command, can be go[default] or go1.18beta1 - goimport = 'gopls', -- goimport command, can be gopls[default] or goimport - fillstruct = 'gopls', -- can be nil (use fillstruct, slower) and gopls - gofmt = 'gofumpt', --gofmt cmd, - max_line_len = 128, -- max line length in golines format, Target maximum line length for golines - tag_transform = false, -- can be transform option("snakecase", "camelcase", etc) check gomodifytags for details and more options - gotests_template = "", -- sets gotests -template parameter (check gotests for details) - gotests_template_dir = "", -- sets gotests -template_dir parameter (check gotests for details) - comment_placeholder = '' , -- comment_placeholder your cool placeholder e.g. ﳑ     - icons = {breakpoint = '🧘', currentpos = '🏃'}, -- setup to `false` to disable icons setup - verbose = false, -- output loginf in messages - lsp_cfg = false, -- true: use non-default gopls setup specified in go/lsp.lua - -- false: do nothing - -- if lsp_cfg is a table, merge table with with non-default gopls setup in go/lsp.lua, e.g. - -- lsp_cfg = {settings={gopls={matcher='CaseInsensitive', ['local'] = 'your_local_module_path', gofumpt = true }}} - lsp_gofumpt = false, -- true: set default gofmt in gopls format to gofumpt - lsp_on_attach = nil, -- nil: use on_attach function defined in go/lsp.lua, - -- when lsp_cfg is true - -- if lsp_on_attach is a function: use this function as on_attach function for gopls - lsp_keymaps = true, -- set to false to disable gopls/lsp keymap - lsp_codelens = true, -- set to false to disable codelens, true by default, you can use a function - -- function(bufnr) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "F", "lua vim.lsp.buf.formatting()", {noremap=true, silent=true}) - -- end - -- to setup a table of codelens - lsp_diag_hdlr = true, -- hook lsp diag handler - -- virtual text setup - lsp_diag_virtual_text = { space = 0, prefix = "" }, - lsp_diag_signs = true, - lsp_diag_update_in_insert = false, - lsp_document_formatting = true, - -- set to true: use gopls to format - -- false if you want to use other formatter tool(e.g. efm, nulls) - lsp_inlay_hints = { - enable = true, - -- Only show inlay hints for the current line - only_current_line = false, - -- Event which triggers a refersh of the inlay hints. - -- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but - -- not that this may cause higher CPU usage. - -- This option is only respected when only_current_line and - -- autoSetHints both are true. - only_current_line_autocmd = "CursorHold", - -- whether to show variable name before type hints with the inlay hints or not - -- default: false - show_variable_name = true, - -- prefix for parameter hints - parameter_hints_prefix = " ", - show_parameter_hints = true, - -- prefix for all the other hints (type, chaining) - other_hints_prefix = "=> ", - -- whether to align to the lenght of the longest line in the file - max_len_align = false, - -- padding from the left if max_len_align is true - max_len_align_padding = 1, - -- whether to align to the extreme right or not - right_align = false, - -- padding from the right if right_align is true - right_align_padding = 6, - -- The color of the hints - highlight = "Comment", - }, - gopls_cmd = nil, -- if you need to specify gopls path and cmd, e.g {"/home/user/lsp/gopls", "-logfile","/var/log/gopls.log" } - gopls_remote_auto = true, -- add -remote=auto to gopls - gocoverage_sign = "█", - sign_priority = 5, -- change to a higher number to override other signs - dap_debug = true, -- set to false to disable dap - dap_debug_keymap = true, -- true: use keymap for debugger defined in go/dap.lua - -- false: do not use keymap in go/dap.lua. you must define your own. - -- windows: use visual studio keymap - dap_debug_gui = true, -- set to true to enable dap gui, highly recommand - dap_debug_vt = true, -- set to true to enable dap virtual text - -- build_tags = "tag1,tag2", -- set default build tags - textobjects = true, -- enable default text jobects through treesittter-text-objects - test_runner = 'go', -- one of {`go`, `richgo`, `dlv`, `ginkgo`} - verbose_tests = true, -- set to add verbose flag to tests - run_in_floaterm = false, -- set to true to run in float window. :GoTermClose closes the floatterm - -- float term recommand if you use richgo/ginkgo with terminal color - - trouble = false, -- true: use trouble to open quickfix - test_efm = false, -- errorfomat for quickfix, default mix mode, set to true will be efm only - luasnip = false, -- enable included luasnip snippets. you can also disable while add lua/snips folder to luasnip load - -- Do not enable this if you already added the path, that will duplicate the entries -}) diff --git a/.config/nvim/lua/config/harpoon.lua b/.config/nvim/lua/config/harpoon.lua deleted file mode 100644 index 18eab4c..0000000 --- a/.config/nvim/lua/config/harpoon.lua +++ /dev/null @@ -1,14 +0,0 @@ -local mark = require("harpoon.mark") -local ui = require("harpoon.ui") - -vim.keymap.set('n', 'a', mark.add_file) -vim.keymap.set('n', 'th', mark.toggle_file) -vim.keymap.set('n', '', ui.toggle_quick_menu) - -vim.keymap.set('n', '', function () ui.nav_file(1) end) -vim.keymap.set('n', '', function () ui.nav_file(2) end) -vim.keymap.set('n', '', function () ui.nav_file(3) end) -vim.keymap.set('n', '', function () ui.nav_file(4) end) - -vim.keymap.set('n', '', function () ui.nav_prev() end) -vim.keymap.set('n', '', function () ui.nav_next() end) diff --git a/.config/nvim/lua/config/lsp.lua b/.config/nvim/lua/config/lsp.lua deleted file mode 100644 index 7b86798..0000000 --- a/.config/nvim/lua/config/lsp.lua +++ /dev/null @@ -1,128 +0,0 @@ -local lsp = require('lsp-zero') -local luasnip = require("luasnip") - -lsp.preset('recommended') - -lsp.ensure_installed({ - 'lua_ls', - 'tsserver', - 'eslint', - 'gopls', - 'intelephense', - 'jsonls', - 'volar', -}) - -local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil -end - -local cmp = require('cmp') - --- Use buffer source for `/` -cmp.setup.cmdline("/", { - enabled = false -}) - --- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(':', { - enabled = false, -}) - --- local cmp_select = {behavior = cmp.SelectBehavior.Select} -local cmp_mappings = lsp.defaults.cmp_mappings({ - [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.mapping { i = cmp.mapping.close(), c = cmp.mapping.close() }, - [""] = cmp.mapping { - i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false }, - c = function(fallback) - if cmp.visible() then - cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false } - else - fallback() - end - end, - }, - [""] = cmp.mapping( - function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, - { - "i", - "s", - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, - { - "i", - "s", - }), -}) - -lsp.setup_nvim_cmp({ - mapping = cmp_mappings, - completion = { - completeopt = "menu,menuone", - }, - window = { - completion = { - side_padding = 1, - winhighlight = "NormalFloat:NormalFloat,FloatBorder:TelescopeBorder", - scrollbar = false, - }, - documentation = { - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, - winhighlight = "NormalFloat:NormalFloat,FloatBorder:TelescopeBorder", - }, - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - }, -}) - -lsp.on_attach(function(client, bufnr) - local opts = {buffer = bufnr, remap = false} - - -- Key mappings - vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) - - vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) - vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) - vim.keymap.set("n", "[e", function () vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR}) end, opts) - vim.keymap.set("n", "]e", function () vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR}) end, opts) - - vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) - - vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) - vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) - - vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) - vim.keymap.set("n", "K", vim.lsp.buf.code_action, opts) - vim.keymap.set("n", "of", vim.diagnostic.open_float, opts) - - vim.keymap.set("n", "gh", vim.lsp.buf.signature_help, opts) -end) - -lsp.setup() diff --git a/.config/nvim/lua/config/lualine.lua b/.config/nvim/lua/config/lualine.lua deleted file mode 100644 index 9b05bc2..0000000 --- a/.config/nvim/lua/config/lualine.lua +++ /dev/null @@ -1,40 +0,0 @@ -require('lualine').setup { - options = { - icons_enabled = true, - theme = 'catppuccin-mocha', - component_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, - disabled_filetypes = { - statusline = {}, - winbar = {}, - }, - ignore_focus = {}, - always_divide_middle = true, - globalstatus = false, - refresh = { - statusline = 1000, - tabline = 1000, - winbar = 1000, - } - }, - sections = { - lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {'filename'}, - lualine_x = {'encoding', 'fileformat', 'filetype'}, - lualine_y = {'progress'}, - lualine_z = {'location'} - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {'filename'}, - lualine_x = {'location'}, - lualine_y = {}, - lualine_z = {} - }, - tabline = {}, - winbar = {}, - inactive_winbar = {}, - extensions = {} -} diff --git a/.config/nvim/lua/config/luasnip.lua b/.config/nvim/lua/config/luasnip.lua deleted file mode 100644 index 10ecf74..0000000 --- a/.config/nvim/lua/config/luasnip.lua +++ /dev/null @@ -1,14 +0,0 @@ -local M = {} - -function M.setup() - local luasnip = require "luasnip" - - luasnip.config.set_config { - history = false, - updateevents = "TextChanged,TextChangedI", - } - - require("luasnip/loaders/from_vscode").load() -end - -return M diff --git a/.config/nvim/lua/config/neoclip.lua b/.config/nvim/lua/config/neoclip.lua deleted file mode 100644 index 175275b..0000000 --- a/.config/nvim/lua/config/neoclip.lua +++ /dev/null @@ -1,60 +0,0 @@ -require('neoclip').setup({ - history = 1000, - enable_persistent_history = true, - length_limit = 1048576, - continuous_sync = true, - db_path = vim.fn.stdpath("data") .. "/databases/neoclip.sqlite3", - filter = nil, - preview = true, - prompt = nil, - default_register = '"', - default_register_macros = 'q', - enable_macro_history = true, - content_spec_column = false, - disable_keycodes_parsing = false, - on_select = { - move_to_front = false, - close_telescope = true, - }, - on_paste = { - set_reg = false, - move_to_front = false, - close_telescope = true, - }, - on_replay = { - set_reg = false, - move_to_front = false, - close_telescope = true, - }, - on_custom_action = { - close_telescope = true, - }, - keys = { - telescope = { - i = { - select = '', - paste = '', - paste_behind = '', - replay = '', -- replay a macro - delete = '', -- delete an entry - edit = '', -- edit an entry - custom = {}, - }, - n = { - select = '', - paste = 'p', - --- It is possible to map to more than one key. - -- paste = { 'p', '' }, - paste_behind = 'P', - replay = 'q', - delete = 'd', - edit = 'e', - custom = {}, - }, - }, - }, -}) - -vim.keymap.set('n', 'cp', function() - require('telescope').extensions.neoclip.default() -end) diff --git a/.config/nvim/lua/config/neotest.lua b/.config/nvim/lua/config/neotest.lua deleted file mode 100644 index d8c24f0..0000000 --- a/.config/nvim/lua/config/neotest.lua +++ /dev/null @@ -1,22 +0,0 @@ -local neotest = require('neotest') - -vim.keymap.set('n', 'tr', function () neotest.run.run() end) -vim.keymap.set('n', 'tR', function () neotest.run.run_last() end) -vim.keymap.set('n', 'tf', function () neotest.run.run(vim.fn.expand('%')) end) -vim.keymap.set('n', 'tS', function () neotest.run.stop() end) -vim.keymap.set('n', 'ta', function () neotest.run.attach() end) -vim.keymap.set('n', 'to', function () neotest.output.open() end) -vim.keymap.set('n', 'ts', function () neotest.summary.toggle() end) - -neotest.setup({ - adapters = { - require("neotest-phpunit")({ - root_files = { "phpunit.xml", "composer.json" }, - phpunit_cmd = { "docker-compose", "exec", "fpm", "./vendor/bin/phpunit" }, - filter_dirs = { "vendor" }, - mapped_docker_dir = "/var/www", - append_to_cwd = '/api' - }), - }, -}) - diff --git a/.config/nvim/lua/config/noice.lua b/.config/nvim/lua/config/noice.lua deleted file mode 100644 index 7de2a22..0000000 --- a/.config/nvim/lua/config/noice.lua +++ /dev/null @@ -1,18 +0,0 @@ -require("noice").setup({ - lsp = { - -- override markdown rendering so that **cmp** and other plugins use **Treesitter** - override = { - ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - ["vim.lsp.util.stylize_markdown"] = true, - ["cmp.entry.get_documentation"] = true, - }, - }, - -- you can enable a preset for easier configuration - presets = { - bottom_search = false, -- use a classic bottom cmdline for search - command_palette = true, -- position the cmdline and popupmenu together - long_message_to_split = true, -- long messages will be sent to a split - inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = false, -- add a border to hover docs and signature help - }, -}) diff --git a/.config/nvim/lua/config/nvim-neo-tree.lua b/.config/nvim/lua/config/nvim-neo-tree.lua deleted file mode 100644 index 57164b0..0000000 --- a/.config/nvim/lua/config/nvim-neo-tree.lua +++ /dev/null @@ -1,205 +0,0 @@ - --- Unless you are still migrating, remove the deprecated commands from v1.x -vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) - --- If you want icons for diagnostic errors, you'll need to define them somewhere: -vim.fn.sign_define("DiagnosticSignError", - {text = " ", texthl = "DiagnosticSignError"}) -vim.fn.sign_define("DiagnosticSignWarn", - {text = " ", texthl = "DiagnosticSignWarn"}) -vim.fn.sign_define("DiagnosticSignInfo", - {text = " ", texthl = "DiagnosticSignInfo"}) -vim.fn.sign_define("DiagnosticSignHint", - {text = "", texthl = "DiagnosticSignHint"}) --- NOTE: this is changed from v1.x, which used the old style of highlight groups --- in the form "LspDiagnosticsSignWarning" - -require("neo-tree").setup({ - close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab - popup_border_style = "rounded", - enable_git_status = true, - enable_diagnostics = true, - sort_case_insensitive = false, -- used when sorting files and directories in the tree - sort_function = nil , -- use a custom function for sorting files and directories in the tree - -- sort_function = function (a,b) - -- if a.type == b.type then - -- return a.path > b.path - -- else - -- return a.type > b.type - -- end - -- end , -- this sorts files and directories descendantly - default_component_configs = { - container = { - enable_character_fade = true - }, - indent = { - indent_size = 2, - padding = 1, -- extra padding on left hand side - -- indent guides - with_markers = true, - indent_marker = "│", - last_indent_marker = "└", - highlight = "NeoTreeIndentMarker", - -- expander config, needed for nesting files - with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - icon = { - folder_closed = "", - folder_open = "", - folder_empty = "ﰊ", - -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there - -- then these will never be used. - default = "*", - highlight = "NeoTreeFileIcon" - }, - modified = { - symbol = "[+]", - highlight = "NeoTreeModified", - }, - name = { - trailing_slash = false, - use_git_status_colors = true, - highlight = "NeoTreeFileName", - }, - git_status = { - symbols = { - -- Change type - added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name - modified = "", -- or "", but this is redundant info if you use git_status_colors on the name - deleted = "✖",-- this can only be used in the git_status source - renamed = "",-- this can only be used in the git_status source - -- Status type - untracked = "", - ignored = "", - unstaged = "", - staged = "", - conflict = "", - } - }, - }, - window = { - position = "left", - width = 40, - mapping_options = { - noremap = true, - nowait = true, - }, - mappings = { - [""] = { - "toggle_node", - nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use - }, - ["<2-LeftMouse>"] = "open", - [""] = "open", - ["S"] = "open_split", - ["s"] = "open_vsplit", - -- ["S"] = "split_with_window_picker", - -- ["s"] = "vsplit_with_window_picker", - ["t"] = "open_tabnew", - ["w"] = "open_with_window_picker", - ["C"] = "close_node", - ["z"] = "close_all_nodes", - --["Z"] = "expand_all_nodes", - ["a"] = { - "add", - -- some commands may take optional config options, see `:h neo-tree-mappings` for details - config = { - show_path = "none" -- "none", "relative", "absolute" - } - }, - ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". - ["d"] = "delete", - ["r"] = "rename", - ["y"] = "copy_to_clipboard", - ["x"] = "cut_to_clipboard", - ["p"] = "paste_from_clipboard", - ["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": - -- ["c"] = { - -- "copy", - -- config = { - -- show_path = "none" -- "none", "relative", "absolute" - -- } - --} - ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". - ["q"] = "close_window", - ["R"] = "refresh", - ["?"] = "show_help", - ["<"] = "prev_source", - [">"] = "next_source", - } - }, - nesting_rules = {}, - filesystem = { - filtered_items = { - visible = false, -- when true, they will just be displayed differently than normal items - hide_dotfiles = true, - hide_gitignored = true, - hide_hidden = true, -- only works on Windows for hidden files/directories - hide_by_name = { - --"node_modules" - }, - hide_by_pattern = { -- uses glob style patterns - --"*.meta" - }, - never_show = { -- remains hidden even if visible is toggled to true - --".DS_Store", - --"thumbs.db" - }, - }, - follow_current_file = true, -- This will find and focus the file in the active buffer every - -- time the current file is changed while the tree is open. - group_empty_dirs = false, -- when true, empty folders will be grouped together - hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree - -- in whatever position is specified in window.position - -- "open_current", -- netrw disabled, opening a directory opens within the - -- window like netrw would, regardless of window.position - -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs - use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes - -- instead of relying on nvim autocmd events. - window = { - mappings = { - [""] = "navigate_up", - ["."] = "set_root", - ["H"] = "toggle_hidden", - ["/"] = "fuzzy_finder", - ["D"] = "fuzzy_finder_directory", - ["f"] = "filter_on_submit", - [""] = "clear_filter", - ["[g"] = "prev_git_modified", - ["]g"] = "next_git_modified", - } - } - }, - buffers = { - follow_current_file = true, -- This will find and focus the file in the active buffer every - -- time the current file is changed while the tree is open. - group_empty_dirs = true, -- when true, empty folders will be grouped together - show_unloaded = true, - window = { - mappings = { - ["bd"] = "buffer_delete", - [""] = "navigate_up", - ["."] = "set_root", - } - }, - }, - git_status = { - window = { - position = "float", - mappings = { - ["A"] = "git_add_all", - ["gu"] = "git_unstage_file", - ["ga"] = "git_add_file", - ["gr"] = "git_revert_file", - ["gc"] = "git_commit", - ["gp"] = "git_push", - ["gg"] = "git_commit_and_push", - } - } - } -}) - -vim.api.nvim_set_keymap('n', '', 'Neotree toggle', { noremap = true }) diff --git a/.config/nvim/lua/config/osc52.lua b/.config/nvim/lua/config/osc52.lua deleted file mode 100644 index 13320b4..0000000 --- a/.config/nvim/lua/config/osc52.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.keymap.set('n', 'c', require('osc52').copy_operator, { expr = true }) -vim.keymap.set('n', 'cc', 'c_', { remap = true }) -vim.keymap.set('v', 'c', require('osc52').copy_visual) diff --git a/.config/nvim/lua/config/php-doc.lua b/.config/nvim/lua/config/php-doc.lua deleted file mode 100644 index 7bfee69..0000000 --- a/.config/nvim/lua/config/php-doc.lua +++ /dev/null @@ -1,7 +0,0 @@ -vim.keymap.set('n', '', function () - if vim.bo.filetype ~= 'php' then - return - end - - vim.api.nvim_call_function("PhpDocSingle", {}) -end, options) diff --git a/.config/nvim/lua/config/prettier.lua b/.config/nvim/lua/config/prettier.lua deleted file mode 100644 index abfcd15..0000000 --- a/.config/nvim/lua/config/prettier.lua +++ /dev/null @@ -1,19 +0,0 @@ -local prettier = require("prettier") - -prettier.setup({ - bin = 'prettier', - filetypes = { - "css", - "graphql", - "html", - "javascript", - "javascriptreact", - "json", - "less", - "markdown", - "scss", - "typescript", - "typescriptreact", - "yaml", - }, -}) diff --git a/.config/nvim/lua/config/telescope.lua b/.config/nvim/lua/config/telescope.lua deleted file mode 100644 index 89c53f9..0000000 --- a/.config/nvim/lua/config/telescope.lua +++ /dev/null @@ -1,106 +0,0 @@ -local previewers = require('telescope.previewers') -local previewers_utils = require('telescope.previewers.utils') -local builtin = require('telescope.builtin') -local sorters = require('telescope.sorters') -local actions = require('telescope.actions') - -local max_size = 100000 -local truncate_large_files = function(filepath, bufnr, opts) - opts = opts or {} - - filepath = vim.fn.expand(filepath) - vim.loop.fs_stat(filepath, function(_, stat) - if not stat then return end - if stat.size > max_size then - local cmd = {"head", "-c", max_size, filepath} - previewers_utils.job_maker(cmd, bufnr, opts) - else - previewers.buffer_previewer_maker(filepath, bufnr, opts) - end - end) -end - -require('telescope').setup({ - defaults = { - file_sorter = sorters.get_fzy_sorter, - prompt_prefix = ' >', - color_devicons = true, - - buffer_previewer_maker = truncate_large_files, - - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "ascending", - layout_strategy = "horizontal", - layout_config = { - horizontal = { - prompt_position = "top", - preview_width = 0.55, - results_width = 0.8, - }, - vertical = { - mirror = false, - }, - width = 0.87, - height = 0.80, - preview_cutoff = 120, - }, - path_display = { "truncate" }, - winblend = 0, - border = {}, - borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, - - mappings = { - i = { - [''] = false, - [''] = actions.send_to_qflist, - }, - }, - }, -}) - -function git_branches () - builtin.git_branches({ - attach_mappings = function(_, map) - map("i", "", actions.git_delete_branch) - map("n", "", actions.git_delete_branch) - return true - end, - }) -end - -function files () - local ran, errorMessage = pcall(function() - builtin.git_files({ show_untracked = true }) - end) - if not ran then - builtin.find_files() - end -end - -local options = { noremap = true } - -vim.keymap.set('n', '', builtin.live_grep, options) - -vim.keymap.set('n', '', files, options) - -vim.keymap.set('n', 'df', function() - builtin.find_files({ - prompt_title = "< VimRC >", - cwd = vim.fn.expand('~/.config/nvim'), - hidden = true, - }) -end, options) - -vim.keymap.set('n', 'fb', builtin.buffers, options) -vim.keymap.set('n', 'fo', builtin.oldfiles, options) - -vim.keymap.set('n', 'gr', builtin.lsp_references, options) -vim.keymap.set("n", 'gi', builtin.lsp_implementations, options) -vim.keymap.set("n", 'gT', builtin.lsp_type_definitions, options) - -vim.keymap.set('n', 'm', builtin.marks, options) -vim.keymap.set('n', 'ch', builtin.command_history, options) - -vim.keymap.set('n', 'gb', git_branches, options) -vim.keymap.set('n', 'gs', builtin.git_status, options) diff --git a/.config/nvim/lua/config/tmux.lua b/.config/nvim/lua/config/tmux.lua deleted file mode 100644 index 59f62ad..0000000 --- a/.config/nvim/lua/config/tmux.lua +++ /dev/null @@ -1,13 +0,0 @@ -require("tmux").setup({ - copy_sync = { - enable = true, - }, - navigation = { - -- enables default keybindings (C-hjkl) for normal mode - enable_default_keybindings = true, - }, - resize = { - -- enables default keybindings (A-hjkl) for normal mode - enable_default_keybindings = true, - } - }) diff --git a/.config/nvim/lua/config/treesitter-context.lua b/.config/nvim/lua/config/treesitter-context.lua deleted file mode 100644 index d2d2b43..0000000 --- a/.config/nvim/lua/config/treesitter-context.lua +++ /dev/null @@ -1,12 +0,0 @@ -require('treesitter-context').setup{ - enable = true, - max_lines = 0, - min_window_height = 0, - line_numbers = true, - multiline_threshold = 20, - trim_scope = 'outer', - mode = 'cursor', - separator = nil, - zindex = 20, - on_attach = nil, -} diff --git a/.config/nvim/lua/config/treesitter.lua b/.config/nvim/lua/config/treesitter.lua deleted file mode 100644 index 0d4a056..0000000 --- a/.config/nvim/lua/config/treesitter.lua +++ /dev/null @@ -1,24 +0,0 @@ -require('nvim-treesitter.configs').setup { - ensure_installed = { 'go', 'dart', 'php', 'javascript' }, - - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, - - -- Automatically install missing parsers when entering buffer - auto_install = true, - - indent = { - enable = true, - }, - - highlight = { - -- `false` will disable the whole extension - enable = true, - - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, -} diff --git a/.config/nvim/lua/config/undotree.lua b/.config/nvim/lua/config/undotree.lua deleted file mode 100644 index a346462..0000000 --- a/.config/nvim/lua/config/undotree.lua +++ /dev/null @@ -1 +0,0 @@ -vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle) diff --git a/.config/nvim/lua/helper/toggle-tab-width.lua b/.config/nvim/lua/helper/toggle-tab-width.lua deleted file mode 100644 index 5bf91c0..0000000 --- a/.config/nvim/lua/helper/toggle-tab-width.lua +++ /dev/null @@ -1,19 +0,0 @@ -local tabWidth = 4 - -function ToggleTabWidth() - if tabWidth == 2 then - vim.o.tabstop = 4 - vim.o.softtabstop = 4 - vim.o.shiftwidth = 4 - tabWidth = 4 - print('Set tab width to 4') - return - end - vim.o.tabstop = 2 - vim.o.softtabstop = 2 - vim.o.shiftwidth = 2 - tabWidth = 2 - print('Set tab width to 2') -end - -vim.keymap.set('n', 'tt', ToggleTabWidth, { noremap = true }) diff --git a/.config/nvim/lua/packer-plugins.lua b/.config/nvim/lua/packer-plugins.lua deleted file mode 100644 index b644343..0000000 --- a/.config/nvim/lua/packer-plugins.lua +++ /dev/null @@ -1,235 +0,0 @@ -return require('packer').startup(function() - -- Packer can manage itself - use { 'wbthomason/packer.nvim' } - - use { - 'github/copilot.vim', - config = function() - require('config.copilot') - end - } - - use { - 'VonHeikemen/lsp-zero.nvim', - requires = { - -- LSP Support - {'neovim/nvim-lspconfig'}, - {'williamboman/mason.nvim'}, - {'williamboman/mason-lspconfig.nvim'}, - - -- Autocompletion - {'hrsh7th/nvim-cmp'}, - {'hrsh7th/cmp-buffer'}, - {'hrsh7th/cmp-path'}, - {'saadparwaiz1/cmp_luasnip'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'hrsh7th/cmp-nvim-lua'}, - - -- Snippets - {'L3MON4D3/LuaSnip'}, - {'rafamadriz/friendly-snippets'}, - }, - - config = function() - require('config.lsp') - end - } - - use { - 'tpope/vim-fugitive', - config = function() - require('config.fugitive') - end - } - - use { 'shumphrey/fugitive-gitlab.vim' } - - use { 'nvim-lua/plenary.nvim' } - - use { - 'nvim-telescope/telescope.nvim', - config = function() - require('config.telescope') - end - } - - use { 'nvim-telescope/telescope-fzy-native.nvim'} - - use { 'nvim-treesitter/nvim-treesitter' } - - use { - 'nvim-treesitter/nvim-treesitter-context', - config = function () - require('config.treesitter-context') - end - } - - use { - 'theprimeagen/harpoon', - config = function () - require('config.harpoon') - end - } - - use { - 'mbbill/undotree', - config = function () - require('config.undotree') - end - } - - use { - 'lewis6991/gitsigns.nvim', - config = function() - require('config.gitsigns') - end - } - - use { - 'nvim-lualine/lualine.nvim', - requires = { - 'kyazdani42/nvim-web-devicons', - 'nvim-lua/lsp-status.nvim', - opt = true - }, - config = function() - require('config.lualine') - end - } - - use { - 'nvim-neo-tree/neo-tree.nvim', - branch = 'v2.x', - requires = { - 'nvim-lua/plenary.nvim', - 'kyazdani42/nvim-web-devicons', - 'MunifTanjim/nui.nvim', - }, - config = function () - require('config.nvim-neo-tree') - end - } - - -- use { - -- 'glepnir/dashboard-nvim', - -- event = 'VimEnter', - -- config = function() - -- require('config.dashboard') - -- end, - -- requires = {'nvim-tree/nvim-web-devicons'} - -- } - - use { - "eoh-bse/minintro.nvim", - config = function() require("minintro").setup() end - } - - use { - 'nvim-neotest/neotest', - requires = { - 'nvim-lua/plenary.nvim', - 'nvim-treesitter/nvim-treesitter', - 'antoinemadec/FixCursorHold.nvim', - -- Adapters - 'tovijaeschke/neotest-phpunit', - 'nvim-neotest/neotest-go', - }, - config = function() - require('config.neotest') - end, - } - - use { - 'MunifTanjim/prettier.nvim', - requires = { - -- 'jose-elias-alvarez/null-ls.nvim', - 'neovim/nvim-lspconfig', - }, - - config = function() - -- require('config.null-ls') - require('config.prettier') - end - } - - use { - 'rcarriga/nvim-notify', - config = function () - require('notify').setup({ - background_color = '#000000', - timeout = 3 - }) - end - } - - -- CMD and search at the top - -- use { - -- 'folke/noice.nvim', - -- requires = { - -- 'MunifTanjim/nui.nvim', - -- 'rcarriga/nvim-notify', - -- }, - -- config = function () - -- require('config.noice') - -- end - -- } - - -- DB manager - use { - 'kristijanhusak/vim-dadbod-ui', - requires = { - 'tpope/vim-dadbod', - }, - config = function() - require('config.dadbod') - end - } - - -- Copy to clipboard over ssh - use { - 'ojroques/nvim-osc52', - config = function() - require('config.osc52') - end - } - - use { - 'numToStr/Comment.nvim', - config = function() - require('Comment').setup() - end - } - - -- Programming language specifics - use { 'dart-lang/dart-vim-plugin' } - use { 'ray-x/guihua.lua' } - -- use { - -- 'ray-x/go.nvim', - -- config = function() - -- require('config.go') - -- end - -- } - - -- Colorschemes - use { - 'gruvbox-community/gruvbox', - -- config = function () - -- vim.cmd('colorscheme gruvbox') - -- end - } - - use { - 'folke/tokyonight.nvim', - -- config = function () - -- vim.cmd('colorscheme tokyonight-night') - -- end - } - - use { - 'catppuccin/nvim', - as = 'catppuccin', - config = function () - vim.cmd('colorscheme catppuccin-mocha') - end - } -end) diff --git a/.config/nvim/lua/config/general/autocmd.lua b/.config/nvim/lua/tovi/core/autocmd.lua similarity index 81% rename from .config/nvim/lua/config/general/autocmd.lua rename to .config/nvim/lua/tovi/core/autocmd.lua index 1a9ca57..acd8428 100644 --- a/.config/nvim/lua/config/general/autocmd.lua +++ b/.config/nvim/lua/tovi/core/autocmd.lua @@ -1,23 +1,23 @@ - local aucmd_dict = { FileType = { + -- Set tabstop to 2 for Dart, Vue, JavaScript, TypeScript, and JSON files { pattern = "dart,vue,javascript,typescript,json", callback = function() vim.opt_local.tabstop = 2 vim.opt_local.softtabstop = 2 vim.opt_local.shiftwidth = 2 - -- vim.bo.tabstop = 2 -- size of a hard tabstop (ts). - -- vim.bo.shiftwidth = 2 -- size of an indentation (sw). - -- vim.bo.softtabstop = 2 -- number of spaces a counts for. When 0, feature is off (sts). end, }, }, BufWritePre = { + -- Remove trailing whitespace on save { command = [[%s/\s\+$//e]], }, + + -- Run goimports on save { pattern = "*.go", command = 'silent! lua require(\'go.format\').goimport()' @@ -25,9 +25,12 @@ local aucmd_dict = { }, BufRead = { + -- Return cursor to where it was previously when re-opening a file { command = [[if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]] }, + + -- Set syntax for Dockerfiles { pattern = { '*.docker' }, callback = function() @@ -37,6 +40,7 @@ local aucmd_dict = { }, BufNewFile = { + -- Set syntax for Dockerfiles { pattern = { '*.docker' }, callback = function() @@ -46,6 +50,7 @@ local aucmd_dict = { }, VimLeave = { + -- Save session on exit { command = [[mksession! ~/.cache/nvim/session/shutdown_session.vim]] }, @@ -57,3 +62,4 @@ for event, opt_tbls in pairs(aucmd_dict) do vim.api.nvim_create_autocmd(event, opt_tbl) end end + diff --git a/.config/nvim/lua/tovi/core/init.lua b/.config/nvim/lua/tovi/core/init.lua new file mode 100644 index 0000000..3534db7 --- /dev/null +++ b/.config/nvim/lua/tovi/core/init.lua @@ -0,0 +1,4 @@ +require('tovi.core.options') +require('tovi.core.remaps') +require('tovi.core.autocmd') + diff --git a/.config/nvim/lua/config/general/options.lua b/.config/nvim/lua/tovi/core/options.lua similarity index 99% rename from .config/nvim/lua/config/general/options.lua rename to .config/nvim/lua/tovi/core/options.lua index fed6e33..b7a066d 100644 --- a/.config/nvim/lua/config/general/options.lua +++ b/.config/nvim/lua/tovi/core/options.lua @@ -43,3 +43,4 @@ vim.opt.splitbelow = true vim.opt.splitright = true vim.opt.termguicolors = true + diff --git a/.config/nvim/lua/tovi/core/remaps.lua b/.config/nvim/lua/tovi/core/remaps.lua new file mode 100644 index 0000000..5ad324e --- /dev/null +++ b/.config/nvim/lua/tovi/core/remaps.lua @@ -0,0 +1,95 @@ +-- Don't copy "c" changes to primary register +vim.keymap.set("n", "c", '"_c', { desc = "Prevent copying to primary register" }) + +-- Easily open splits +vim.keymap.set("n", "hs", "split", { desc = "Open horizontal spilt" }) +vim.keymap.set("n", "vs", "vsplit", { desc = "Open vertical spilt" }) + +-- Easily navigate splits +vim.keymap.set("n", "", "h", { desc = "Move focus to split left" }) +vim.keymap.set("n", "", "j", { desc = "Move focus to split down" }) +vim.keymap.set("n", "", "k", { desc = "Move focus to split up" }) +vim.keymap.set("n", "", "l", { desc = "Move focus to split right" }) + +-- Copy the entire file +vim.keymap.set("n", "y", "ggyG", { desc = "Copy the entire file to default register" }) + +-- Manage sessions +vim.keymap.set("n", "", function() + vim.cmd("mksession! ~/.cache//nvim/session/manual_session.vim") +end, { desc = "Manually create session" }) +vim.keymap.set("n", "", function() + vim.cmd("source ~/.cache/nvim/session/manual_session.vim") +end, { desc = "Restore manually created session" }) +vim.keymap.set("n", "", function() + vim.cmd("source ~/.cache/nvim/session/shutdown_session.vim") +end, { desc = "Restore session automatically created on VimLeave" }) + +-- Navigating with guides +vim.keymap.set( + "n", + "", + '/<++>"_c4l', + { desc = "Find next <++> in file and enter insert mode" } +) +vim.keymap.set( + "v", + "", + '/<++>"_c4l', + { desc = "Find next <++> in file and enter insert mode" } +) + +-- Spell-check +vim.keymap.set("n", "o", "setlocal spell! spelllang=en_au", { desc = "Toggle spell check" }) + +-- Map Q to nop +vim.keymap.set("n", "Q", "", { desc = "Remap Q to because Q is the worst" }) + +-- Keep highlight when indenting +vim.keymap.set("v", "<", "", ">gv", { desc = "Keep highlight when indenting" }) + +-- Easily navigate tabs +vim.keymap.set("n", "", "1gt", { desc = "Navigate to tab 2" }) +vim.keymap.set("n", "", "2gt", { desc = "Navigate to tab 3" }) +vim.keymap.set("n", "", "3gt", { desc = "Navigate to tab 4" }) +vim.keymap.set("n", "", "4gt", { desc = "Navigate to tab 5" }) +vim.keymap.set("n", "", "5gt", { desc = "Navigate to tab 6" }) +vim.keymap.set("n", "", "6gt", { desc = "Navigate to tab 7" }) +vim.keymap.set("n", "", "7gt", { desc = "Navigate to tab 8" }) +vim.keymap.set("n", "", "8gt", { desc = "Navigate to tab 9" }) +vim.keymap.set("n", "", "9gt", { desc = "Navigate to tab 10" }) + +-- TODO: Move these into fugitive config +-- vim.keymap.set('n', 'gp', 'Git push', options) +-- vim.keymap.set('n', 'gP', 'Git pull', options) +-- vim.keymap.set('n', 'ga', 'Git add .', options) +-- vim.keymap.set('n', 'gA', 'Git add', options) +-- vim.keymap.set('n', 'gc', 'Git commit', options) +-- vim.keymap.set('n', 'gC', 'Git commit -a', options) + +vim.keymap.set("x", "p", '"_dP', { desc = "Delete into black hole register" }) +vim.keymap.set("n", "d", '"_d', { desc = "Delete into black hole register" }) +vim.keymap.set("v", "d", '"_d', { desc = "Delete into black hole register" }) + +-- Keep page scroll centered +vim.keymap.set("n", "", "zz", { desc = "Scroll down half page" }) +vim.keymap.set("n", "", "zz", { desc = "Scroll up half page" }) + +-- Keep cursor centered +vim.keymap.set("n", "n", "nzzzv", { desc = "Next search result" }) +vim.keymap.set("n", "N", "Nzzzv", { desc = "Previous search result" }) + +-- Keep cursor centered when jumping through quickfix list +vim.keymap.set("n", "", "cnextzz", { desc = "Next item in quickfix list" }) +vim.keymap.set("n", "", "cprevzz", { desc = "Previous item in quickfix list" }) +vim.keymap.set("n", "k", "lnextzz", { desc = "Next item in quickfix list" }) +vim.keymap.set("n", "j", "cprevzz", { desc = "Previous item in quickfix list" }) + +-- Easily run global search and replace +vim.keymap.set( + "n", + "s", + [[:%s/\<\>//gI]], + { desc = "Search and replace for word under cursor" } +) diff --git a/.config/nvim/lua/tovi/lazy.lua b/.config/nvim/lua/tovi/lazy.lua new file mode 100644 index 0000000..b655089 --- /dev/null +++ b/.config/nvim/lua/tovi/lazy.lua @@ -0,0 +1,28 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +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) + +require("lazy").setup({ + { import = "tovi.plugins" }, + { import = "tovi.plugins.lsp" }, +}, { + install = { + colorscheme = { "nightfly" }, + }, + checker = { + enabled = true, + notify = false, + }, + change_detection = { + notify = false, + }, +}) diff --git a/.config/nvim/lua/tovi/plugins/colorizer.lua b/.config/nvim/lua/tovi/plugins/colorizer.lua new file mode 100644 index 0000000..f8cfa97 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/colorizer.lua @@ -0,0 +1,5 @@ +return { + "NvChad/nvim-colorizer.lua", + event = { "BufReadPre", "BufNewFile" }, + config = true, +} diff --git a/.config/nvim/lua/tovi/plugins/colorscheme.lua b/.config/nvim/lua/tovi/plugins/colorscheme.lua new file mode 100644 index 0000000..7400464 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/colorscheme.lua @@ -0,0 +1,9 @@ +return { + "bluz71/vim-nightfly-colors", + name = "nightfly", + lazy = false, + priority = 1000, + config = function () + vim.cmd([[ colorscheme nightfly ]]) + end +} diff --git a/.config/nvim/lua/tovi/plugins/comment.lua b/.config/nvim/lua/tovi/plugins/comment.lua new file mode 100644 index 0000000..da8133e --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/comment.lua @@ -0,0 +1,5 @@ +return { + "numToStr/Comment.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = true, +} diff --git a/.config/nvim/lua/tovi/plugins/copilot.lua b/.config/nvim/lua/tovi/plugins/copilot.lua new file mode 100644 index 0000000..cb2f6c9 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/copilot.lua @@ -0,0 +1,7 @@ +return { + "github/copilot.vim", + config = function() + vim.api.nvim_set_keymap("i", ",,", 'copilot#Accept("")', { expr = true, silent = true }) + vim.api.nvim_set_keymap("n", "cs", "Copilot panel", { noremap = true }) + end, +} diff --git a/.config/nvim/lua/tovi/plugins/dressing.lua b/.config/nvim/lua/tovi/plugins/dressing.lua new file mode 100644 index 0000000..98f56c1 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/dressing.lua @@ -0,0 +1,4 @@ +return { + "stevearc/dressing.nvim", + event = "VeryLazy", +} diff --git a/.config/nvim/lua/tovi/plugins/fugitive.lua b/.config/nvim/lua/tovi/plugins/fugitive.lua new file mode 100644 index 0000000..c20c4ef --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/fugitive.lua @@ -0,0 +1,13 @@ +return { + "tpope/vim-fugitive", + dependencies = { + "shumphrey/fugitive-gitlab.vim", + }, + config = function() + vim.opt.diffopt = vim.opt.diffopt + "vertical" + vim.opt.display = vim.opt.display + "lastline" + + vim.api.nvim_set_keymap("n", "gl", ":GBrowse", { noremap = true }) + vim.cmd([[ let g:fugitive_gitlab_domains = {"ssh://code.codium.com.au": "https://code.codium.com.au"} ]]) + end, +} diff --git a/.config/nvim/lua/tovi/plugins/gitsigns.lua b/.config/nvim/lua/tovi/plugins/gitsigns.lua new file mode 100644 index 0000000..a3576c8 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/gitsigns.lua @@ -0,0 +1,5 @@ +return { + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = true, +} diff --git a/.config/nvim/lua/tovi/plugins/harpoon.lua b/.config/nvim/lua/tovi/plugins/harpoon.lua new file mode 100644 index 0000000..6b1a7bf --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/harpoon.lua @@ -0,0 +1,41 @@ +return { + "ThePrimeagen/harpoon", + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = function() + local mark = require("harpoon.mark") + local ui = require("harpoon.ui") + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + keymap.set("n", "a", mark.add_file, { desc = "Mark file with harpoon" }) + keymap.set("n", "th", mark.toggle_file, { desc = "Toggle file with harpoon" }) + keymap.set("n", "", ui.toggle_quick_menu, { desc = "Toggle quick menu for harpoon" }) + + keymap.set("n", "", function() + ui.nav_prev() + end, { desc = "Go to previous harpoon mark" }) + + keymap.set("n", "", function() + ui.nav_next() + end, { desc = "Go to next harpoon mark" }) + + keymap.set("n", "", function() + ui.nav_file(1) + end, { desc = "Go to first harpoon file" }) + + keymap.set("n", "", function() + ui.nav_file(2) + end, { desc = "Go to second harpoon file" }) + + keymap.set("n", "", function() + ui.nav_file(3) + end, { desc = "Go to third harpoon file" }) + + keymap.set("n", "", function() + ui.nav_file(4) + end, { desc = "Go to fourth harpoon file" }) + end, +} diff --git a/.config/nvim/lua/tovi/plugins/init.lua b/.config/nvim/lua/tovi/plugins/init.lua new file mode 100644 index 0000000..cc2491a --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/init.lua @@ -0,0 +1,8 @@ +return { + "nvim-lua/plenary.nvim", -- lua functions that many plugins use + + -- Programming language specific plugins + "ray-x/go.nvim", + "ray-x/guihua.lua", + "dart-lang/dart-vim-plugin", +} diff --git a/.config/nvim/lua/tovi/plugins/lsp/lspconfig.lua b/.config/nvim/lua/tovi/plugins/lsp/lspconfig.lua new file mode 100644 index 0000000..126a767 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/lsp/lspconfig.lua @@ -0,0 +1,167 @@ +return { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + { "antosha417/nvim-lsp-file-operations", config = true }, + }, + config = function() + -- import lspconfig plugin + local lspconfig = require("lspconfig") + + -- import cmp-nvim-lsp plugin + local cmp_nvim_lsp = require("cmp_nvim_lsp") + + local keymap = vim.keymap -- for conciseness + + local opts = { noremap = true, silent = true } + local on_attach = function(client, bufnr) + opts.buffer = bufnr + + -- set keybinds + opts.desc = "Show LSP references" + keymap.set("n", "gR", "Telescope lsp_references", opts) -- show definition, references + + opts.desc = "Go to declaration" + keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration + + opts.desc = "Show LSP definitions" + keymap.set("n", "gd", "Telescope lsp_definitions", opts) -- show lsp definitions + + opts.desc = "Show LSP implementations" + keymap.set("n", "gi", "Telescope lsp_implementations", opts) -- show lsp implementations + + opts.desc = "Show LSP type definitions" + keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) -- show lsp type definitions + + opts.desc = "See available code actions" + keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection + + opts.desc = "Smart rename" + keymap.set("n", "rn", vim.lsp.buf.rename, opts) -- smart rename + + opts.desc = "Show buffer diagnostics" + keymap.set("n", "D", "Telescope diagnostics bufnr=0", opts) -- show diagnostics for file + + opts.desc = "Show line diagnostics" + keymap.set("n", "d", vim.diagnostic.open_float, opts) -- show diagnostics for line + + opts.desc = "Go to previous diagnostic" + keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer + + opts.desc = "Go to next diagnostic" + keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer + + opts.desc = "Show documentation for what is under cursor" + keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor + + opts.desc = "Restart LSP" + keymap.set("n", "rs", ":LspRestart", opts) -- mapping to restart lsp if necessary + end + + -- used to enable autocompletion (assign to every lsp server config) + local capabilities = cmp_nvim_lsp.default_capabilities() + + -- Change the Diagnostic symbols in the sign column (gutter) + -- (not in youtube nvim video) + local signs = { Error = " ", Warn = " ", Hint = "󰠠 ", Info = " " } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end + + -- configure html server + lspconfig["html"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure typescript server with plugin + lspconfig["tsserver"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure css server + lspconfig["cssls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure tailwindcss server + lspconfig["tailwindcss"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure svelte server + lspconfig["svelte"].setup({ + capabilities = capabilities, + on_attach = function(client, bufnr) + on_attach(client, bufnr) + + vim.api.nvim_create_autocmd("BufWritePost", { + pattern = { "*.js", "*.ts" }, + callback = function(ctx) + if client.name == "svelte" then + client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.file }) + end + end, + }) + end, + }) + + -- configure prisma orm server + lspconfig["prismals"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure graphql language server + lspconfig["graphql"].setup({ + capabilities = capabilities, + on_attach = on_attach, + filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" }, + }) + + -- configure emmet language server + lspconfig["emmet_ls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" }, + }) + + -- configure php server + lspconfig["intelephense"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure python server + lspconfig["pyright"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure lua server (with special settings) + lspconfig["lua_ls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { -- custom settings for lua + Lua = { + -- make the language server recognize "vim" global + diagnostics = { + globals = { "vim" }, + }, + workspace = { + -- make language server aware of runtime files + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.stdpath("config") .. "/lua"] = true, + }, + }, + }, + }, + }) + end, +} diff --git a/.config/nvim/lua/tovi/plugins/lsp/mason.lua b/.config/nvim/lua/tovi/plugins/lsp/mason.lua new file mode 100644 index 0000000..90d4127 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/lsp/mason.lua @@ -0,0 +1,58 @@ +return { + "williamboman/mason.nvim", + dependencies = { + "williamboman/mason-lspconfig.nvim", + "jayp0521/mason-null-ls.nvim", + }, + config = function() + -- import mason + local mason = require("mason") + + -- import mason-lspconfig + local mason_lspconfig = require("mason-lspconfig") + + -- import mason-null-ls + local mason_null_ls = require("mason-null-ls") + + -- enable mason and configure icons + mason.setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + }) + + mason_lspconfig.setup({ + -- list of servers for mason to install + ensure_installed = { + "tsserver", + "html", + "cssls", + "tailwindcss", + "svelte", + "lua_ls", + "graphql", + "emmet_ls", + "prismals", + "pyright", + "intelephense", + }, + -- auto-install configured servers (with lspconfig) + automatic_installation = true, -- not the same as ensure_installed + }) + + mason_null_ls.setup({ + -- list of formatters & linters for mason to install + ensure_installed = { + "prettier", -- ts/js formatter + "stylua", -- lua formatter + "eslint_d", -- ts/js linter + }, + -- auto-install configured servers (with lspconfig) + automatic_installation = true, + }) + end, +} diff --git a/.config/nvim/lua/tovi/plugins/lsp/null-ls.lua b/.config/nvim/lua/tovi/plugins/lsp/null-ls.lua new file mode 100644 index 0000000..fad7d4c --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/lsp/null-ls.lua @@ -0,0 +1,56 @@ +return { + "jose-elias-alvarez/null-ls.nvim", -- configure formatters & linters + event = { "BufReadPre", "BufNewFile" }, + config = function() + -- import null-ls plugin + local null_ls = require("null-ls") + + local null_ls_utils = require("null-ls.utils") + + -- for conciseness + local formatting = null_ls.builtins.formatting -- to setup formatters + local diagnostics = null_ls.builtins.diagnostics -- to setup linters + + -- to setup format on save + local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + + -- configure null_ls + null_ls.setup({ + -- add package.json as identifier for root (for typescript monorepos) + root_dir = null_ls_utils.root_pattern(".null-ls-root", "Makefile", ".git", "package.json"), + -- setup formatters & linters + sources = { + -- to disable file types use + -- "formatting.prettier.with({disabled_filetypes: {}})" (see null-ls docs) + formatting.prettier.with({ + extra_filetypes = { "svelte" }, + }), -- js/ts formatter + formatting.stylua, -- lua formatter + diagnostics.eslint_d.with({ -- js/ts linter + condition = function(utils) + return utils.root_has_file({ ".eslintrc.js", ".eslintrc.cjs" }) -- only enable if root has .eslintrc.js or .eslintrc.cjs + end, + }), + }, + -- configure format on save + on_attach = function(current_client, bufnr) + if current_client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ + filter = function(client) + -- only use null-ls for formatting instead of lsp server + return client.name == "null-ls" + end, + bufnr = bufnr, + }) + end, + }) + end + end, + }) + end, +} diff --git a/.config/nvim/lua/tovi/plugins/lualine.lua b/.config/nvim/lua/tovi/plugins/lualine.lua new file mode 100644 index 0000000..2739f09 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/lualine.lua @@ -0,0 +1,71 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local lualine = require("lualine") + local lazy_status = require("lazy.status") -- to configure lazy pending updates count + + local colors = { + blue = "#65D1FF", + green = "#3EFFDC", + violet = "#FF61EF", + yellow = "#FFDA7B", + red = "#FF4A4A", + fg = "#c3ccdc", + bg = "#112638", + inactive_bg = "#2c3043", + } + + local my_lualine_theme = { + normal = { + a = { bg = colors.blue, fg = colors.bg, gui = "bold" }, + b = { bg = colors.bg, fg = colors.fg }, + c = { bg = colors.bg, fg = colors.fg }, + }, + insert = { + a = { bg = colors.green, fg = colors.bg, gui = "bold" }, + b = { bg = colors.bg, fg = colors.fg }, + c = { bg = colors.bg, fg = colors.fg }, + }, + visual = { + a = { bg = colors.violet, fg = colors.bg, gui = "bold" }, + b = { bg = colors.bg, fg = colors.fg }, + c = { bg = colors.bg, fg = colors.fg }, + }, + command = { + a = { bg = colors.yellow, fg = colors.bg, gui = "bold" }, + b = { bg = colors.bg, fg = colors.fg }, + c = { bg = colors.bg, fg = colors.fg }, + }, + replace = { + a = { bg = colors.red, fg = colors.bg, gui = "bold" }, + b = { bg = colors.bg, fg = colors.fg }, + c = { bg = colors.bg, fg = colors.fg }, + }, + inactive = { + a = { bg = colors.inactive_bg, fg = colors.semilightgray, gui = "bold" }, + b = { bg = colors.inactive_bg, fg = colors.semilightgray }, + c = { bg = colors.inactive_bg, fg = colors.semilightgray }, + }, + } + + -- configure lualine with modified theme + lualine.setup({ + options = { + theme = my_lualine_theme, + }, + sections = { + lualine_x = { + { + lazy_status.updates, + cond = lazy_status.has_updates, + color = { fg = "#ff9e64" }, + }, + { "encoding" }, + { "fileformat" }, + { "filetype" }, + }, + }, + }) + end, +} diff --git a/.config/nvim/lua/tovi/plugins/minintro.lua b/.config/nvim/lua/tovi/plugins/minintro.lua new file mode 100644 index 0000000..194f34e --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/minintro.lua @@ -0,0 +1,4 @@ +return { + "eoh-bse/minintro.nvim", + config = true, +} diff --git a/.config/nvim/lua/tovi/plugins/neotest.lua b/.config/nvim/lua/tovi/plugins/neotest.lua new file mode 100644 index 0000000..2f7b03c --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/neotest.lua @@ -0,0 +1,52 @@ +return { + "nvim-neotest/neotest", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + "antoinemadec/FixCursorHold.nvim", + -- Adapters + "tovijaeschke/neotest-phpunit", + "nvim-neotest/neotest-go", + }, + config = function() + local neotest = require("neotest") + + local keymap = vim.keymap + + keymap.set("n", "tr", function() + neotest.run.run() + end, { desc = "Run neotest on current function" }) + + keymap.set("n", "tR", function() + neotest.run.run_last() + end, { desc = "Run neotest on most recent test" }) + + keymap.set("n", "tS", function() + neotest.run.stop() + end, { desc = "Stop running tests" }) + + keymap.set("n", "ta", function() + neotest.run.attach() + end, { desc = "Attach to the currently running test" }) + + keymap.set("n", "to", function() + neotest.output.open() + end, { desc = "Open the output of the test" }) + + keymap.set("n", "ts", function() + neotest.summary.toggle() + end, { desc = "Toggle neotest summary pane" }) + + neotest.setup({ + adapters = { + require("neotest-phpunit")({ + root_files = { "phpunit.xml", "composer.json" }, + phpunit_cmd = { "docker-compose", "exec", "fpm", "./vendor/bin/phpunit" }, + filter_dirs = { "vendor" }, + mapped_docker_dir = "/var/www", + append_to_cwd = "/api", + }), + }, + }) + end, +} diff --git a/.config/nvim/lua/tovi/plugins/nvim-cmp.lua b/.config/nvim/lua/tovi/plugins/nvim-cmp.lua new file mode 100644 index 0000000..5620e26 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/nvim-cmp.lua @@ -0,0 +1,90 @@ +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-buffer", -- source for text in buffer + "hrsh7th/cmp-path", -- source for file system paths + "L3MON4D3/LuaSnip", -- snippet engine + "saadparwaiz1/cmp_luasnip", -- for autocompletion + "rafamadriz/friendly-snippets", -- useful snippets + "onsails/lspkind.nvim", -- vs-code like pictograms + }, + config = function() + local cmp = require("cmp") + + local luasnip = require("luasnip") + + local lspkind = require("lspkind") + + -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) + require("luasnip.loaders.from_vscode").lazy_load() + + local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil + end + + cmp.setup({ + completion = { + completeopt = "menu,menuone,preview,noselect", + }, + snippet = { -- configure how nvim-cmp interacts with snippet engine + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), -- previous suggestion + [""] = cmp.mapping.select_next_item(), -- next suggestion + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), -- show completion suggestions + [""] = cmp.mapping.abort(), -- close completion window + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping( + function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, + { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, + { + "i", + "s", + }), + }), + -- sources for autocompletion + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, -- snippets + { name = "buffer" }, -- text within current buffer + { name = "path" }, -- file system paths + }), + -- configure lspkind for vs-code like pictograms in completion menu + formatting = { + format = lspkind.cmp_format({ + maxwidth = 50, + ellipsis_char = "...", + }), + }, + }) +end, +} diff --git a/.config/nvim/lua/tovi/plugins/nvim-tree.lua b/.config/nvim/lua/tovi/plugins/nvim-tree.lua new file mode 100644 index 0000000..af31dd5 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/nvim-tree.lua @@ -0,0 +1,64 @@ +return { + "nvim-tree/nvim-tree.lua", + dependancies = { + "nvim-tree/nvim-web-devicons" + }, + + config = function() + local nvimtree = require("nvim-tree") + + -- recommended settings from nvim-tree documentation + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + -- change color for arrows in tree to light blue + vim.cmd([[ highlight NvimTreeIndentMarker guifg=#3FC5FF ]]) + + -- configure nvim-tree + nvimtree.setup({ + view = { + width = 35, + relativenumber = true, + }, + -- change folder arrow icons + renderer = { + indent_markers = { + enable = true + }, + icons = { + glyphs = { + folder = { + arrow_closed = "", -- arrow when folder is closed + arrow_open = "", -- arrow when folder is open + }, + }, + }, + }, + -- disable window_picker for + -- explorer to work well with + -- window splits + actions = { + open_file = { + window_picker = { + enable = false, + }, + }, + }, + filters = { + custom = { ".DS_Store" }, + }, + git = { + ignore = false, + }, + }) + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + keymap.set("n", "", "NvimTreeToggle", { desc = "Toggle file explorer" }) -- toggle file explorer + keymap.set("n", "ee", "NvimTreeToggle", { desc = "Toggle file explorer" }) -- toggle file explorer + keymap.set("n", "ef", "NvimTreeFindFileToggle", { desc = "Toggle file explorer on current file" }) -- toggle file explorer on current file + keymap.set("n", "ec", "NvimTreeCollapse", { desc = "Collapse file explorer" }) -- collapse file explorer + keymap.set("n", "er", "NvimTreeRefresh", { desc = "Refresh file explorer" }) -- refresh file explorer + end, +} diff --git a/.config/nvim/lua/tovi/plugins/nvim-treesitter.lua b/.config/nvim/lua/tovi/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..762f932 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/nvim-treesitter.lua @@ -0,0 +1,53 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + build = ":TSUpdate", + dependencies = { + "windwp/nvim-ts-autotag", + }, + config = function() + -- import nvim-treesitter plugin + local treesitter = require("nvim-treesitter.configs") + + -- configure treesitter + treesitter.setup({ -- enable syntax highlighting + highlight = { + enable = true, + }, + -- enable indentation + indent = { enable = true }, + -- enable autotagging (w/ nvim-ts-autotag plugin) + autotag = { enable = true }, + -- ensure these language parsers are installed + ensure_installed = { + "json", + "javascript", + "typescript", + "tsx", + "yaml", + "html", + "css", + "prisma", + "markdown", + "markdown_inline", + "svelte", + "graphql", + "bash", + "lua", + "vim", + "dockerfile", + "gitignore", + "php", + }, + -- enable nvim-ts-context-commentstring plugin for commenting tsx and jsx + context_commentstring = { + enable = true, + enable_autocmd = false, + }, + -- auto install above language parsers + auto_install = true, + }) + end, + }, +} diff --git a/.config/nvim/lua/tovi/plugins/telescope.lua b/.config/nvim/lua/tovi/plugins/telescope.lua new file mode 100644 index 0000000..8b0be2e --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/telescope.lua @@ -0,0 +1,118 @@ +return { + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + dependencies = { + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + "nvim-tree/nvim-web-devicons", + }, + config = function() + local telescope = require("telescope") + local actions = require("telescope.actions") + local previewers = require("telescope.previewers") + local previewers_utils = require("telescope.previewers.utils") + local sorters = require("telescope.sorters") + local builtin = require("telescope.builtin") + + local max_size = 100000 + local truncate_large_files = function(filepath, bufnr, opts) + opts = opts or {} + + filepath = vim.fn.expand(filepath) + vim.loop.fs_stat(filepath, function(_, stat) + if not stat then + return + end + if stat.size > max_size then + local cmd = { "head", "-c", max_size, filepath } + previewers_utils.job_maker(cmd, bufnr, opts) + else + previewers.buffer_previewer_maker(filepath, bufnr, opts) + end + end) + end + + telescope.setup({ + defaults = { + file_sorter = sorters.get_fzy_sorter, + prompt_prefix = " >", + color_devicons = true, + + buffer_previewer_maker = truncate_large_files, + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "ascending", + layout_strategy = "horizontal", + layout_config = { + horizontal = { + prompt_position = "top", + preview_width = 0.55, + results_width = 0.8, + }, + vertical = { + mirror = false, + }, + width = 0.87, + height = 0.80, + preview_cutoff = 120, + }, + path_display = { "truncate" }, + winblend = 0, + border = {}, + borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + + mappings = { + i = { + [""] = actions.move_selection_previous, -- move to prev result + [""] = actions.move_selection_next, -- move to next result + [""] = actions.send_selected_to_qflist + actions.open_qflist, + }, + }, + }, + }) + + telescope.load_extension("fzf") + + local git_branches = function() + builtin.git_branches({ + attach_mappings = function(_, map) + map("i", "", actions.git_delete_branch) + map("n", "", actions.git_delete_branch) + return true + end, + }) + end + + local find_files = function() + local ran, errorMessage = pcall(function() + builtin.git_files({ show_untracked = true }) + end) + if not ran then + builtin.find_files() + end + end + + -- set keymaps + local keymap = vim.keymap -- for conciseness + + keymap.set("n", "", builtin.live_grep, { desc = "Live grep over project files." }) + keymap.set("n", "", find_files, { desc = "Fuzzy find files in cwd" }) + + keymap.set("n", "fb", builtin.buffers, { desc = "Fuzzy find open buffers" }) + keymap.set("n", "fo", builtin.oldfiles, { desc = "Fuzzy find recently opened files" }) + + keymap.set("n", "m", builtin.marks, { desc = "Fuzzy find marks" }) + keymap.set("n", "ch", builtin.command_history, { desc = "Fuzzy find recent commands" }) + + keymap.set("n", "gb", git_branches, { desc = "Fuzzy find git branches" }) + keymap.set("n", "gs", builtin.git_status, { desc = "Fuzzy find current git status" }) + + keymap.set("n", "df", function() + builtin.find_files({ + prompt_title = "< VimRC >", + cwd = vim.fn.expand("~/.config/nvim"), + hidden = true, + }) + end, { desc = "Find neovim config files" }) + end, +} diff --git a/.config/nvim/lua/tovi/plugins/undotree.lua b/.config/nvim/lua/tovi/plugins/undotree.lua new file mode 100644 index 0000000..097b621 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/undotree.lua @@ -0,0 +1,6 @@ +return { + "mbbill/undotree", + config = function() + vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) + end, +} diff --git a/.config/nvim/lua/tovi/plugins/which-key.lua b/.config/nvim/lua/tovi/plugins/which-key.lua new file mode 100644 index 0000000..0d22f69 --- /dev/null +++ b/.config/nvim/lua/tovi/plugins/which-key.lua @@ -0,0 +1,13 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 500 + end, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, +} diff --git a/.config/nvim/lua/utils/init.lua b/.config/nvim/lua/utils/init.lua deleted file mode 100644 index 03897f8..0000000 --- a/.config/nvim/lua/utils/init.lua +++ /dev/null @@ -1,37 +0,0 @@ -_G.dump = function(...) - print(vim.inspect(...)) -end - -_G.prequire = function(...) - local status, lib = pcall(require, ...) - if status then - return lib - end - return nil -end - -local M = {} - -function M.t(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) -end - -function M.log(msg, hl, name) - name = name or "Neovim" - hl = hl or "Todo" - vim.api.nvim_echo({ { name .. ": ", hl }, { msg } }, true, {}) -end - -function M.warn(msg, name) - vim.notify(msg, vim.log.levels.WARN, { title = name }) -end - -function M.error(msg, name) - vim.notify(msg, vim.log.levels.ERROR, { title = name }) -end - -function M.info(msg, name) - vim.notify(msg, vim.log.levels.INFO, { title = name }) -end - -return M