mirror of
https://github.com/kossLAN/nvim-flake.git
synced 2025-11-04 17:59:50 -05:00
plugin updates
This commit is contained in:
parent
fd4cc7c8e6
commit
2019cab65d
8 changed files with 113 additions and 59 deletions
|
|
@ -86,6 +86,13 @@ with final.pkgs.lib; let
|
|||
tokyonight-nvim
|
||||
# QOL Plugin for visuals mostly
|
||||
mini-nvim # https://github.com/echasnovski/mini.nvim/
|
||||
# Debugging
|
||||
nvim-dap
|
||||
|
||||
# Copilot related plugins
|
||||
CopilotChat-nvim
|
||||
copilot-cmp
|
||||
copilot-lua
|
||||
];
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
|
|
@ -99,6 +106,9 @@ with final.pkgs.lib; let
|
|||
alejandra # amazing nix autoformatter
|
||||
stylua # lua formatter
|
||||
google-java-format # java formatter based off google guidelines
|
||||
|
||||
# misc
|
||||
nodejs # eww
|
||||
];
|
||||
in {
|
||||
# This is the neovim derivation
|
||||
|
|
|
|||
|
|
@ -44,6 +44,14 @@ opt.cmdheight = 0
|
|||
|
||||
opt.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
||||
|
||||
-- Restore cursor position
|
||||
vim.api.nvim_create_autocmd({ 'BufReadPost' }, {
|
||||
pattern = { '*' },
|
||||
callback = function()
|
||||
vim.api.nvim_exec2('silent! normal! g`"zv', { output = false })
|
||||
end,
|
||||
})
|
||||
|
||||
-- Configure Neovim diagnostic messages
|
||||
|
||||
local function prefix_diagnostic(prefix, diagnostic)
|
||||
|
|
@ -102,4 +110,4 @@ cmd.packadd('cfilter') -- Allows filtering the quickfix list with :cfdo
|
|||
vim.g.sqlite_clib_path = require('luv').os_getenv('LIBSQLITE')
|
||||
|
||||
-- Vim Theme
|
||||
vim.cmd.colorscheme 'tokyonight-night'
|
||||
vim.cmd.colorscheme('tokyonight-night')
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ cmp.setup {
|
|||
-- The insertion order influences the priority of the sources
|
||||
{ name = 'nvim_lsp', keyword_length = 3 },
|
||||
{ name = 'nvim_lsp_signature_help', keyword_length = 3 },
|
||||
{ name = 'copilot' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
},
|
||||
|
|
|
|||
15
nvim/plugin/copilot.lua
Normal file
15
nvim/plugin/copilot.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
-- Copilot related plugins setup
|
||||
require('CopilotChat').setup {
|
||||
debug = true,
|
||||
}
|
||||
|
||||
require('copilot_cmp').setup()
|
||||
|
||||
require('copilot').setup {
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
filetypes = {
|
||||
['*'] = false,
|
||||
},
|
||||
copilot_node_command = 'node',
|
||||
}
|
||||
30
nvim/plugin/dap.lua
Normal file
30
nvim/plugin/dap.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
local dap = require('dap')
|
||||
dap.adapters.gdb = {
|
||||
type = 'executable',
|
||||
command = 'gdb',
|
||||
args = { '-i', 'dap' },
|
||||
}
|
||||
|
||||
dap.configurations.c = {
|
||||
{
|
||||
name = 'Launch',
|
||||
type = 'gdb',
|
||||
request = 'launch',
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
stopAtBeginningOfMainSubprogram = false,
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = 'Launch',
|
||||
type = 'gdb',
|
||||
request = 'launch',
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
stopAtBeginningOfMainSubprogram = false,
|
||||
},
|
||||
}
|
||||
|
|
@ -174,18 +174,47 @@ keymap.set('n', ']h', function()
|
|||
}
|
||||
end, { noremap = true, silent = true, desc = 'next [h]int diagnostic' })
|
||||
|
||||
local function toggle_spell_check()
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
vim.opt.spell = not (vim.opt.spell:get())
|
||||
end
|
||||
|
||||
keymap.set('n', '<leader>S', toggle_spell_check, { noremap = true, silent = true, desc = 'toggle [S]pell' })
|
||||
|
||||
keymap.set('n', '<C-d>', '<C-d>zz', { desc = 'move [d]own half-page and center' })
|
||||
keymap.set('n', '<C-u>', '<C-u>zz', { desc = 'move [u]p half-page and center' })
|
||||
keymap.set('n', '<C-f>', '<C-f>zz', { desc = 'move DOWN [f]ull-page and center' })
|
||||
keymap.set('n', '<C-b>', '<C-b>zz', { desc = 'move UP full-page and center' })
|
||||
|
||||
-- DAP Keymaps
|
||||
vim.api.nvim_set_keymap(
|
||||
'n',
|
||||
'<leader>db',
|
||||
':lua require"dap".toggle_breakpoint()<CR>',
|
||||
{ noremap = true, silent = true, desc = 'debugger set [b]reakpoint' }
|
||||
)
|
||||
|
||||
vim.api.nvim_set_keymap(
|
||||
'n',
|
||||
'<leader>dc',
|
||||
':lua require"dap".continue()<CR>',
|
||||
{ noremap = true, silent = true, desc = 'debugger [c]ontinue' }
|
||||
)
|
||||
|
||||
vim.api.nvim_set_keymap(
|
||||
'n',
|
||||
'<leader>dn',
|
||||
':lua require"dap".step_over()<CR>',
|
||||
{ noremap = true, silent = true, desc = 'debugger [s]tep over' }
|
||||
)
|
||||
|
||||
vim.api.nvim_set_keymap(
|
||||
'n',
|
||||
'<leader>di',
|
||||
':lua require"dap".step_into()<CR>',
|
||||
{ noremap = true, silent = true, desc = 'debugger [s]tep into' }
|
||||
)
|
||||
|
||||
vim.api.nvim_set_keymap(
|
||||
'n',
|
||||
'<leader>dr',
|
||||
':lua require"dap".repl.open()<CR>',
|
||||
{ noremap = true, silent = true, desc = 'debugger [r]epl' }
|
||||
)
|
||||
|
||||
--- Disabled keymaps [enable at your own risk]
|
||||
|
||||
-- Automatic management of search highlight
|
||||
|
|
|
|||
|
|
@ -21,54 +21,6 @@ local layout_config = {
|
|||
},
|
||||
}
|
||||
|
||||
-- Fall back to find_files if not in a git repo
|
||||
local project_files = function()
|
||||
local opts = {} -- define here if you want to define something
|
||||
local ok = pcall(builtin.git_files, opts)
|
||||
if not ok then
|
||||
builtin.find_files(opts)
|
||||
end
|
||||
end
|
||||
|
||||
---@param picker function the telescope picker to use
|
||||
local function grep_current_file_type(picker)
|
||||
local current_file_ext = vim.fn.expand('%:e')
|
||||
local additional_vimgrep_arguments = {}
|
||||
if current_file_ext ~= '' then
|
||||
additional_vimgrep_arguments = {
|
||||
'--type',
|
||||
current_file_ext,
|
||||
}
|
||||
end
|
||||
local conf = require('telescope.config').values
|
||||
picker {
|
||||
vimgrep_arguments = vim.tbl_flatten {
|
||||
conf.vimgrep_arguments,
|
||||
additional_vimgrep_arguments,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
--- Grep the string under the cursor, filtering for the current file type
|
||||
local function grep_string_current_file_type()
|
||||
grep_current_file_type(builtin.grep_string)
|
||||
end
|
||||
|
||||
--- Live grep, filtering for the current file type
|
||||
local function live_grep_current_file_type()
|
||||
grep_current_file_type(builtin.live_grep)
|
||||
end
|
||||
|
||||
--- Like live_grep, but fuzzy (and slower)
|
||||
local function fuzzy_grep(opts)
|
||||
opts = vim.tbl_extend('error', opts or {}, { search = '', prompt_title = 'Fuzzy grep' })
|
||||
builtin.grep_string(opts)
|
||||
end
|
||||
|
||||
local function fuzzy_grep_current_file_type()
|
||||
grep_current_file_type(fuzzy_grep)
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<leader>tp', function()
|
||||
builtin.find_files()
|
||||
end, { desc = '[t]elescope find files - ctrl[p] style' })
|
||||
|
|
@ -83,7 +35,6 @@ vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' }
|
|||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
path_display = {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
require('which-key').setup {
|
||||
preset = 'helix'
|
||||
local whichkey = require('which-key')
|
||||
|
||||
whichkey.setup()
|
||||
|
||||
whichkey.add {
|
||||
{ '<leader>c', group = '[C]ode' },
|
||||
{ '<leader>d', group = '[D]ocument' },
|
||||
{ '<leader>r', group = '[R]ename' },
|
||||
{ '<leader>s', group = '[S]earch' },
|
||||
{ '<leader>w', group = '[W]orkspace' },
|
||||
{ '<leader>t', group = '[T]oggle' },
|
||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue