Browse Source

Update neovim to use folke/lazy.nvim and remove unused plugins

Add alacritty config
master
parent
commit
d6a9959456
58 changed files with 1093 additions and 1242 deletions
  1. +24
    -0
      .config/alacritty/alacritty.yml
  2. +36
    -0
      .config/alacritty/themes/Nightfly.yml
  3. +2
    -8
      .config/nvim/init.lua
  4. +44
    -0
      .config/nvim/lazy-lock.json
  5. +0
    -6
      .config/nvim/lua/.luarc.json
  6. +0
    -2
      .config/nvim/lua/config/copilot.lua
  7. +0
    -3
      .config/nvim/lua/config/dadbod.lua
  8. +0
    -38
      .config/nvim/lua/config/dashboard.lua
  9. +0
    -7
      .config/nvim/lua/config/fugitive.lua
  10. +0
    -4
      .config/nvim/lua/config/general/init.lua
  11. +0
    -63
      .config/nvim/lua/config/general/remaps.lua
  12. +0
    -42
      .config/nvim/lua/config/gitsigns.lua
  13. +0
    -88
      .config/nvim/lua/config/go.lua
  14. +0
    -14
      .config/nvim/lua/config/harpoon.lua
  15. +0
    -128
      .config/nvim/lua/config/lsp.lua
  16. +0
    -40
      .config/nvim/lua/config/lualine.lua
  17. +0
    -14
      .config/nvim/lua/config/luasnip.lua
  18. +0
    -60
      .config/nvim/lua/config/neoclip.lua
  19. +0
    -22
      .config/nvim/lua/config/neotest.lua
  20. +0
    -18
      .config/nvim/lua/config/noice.lua
  21. +0
    -205
      .config/nvim/lua/config/nvim-neo-tree.lua
  22. +0
    -3
      .config/nvim/lua/config/osc52.lua
  23. +0
    -7
      .config/nvim/lua/config/php-doc.lua
  24. +0
    -19
      .config/nvim/lua/config/prettier.lua
  25. +0
    -106
      .config/nvim/lua/config/telescope.lua
  26. +0
    -13
      .config/nvim/lua/config/tmux.lua
  27. +0
    -12
      .config/nvim/lua/config/treesitter-context.lua
  28. +0
    -24
      .config/nvim/lua/config/treesitter.lua
  29. +0
    -1
      .config/nvim/lua/config/undotree.lua
  30. +0
    -19
      .config/nvim/lua/helper/toggle-tab-width.lua
  31. +0
    -235
      .config/nvim/lua/packer-plugins.lua
  32. +10
    -4
      .config/nvim/lua/tovi/core/autocmd.lua
  33. +4
    -0
      .config/nvim/lua/tovi/core/init.lua
  34. +1
    -0
      .config/nvim/lua/tovi/core/options.lua
  35. +95
    -0
      .config/nvim/lua/tovi/core/remaps.lua
  36. +28
    -0
      .config/nvim/lua/tovi/lazy.lua
  37. +5
    -0
      .config/nvim/lua/tovi/plugins/colorizer.lua
  38. +9
    -0
      .config/nvim/lua/tovi/plugins/colorscheme.lua
  39. +5
    -0
      .config/nvim/lua/tovi/plugins/comment.lua
  40. +7
    -0
      .config/nvim/lua/tovi/plugins/copilot.lua
  41. +4
    -0
      .config/nvim/lua/tovi/plugins/dressing.lua
  42. +13
    -0
      .config/nvim/lua/tovi/plugins/fugitive.lua
  43. +5
    -0
      .config/nvim/lua/tovi/plugins/gitsigns.lua
  44. +41
    -0
      .config/nvim/lua/tovi/plugins/harpoon.lua
  45. +8
    -0
      .config/nvim/lua/tovi/plugins/init.lua
  46. +167
    -0
      .config/nvim/lua/tovi/plugins/lsp/lspconfig.lua
  47. +58
    -0
      .config/nvim/lua/tovi/plugins/lsp/mason.lua
  48. +56
    -0
      .config/nvim/lua/tovi/plugins/lsp/null-ls.lua
  49. +71
    -0
      .config/nvim/lua/tovi/plugins/lualine.lua
  50. +4
    -0
      .config/nvim/lua/tovi/plugins/minintro.lua
  51. +52
    -0
      .config/nvim/lua/tovi/plugins/neotest.lua
  52. +90
    -0
      .config/nvim/lua/tovi/plugins/nvim-cmp.lua
  53. +64
    -0
      .config/nvim/lua/tovi/plugins/nvim-tree.lua
  54. +53
    -0
      .config/nvim/lua/tovi/plugins/nvim-treesitter.lua
  55. +118
    -0
      .config/nvim/lua/tovi/plugins/telescope.lua
  56. +6
    -0
      .config/nvim/lua/tovi/plugins/undotree.lua
  57. +13
    -0
      .config/nvim/lua/tovi/plugins/which-key.lua
  58. +0
    -37
      .config/nvim/lua/utils/init.lua

