|
|
|
@ -127,6 +127,12 @@ require('lazy').setup({
|
|
|
|
|
changedelete = { text = '~' },
|
|
|
|
|
},
|
|
|
|
|
on_attach = function(bufnr)
|
|
|
|
|
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' })
|
|
|
|
|
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
|
|
|
|
|
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
|
|
|
|
|
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
|
|
|
|
|
|
|
|
|
|
-- don't override the built-in and fugitive keymaps
|
|
|
|
|
local gs = package.loaded.gitsigns
|
|
|
|
|
|
|
|
|
|
local function map(mode, l, r, opts)
|
|
|
|
@ -259,7 +265,58 @@ require('lazy').setup({
|
|
|
|
|
build = ':TSUpdate',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
|
|
|
|
{'gelguy/wilder.nvim', version = "*", config = function() end },
|
|
|
|
|
-- File browser
|
|
|
|
|
{
|
|
|
|
|
"nvim-neo-tree/neo-tree.nvim",
|
|
|
|
|
version = "*",
|
|
|
|
|
dependencies = {
|
|
|
|
|
"nvim-lua/plenary.nvim",
|
|
|
|
|
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
|
|
|
|
"MunifTanjim/nui.nvim",
|
|
|
|
|
},
|
|
|
|
|
config = function ()
|
|
|
|
|
require('neo-tree').setup {}
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
-- Markdown preview
|
|
|
|
|
{'iamcco/markdown-preview.nvim',
|
|
|
|
|
ft = "markdown",
|
|
|
|
|
-- build = "cd app && yarn install", -- after removing Joplin one day
|
|
|
|
|
build = "cd app && npm install",
|
|
|
|
|
init = function() vim.g.mkdp_filetypes = { "markdown" } end,
|
|
|
|
|
},
|
|
|
|
|
-- show notifications etc in a nice area
|
|
|
|
|
{'folke/noice.nvim',
|
|
|
|
|
event = 'VeryLazy',
|
|
|
|
|
opts = {
|
|
|
|
|
},
|
|
|
|
|
dependencies = {
|
|
|
|
|
'MunifTanjim/nui.nvim',
|
|
|
|
|
'rcarriga/nvim-notify',
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
-- tmux vim keybindings
|
|
|
|
|
'christoomey/vim-tmux-navigator',
|
|
|
|
|
-- databse connections from within vim using DBGUI and DB
|
|
|
|
|
'tpope/vim-dadbod',
|
|
|
|
|
'kristijanhusak/vim-dadbod-ui',
|
|
|
|
|
'kristijanhusak/vim-dadbod-completion',
|
|
|
|
|
{
|
|
|
|
|
-- Highlight, edit, and navigate code
|
|
|
|
|
'ThePrimeagen/harpoon',
|
|
|
|
|
dependencies = {
|
|
|
|
|
'nvim-lua/plenary.nvim',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
'mbbill/undotree',
|
|
|
|
|
'tpope/vim-surround',
|
|
|
|
|
'tpope/vim-commentary',
|
|
|
|
|
'github/copilot.vim',
|
|
|
|
|
'mfussenegger/nvim-jdtls',
|
|
|
|
|
'AckslD/nvim-neoclip.lua',
|
|
|
|
|
|
|
|
|
|
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
|
|
|
|
-- These are some example plugins that I've included in the kickstart repository.
|
|
|
|
|
-- Uncomment any of the lines below to enable them.
|
|
|
|
|
-- require 'kickstart.plugins.autoformat',
|
|
|
|
@ -284,14 +341,33 @@ vim.o.hlsearch = false
|
|
|
|
|
-- Make line numbers default
|
|
|
|
|
vim.wo.number = true
|
|
|
|
|
|
|
|
|
|
-- Toggle line numbers depending on the vim mode
|
|
|
|
|
local augroup = vim.api.nvim_create_augroup("numbertoggle", {})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "CmdlineLeave", "WinEnter" }, {
|
|
|
|
|
pattern = "*",
|
|
|
|
|
group = augroup,
|
|
|
|
|
callback = function()
|
|
|
|
|
if vim.o.nu and vim.api.nvim_get_mode().mode ~= "i" then
|
|
|
|
|
vim.opt.relativenumber = true
|
|
|
|
|
end
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "CmdlineEnter", "WinLeave" }, {
|
|
|
|
|
pattern = "*",
|
|
|
|
|
group = augroup,
|
|
|
|
|
callback = function()
|
|
|
|
|
if vim.o.nu then
|
|
|
|
|
vim.opt.relativenumber = false
|
|
|
|
|
vim.cmd "redraw"
|
|
|
|
|
end
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Enable mouse mode
|
|
|
|
|
vim.o.mouse = 'a'
|
|
|
|
|
|
|
|
|
|
-- Sync clipboard between OS and Neovim.
|
|
|
|
|
-- Remove this option if you want your OS clipboard to remain independent.
|
|
|
|
|
-- See `:help 'clipboard'`
|
|
|
|
|
vim.o.clipboard = 'unnamedplus'
|
|
|
|
|
|
|
|
|
|
-- Enable break indent
|
|
|
|
|
vim.o.breakindent = true
|
|
|
|
|
|
|
|
|
@ -353,6 +429,13 @@ require('telescope').setup {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
pickers = {
|
|
|
|
|
live_grep = {
|
|
|
|
|
additional_args = function(opts)
|
|
|
|
|
return {"--hidden"}
|
|
|
|
|
end
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Enable telescope fzf native, if installed
|
|
|
|
@ -411,10 +494,27 @@ local function telescope_live_grep_open_files()
|
|
|
|
|
prompt_title = 'Live Grep in Open Files',
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function telescope_find_files_in_home()
|
|
|
|
|
local opts = {
|
|
|
|
|
hidden = true,
|
|
|
|
|
cwd = "/home/julian"
|
|
|
|
|
}
|
|
|
|
|
require('telescope.builtin').find_files(opts)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function telescope_find_files_in_home_hidden()
|
|
|
|
|
local opts = {
|
|
|
|
|
hidden = true,
|
|
|
|
|
cwd = "/home/julian"
|
|
|
|
|
}
|
|
|
|
|
require('telescope.builtin').find_files(opts)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>s/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' })
|
|
|
|
|
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').builtin, { desc = '[S]earch [S]elect Telescope' })
|
|
|
|
|
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
|
|
|
|
|
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
|
|
|
|
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
|
|
|
|
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
|
|
|
|
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
|
|
|
@ -422,13 +522,19 @@ vim.keymap.set('n', '<leader>sG', ':LiveGrepGitRoot<cr>', { desc = '[S]earch by
|
|
|
|
|
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
|
|
|
|
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>ff', require('telescope.builtin').find_files, { desc = '[F]ind [F]iles no Hidden in current dir' })
|
|
|
|
|
vim.keymap.set('n', '<leader>fh', '<Cmd>Telescope find_files hidden=true no_ignore=true<Cr>', { desc = '[F]ind files [H]idden in current dir' })
|
|
|
|
|
vim.keymap.set('n', '<leader>fg', require('telescope.builtin').git_files, { desc = '[Find] files in [G]it [F]iles' })
|
|
|
|
|
vim.keymap.set('n', '<leader>fr', telescope_find_files_in_home, { desc = '[F]ind files starting in home, hidden' })
|
|
|
|
|
vim.keymap.set('n', '<leader>fs', telescope_find_files_in_home_hidden, { desc = '[F]ind files starting in home, no hidden' })
|
|
|
|
|
|
|
|
|
|
-- [[ Configure Treesitter ]]
|
|
|
|
|
-- See `:help nvim-treesitter`
|
|
|
|
|
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
|
|
|
|
|
vim.defer_fn(function()
|
|
|
|
|
require('nvim-treesitter.configs').setup {
|
|
|
|
|
-- Add languages to be installed here that you want installed for treesitter
|
|
|
|
|
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' },
|
|
|
|
|
ensure_installed = { 'lua', 'python', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash', 'css', 'dockerfile', 'html', 'java', 'kotlin', 'json', 'markdown_inline', 'ruby', 'sql', 'toml', 'vue', 'yaml' },
|
|
|
|
|
|
|
|
|
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
|
|
|
|
auto_install = false,
|
|
|
|
@ -527,7 +633,7 @@ local on_attach = function(_, bufnr)
|
|
|
|
|
|
|
|
|
|
-- See `:help K` for why this keymap
|
|
|
|
|
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
|
|
|
|
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
|
|
|
|
-- nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation') this breaks jumping between buffers in split view
|
|
|
|
|
|
|
|
|
|
-- Lesser used LSP functionality
|
|
|
|
|
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
|
|
|
@ -547,6 +653,7 @@ end
|
|
|
|
|
require('which-key').register {
|
|
|
|
|
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
|
|
|
|
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
|
|
|
|
['<leader>f'] = { name = '[F]ind', _ = 'which_key_ignore' },
|
|
|
|
|
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
|
|
|
|
|
['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
|
|
|
|
|
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
|
|
|
@ -671,3 +778,66 @@ cmp.setup {
|
|
|
|
|
|
|
|
|
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
|
|
|
|
-- vim: ts=2 sts=2 sw=2 et
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('i', 'jj', '<esc>', { desc = 'Closes insert mode' })
|
|
|
|
|
vim.keymap.set('n', 'ec', ':', { desc = 'Execute command' })
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv", { desc = 'Move line down' })
|
|
|
|
|
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv", { desc = 'Move line up' })
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('x', '<leader>p', "\"_dP", { desc = '[P]aste with previous still in buffer' })
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>y', "\"+y", { desc = '[Y]ank to system clipboard' })
|
|
|
|
|
vim.keymap.set('v', '<leader>y', "\"+y", { desc = '[Y]ank to system clipboard' })
|
|
|
|
|
vim.keymap.set('n', '<leader>Y', "\"+Y", { desc = '[Y]ank to system clipboard' })
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>rr', [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], { desc = '[R]ename by [R]egex pattern' })
|
|
|
|
|
|
|
|
|
|
-- map capital b and e to end/start line, should be default?
|
|
|
|
|
vim.keymap.set('n', 'B', '_', { desc = 'Jump to line [B]eginning' })
|
|
|
|
|
vim.keymap.set('n', 'E', '$', { desc = 'Jump to line [E]nding' })
|
|
|
|
|
|
|
|
|
|
-- wilder
|
|
|
|
|
local wilder = require('wilder')
|
|
|
|
|
wilder.setup({modes = {':', '/', '?'}})
|
|
|
|
|
|
|
|
|
|
-- filetree
|
|
|
|
|
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
|
|
|
|
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
|
|
|
|
|
|
|
|
|
-- neo_tree
|
|
|
|
|
vim.keymap.set('n', '<leader>n', '<Cmd>Neotree toggle <Cr>', { desc = 'Toggle [N]eoTree' })
|
|
|
|
|
vim.keymap.set('n', '<leader>m', '<Cmd>Neotree float dir=%:p:h:h reveal_file=%:p <CR>', { desc = '[M]odify File NeoTree' })
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<C-P>', ':Telescope find_files<CR>', { desc = 'Toggle [N]eoTree' })
|
|
|
|
|
|
|
|
|
|
-- harpoon
|
|
|
|
|
local mark = require('harpoon.mark')
|
|
|
|
|
local ui = require('harpoon.ui')
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>hh', mark.add_file, { desc = 'Add file to harpoon'})
|
|
|
|
|
vim.keymap.set('n', '<C-e>', ui.toggle_quick_menu, { desc = 'Toggle harpoon quick menu'})
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<C-t>', function () ui.nav_file(1) end, { desc = 'Harpoon file 1'})
|
|
|
|
|
vim.keymap.set('n', '<C-n>', function () ui.nav_file(2) end, { desc = 'Harpoon file 2'})
|
|
|
|
|
|
|
|
|
|
-- ctrl+s write
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<C-s>', ':w<CR>', {noremap = true, silent = true})
|
|
|
|
|
vim.api.nvim_set_keymap('i', '<C-s>', '<Esc>:w<CR>i', {noremap = true, silent = true})
|
|
|
|
|
|
|
|
|
|
--- ctrl+q quit
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<C-q>', ':q<CR>', {noremap = true, silent = true})
|
|
|
|
|
vim.api.nvim_set_keymap('i', '<C-q>', '<Esc>:q<CR>', {noremap = true, silent = true})
|
|
|
|
|
|
|
|
|
|
-- undotree
|
|
|
|
|
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle , { desc = 'Toggle Undotree'})
|
|
|
|
|
|
|
|
|
|
-- copilot disabled by default, enable it by typing :let b:copilot_enabled = 1 or executing ThisIsYourCaptainSpeaking
|
|
|
|
|
vim.g.copilot_assume_mapped = true
|
|
|
|
|
vim.api.nvim_exec([[ au BufNewFile,BufRead * let b:copilot_enabled = 0 ]], false)
|
|
|
|
|
vim.api.nvim_create_user_command('ThisIsYourCaptainSpeaking', 'let b:copilot_enabled = 1', {})
|
|
|
|
|
|
|
|
|
|
require('neoclip').setup()
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<leader>cc', ':Telescope neoclip<CR>', {noremap = true, silent = true})
|
|
|
|
|
|
|
|
|
|