Compare commits

..

No commits in common. "b2d0788ede217a8caf18ec3c0aa64175435fed29" and "9373dd686ad1996b246730ccb14b7f0a31c4c2bf" have entirely different histories.

22 changed files with 238 additions and 368 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ test.sh
nvim nvim
spell/ spell/
lazy-lock.json

View File

@ -58,13 +58,13 @@ git clone https://github.com/Baipyrus/nvim-config.git "${XDG_CONFIG_HOME:-$HOME/
If you're using `cmd.exe`: If you're using `cmd.exe`:
```bat ```bat
git clone https://github.com/Baipyrus/nvim-config.git "%localappdata%\nvim\" git clone https://github.com/Baipyrus/nvim-config.git %localappdata%\nvim\
``` ```
If you're using `powershell.exe` If you're using `powershell.exe`
```pwsh ```pwsh
git clone https://github.com/Baipyrus/nvim-config.git "${env:LOCALAPPDATA}\nvim" git clone https://github.com/Baipyrus/nvim-config.git $env:LOCALAPPDATA\nvim\
``` ```
</details> </details>
@ -103,7 +103,7 @@ current plugin status. Hit `q` to close the window.
You can apply both of these approaches to any Neovim You can apply both of these approaches to any Neovim
distribution that you would like to try out. distribution that you would like to try out.
* What if I want to "uninstall" this configuration: * What if I want to "uninstall" this configuration:
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
### Install Recipes ### Install Recipes

View File

@ -1,46 +0,0 @@
{
"LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conflict-marker.vim": { "branch": "master", "commit": "62742b2ffe7a433988759c67b5c5a22eff74a14b" },
"conform.nvim": { "branch": "master", "commit": "f5bd8419f8a29451e20bdb1061a54fe13d5c8de3" },
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
"gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" },
"indent-blankline.nvim": { "branch": "master", "commit": "e7a4442e055ec953311e77791546238d1eaae507" },
"lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" },
"lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.nvim": { "branch": "main", "commit": "d4ce7d025f9c7bb4d55ebc4fd88987651e632893" },
"nvim": { "branch": "main", "commit": "7be452ee067978cdc8b2c5f3411f0c71ffa612b9" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-jdtls": { "branch": "master", "commit": "efe813854432a314b472226dca813f0f2598d44a" },
"nvim-lint": { "branch": "master", "commit": "b3ab4ba88845893663d0b7122ee82921adf28358" },
"nvim-lspconfig": { "branch": "master", "commit": "541f3a2781de481bb84883889e4d9f0904250a56" },
"nvim-treesitter": { "branch": "master", "commit": "03452942dfbd998701d4123ccad2090e1bc7e9f1" },
"nvim-treesitter-context": { "branch": "master", "commit": "78a81c7494e7d1a08dd1200b556933e513fd9f29" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "0d79d169fcd45a8da464727ac893044728f121d4" },
"nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
"oil.nvim": { "branch": "master", "commit": "39dbf875861449cf09e936fa80073f3413e9439c" },
"overseer.nvim": { "branch": "master", "commit": "6f8bc37eb729a00e185cdf38b1ed3309a05bfeef" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
"vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" },
"vim-flog": { "branch": "master", "commit": "6f80c1ffa7068ca8cc0e29af7af4f6ed0717e65e" },
"vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" },
"vim-lastplace": { "branch": "master", "commit": "e58cb0df716d3c88605ae49db5c4741db8b48aa9" },
"vim-merginal": { "branch": "develop", "commit": "3dca10fd8bce10edbc2024651db4ffb6dd2d89de" },
"vim-processing": { "branch": "master", "commit": "91aaa18a54f8e507e48353ba87b1eb4ecd82a17c" },
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
"which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" }
}

View File

@ -0,0 +1,8 @@
-- Set keymap to open chat in browser
vim.keymap.set('n', '<leader>cc', ':execute codeium#Chat()<Enter>', { desc = '[C]odeium [C]hat' })
return {
-- Free Github Copilot alternative
'Exafunction/codeium.vim',
event = 'BufEnter',
}

View File

@ -5,38 +5,40 @@ vim.g.conflict_marker_highlight_group = ''
vim.g.conflict_marker_begin = '^<<<<<<< .*$' vim.g.conflict_marker_begin = '^<<<<<<< .*$'
vim.g.conflict_marker_end = '^>>>>>>> .*$' vim.g.conflict_marker_end = '^>>>>>>> .*$'
-- Highlight groups
vim.cmd 'highlight ConflictMarkerBegin guibg=#2f7366'
vim.cmd 'highlight ConflictMarkerOurs guibg=#2e5049'
vim.cmd 'highlight ConflictMarkerTheirs guibg=#344f69'
vim.cmd 'highlight ConflictMarkerEnd guibg=#2f628e'
vim.cmd 'highlight ConflictMarkerCommonAncestorsHunk guibg=#754a81'
-- Git conflict marker management plugin -- Git conflict marker management plugin
return { return {
{ 'rhysd/conflict-marker.vim',
'rhysd/conflict-marker.vim', config = function()
config = function() -- Read all lines in buffer, check if there is any conflict marker
-- Highlight groups function git_conflict_detection()
vim.cmd 'highlight ConflictMarkerBegin guibg=#2f7366' local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
vim.cmd 'highlight ConflictMarkerOurs guibg=#2e5049' -- Check if strict regex is contained in any line
vim.cmd 'highlight ConflictMarkerTheirs guibg=#344f69' local beginning = vim.fn.match(lines, vim.g.conflict_marker_begin)
vim.cmd 'highlight ConflictMarkerEnd guibg=#2f628e' local ending = vim.fn.match(lines, vim.g.conflict_marker_end)
vim.cmd 'highlight ConflictMarkerCommonAncestorsHunk guibg=#754a81' local enabled = vim.diagnostic.is_enabled()
if (beginning > -1 or ending > -1) and enabled then
-- Read all lines in buffer, check if there is any conflict marker vim.diagnostic.enable(false)
function git_conflict_detection() elseif not enabled then
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) vim.diagnostic.enable(true)
-- Check if strict regex is contained in any line
local beginning = vim.fn.match(lines, vim.g.conflict_marker_begin)
local ending = vim.fn.match(lines, vim.g.conflict_marker_end)
local enabled = vim.diagnostic.is_enabled()
local conflict = beginning > -1 or ending > -1
if conflict and enabled then
vim.diagnostic.enable(false)
elseif not conflict and not enabled then
vim.diagnostic.enable(true)
end
end end
end
-- Autocommand to disable diagnostics on buffer enter -- Autocommand to disable diagnostics on buffer enter
vim.api.nvim_create_autocmd({ 'BufRead', 'BufWritePre' }, { vim.api.nvim_create_autocmd('BufRead', {
group = vim.api.nvim_create_augroup('git-conflict-lsp-disable', { clear = true }), group = vim.api.nvim_create_augroup('git-conflict-lsp-disable', { clear = true }),
callback = git_conflict_detection, callback = git_conflict_detection,
}) })
end, -- Autocommand to disable diagnostics on save
}, vim.api.nvim_create_autocmd('BufWritePre', {
group = vim.api.nvim_create_augroup('git-conflict-lsp-disable', { clear = false }),
callback = git_conflict_detection,
})
end,
} }

View File

@ -1,28 +1,23 @@
-- Switch in fugitive.vim status window with the current one
vim.keymap.set('n', '<leader>gs', '<cmd>Gedit :<cr>', { desc = '[G]it [S]tatus' })
-- Fetch all changes
vim.keymap.set('n', '<leader>gF', '<cmd>Git fetch<cr>', { desc = '[G]it [F]etch' })
-- Push changes
vim.keymap.set('n', '<leader>gP', '<cmd>Git push<cr>', { desc = '[G]it [P]ush' })
-- Pull changes
vim.keymap.set('n', '<leader>gp', '<cmd>Git pull<cr>', { desc = '[G]it [P]ull' })
-- Open history graph
vim.keymap.set('n', '<leader>gl', '<cmd>Flogsplit<cr><cmd>wincmd k<cr><cmd>q<cr>', { desc = '[G]it [L]og' })
return { return {
{ -- Git related plugins
-- Git related plugins 'tpope/vim-fugitive',
'tpope/vim-fugitive', dependencies = {
dependencies = { {
{ 'rbong/vim-flog',
'rbong/vim-flog', lazy = true,
lazy = true, cmd = { 'Flogsplit' },
cmd = { 'Flogsplit' },
},
'idanarye/vim-merginal',
}, },
config = function() 'idanarye/vim-merginal',
-- Switch in fugitive.vim status window with the current one
vim.keymap.set('n', '<leader>gs', '<cmd>Gedit :<cr>', { desc = '[G]it [S]tatus' })
-- Fetch all changes
vim.keymap.set('n', '<leader>gF', '<cmd>Git fetch<cr>', { desc = '[G]it [F]etch' })
-- Push changes
vim.keymap.set('n', '<leader>gP', '<cmd>Git push<cr>', { desc = '[G]it [P]ush' })
-- Pull changes
vim.keymap.set('n', '<leader>gp', '<cmd>Git pull<cr>', { desc = '[G]it [P]ull' })
-- Open history graph
vim.keymap.set('n', '<leader>gl', '<cmd>Flogsplit<cr><cmd>wincmd k<cr><cmd>q<cr>', { desc = '[G]it [L]og' })
-- Open branch manager
vim.keymap.set('n', '<leader>gm', '<cmd>Merginal<cr>', { desc = '[G]it [M]erginal' })
end,
}, },
} }

View File

@ -1,6 +1,4 @@
-- Plugin to intelligently reopen files at last edit position -- Plugin to intelligently reopen files at last edit position
return { return {
{ 'farmergreg/vim-lastplace',
'farmergreg/vim-lastplace',
},
} }

View File

@ -1,15 +1,13 @@
return { return {
{ -- Set lualine as statusline
-- Set lualine as statusline 'nvim-lualine/lualine.nvim',
'nvim-lualine/lualine.nvim', -- See `:help lualine.txt`
-- See `:help lualine.txt` opts = {
opts = { options = {
options = { icons_enabled = vim.g.have_nerd_font,
icons_enabled = vim.g.have_nerd_font, theme = 'catppuccin',
theme = 'catppuccin', section_separators = { left = '', right = '' },
section_separators = { left = '', right = '' }, component_separators = { left = '', right = '' },
component_separators = { left = '', right = '' },
},
}, },
}, },
} }

View File

@ -1,12 +1,10 @@
-- Markdown preview plugin -- Markdown preview plugin
return { return {
{ 'iamcco/markdown-preview.nvim',
'iamcco/markdown-preview.nvim', cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', 'MarkdownPreviewStop' },
cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', 'MarkdownPreviewStop' }, build = 'cd app; npm install',
build = 'cd app; npm install', init = function()
init = function() vim.g.mkdp_filetypes = { 'markdown' }
vim.g.mkdp_filetypes = { 'markdown' } end,
end, ft = { 'markdown' },
ft = { 'markdown' },
},
} }

View File

@ -1,30 +1,28 @@
-- Smooth scroll plugin and keymaps -- Smooth scroll plugin and keymaps
return { return {
{ 'karb94/neoscroll.nvim',
'karb94/neoscroll.nvim', enabled = not vim.g.neovide,
enabled = not vim.g.neovide, config = function()
config = function() require('neoscroll').setup {
require('neoscroll').setup { hide_cursor = false,
hide_cursor = false, easing_function = nil,
easing_function = nil, respect_scrolloff = true,
respect_scrolloff = true, }
}
require('neoscroll.config').set_mappings { require('neoscroll.config').set_mappings {
-- Scroll normally -- Scroll normally
['<C-u>'] = { 'scroll', { '-vim.wo.scroll', 'true', '50' } }, ['<C-u>'] = { 'scroll', { '-vim.wo.scroll', 'true', '50' } },
['<C-d>'] = { 'scroll', { 'vim.wo.scroll', 'true', '50' } }, ['<C-d>'] = { 'scroll', { 'vim.wo.scroll', 'true', '50' } },
-- Scroll entire page height -- Scroll entire page height
['<C-b>'] = { 'scroll', { '-vim.api.nvim_win_get_height(0)', 'true', '80' } }, ['<C-b>'] = { 'scroll', { '-vim.api.nvim_win_get_height(0)', 'true', '80' } },
['<C-f>'] = { 'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '80' } }, ['<C-f>'] = { 'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '80' } },
-- Scroll 10% at a time -- Scroll 10% at a time
['<C-y>'] = { 'scroll', { '-0.10', 'false', '25' } }, ['<C-y>'] = { 'scroll', { '-0.10', 'false', '25' } },
['<C-e>'] = { 'scroll', { '0.10', 'false', '25' } }, ['<C-e>'] = { 'scroll', { '0.10', 'false', '25' } },
-- Jump to top, bottom and center -- Jump to top, bottom and center
['zt'] = { 'zt', { '40' } }, ['zt'] = { 'zt', { '40' } },
['zz'] = { 'zz', { '50' } }, ['zz'] = { 'zz', { '50' } },
['zb'] = { 'zb', { '40' } }, ['zb'] = { 'zb', { '40' } },
} }
end, end,
},
} }

View File

@ -1,33 +1,20 @@
-- Fix oil absolute path to relative path conversion
vim.api.nvim_create_augroup('OilRelPathFix', {})
vim.api.nvim_create_autocmd('BufLeave', {
group = 'OilRelPathFix',
pattern = 'oil:///*',
callback = function()
vim.cmd 'cd .'
end,
})
return { return {
{ 'stevearc/oil.nvim',
'stevearc/oil.nvim', opts = {},
-- Optional dependencies -- Optional dependencies
dependencies = { 'nvim-tree/nvim-web-devicons' }, dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function() config = function()
-- Fix oil absolute path to relative path conversion require('oil').setup()
vim.api.nvim_create_augroup('OilRelPathFix', {}) vim.keymap.set('n', '<leader>fe', require('oil').open, { desc = '[F]ile [E]xplorer' })
vim.api.nvim_create_autocmd('BufLeave', { end,
group = 'OilRelPathFix',
pattern = 'oil:///*',
callback = function()
vim.cmd 'cd .'
end,
})
local oil = require 'oil'
oil.setup {
view_options = {
show_hidden = true,
},
}
vim.keymap.set('n', '<leader>fe', function()
if vim.bo.filetype == 'oil' then
oil.close()
else
oil.open()
end
end, { desc = '[F]ile [E]xplorer' })
end,
},
} }

View File

@ -1,61 +1,47 @@
return { return {
{ -- Simple task runner plugin
-- Simple task runner plugin 'stevearc/overseer.nvim',
'stevearc/overseer.nvim', opts = {},
opts = {}, config = function()
config = function() local overseer = require 'overseer'
local overseer = require 'overseer' overseer.setup {
overseer.setup { templates = {
templates = { 'builtin',
'builtin', 'golang.run_project',
'golang.run_project', 'golang.run_file',
'golang.run_file', },
task_list = {
bindings = {
['<C-h>'] = false,
['<C-j>'] = false,
['<C-k>'] = false,
['<C-l>'] = false,
['q'] = false,
}, },
task_list = { },
bindings = { }
['<C-h>'] = false,
['<C-j>'] = false,
['<C-k>'] = false,
['<C-l>'] = false,
['q'] = false,
},
},
}
-- Reference: overseer.nvim/lua/overseer/window.lua -- Reference: overseer.nvim/lua/overseer/window.lua
local function is_open() local function is_open()
for _, winid in ipairs(vim.api.nvim_tabpage_list_wins(0)) do for _, winid in ipairs(vim.api.nvim_tabpage_list_wins(0)) do
local bufnr = vim.api.nvim_win_get_buf(winid) local bufnr = vim.api.nvim_win_get_buf(winid)
if vim.bo[bufnr].filetype == 'OverseerList' then if vim.bo[bufnr].filetype == 'OverseerList' then
return true return true
end
end end
return false
end end
return false
end
-- Display status info about tasks -- Display status info about tasks
vim.keymap.set('n', '<leader>ol', function() vim.keymap.set('n', '<leader>ol', function()
-- Get currently open windows (detects splits) overseer.toggle { winid = 0 }
local curWindows = #vim.api.nvim_tabpage_list_wins(0) if is_open() then
-- Use builtin toggle if already using splits vim.cmd.winc '_'
if curWindows ~= (is_open() and 2 or 1) then else
vim.cmd 'OverseerToggle' vim.api.nvim_buf_delete(vim.api.nvim_get_current_buf(), {})
return end
end end, { desc = '[O]verseer [L]og' })
-- Run task by listing all in floating
-- Otherwise, toggle overseer in fullscreen vim.keymap.set('n', '<leader>or', '<cmd>OverseerRun<cr>', { desc = '[O]verseer [R]un' })
overseer.toggle { winid = 0 } end,
local bufnr = vim.api.nvim_get_current_buf()
if is_open() then
-- Maximize height
vim.cmd.winc '_'
elseif vim.bo[bufnr].filetype == '' and vim.bo.buftype ~= 'terminal' then
-- Delete empty buffer created by overseer
vim.api.nvim_buf_delete(bufnr, {})
end
end, { desc = '[O]verseer [L]og' })
-- Run task by listing all in floating
vim.keymap.set('n', '<leader>or', '<cmd>OverseerRun<cr>', { desc = '[O]verseer [R]un' })
end,
},
} }

View File

@ -1,8 +0,0 @@
return {
{
'moll/vim-bbye',
config = function()
vim.keymap.set('n', '<leader>bd', '<cmd>Bdelete<cr>', { desc = '[B]uffer [D]elete' })
end,
},
}

View File