+ 24
- 0
.config/alacritty/alacritty.yml View File

@ -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 }

+ 36
- 0
.config/alacritty/themes/Nightfly.yml View File

@ -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'

+ 2
- 8
.config/nvim/init.lua View File

@ -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')

+ 44
- 0
.config/nvim/lazy-lock.json View File

@ -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" }
}

+ 0
- 6
.config/nvim/lua/.luarc.json View File

@ -1,6 +0,0 @@
{
"diagnostics.globals": [
"vim",
"use"
]
}

+ 0
- 2
.config/nvim/lua/config/copilot.lua View File

@ -1,2 +0,0 @@
vim.api.nvim_set_keymap('i', ',,', 'copilot#Accept("<CR>")', { expr = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>cs', '<cmd>Copilot panel<CR>', { noremap = true })

+ 0
- 3
.config/nvim/lua/config/dadbod.lua View File

@ -1,3 +0,0 @@
vim.cmd[[ let g:db_ui_winwidth = 30 ]]
vim.keymap.set('n', '<leader>db', ':DBUIToggle<CR>', { noremap = true })

+ 0
- 38
.config/nvim/lua/config/dashboard.lua View File

@ -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',
},
},
},
})

+ 0
- 7
.config/nvim/lua/config/fugitive.lua View File

@ -1,7 +0,0 @@
vim.opt.diffopt = vim.opt.diffopt + "vertical"
vim.opt.display = vim.opt.display + 'lastline'
vim.api.nvim_set_keymap('n', '<leader>gl', ':GBrowse<CR>', { noremap = true })
vim.cmd([[ let g:fugitive_gitlab_domains = {"ssh://code.codium.com.au": "https://code.codium.com.au"} ]])

+ 0
- 4
.config/nvim/lua/config/general/init.lua View File

@ -1,4 +0,0 @@
require('config.general.options')
require('config.general.remaps')
require('config.general.autocmd')

+ 0
- 63
.config/nvim/lua/config/general/remaps.lua View File

@ -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', '<leader>hs', '<cmd>split<cr>', options)
vim.keymap.set('n', '<leader>vs', '<cmd>vsplit<cr>', options)
-- Copy the entire file
vim.keymap.set('n', '<leader>y', 'ggyG<C-o>', options)
vim.keymap.set('n', '<F5>', function() vim.cmd('mksession! ~/.cache//nvim/session/manual_session.vim') end, options)
vim.keymap.set('n', '<F6>', function() vim.cmd('source ~/.cache/nvim/session/manual_session.vim') end, options)
vim.keymap.set('n', '<F7>', function() vim.cmd('source ~/.cache/nvim/session/shutdown_session.vim') end, options)
-- Navigating with guides
vim.keymap.set('n', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options)
vim.keymap.set('v', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options)
-- Spell-check
vim.keymap.set('n', '<leader>o', '<cmd>setlocal spell! spelllang=en_au<cr>', options)
-- Keep highlight when indenting
vim.keymap.set('v', '<', '<gv', options)
vim.keymap.set('v', '>', '>gv', options)
vim.keymap.set('n', '<A-1>', '1gt', options)
vim.keymap.set('n', '<A-2>', '2gt', options)
vim.keymap.set('n', '<A-3>', '3gt', options)
vim.keymap.set('n', '<A-4>', '4gt', options)
vim.keymap.set('n', '<A-5>', '5gt', options)
vim.keymap.set('n', '<A-6>', '6gt', options)
vim.keymap.set('n', '<A-7>', '7gt', options)
vim.keymap.set('n', '<A-8>', '8gt', options)
vim.keymap.set('n', '<A-9>', '9gt', options)
vim.keymap.set('n', '<leader>gp', '<cmd>Git push<CR>', options)
vim.keymap.set('n', '<leader>gP', '<cmd>Git pull<CR>', options)
vim.keymap.set('n', '<leader>ga', '<cmd>Git add .<CR>', options)
vim.keymap.set('n', '<leader>gA', '<cmd>Git add<CR>', options)
vim.keymap.set('n', '<leader>gc', '<cmd>Git commit<CR>', options)
vim.keymap.set('n', '<leader>gC', '<cmd>Git commit -a<CR>', options)
vim.keymap.set("x", "<leader>p", "\"_dP", options)
vim.keymap.set("n", "<leader>d", "\"_d", options)
vim.keymap.set("v", "<leader>d", "\"_d", options)
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
vim.keymap.set('n', '<C-d>', '<C-d>zz')
vim.keymap.set('n', '<C-u>', '<C-u>zz')
vim.keymap.set('n', 'n', 'nzzzv')
vim.keymap.set('n', 'N', 'Nzzzv')
vim.keymap.set('n', '<C-k>', '<cmd>cnext<CR>zz')
vim.keymap.set('n', '<C-j>', '<cmd>cprev<CR>zz')
vim.keymap.set('n', '<leader>k', '<cmd>lnext<CR>zz')
vim.keymap.set('n', '<leader>j', '<cmd>cprev<CR>zz')
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])

