mirror of
https://github.com/Baipyrus/nvim-config.git
synced 2024-12-27 05:41:45 +00:00
Compare commits
7 Commits
9fb7d5de4b
...
689f994fbd
Author | SHA1 | Date | |
---|---|---|---|
689f994fbd | |||
e95ecf56e6 | |||
9a4a5f31ae | |||
69c8790f6e | |||
15d4cfcdf7 | |||
12aa2d8a7b | |||
37ccad6701 |
@ -1,8 +0,0 @@
|
|||||||
-- 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',
|
|
||||||
}
|
|
@ -5,40 +5,42 @@ 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',
|
{
|
||||||
config = function()
|
'rhysd/conflict-marker.vim',
|
||||||
-- Read all lines in buffer, check if there is any conflict marker
|
config = function()
|
||||||
function git_conflict_detection()
|
-- Highlight groups
|
||||||
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
vim.cmd 'highlight ConflictMarkerBegin guibg=#2f7366'
|
||||||
-- Check if strict regex is contained in any line
|
vim.cmd 'highlight ConflictMarkerOurs guibg=#2e5049'
|
||||||
local beginning = vim.fn.match(lines, vim.g.conflict_marker_begin)
|
vim.cmd 'highlight ConflictMarkerTheirs guibg=#344f69'
|
||||||
local ending = vim.fn.match(lines, vim.g.conflict_marker_end)
|
vim.cmd 'highlight ConflictMarkerEnd guibg=#2f628e'
|
||||||
local enabled = vim.diagnostic.is_enabled()
|
vim.cmd 'highlight ConflictMarkerCommonAncestorsHunk guibg=#754a81'
|
||||||
if (beginning > -1 or ending > -1) and enabled then
|
|
||||||
vim.diagnostic.enable(false)
|
|
||||||
elseif not enabled then
|
|
||||||
vim.diagnostic.enable(true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Autocommand to disable diagnostics on buffer enter
|
-- Read all lines in buffer, check if there is any conflict marker
|
||||||
vim.api.nvim_create_autocmd('BufRead', {
|
function git_conflict_detection()
|
||||||
group = vim.api.nvim_create_augroup('git-conflict-lsp-disable', { clear = true }),
|
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
||||||
callback = git_conflict_detection,
|
-- Check if strict regex is contained in any line
|
||||||
})
|
local beginning = vim.fn.match(lines, vim.g.conflict_marker_begin)
|
||||||
-- Autocommand to disable diagnostics on save
|
local ending = vim.fn.match(lines, vim.g.conflict_marker_end)
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
local enabled = vim.diagnostic.is_enabled()
|
||||||
group = vim.api.nvim_create_augroup('git-conflict-lsp-disable', { clear = false }),
|
if (beginning > -1 or ending > -1) and enabled then
|
||||||
callback = git_conflict_detection,
|
vim.diagnostic.enable(false)
|
||||||
})
|
elseif not enabled then
|
||||||
end,
|
vim.diagnostic.enable(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Autocommand to disable diagnostics on buffer enter
|
||||||
|
vim.api.nvim_create_autocmd('BufRead', {
|
||||||
|
group = vim.api.nvim_create_augroup('git-conflict-lsp-disable', { clear = true }),
|
||||||
|
callback = git_conflict_detection,
|
||||||
|
})
|
||||||
|
-- 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,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,26 @@
|
|||||||
-- 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
|
{
|
||||||
'tpope/vim-fugitive',
|
-- Git related plugins
|
||||||
dependencies = {
|
'tpope/vim-fugitive',
|
||||||
{
|
dependencies = {
|
||||||
'rbong/vim-flog',
|
{
|
||||||
lazy = true,
|
'rbong/vim-flog',
|
||||||
cmd = { 'Flogsplit' },
|
lazy = true,
|
||||||
|
cmd = { 'Flogsplit' },
|
||||||
|
},
|
||||||
|
'idanarye/vim-merginal',
|
||||||
},
|
},
|
||||||
'idanarye/vim-merginal',
|
config = function()
|
||||||
|
-- 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' })
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
-- 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',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
return {
|
return {
|
||||||
-- Set lualine as statusline
|
{
|
||||||
'nvim-lualine/lualine.nvim',
|
-- Set lualine as statusline
|
||||||
-- See `:help lualine.txt`
|
'nvim-lualine/lualine.nvim',
|
||||||
opts = {
|
-- See `:help lualine.txt`
|
||||||
options = {
|
opts = {
|
||||||
icons_enabled = vim.g.have_nerd_font,
|
options = {
|
||||||
theme = 'catppuccin',
|
icons_enabled = vim.g.have_nerd_font,
|
||||||
section_separators = { left = '', right = '' },
|
theme = 'catppuccin',
|
||||||
component_separators = { left = '', right = '' },
|
section_separators = { left = '', right = '' },
|
||||||
|
component_separators = { left = '', right = '' },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
-- Markdown preview plugin
|
-- Markdown preview plugin
|
||||||
return {
|
return {
|
||||||
'iamcco/markdown-preview.nvim',
|
{
|
||||||
cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', 'MarkdownPreviewStop' },
|
'iamcco/markdown-preview.nvim',
|
||||||
build = 'cd app; npm install',
|
cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', 'MarkdownPreviewStop' },
|
||||||
init = function()
|
build = 'cd app; npm install',
|
||||||
vim.g.mkdp_filetypes = { 'markdown' }
|
init = function()
|
||||||
end,
|
vim.g.mkdp_filetypes = { 'markdown' }
|
||||||
ft = { 'markdown' },
|
end,
|
||||||
|
ft = { 'markdown' },
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,30 @@
|
|||||||
-- Smooth scroll plugin and keymaps
|
-- Smooth scroll plugin and keymaps
|
||||||
return {
|
return {
|
||||||
'karb94/neoscroll.nvim',
|
{
|
||||||
enabled = not vim.g.neovide,
|
'karb94/neoscroll.nvim',
|
||||||
config = function()
|
enabled = not vim.g.neovide,
|
||||||
require('neoscroll').setup {
|
config = function()
|
||||||
hide_cursor = false,
|
require('neoscroll').setup {
|
||||||
easing_function = nil,
|
hide_cursor = false,
|
||||||
respect_scrolloff = true,
|
easing_function = nil,
|
||||||
}
|
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,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,25 @@ vim.api.nvim_create_autocmd('BufLeave', {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'stevearc/oil.nvim',
|
{
|
||||||
opts = {},
|
'stevearc/oil.nvim',
|
||||||
-- Optional dependencies
|
-- Optional dependencies
|
||||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||||
config = function()
|
config = function()
|
||||||
require('oil').setup()
|
local oil = require 'oil'
|
||||||
vim.keymap.set('n', '<leader>fe', require('oil').open, { desc = '[F]ile [E]xplorer' })
|
oil.setup {
|
||||||
end,
|
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,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,47 +1,49 @@
|
|||||||
return {
|
return {
|
||||||
-- Simple task runner plugin
|
{
|
||||||
'stevearc/overseer.nvim',
|
-- Simple task runner plugin
|
||||||
opts = {},
|
'stevearc/overseer.nvim',
|
||||||
config = function()
|
opts = {},
|
||||||
local overseer = require 'overseer'
|
config = function()
|
||||||
overseer.setup {
|
local overseer = require 'overseer'
|
||||||
templates = {
|
overseer.setup {
|
||||||
'builtin',
|
templates = {
|
||||||
'golang.run_project',
|
'builtin',
|
||||||
'golang.run_file',
|
'golang.run_project',
|
||||||
},
|
'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()
|
||||||
overseer.toggle { winid = 0 }
|
overseer.toggle { winid = 0 }
|
||||||
if is_open() then
|
if is_open() then
|
||||||
vim.cmd.winc '_'
|
vim.cmd.winc '_'
|
||||||
else
|
else
|
||||||
vim.api.nvim_buf_delete(vim.api.nvim_get_current_buf(), {})
|
vim.api.nvim_buf_delete(vim.api.nvim_get_current_buf(), {})
|
||||||
end
|
end
|
||||||
end, { desc = '[O]verseer [L]og' })
|
end, { desc = '[O]verseer [L]og' })
|
||||||
-- Run task by listing all in floating
|
-- Run task by listing all in floating
|
||||||
vim.keymap.set('n', '<leader>or', '<cmd>OverseerRun<cr>', { desc = '[O]verseer [R]un' })
|
vim.keymap.set('n', '<leader>or', '<cmd>OverseerRun<cr>', { desc = '[O]verseer [R]un' })
|
||||||
end,
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
-- 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('language en_US', {})
|
vim.cmd 'language en_US'
|
||||||
|
|
||||||
-- Shell options
|
-- Shell options
|
||||||
-- Sets the shell to use for system() and ! commands in windows
|
-- Sets the shell to use for system() and ! commands in windows
|
||||||
|
Loading…
Reference in New Issue
Block a user