Compare commits
7 Commits
8eb5b3b325
...
b9f1478645
Author | SHA1 | Date |
---|---|---|
Julian Raufelder | b9f1478645 | |
Julian Raufelder | f222270b9e | |
Julian Raufelder | b175e98bde | |
Julian Raufelder | aa1c2b31e7 | |
Julian Raufelder | 966fa31055 | |
Julian Raufelder | 1fd1d744d7 | |
Julian Raufelder | f7029b5b16 |
143
init.lua
143
init.lua
|
@ -209,7 +209,55 @@ 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',
|
||||
|
||||
-- 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',
|
||||
|
@ -234,14 +282,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
|
||||
|
||||
|
@ -297,6 +364,13 @@ require('telescope').setup {
|
|||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
live_grep = {
|
||||
additional_args = function(opts)
|
||||
return {"--hidden"}
|
||||
end
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
|
@ -314,18 +388,19 @@ vim.keymap.set('n', '<leader>/', function()
|
|||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
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' })
|
||||
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]resume' })
|
||||
vim.keymap.set('n', '<leader>sfn', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles [N]o Hidden' })
|
||||
vim.keymap.set('n', '<leader>sfh', '<Cmd>Telescope find_files hidden=true no_ignore=true<Cr>', { desc = '[S]earch [F]iles [H]idden' })
|
||||
|
||||
-- [[ Configure Treesitter ]]
|
||||
-- See `:help nvim-treesitter`
|
||||
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' },
|
||||
ensure_installed = { 'lua', 'python', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash', 'css', 'dockerfile', 'html', 'java', 'kotlin', 'json', 'markdown_inline', 'ruby', 'rust', 'sql', 'toml', 'vue', 'yaml' },
|
||||
|
||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||
auto_install = false,
|
||||
|
@ -532,8 +607,60 @@ cmp.setup {
|
|||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'vim-dadbod-completion' },
|
||||
},
|
||||
}
|
||||
|
||||
-- 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>f', '<Cmd>Neotree toggle<Cr>', { desc = 'Toggle NeoTree' })
|
||||
|
||||
-- database
|
||||
vim.keymap.set('n', '<leader>nu', '<Cmd>DBUIToggle<Cr>', { desc = 'Toggle UI' })
|
||||
vim.keymap.set('n', '<leader>nf', '<Cmd>DBUIFindBuffer<Cr>', { desc = 'Find buffer' })
|
||||
vim.keymap.set('n', '<leader>nr', '<Cmd>DBUIRenameBuffer<Cr>', { desc = 'Rename buffer' })
|
||||
vim.keymap.set('n', '<leader>nq', '<Cmd>DBUILastQueryInfo<Cr>', { desc = 'Last query info' })
|
||||
|
||||
-- harpoon
|
||||
local mark = require('harpoon.mark')
|
||||
local ui = require('harpoon.ui')
|
||||
|
||||
vim.keymap.set('n', '<leader>h', 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-h>', function () ui.nav_file(1) end, { desc = 'Harpoon file 1'})
|
||||
vim.keymap.set('n', '<C-t>', function () ui.nav_file(2) end, { desc = 'Harpoon file 2'})
|
||||
vim.keymap.set('n', '<C-n>', function () ui.nav_file(3) end, { desc = 'Harpoon file 3'})
|
||||
vim.keymap.set('n', '<C-s>', function () ui.nav_file(4) end, { desc = 'Harpoon file 4'})
|
||||
|
||||
-- undotree
|
||||
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle , { desc = 'Toggle Undotree'})
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
|
||||
return {
|
||||
"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,
|
||||
}
|
Loading…
Reference in New Issue