+ 0
- 42
.config/nvim/lua/config/gitsigns.lua View File

@ -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 = '<author>, <author_time:%Y-%m-%d> - <summary>',
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
},
}

+ 0
- 88
.config/nvim/lua/config/go.lua View File

@ -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", "<space>F", "<cmd>lua vim.lsp.buf.formatting()<CR>", {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
})

+ 0
- 14
.config/nvim/lua/config/harpoon.lua View File

@ -1,14 +0,0 @@
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
vim.keymap.set('n', '<leader>a', mark.add_file)
vim.keymap.set('n', '<leader>th', mark.toggle_file)
vim.keymap.set('n', '<C-e>', ui.toggle_quick_menu)
vim.keymap.set('n', '<C-h>', function () ui.nav_file(1) end)
vim.keymap.set('n', '<C-j>', function () ui.nav_file(2) end)
vim.keymap.set('n', '<C-k>', function () ui.nav_file(3) end)
vim.keymap.set('n', '<C-l>', function () ui.nav_file(4) end)
vim.keymap.set('n', '<C-,>', function () ui.nav_prev() end)
vim.keymap.set('n', '<C-.>', function () ui.nav_next() end)

+ 0
- 128
.config/nvim/lua/config/lsp.lua View File

@ -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({
["<C-k>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
["<C-j>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-e>"] = cmp.mapping { i = cmp.mapping.close(), c = cmp.mapping.close() },
["<CR>"] = 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,
},
["<Tab>"] = 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",
}),
["<S-Tab>"] = 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", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<leader>K", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>of", vim.diagnostic.open_float, opts)
vim.keymap.set("n", "gh", vim.lsp.buf.signature_help, opts)
end)
lsp.setup()

+ 0
- 40
.config/nvim/lua/config/lualine.lua View File

@ -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 = {}
}

+ 0
- 14
.config/nvim/lua/config/luasnip.lua View File

@ -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

+ 0
- 60
.config/nvim/lua/config/neoclip.lua View File

@ -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 = '<cr>',
paste = '<c-p>',
paste_behind = '<c-k>',
replay = '<c-q>', -- replay a macro
delete = '<c-d>', -- delete an entry
edit = '<c-e>', -- edit an entry
custom = {},
},
n = {
select = '<cr>',
paste = 'p',
--- It is possible to map to more than one key.
-- paste = { 'p', '<c-p>' },
paste_behind = 'P',
replay = 'q',
delete = 'd',
edit = 'e',
custom = {},
},
},
},
})
vim.keymap.set('n', '<leader>cp', function()
require('telescope').extensions.neoclip.default()
end)

+ 0
- 22
.config/nvim/lua/config/neotest.lua View File

@ -1,22 +0,0 @@
local neotest = require('neotest')
vim.keymap.set('n', '<leader>tr', function () neotest.run.run() end)
vim.keymap.set('n', '<leader>tR', function () neotest.run.run_last() end)
vim.keymap.set('n', '<leader>tf', function () neotest.run.run(vim.fn.expand('%')) end)
vim.keymap.set('n', '<leader>tS', function () neotest.run.stop() end)
vim.keymap.set('n', '<leader>ta', function () neotest.run.attach() end)
vim.keymap.set('n', '<leader>to', function () neotest.output.open() end)
vim.keymap.set('n', '<leader>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'
}),
},
})

+ 0
- 18
.config/nvim/lua/config/noice.lua View File

@ -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
},
})

+ 0
- 205
.config/nvim/lua/config/nvim-neo-tree.lua View File

@ -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 = {
["<space>"] = {
"toggle_node",
nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use
},
["<2-LeftMouse>"] = "open",
["<cr>"] = "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 = {
["<bs>"] = "navigate_up",
["."] = "set_root",
["H"] = "toggle_hidden",
["/"] = "fuzzy_finder",
["D"] = "fuzzy_finder_directory",
["f"] = "filter_on_submit",
["<c-x>"] = "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",
["<bs>"] = "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', '<C-q>', '<Cmd>Neotree toggle<CR>', { noremap = true })

+ 0
- 3
.config/nvim/lua/config/osc52.lua View File

@ -1,3 +0,0 @@
vim.keymap.set('n', '<leader>c', require('osc52').copy_operator, { expr = true })
vim.keymap.set('n', '<leader>cc', '<leader>c_', { remap = true })
vim.keymap.set('v', '<leader>c', require('osc52').copy_visual)

+ 0
- 7
.config/nvim/lua/config/php-doc.lua View File

@ -1,7 +0,0 @@
vim.keymap.set('n', '<C-d>', function ()
if vim.bo.filetype ~= 'php' then
return
end
vim.api.nvim_call_function("PhpDocSingle", {})
end, options)

+ 0
- 19
.config/nvim/lua/config/prettier.lua View File

@ -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",
},
})

+ 0
- 106
.config/nvim/lua/config/telescope.lua View File

@ -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 = {
['<C-x>'] = false,
['<C-q>'] = actions.send_to_qflist,
},
},
},
})
function git_branches ()
builtin.git_branches({
attach_mappings = function(_, map)
map("i", "<c-d>", actions.git_delete_branch)
map("n", "<c-d>", 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', '<C-g>', builtin.live_grep, options)
vim.keymap.set('n', '<C-p>', files, options)
vim.keymap.set('n', '<leader>df', function()
builtin.find_files({
prompt_title = "< VimRC >",
cwd = vim.fn.expand('~/.config/nvim'),
hidden = true,
})
end, options)
vim.keymap.set('n', '<leader>fb', builtin.buffers, options)
vim.keymap.set('n', '<leader>fo', builtin.oldfiles, options)
vim.keymap.set('n', '<leader>gr', builtin.lsp_references, options)
vim.keymap.set("n", '<leader>gi', builtin.lsp_implementations, options)
vim.keymap.set("n", '<leader>gT', builtin.lsp_type_definitions, options)
vim.keymap.set('n', '<leader>m', builtin.marks, options)
vim.keymap.set('n', '<leader>ch', builtin.command_history, options)
vim.keymap.set('n', '<leader>gb', git_branches, options)
vim.keymap.set('n', '<leader>gs', builtin.git_status, options)

+ 0
- 13
.config/nvim/lua/config/tmux.lua View File

@ -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,
}
})

+ 0
- 12
.config/nvim/lua/config/treesitter-context.lua View File

@ -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,
}

+ 0
- 24
.config/nvim/lua/config/treesitter.lua View File

@ -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,
},
}

+ 0
- 1
.config/nvim/lua/config/undotree.lua View File

@ -1 +0,0 @@
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle)

+ 0
- 19
.config/nvim/lua/helper/toggle-tab-width.lua View File

@ -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', '<leader>tt', ToggleTabWidth, { noremap = true })

+ 0
- 235
.config/nvim/lua/packer-plugins.lua View File

@ -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)

.config/nvim/lua/config/general/autocmd.lua → .config/nvim/lua/tovi/core/autocmd.lua View File


+ 4
- 0
.config/nvim/lua/tovi/core/init.lua View File

@ -0,0 +1,4 @@
require('tovi.core.options')
require('tovi.core.remaps')
require('tovi.core.autocmd')

.config/nvim/lua/config/general/options.lua → .config/nvim/lua/tovi/core/options.lua View File