@ -1,15 +1,15 @@
-- [[ Basic Keymaps ]] -- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()` -- See `:help vim.keymap.set()`
-- Clear highlights on search when pressing <Esc> in normal mode -- Set highlight on search, but clear on pressing <Esc> in normal mode
-- See `:help hlsearch` vim.opt.hlsearch = true
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps -- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setqflist, { desc = 'Open diagnostic [Q]uickfix list' }) vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping -- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
@ -33,6 +33,11 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- Delete (currently selected) text without yanking it
vim.keymap.set({ 'n', 'v' }, '<leader>dny', '"_d', { desc = '[D]elete [N]o [Y]ank' })
-- Replace currently selected text with default register without yanking it
vim.keymap.set('v', '<leader>pny', '"_dP', { desc = '[P]aste [N]o [Y]ank' })
-- Populate CMD to prepare for change directory -- Populate CMD to prepare for change directory
vim.keymap.set('n', '<leader>cd ', ':cd ', { desc = 'Prepare CMD for [C]hange [D]irectory' }) vim.keymap.set('n', '<leader>cd ', ':cd ', { desc = 'Prepare CMD for [C]hange [D]irectory' })
-- Navigate to 'base' directory, the initial dir that nvim was run in -- Navigate to 'base' directory, the initial dir that nvim was run in
@ -42,6 +47,15 @@ vim.keymap.set('n', '<leader>cdh', '<cmd>cd ' .. vim.env.HOME .. '<cr>', { desc
-- Automatically navigate to config directory -- Automatically navigate to config directory
vim.keymap.set('n', '<leader>cdn', '<cmd>cd ' .. vim.fn.stdpath 'config' .. '<cr>', { desc = '[C]hange [D]irectory to [N]eovim' }) vim.keymap.set('n', '<leader>cdn', '<cmd>cd ' .. vim.fn.stdpath 'config' .. '<cr>', { desc = '[C]hange [D]irectory to [N]eovim' })
-- Delete current buffer without closing window
vim.keymap.set('n', '<leader>bd', function()
-- Get current buffer
local buf = vim.api.nvim_get_current_buf()
-- Switch to different buffer
vim.cmd 'bp'
-- Delete saved buffer
vim.api.nvim_buf_delete(buf, {})
end, { desc = '[B]uffer [D]elete' })
-- Switch to between buffers -- Switch to between buffers
vim.keymap.set('n', '<leader>bp', '<cmd>bp<cr>', { desc = '[B]uffer [P]revious' }) vim.keymap.set('n', '<leader>bp', '<cmd>bp<cr>', { desc = '[B]uffer [P]revious' })
vim.keymap.set('n', '<leader>bn', '<cmd>bn<cr>', { desc = '[B]uffer [N]ext' }) vim.keymap.set('n', '<leader>bn', '<cmd>bn<cr>', { desc = '[B]uffer [N]ext' })
@ -111,8 +125,8 @@ vim.keymap.set({ 'n', 'v' }, '<leader>gy', global_cmd_yank, { desc = '[G]lobal c
-- Fix filename keymap -- Fix filename keymap
vim.keymap.set({ 'n', 'v' }, '<leader>fp', function() vim.keymap.set({ 'n', 'v' }, '<leader>fp', function()
-- lua print(string.gsub(vim.api.nvim_buf_get_name(0), vim.fn.getcwd(), '')) -- lua print(string.gsub(vim.api.nvim_buf_get_name(0), vim.fn.getcwd(), ''))
local cwd = vim.fn.getcwd():lower() local cwd = vim.fn.getcwd()
local path = vim.api.nvim_buf_get_name(0):lower() local path = vim.api.nvim_buf_get_name(0)
local file, _ = string.gsub(path, cwd .. '\\', '') local file, _ = string.gsub(path, cwd .. '\\', '')
vim.cmd('0f | file ' .. file) vim.cmd('0f | file ' .. file)
end, { desc = '[F]ile Fix Relative [P]ath' }) end, { desc = '[F]ile Fix Relative [P]ath' })
@ -123,8 +137,6 @@ if vim.g.neovide then
vim.keymap.set({ 'n', 'v' }, '<C-S-v>', '"+p', { desc = 'Paste from System clipboard' }) vim.keymap.set({ 'n', 'v' }, '<C-S-v>', '"+p', { desc = 'Paste from System clipboard' })
-- Clipboard for command and insert mode -- Clipboard for command and insert mode
vim.keymap.set({ 'c', 'i' }, '<C-S-v>', '<C-R>+', { desc = 'Paste from System clipboard' }) vim.keymap.set({ 'c', 'i' }, '<C-S-v>', '<C-R>+', { desc = 'Paste from System clipboard' })
-- Clipboard for terminal mode
vim.keymap.set({ 't' }, '<C-S-v>', '<C-\\><C-n>"+pi', { desc = 'Paste from System clipboard' })
end end
-- [[ Basic Autocommands ]] -- [[ Basic Autocommands ]]

View File

@ -7,7 +7,7 @@ return {
{ {
'<leader>fb', '<leader>fb',
function() function()
require('conform').format { async = true, lsp_format = 'fallback' } require('conform').format { async = true, lsp_fallback = true }
end, end,
mode = '', mode = '',
desc = '[F]ormat [B]uffer', desc = '[F]ormat [B]uffer',
@ -20,15 +20,9 @@ return {
-- have a well standardized coding style. You can add additional -- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones. -- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true, php = true } local disable_filetypes = { c = true, cpp = true, php = true }
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never'
else
lsp_format_opt = 'fallback'
end
return { return {
timeout_ms = 500, timeout_ms = 500,
lsp_format = lsp_format_opt, lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
} }
end, end,
formatters_by_ft = { formatters_by_ft = {
@ -36,8 +30,9 @@ return {
-- Conform can also run multiple formatters sequentially -- Conform can also run multiple formatters sequentially
python = { 'isort', 'black' }, python = { 'isort', 'black' },
-- You can use 'stop_after_first' to run the first available formatter from the list -- You can use a sub-list to tell conform to run *until* a formatter
javascript = { 'prettierd', 'prettier', stop_after_first = true }, -- is found.
javascript = { { 'prettierd', 'prettier' } },
}, },
}, },
}, },

View File

@ -8,7 +8,6 @@ return {
lint.linters_by_ft = { lint.linters_by_ft = {
javascript = { 'eslint' }, javascript = { 'eslint' },
typescript = { 'eslint' }, typescript = { 'eslint' },
php = { 'eslint' },
markdown = { 'markdownlint' }, markdown = { 'markdownlint' },
} }
@ -18,7 +17,7 @@ return {
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup, group = lint_augroup,
callback = function() callback = function()
lint.try_lint(nil, { ignore_errors = true }) lint.try_lint()
end, end,
}) })
end, end,

View File

@ -1,20 +1,5 @@
-- LSP Plugins
return { return {
{ { -- LSP Configuration & Plugins
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
{ 'Bilal2453/luvit-meta', lazy = true },
{
-- Main LSP Configuration
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
dependencies = { dependencies = {
-- Automatically install LSPs and related tools to stdpath for Neovim -- Automatically install LSPs and related tools to stdpath for Neovim
@ -27,8 +12,19 @@ return {
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ 'j-hui/fidget.nvim', opts = {} }, { 'j-hui/fidget.nvim', opts = {} },
-- Allows extra capabilities provided by nvim-cmp -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
'hrsh7th/cmp-nvim-lsp', -- used for completion, annotations and signatures of Neovim apis
{
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
{ 'Bilal2453/luvit-meta', lazy = true },
}, },
config = function() config = function()
-- Brief aside: **What is LSP?** -- Brief aside: **What is LSP?**
@ -68,9 +64,8 @@ return {
-- --
-- In this case, we create a function that lets us more easily define mappings specific -- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time. -- for LSP related items. It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc, mode) local map = function(keys, func, desc)
mode = mode or 'n' vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end end
-- Jump to the definition of the word under your cursor. -- Jump to the definition of the word under your cursor.
@ -107,13 +102,11 @@ return {
-- Execute a code action, usually your cursor needs to be on top of an error -- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate. -- or a suggestion from your LSP for this to activate.
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
-- Opens a popup that displays documentation about the word under your cursor -- Opens a popup that displays documentation about the word under your cursor
-- See `:help K` for why this keymap. -- See `:help K` for why this keymap.
map('K', vim.lsp.buf.hover, 'Hover Documentation') map('K', vim.lsp.buf.hover, 'Hover Documentation')
-- Similar as above, shows hover documentation for current function
vim.keymap.set('i', '<C-k>', vim.lsp.buf.signature_help, { buffer = event.buf, desc = 'LSP: ' .. 'Hover Signature Information' })
-- WARN: This is not Goto Definition, this is Goto Declaration. -- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header. -- For example, in C this would take you to the header.
@ -177,13 +170,12 @@ return {
-- - settings (table): Override the default settings passed when initializing the server. -- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = { local servers = {
powershell_es = {},
rust_analyzer = {}, rust_analyzer = {},
tailwindcss = {}, tailwindcss = {},
omnisharp = {}, omnisharp = {},
tsserver = {},
pyright = {}, pyright = {},
svelte = {}, svelte = {},
ts_ls = {},
gopls = {}, gopls = {},
intelephense = {}, intelephense = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
@ -316,7 +308,7 @@ return {
local server = servers[server_name] or {} local server = servers[server_name] or {}
-- This handles overriding only values explicitly passed -- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling -- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for ts_ls) -- certain features of an LSP (for example, turning off formatting for tsserver)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server) require('lspconfig')[server_name].setup(server)
end, end,

View File

@ -111,12 +111,8 @@ return {
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', function() vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
builtin.oldfiles { vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
only_cwd = true,
}
end, { desc = '[S]earch [R]ecent Files in CWD' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Global Files' })
vim.keymap.set('n', '<leader>sc', builtin.command_history, { desc = '[S]earch [C]ommand History' }) vim.keymap.set('n', '<leader>sc', builtin.command_history, { desc = '[S]earch [C]ommand History' })
vim.keymap.set('n', '<leader><leader>', function() vim.keymap.set('n', '<leader><leader>', function()
builtin.buffers { builtin.buffers {

View File

@ -6,8 +6,6 @@ return {
'nvim-treesitter/nvim-treesitter-textobjects', 'nvim-treesitter/nvim-treesitter-textobjects',
}, },
build = ':TSUpdate', build = ':TSUpdate',
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = { opts = {
ensure_installed = { ensure_installed = {
-- kickstart -- kickstart
@ -32,7 +30,6 @@ return {
'rust', 'rust',
'c_sharp', 'c_sharp',
'go', 'go',
'powershell',
-- git -- git
'gitcommit', 'gitcommit',
'gitignore', 'gitignore',
@ -105,6 +102,14 @@ return {
}, },
}, },
}, },
config = function(_, opts)
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
-- Prefer git instead of curl in order to improve connectivity in some environments
require('nvim-treesitter.install').prefer_git = true
---@diagnostic disable-next-line: missing-fields
require('nvim-treesitter.configs').setup(opts)
end,
}, },
} }
-- vim: ts=2 sts=2 sw=2 et -- vim: ts=2 sts=2 sw=2 et

View File

@ -17,49 +17,12 @@ return {
{ -- Useful plugin to show you pending keybinds. { -- Useful plugin to show you pending keybinds.
'folke/which-key.nvim', 'folke/which-key.nvim',
event = 'VimEnter', -- Sets the loading event to 'VimEnter' event = 'VimEnter', -- Sets the loading event to 'VimEnter'
opts = { config = function() -- This is the function that runs, AFTER loading
icons = { require('which-key').setup()
-- set icon mappings to true if you have a Nerd Font
mappings = vim.g.have_nerd_font,
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ',
Down = '<Down> ',
Left = '<Left> ',
Right = '<Right> ',
C = '<C-…> ',
M = '<M-…> ',
D = '<D-…> ',
S = '<S-…> ',
CR = '<CR> ',
Esc = '<Esc> ',
ScrollWheelDown = '<ScrollWheelDown> ',
ScrollWheelUp = '<ScrollWheelUp> ',
NL = '<NL> ',
BS = '<BS> ',
Space = '<Space> ',
Tab = '<Tab> ',
F1 = '<F1>',
F2 = '<F2>',
F3 = '<F3>',
F4 = '<F4>',
F5 = '<F5>',
F6 = '<F6>',
F7 = '<F7>',
F8 = '<F8>',
F9 = '<F9>',
F10 = '<F10>',
F11 = '<F11>',
F12 = '<F12>',
},
},
-- Document existing key chains -- Document existing key chains
spec = { require('which-key').add {
{ '<leader>c', group = '[C]ode-/[C]hange' }, { '<leader>c', group = '[C]ode-/[C]hange' },
{ '<leader>c', group = '[C]ode', mode = { 'x' } }, { '<leader>d', group = '[D]ocument/[D]elete', mode = { 'n', 'v' } },
{ '<leader>d', group = '[D]ocument' },
{ '<leader>r', group = '[R]ename' }, { '<leader>r', group = '[R]ename' },
{ '<leader>s', group = '[S]earch' }, { '<leader>s', group = '[S]earch' },
{ '<leader>w', group = '[W]orkspace' }, { '<leader>w', group = '[W]orkspace' },
@ -68,11 +31,14 @@ return {
{ '<leader>g', group = '[G]it/[G]lobal', mode = { 'n', 'v' } }, { '<leader>g', group = '[G]it/[G]lobal', mode = { 'n', 'v' } },
{ '<leader>b', group = '[B]uffer/[B]reakpoint' }, { '<leader>b', group = '[B]uffer/[B]reakpoint' },
{ '<leader>cd', group = '[D]irectory' }, { '<leader>cd', group = '[D]irectory' },
{ '<leader>dn', group = '[N]o', mode = { 'n', 'v' } },
{ '<leader>l', group = '[L]ist', mode = { 'n', 'v' } }, { '<leader>l', group = '[L]ist', mode = { 'n', 'v' } },
{ '<leader>f', group = '[F]ormat/[F]ile', mode = { 'n', 'v' } }, { '<leader>f', group = '[F]ormat/[F]ile', mode = { 'n', 'v' } },
{ '<leader>o', group = '[O]verseer', mode = { 'n', 'v' } }, { '<leader>o', group = '[O]verseer', mode = { 'n', 'v' } },
}, { '<leader>p', group = '[P]aste', mode = { 'v' } },
}, { '<leader>pn', group = '[N]o', mode = { 'v' } },
}
end,
}, },
} }
-- vim: ts=2 sts=2 sw=2 et -- vim: ts=2 sts=2 sw=2 et

View File

@ -1,7 +1,7 @@
-- [[ Install `lazy.nvim` plugin manager ]] -- [[ Install `lazy.nvim` plugin manager ]]
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then if not vim.uv.fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git' local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system { local out = vim.fn.system {
'git', 'git',

View File

@ -4,12 +4,12 @@
-- For more options, you can see `:help option-list` -- For more options, you can see `:help option-list`
-- Set display language -- Set display language
vim.cmd 'silent! language en_US' vim.cmd('language en_US', {})
-- Shell options -- Shell options
-- Sets the shell to use for system() and ! commands in windows and wsl -- Sets the shell to use for system() and ! commands in windows
if vim.fn.has 'win32' == 1 or vim.fn.has 'wsl' == 1 then if vim.fn.has 'win32' == 1 and vim.fn.has 'wsl' == 0 then
vim.opt.shell = vim.fn.executable 'pwsh.exe' == 1 and 'pwsh.exe' or 'powershell.exe' vim.opt.shell = vim.fn.executable 'pwsh' == 1 and 'pwsh' or 'powershell'
vim.opt.shellcmdflag = '-NoLogo -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;' vim.opt.shellcmdflag = '-NoLogo -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
vim.opt.shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait' vim.opt.shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait'
vim.opt.shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode' vim.opt.shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
@ -38,12 +38,9 @@ vim.opt.mouse = 'a'
vim.opt.showmode = false vim.opt.showmode = false
-- Sync clipboard between OS and Neovim. -- Sync clipboard between OS and Neovim.
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent. -- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'` -- See `:help 'clipboard'`
vim.schedule(function() vim.opt.clipboard = 'unnamedplus'
vim.opt.clipboard = 'unnamedplus'
end)
-- Enable break indent -- Enable break indent
vim.opt.breakindent = true vim.opt.breakindent = true
@ -92,21 +89,12 @@ vim.opt.sidescrolloff = 12
-- Set cursor pointer to block -- Set cursor pointer to block
vim.opt.guicursor = 'n-v-i-c:block-Cursor' vim.opt.guicursor = 'n-v-i-c:block-Cursor'
-- Set global statusline -- Options specifically targeted at Neovide
vim.o.laststatus = 3 if vim.g.neovide then
vim.api.nvim_set_hl(0, 'WinSeparator', { bg = nil }) vim.o.guifont = 'CaskaydiaCove Nerd Font Mono:h14'
vim.g.neovide_hide_mouse_when_typing = true
vim.api.nvim_create_autocmd('UIEnter', { vim.g.neovide_cursor_animation_length = 0
group = vim.api.nvim_create_augroup('SetGUISettings', { clear = true }), vim.g.neovide_cursor_trail_length = 0
callback = function() end
-- Options specifically targeted at Neovide
if vim.g.neovide then
vim.o.guifont = 'CaskaydiaCove Nerd Font Mono:h14'
vim.g.neovide_hide_mouse_when_typing = true
vim.g.neovide_cursor_animation_length = 0
vim.g.neovide_cursor_trail_length = 0
end
end,
})
-- vim: ts=2 sts=2 sw=2 et -- vim: ts=2 sts=2 sw=2 et