+ 95
- 0
.config/nvim/lua/tovi/core/remaps.lua View File

@ -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", "<leader>hs", "<cmd>split<cr>", { desc = "Open horizontal spilt" })
vim.keymap.set("n", "<leader>vs", "<cmd>vsplit<cr>", { desc = "Open vertical spilt" })
-- Easily navigate splits
vim.keymap.set("n", "<A-h>", "<C-w>h", { desc = "Move focus to split left" })
vim.keymap.set("n", "<A-j>", "<C-w>j", { desc = "Move focus to split down" })
vim.keymap.set("n", "<A-k>", "<C-w>k", { desc = "Move focus to split up" })
vim.keymap.set("n", "<A-l>", "<C-w>l", { desc = "Move focus to split right" })
-- Copy the entire file
vim.keymap.set("n", "<leader>y", "ggyG<C-o>", { desc = "Copy the entire file to default register" })
-- Manage sessions
vim.keymap.set("n", "<F5>", function()
vim.cmd("mksession! ~/.cache//nvim/session/manual_session.vim")
end, { desc = "Manually create session" })
vim.keymap.set("n", "<F6>", function()
vim.cmd("source ~/.cache/nvim/session/manual_session.vim")
end, { desc = "Restore manually created session" })
vim.keymap.set("n", "<F7>", 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",
"<leader><leader>",
'<Esc>/<++><Enter>"_c4l',
{ desc = "Find next <++> in file and enter insert mode" }
)
vim.keymap.set(
"v",
"<leader><leader>",
'<Esc>/<++><Enter>"_c4l',
{ desc = "Find next <++> in file and enter insert mode" }
)
-- Spell-check
vim.keymap.set("n", "<leader>o", "<cmd>setlocal spell! spelllang=en_au<CR>", { desc = "Toggle spell check" })
-- Map Q to nop
vim.keymap.set("n", "Q", "<nop>", { desc = "Remap Q to <nop> because Q is the worst" })
-- Keep highlight when indenting
vim.keymap.set("v", "<", "<gv", { desc = "Keep highlight when indenting" })
vim.keymap.set("v", ">", ">gv", { desc = "Keep highlight when indenting" })
-- Easily navigate tabs
vim.keymap.set("n", "<A-1>", "1gt", { desc = "Navigate to tab 2" })
vim.keymap.set("n", "<A-2>", "2gt", { desc = "Navigate to tab 3" })
vim.keymap.set("n", "<A-3>", "3gt", { desc = "Navigate to tab 4" })
vim.keymap.set("n", "<A-4>", "4gt", { desc = "Navigate to tab 5" })
vim.keymap.set("n", "<A-5>", "5gt", { desc = "Navigate to tab 6" })
vim.keymap.set("n", "<A-6>", "6gt", { desc = "Navigate to tab 7" })
vim.keymap.set("n", "<A-7>", "7gt", { desc = "Navigate to tab 8" })
vim.keymap.set("n", "<A-8>", "8gt", { desc = "Navigate to tab 9" })
vim.keymap.set("n", "<A-9>", "9gt", { desc = "Navigate to tab 10" })
-- TODO: Move these into fugitive config
-- vim.keymap.set('n', '<leader>gp', '<cmd>Git push<CR>', options)
-- vim.keymap.set('n', '<leader>gP', '<cmd>Git pull<CR>', options)
-- vim.keymap.set('n', '<leader>ga', '<cmd>Git add .<CR>', options)
-- vim.keymap.set('n', '<leader>gA', '<cmd>Git add<CR>', options)
-- vim.keymap.set('n', '<leader>gc', '<cmd>Git commit<CR>', options)
-- vim.keymap.set('n', '<leader>gC', '<cmd>Git commit -a<CR>', options)
vim.keymap.set("x", "<leader>p", '"_dP', { desc = "Delete into black hole register" })
vim.keymap.set("n", "<leader>d", '"_d', { desc = "Delete into black hole register" })
vim.keymap.set("v", "<leader>d", '"_d', { desc = "Delete into black hole register" })
-- Keep page scroll centered
vim.keymap.set("n", "<C-d>", "<C-d>zz", { desc = "Scroll down half page" })
vim.keymap.set("n", "<C-u>", "<C-u>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", "<C-k>", "<cmd>cnext<CR>zz", { desc = "Next item in quickfix list" })
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz", { desc = "Previous item in quickfix list" })
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz", { desc = "Next item in quickfix list" })
vim.keymap.set("n", "<leader>j", "<cmd>cprev<CR>zz", { desc = "Previous item in quickfix list" })
-- Easily run global search and replace
vim.keymap.set(
"n",
"<leader>s",
[[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
{ desc = "Search and replace for word under cursor" }
)

+ 28
- 0
.config/nvim/lua/tovi/lazy.lua View File

@ -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,
},
})

+ 5
- 0
.config/nvim/lua/tovi/plugins/colorizer.lua View File

@ -0,0 +1,5 @@
return {
"NvChad/nvim-colorizer.lua",
event = { "BufReadPre", "BufNewFile" },
config = true,
}

+ 9
- 0
.config/nvim/lua/tovi/plugins/colorscheme.lua View File

@ -0,0 +1,9 @@
return {
"bluz71/vim-nightfly-colors",
name = "nightfly",
lazy = false,
priority = 1000,
config = function ()
vim.cmd([[ colorscheme nightfly ]])
end
}

+ 5
- 0
.config/nvim/lua/tovi/plugins/comment.lua View File

@ -0,0 +1,5 @@
return {
"numToStr/Comment.nvim",
event = { "BufReadPre", "BufNewFile" },
config = true,
}

+ 7
- 0
.config/nvim/lua/tovi/plugins/copilot.lua View File

@ -0,0 +1,7 @@
return {
"github/copilot.vim",
config = function()
vim.api.nvim_set_keymap("i", ",,", 'copilot#Accept("<CR>")', { expr = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader>cs", "<cmd>Copilot panel<CR>", { noremap = true })
end,
}

+ 4
- 0
.config/nvim/lua/tovi/plugins/dressing.lua View File

@ -0,0 +1,4 @@
return {
"stevearc/dressing.nvim",
event = "VeryLazy",
}

+ 13
- 0
.config/nvim/lua/tovi/plugins/fugitive.lua View File

@ -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", "<leader>gl", ":GBrowse<CR>", { noremap = true })
vim.cmd([[ let g:fugitive_gitlab_domains = {"ssh://code.codium.com.au": "https://code.codium.com.au"} ]])
end,
}

+ 5
- 0
.config/nvim/lua/tovi/plugins/gitsigns.lua View File

@ -0,0 +1,5 @@
return {
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
config = true,
}

+ 41
- 0
.config/nvim/lua/tovi/plugins/harpoon.lua View File

@ -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", "<leader>a", mark.add_file, { desc = "Mark file with harpoon" })
keymap.set("n", "<leader>th", mark.toggle_file, { desc = "Toggle file with harpoon" })
keymap.set("n", "<C-e>", ui.toggle_quick_menu, { desc = "Toggle quick menu for harpoon" })
keymap.set("n", "<C-,>", function()
ui.nav_prev()
end, { desc = "Go to previous harpoon mark" })
keymap.set("n", "<C-.>", function()
ui.nav_next()
end, { desc = "Go to next harpoon mark" })
keymap.set("n", "<C-h>", function()
ui.nav_file(1)
end, { desc = "Go to first harpoon file" })
keymap.set("n", "<C-j>", function()
ui.nav_file(2)
end, { desc = "Go to second harpoon file" })
keymap.set("n", "<C-k>", function()
ui.nav_file(3)
end, { desc = "Go to third harpoon file" })
keymap.set("n", "<C-l>", function()
ui.nav_file(4)
end, { desc = "Go to fourth harpoon file" })
end,
}

+ 8
- 0
.config/nvim/lua/tovi/plugins/init.lua View File

@ -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",
}

+ 167
- 0
.config/nvim/lua/tovi/plugins/lsp/lspconfig.lua View File

@ -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", "<cmd>Telescope lsp_references<CR>", 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", "<cmd>Telescope lsp_definitions<CR>", opts) -- show lsp definitions
opts.desc = "Show LSP implementations"
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts) -- show lsp implementations
opts.desc = "Show LSP type definitions"
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts) -- show lsp type definitions
opts.desc = "See available code actions"
keymap.set({ "n", "v" }, "<leader>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", "<leader>rn", vim.lsp.buf.rename, opts) -- smart rename
opts.desc = "Show buffer diagnostics"
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnr=0<CR>", opts) -- show diagnostics for file
opts.desc = "Show line diagnostics"
keymap.set("n", "<leader>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", "<leader>rs", ":LspRestart<CR>", 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,
}

+ 58
- 0
.config/nvim/lua/tovi/plugins/lsp/mason.lua View File

@ -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,
}

+ 56
- 0
.config/nvim/lua/tovi/plugins/lsp/null-ls.lua View File

@ -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,
}

+ 71
- 0
.config/nvim/lua/tovi/plugins/lualine.lua View File

@ -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,
}

+ 4
- 0
.config/nvim/lua/tovi/plugins/minintro.lua View File

@ -0,0 +1,4 @@
return {
"eoh-bse/minintro.nvim",
config = true,
}

+ 52
- 0
.config/nvim/lua/tovi/plugins/neotest.lua View File

@ -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", "<leader>tr", function()
neotest.run.run()
end, { desc = "Run neotest on current function" })
keymap.set("n", "<leader>tR", function()
neotest.run.run_last()
end, { desc = "Run neotest on most recent test" })
keymap.set("n", "<leader>tS", function()
neotest.run.stop()
end, { desc = "Stop running tests" })
keymap.set("n", "<leader>ta", function()
neotest.run.attach()
end, { desc = "Attach to the currently running test" })
keymap.set("n", "<leader>to", function()
neotest.output.open()
end, { desc = "Open the output of the test" })
keymap.set("n", "<leader>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,
}

+ 90
- 0
.config/nvim/lua/tovi/plugins/nvim-cmp.lua View File

@ -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({
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
["<C-e>"] = cmp.mapping.abort(), -- close completion window
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = 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",
}),
["<S-Tab>"] = 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,
}

+ 64
- 0
.config/nvim/lua/tovi/plugins/nvim-tree.lua View File

@ -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", "<C-q>", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" }) -- toggle file explorer
keymap.set("n", "<leader>ee", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" }) -- toggle file explorer
keymap.set("n", "<leader>ef", "<cmd>NvimTreeFindFileToggle<CR>", { desc = "Toggle file explorer on current file" }) -- toggle file explorer on current file
keymap.set("n", "<leader>ec", "<cmd>NvimTreeCollapse<CR>", { desc = "Collapse file explorer" }) -- collapse file explorer
keymap.set("n", "<leader>er", "<cmd>NvimTreeRefresh<CR>", { desc = "Refresh file explorer" }) -- refresh file explorer
end,
}

+ 53
- 0
.config/nvim/lua/tovi/plugins/nvim-treesitter.lua View File

@ -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,
},
}

+ 118
- 0
.config/nvim/lua/tovi/plugins/telescope.lua View File

@ -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 = {
["<C-k>"] = actions.move_selection_previous, -- move to prev result
["<C-j>"] = actions.move_selection_next, -- move to next result
["<C-q>"] = 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", "<c-d>", actions.git_delete_branch)
map("n", "<c-d>", 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", "<C-g>", builtin.live_grep, { desc = "Live grep over project files." })
keymap.set("n", "<C-p>", find_files, { desc = "Fuzzy find files in cwd" })
keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Fuzzy find open buffers" })
keymap.set("n", "<leader>fo", builtin.oldfiles, { desc = "Fuzzy find recently opened files" })
keymap.set("n", "<leader>m", builtin.marks, { desc = "Fuzzy find marks" })
keymap.set("n", "<leader>ch", builtin.command_history, { desc = "Fuzzy find recent commands" })
keymap.set("n", "<leader>gb", git_branches, { desc = "Fuzzy find git branches" })
keymap.set("n", "<leader>gs", builtin.git_status, { desc = "Fuzzy find current git status" })
keymap.set("n", "<leader>df", function()
builtin.find_files({
prompt_title = "< VimRC >",
cwd = vim.fn.expand("~/.config/nvim"),
hidden = true,
})
end, { desc = "Find neovim config files" })
end,
}

+ 6
- 0
.config/nvim/lua/tovi/plugins/undotree.lua View File

@ -0,0 +1,6 @@
return {
"mbbill/undotree",
config = function()
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
end,
}

+ 13
- 0
.config/nvim/lua/tovi/plugins/which-key.lua View File

@ -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
},
}

+ 0
- 37
.config/nvim/lua/utils/init.lua View File

@ -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

Loading…
Cancel
Save