My custom kickstart.nvim setup

This commit is contained in:
Martin-Melody 2024-09-17 14:23:30 +01:00
parent 1860184830
commit c51b67a644
22 changed files with 1005 additions and 43 deletions

306
init.lua
View File

@ -90,14 +90,45 @@ P.S. You can delete this when you're done too. It's your config now! :)
vim.g.mapleader = ' ' vim.g.mapleader = ' '
vim.g.maplocalleader = ' ' vim.g.maplocalleader = ' '
-- Add the clipboard configuration for win32yank
if vim.fn.has 'win32' == 1 or vim.fn.has 'win64' == 1 then
vim.g.clipboard = {
name = 'win32yank-wsl',
copy = {
['+'] = 'win32yank.exe -i --crlf',
['*'] = 'win32yank.exe -i --crlf',
},
paste = {
['+'] = 'win32yank.exe -o --lf',
['*'] = 'win32yank.exe -o --lf',
},
cache_enabled = 0,
}
end
-- Set to true if you have a Nerd Font installed and selected in the terminal -- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false vim.g.have_nerd_font = true
-- [[ Setting options ]] -- [[ Setting options ]]
-- See `:help vim.opt` -- See `:help vim.opt`
-- NOTE: You can change these options as you wish! -- NOTE: You can change these options as you wish!
-- For more options, you can see `:help option-list` -- For more options, you can see `:help option-list`
-- Create the spell directory if it doesn't exist
local spell_dir = vim.fn.stdpath 'config' .. '/spell'
if vim.fn.isdirectory(spell_dir) == 0 then
vim.fn.mkdir(spell_dir, 'p')
end
-- Set the spellfile option
vim.opt.spellfile = spell_dir .. '/en.utf-8.add'
-- Ensure the spellfile exists
local spellfile_path = spell_dir .. '/en.utf-8.add'
if vim.fn.filereadable(spellfile_path) == 0 then
vim.fn.writefile({}, spellfile_path)
end
-- Make line numbers default -- Make line numbers default
vim.opt.number = true vim.opt.number = true
-- You can also add relative line numbers, to help with jumping. -- You can also add relative line numbers, to help with jumping.
@ -160,6 +191,11 @@ vim.opt.scrolloff = 10
-- [[ Basic Keymaps ]] -- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()` -- See `:help vim.keymap.set()`
-- Key mapping to toggle DAP UI
vim.keymap.set('n', '<Leader>dui', function()
require('dapui').toggle()
end)
-- Clear highlights on search when pressing <Esc> in normal mode -- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch` -- See `:help hlsearch`
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
@ -176,10 +212,10 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }) vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- TIP: Disable arrow keys in normal mode -- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>') vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>') vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>') vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>') vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Keybinds to make split navigation easier. -- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows -- Use CTRL+<hjkl> to switch between windows
@ -190,6 +226,24 @@ 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' })
-- [[ Custom Keymaps ]]
-- Keymap to close the current buffer but keep split windows open
vim.keymap.set('n', '<leader>bD', ':bp | bd #<CR>', { noremap = true, silent = true, desc = "Close buffer but keep split" })
-- Vim Rest Console
vim.keymap.set('n', '<leader>r', ':Vrc<CR>', { noremap = true, silent = true })
-- Navigate to the next buffer
vim.keymap.set('n', '<leader>bn', ':bnext<CR>', { desc = 'Next buffer' })
-- Navigate to the previous buffer
vim.keymap.set('n', '<leader>bp', ':bprevious<CR>', { desc = 'Previous buffer' })
-- Close the current buffer
vim.keymap.set('n', '<leader>bd', ':bd<CR>', { desc = 'Close buffer' })
-- [[ Basic Autocommands ]] -- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands` -- See `:help lua-guide-autocommands`
@ -207,7 +261,7 @@ vim.api.nvim_create_autocmd('TextYankPost', {
-- [[ 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.fs_stat(lazypath) then if not vim.loop.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 { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
if vim.v.shell_error ~= 0 then if vim.v.shell_error ~= 0 then
@ -228,6 +282,12 @@ vim.opt.rtp:prepend(lazypath)
-- --
-- NOTE: Here is where you install your plugins. -- NOTE: Here is where you install your plugins.
require('lazy').setup({ require('lazy').setup({
--spec = {
--{ 'LazyVim/LazyVim', import = 'lazyvim.plugins' },
--{ import = 'custom.plugins' },
--},
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
@ -255,6 +315,57 @@ require('lazy').setup({
}, },
}, },
}, },
{
'windwp/nvim-ts-autotag',
},
{
'vhyrro/luarocks.nvim',
opts = {
luarocks_build_args = {
'--with-lua-include=/usr/include',
},
},
},
{ import = 'custom.plugins.noice' },
{ import = 'custom.plugins.notify' },
{
'nvimdev/dashboard-nvim',
event = 'VimEnter',
config = function()
require('dashboard').setup {
theme = 'doom',
config = {
header = {},
center = {
{
desc = ' Files',
group = 'Label',
action = 'Telescope find_files',
key = 'f',
},
{ desc = '󰊳 Update', group = '@property', action = 'Lazy update', key = 'u' },
{
desc = '\u{1F5CA} Notes',
group = 'DiagnosticHint',
action = 'Neorg index',
key = 'n',
},
{
desc = 'Projects',
group = 'work',
action = 'e ~/Projects',
key = 'p',
},
},
footer = {},
week_header = {
enable = true,
},
},
}
end,
dependencies = { { 'nvim-tree/nvim-web-devicons' } },
},
-- NOTE: Plugins can also be configured to run Lua code when they are loaded. -- NOTE: Plugins can also be configured to run Lua code when they are loaded.
-- --
@ -340,7 +451,6 @@ require('lazy').setup({
-- This opens a window that shows you all of the keymaps for the current -- This opens a window that shows you all of the keymaps for the current
-- Telescope picker. This is really useful to discover what Telescope can -- Telescope picker. This is really useful to discover what Telescope can
-- do as well as how to actually do it! -- do as well as how to actually do it!
-- [[ Configure Telescope ]] -- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()` -- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup { require('telescope').setup {
@ -399,6 +509,11 @@ require('lazy').setup({
vim.keymap.set('n', '<leader>sn', function() vim.keymap.set('n', '<leader>sn', function()
builtin.find_files { cwd = vim.fn.stdpath 'config' } builtin.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = '[S]earch [N]eovim files' }) end, { desc = '[S]earch [N]eovim files' })
-- Shortcut for searching Obsidian files
vim.keymap.set('n', '<leader>so', function()
builtin.find_files { cwd = '~/Obsidian/vaults/' }
end, { desc = '[S]earch [O]bsidian files' })
end, end,
}, },
@ -840,36 +955,105 @@ require('lazy').setup({
-- Check out: https://github.com/echasnovski/mini.nvim -- Check out: https://github.com/echasnovski/mini.nvim
end, end,
}, },
{ -- Highlight, edit, and navigate code {
'nvim-treesitter/nvim-treesitter', 'olrtg/nvim-emmet',
build = ':TSUpdate', config = function()
opts = { vim.keymap.set({ 'n', 'v' }, '<leader>xe', require('nvim-emmet').wrap_with_abbreviation)
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
enable = true,
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
-- If you are experiencing weird indenting issues, add the language to
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
additional_vim_regex_highlighting = { 'ruby' },
},
indent = { enable = true, disable = { 'ruby' } },
},
config = function(_, opts)
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
---@diagnostic disable-next-line: missing-fields
require('nvim-treesitter.configs').setup(opts)
-- There are additional nvim-treesitter modules that you can use to interact
-- with nvim-treesitter. You should go explore a few and see what interests you:
--
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
end, end,
}, },
{
'nvim-treesitter/nvim-treesitter',
version = false, -- last release is way too old and doesn't work on Windows
build = ':TSUpdate',
event = { 'BufRead', 'BufNewFile' },
lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline
init = function(plugin)
-- PERF: add nvim-treesitter queries to the rtp and its custom query predicates early
-- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which
-- no longer triggers the **nvim-treesitter** module to be loaded in time.
-- Luckily, the only things that those plugins need are the custom queries, which we make available
-- during startup.
require('lazy.core.loader').add_to_rtp(plugin)
require 'nvim-treesitter.query_predicates'
end,
cmd = { 'TSUpdateSync', 'TSUpdate', 'TSInstall' },
keys = {
{ '<c-space>', desc = 'Increment Selection' },
{ '<bs>', desc = 'Decrement Selection', mode = 'x' },
},
opts_extend = { 'ensure_installed' },
---@type TSConfig
---@diagnostic disable-next-line: missing-fields
opts = {
highlight = { enable = true },
indent = { enable = true },
ensure_installed = {
'bash',
'c',
'diff',
'html',
'javascript',
'jsdoc',
'json',
'jsonc',
'lua',
'luadoc',
'luap',
'markdown',
'markdown_inline',
'printf',
'python',
'query',
'regex',
'toml',
'tsx',
'typescript',
'vim',
'vimdoc',
'xml',
'yaml',
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<C-space>',
node_incremental = '<C-space>',
scope_incremental = false,
node_decremental = '<bs>',
},
},
textobjects = {
move = {
enable = true,
goto_next_start = { [']f'] = '@function.outer', [']c'] = '@class.outer', [']a'] = '@parameter.inner' },
goto_next_end = { [']F'] = '@function.outer', [']C'] = '@class.outer', [']A'] = '@parameter.inner' },
goto_previous_start = { ['[f'] = '@function.outer', ['[c'] = '@class.outer', ['[a'] = '@parameter.inner' },
goto_previous_end = { ['[F'] = '@function.outer', ['[C'] = '@class.outer', ['[A'] = '@parameter.inner' },
},
},
},
---@param opts TSConfig
config = function(_, opts)
-- Ensure the list is deduplicated manually
if type(opts.ensure_installed) == 'table' then
local seen = {}
local deduped = {}
for _, item in ipairs(opts.ensure_installed) do
if not seen[item] then
table.insert(deduped, item)
seen[item] = true
end
end
opts.ensure_installed = deduped
end
require('nvim-treesitter.configs').setup(opts)
end,
},
{
'windwp/nvim-ts-autotag',
after = 'nvim-treesitter',
opts = {},
},
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
-- init.lua. If you want these files, they are in the repository, so you can just download them and -- init.lua. If you want these files, they are in the repository, so you can just download them and
@ -880,19 +1064,57 @@ require('lazy').setup({
-- Here are some example plugins that I've included in the Kickstart repository. -- Here are some example plugins that I've included in the Kickstart repository.
-- Uncomment any of the lines below to enable them (you will need to restart nvim). -- Uncomment any of the lines below to enable them (you will need to restart nvim).
-- --
-- require 'kickstart.plugins.debug', require 'kickstart.plugins.debug',
-- require 'kickstart.plugins.indent_line', --require 'kickstart.plugins.indent_line',
-- require 'kickstart.plugins.lint', require 'kickstart.plugins.lint',
-- require 'kickstart.plugins.autopairs', require 'kickstart.plugins.autopairs',
-- require 'kickstart.plugins.neo-tree', require 'kickstart.plugins.neo-tree',
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- This is the easiest way to modularize your config. -- This is the easiest way to modularize your config.
-- --
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
-- { import = 'custom.plugins' }, { import = 'custom.plugins' },
-- Custom Plugins
-- Transparent Background
require 'custom.plugins.transparent',
-- Neorg
require 'custom.plugins.neorg',
-- Cattpuccin Theme
require 'custom.plugins.cattpuccin',
-- Obsidian
require 'custom.plugins.obsidian',
-- Lua Line
require 'custom.plugins.lualine',
-- Git Fugitive
require 'custom.plugins.git-fugitive',
-- Lazy Git
require 'custom.plugins.lazy-git',
-- Dad Bod
require 'custom.plugins.dadbod',
-- Dad Bod UI
require 'custom.plugins.dadbod-ui',
-- Dad Bod Completion
require 'custom.plugins.dad-bod-completion',
-- Dap Debugg
require 'custom.plugins.dap',
-- Completion
require 'custom.plugins.completion',
}, { }, {
ui = { ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the -- If you are using a Nerd Font: set icons to an empty table which will use the

9
lazyvim.json Normal file
View File

@ -0,0 +1,9 @@
{
"extras": [
],
"news": {
"NEWS.md": "6520"
},
"version": 6
}

View File

@ -0,0 +1,6 @@
return {
{
'windwp/nvim-ts-autotag',
after = 'nvim-treesitter',
},
}

View File

@ -0,0 +1,61 @@
-- Catppuccin is a Neovim theme plugin with flexible color schemes
-- https://github.com/catppuccin/nvim
return {
'catppuccin/nvim', -- GitHub repository
as = 'catppuccin', -- Optional: rename the plugin to 'catppuccin'
version = '*', -- Use the latest version
dependencies = {
'kyazdani42/nvim-web-devicons', -- Recommended for file icons
},
config = function()
require('catppuccin').setup {
flavour = 'frappe', -- Choose from "latte", "frappe", "macchiato", "mocha"
background = {
light = 'latte',
dark = 'mocha',
},
transparent_background = false,
show_end_of_buffer = true,
term_colors = true,
dim_inactive = {
enabled = true,
shade = 'dark',
percentage = 0.15,
},
styles = {
comments = { 'italic' },
conditionals = { 'italic' },
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
operators = {},
},
color_overrides = {},
custom_highlights = {},
default_integrations = true,
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
treesitter = true,
notify = false,
mini = {
enabled = true,
indentscope_color = 'auto',
},
},
}
-- Set the colorscheme
vim.cmd 'colorscheme catppuccin'
end,
}

View File

@ -0,0 +1,67 @@
-- ~/.config/nvim/lua/custom/plugins/completion.lua
return {
-- Completion framework
{
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
config = function()
local cmp = require 'cmp'
cmp.setup {
snippet = {
expand = function(args)
vim.fn['vsnip#anonymous'](args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm { select = true },
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn == 1 then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>(vsnip-expand-or-jump)', true, true, true), '')
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn['vsnip#jumpable'](-1) == 1 then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>(vsnip-jump-prev)', true, true, true), '')
else
fallback()
end
end, { 'i', 's' }),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
}, {
{ name = 'buffer' },
}),
}
end,
},
-- LSP completion source
{ 'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp' },
-- Buffer completion source
{ 'hrsh7th/cmp-buffer', after = 'nvim-cmp' },
-- Path completion source
{ 'hrsh7th/cmp-path', after = 'nvim-cmp' },
-- Snippet completion source
{ 'hrsh7th/cmp-vsnip', after = 'nvim-cmp' },
-- Snippet engine
{ 'hrsh7th/vim-vsnip', event = 'InsertEnter' },
}

View File

@ -0,0 +1,3 @@
return {
'kristijanhusak/vim-dadbod-completion',
}

View File

@ -0,0 +1,3 @@
return {
'kristijanhusak/vim-dadbod-ui',
}

View File

@ -0,0 +1,3 @@
return {
'tpope/vim-dadbod',
}

118
lua/custom/plugins/dap.lua Normal file
View File

@ -0,0 +1,118 @@
return {
{
'mfussenegger/nvim-dap',
dependencies = {
'leoluz/nvim-dap-go',
'rcarriga/nvim-dap-ui',
'theHamsta/nvim-dap-virtual-text',
'nvim-neotest/nvim-nio',
'williamboman/mason.nvim',
},
config = function()
local dap = require 'dap'
local ui = require 'dapui'
require('dapui').setup()
require('dap-go').setup()
require('nvim-dap-virtual-text').setup {}
-- Configuration for .NET Core (ASP.NET Core) using net8.0
dap.adapters.coreclr = {
type = 'executable',
command = '/usr/local/bin/netcoredbg/netcoredbg', -- Update with the correct path to netcoredbg
args = { '--interpreter=vscode' },
}
dap.configurations.cs = {
{
type = 'coreclr',
name = 'Launch ASP.NET Core',
request = 'launch',
preLaunchTask = function()
-- Run the project before launching the debugger
local build_cmd = 'dotnet publish --configuration Debug --runtime linux-x64 --self-contained'
print('Running: ' .. build_cmd)
vim.fn.system(build_cmd)
end,
program = function()
local cwd = vim.fn.getcwd()
local dll = vim.fn.glob(cwd .. '/bin/Debug/net8.0/linux-x64/MelodyFitnessApi.dll', 0, 1)
if #dll == 0 then
print 'No DLL found in bin/Debug/net8.0/linux-x64'
return ''
end
print('Using program: ' .. dll[1])
return dll[1]
end,
cwd = '${workspaceFolder}',
stopAtEntry = false,
console = 'integratedTerminal',
},
{
type = 'coreclr',
name = 'Attach ASP.NET Core',
request = 'attach',
processId = require('dap.utils').pick_process,
cwd = '${workspaceFolder}',
},
}
-- Configuration for Ionic Angular (JavaScript/TypeScript) using Firefox
dap.adapters.chrome = {
type = 'executable',
command = 'node',
args = { os.getenv 'HOME' .. '/.vscode/extensions/vscode-chrome-debug/out/src/chromeDebug.js' },
}
dap.configurations.javascript = {
{
type = 'chrome',
name = 'Attach to Chrome (Ionic App)',
request = 'attach',
program = '${file}',
cwd = vim.fn.getcwd(),
sourceMaps = true,
protocol = 'inspector',
port = 9222, -- Port where Chrome is listening
url = 'https://localhost:8100/login', -- URL of your running Ionic app
webRoot = '${workspaceFolder}',
timeout = 20000, -- Optional: Increase if you experience timeouts
address = '0.0.0.0',
},
}
dap.configurations.typescript = dap.configurations.javascript
vim.keymap.set('n', '<space>tb', dap.toggle_breakpoint)
vim.keymap.set('n', '<space>gb', dap.run_to_cursor)
vim.keymap.set('n', '<space>?', function()
require('dapui').eval(nil, { enter = true })
end)
vim.keymap.set('n', '<F1>', dap.continue)
vim.keymap.set('n', '<F2>', dap.step_into)
vim.keymap.set('n', '<F3>', dap.step_over)
vim.keymap.set('n', '<F4>', dap.step_out)
vim.keymap.set('n', '<F5>', dap.step_back)
vim.keymap.set('n', '<F12>', dap.restart)
-- Key mapping to toggle the DAP UI
vim.keymap.set('n', '<Leader>dui', function()
ui.toggle()
end)
dap.listeners.before.attach.dapui_config = function()
ui.open()
end
dap.listeners.before.launch.dapui_config = function()
ui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
ui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
ui.close()
end
end,
},
}

View File

@ -0,0 +1,3 @@
return {
'tpope/vim-fugitive',
}

View File

@ -0,0 +1,19 @@
return {
'kdheepak/lazygit.nvim',
cmd = {
'LazyGit',
'LazyGitConfig',
'LazyGitCurrentFile',
'LazyGitFilter',
'LazyGitFilterCurrentFile',
},
-- optional for floating window border decoration
dependencies = {
'nvim-lua/plenary.nvim',
},
-- setting the keybinding for LazyGit with 'keys' is recommended in
-- order to load the plugin when the command is run for the first time
keys = {
{ '<leader>lg', '<cmd>LazyGit<cr>', desc = 'LazyGit' },
},
}

View File

@ -0,0 +1,46 @@
return {
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'catppuccin',
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
},
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { 'buffers' }, -- Show buffers in the main statusline
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {},
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {},
}
end,
}

View File

@ -0,0 +1,77 @@
-- neorg_setup.lua
return {
-- Dependency for Neorg: a colorscheme compatible with treesitter
{
'rebelot/kanagawa.nvim',
config = function()
vim.cmd.colorscheme 'kanagawa'
end,
},
-- Treesitter configuration necessary for Neorg
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
opts = {
ensure_installed = { 'c', 'lua', 'vim', 'vimdoc', 'query' },
highlight = { enable = true },
},
config = function(_, opts)
require('nvim-treesitter.configs').setup(opts)
end,
},
-- Dependency manager for Neorg
{
'vhyrro/luarocks.nvim',
priority = 1000,
config = true,
},
-- Main Neorg setup
{
'nvim-neorg/neorg',
dependencies = { 'luarocks.nvim' },
version = '*',
config = function()
require('neorg').setup {
load = {
['core.defaults'] = {}, -- Load all the default modules
['core.concealer'] = {}, -- Allows for use of icons
['core.export'] = {
config = {
export_dir = '~/notes/exports', -- Sets the export directory for all files
exporters = { -- Defines the exporters available and their settings
markdown = { -- Markdown exporter settings
extensions = { 'md' }, -- Specifies the file extensions to use when exporting to Markdown
},
html = { -- HTML exporter settings
extensions = { 'html' }, -- Specifies the file extensions to use when exporting to HTML
},
pdf = { -- PDF exporter settings
extensions = { 'pdf' }, -- Specifies the file extensions to use when exporting to PDF
},
},
},
},
['core.journal'] = {
config = {
workspace = 'notes', -- Specifies the workspace for journaling
},
},
['core.dirman'] = {
config = {
workspaces = {
notes = '~/notes', -- Path to your notes directory
},
default_workspace = 'notes', -- Sets default workspace
},
},
},
}
vim.wo.foldlevel = 99 -- Set the foldlevel for vim
vim.wo.conceallevel = 2 -- Set the conceallevel for better visibility
end,
},
}

View File

@ -0,0 +1,24 @@
return {
'folke/noice.nvim',
event = 'VeryLazy',
opts = {
-- add any options here
lsp = {
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
['cmp.entry.get_documentation'] = true,
},
},
},
config = function()
local noice = require 'noice'
noice.setup {
-- any options for noice
}
end,
dependencies = {
'MunifTanjim/nui.nvim',
'rcarriga/nvim-notify',
},
}

View File

@ -0,0 +1,8 @@
return {
'rcarriga/nvim-notify',
config = function()
require('notify').setup {
background_colour = '#000000',
}
end,
}

View File

@ -0,0 +1,77 @@
return {
'epwalsh/obsidian.nvim',
version = '*',
lazy = false,
ft = 'markdown',
dependencies = {
'nvim-lua/plenary.nvim',
},
opts = {
workspaces = {
{
name = 'personal',
path = '/home/martin/Obsidian/vaults/personal',
default_tags = { 'personal-notes' },
overrides = {
notes_subdir = 'vaults/personal/notes/',
},
},
{
name = 'work',
path = '/home/martin/Obsidian/vaults/work',
default_tags = { 'work-notes' },
overrides = {
notes_subdir = 'vaults/work/notes/',
},
},
{
name = 'daily',
path = '/home/martin/Obsidian/vaults/daily',
overrides = {
notes_subdir = 'notes',
},
},
},
templates = {
folder = '/home/martin/Obsidian/templates',
date_format = '%Y-%m-%d',
time_format = '%H:%M',
},
daily_notes = {
date_format = '%Y-%m-%d',
alias_format = '%B %-d, %Y',
default_tags = { 'daily-notes' },
template = 'daily.md',
},
completion = {
nvim_cmp = true,
min_chars = 2,
},
mappings = {
['gf'] = {
action = function()
return require('obsidian').util.gf_passthrough()
end,
opts = { noremap = false, expr = true, buffer = true },
},
},
new_notes_location = 'notes_subdir',
note_id_func = function(title)
local suffix = ''
local current_time = os.date '%Y-%m-%d-%H%M'
if title ~= nil then
suffix = title:gsub(' ', '-'):gsub('[^A-Za-z0-9-]', ''):lower()
else
for _ = 1, 4 do
suffix = suffix .. string.char(math.random(65, 90))
end
end
return current_time .. '-' .. suffix
end,
},
config = function(_, opts)
require('obsidian').setup(opts)
-- Load the custom key mappings
require('obsidian_keymaps').setup_keymaps()
end,
}

View File

@ -0,0 +1,5 @@
return {
-- 'rest-nvim/rest.nvim',
-- dependencies = { 'luarocks.nvim', 'nvim-lua/plenary.nvim' },
-- config = function() end,
}

View File

@ -0,0 +1,24 @@
-- transparent.nvim plugin configuration
-- https://github.com/xiyaowong/transparent.nvim
return {
'xiyaowong/transparent.nvim', -- GitHub repository
as = 'transparent', -- Optional: rename the plugin to 'transparent'
config = function()
require('transparent').setup({
groups = { -- table: default groups
'Normal', 'NormalNC', 'Comment', 'Constant', 'Special', 'Identifier',
'Statement', 'PreProc', 'Type', 'Underlined', 'Todo', 'String', 'Function',
'Conditional', 'Repeat', 'Operator', 'Structure', 'LineNr', 'NonText',
'SignColumn', 'CursorLine', 'CursorLineNr', 'StatusLine', 'StatusLineNC',
'EndOfBuffer',
},
extra_groups = { -- extra highlight groups to clear
'all', -- Also clear background for all highlight groups
},
exclude_groups = {}, -- exclude these highlight groups from being cleared
})
end,
}

View File

@ -0,0 +1,96 @@
-- ~/.config/nvim/lua/custom/plugins/treesitter.lua
return {
{
'nvim-treesitter/nvim-treesitter',
version = false, -- last release is way too old and doesn't work on Windows
build = ':TSUpdate',
event = { 'BufRead', 'BufNewFile' },
lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline
init = function(plugin)
-- PERF: add nvim-treesitter queries to the rtp and its custom query predicates early
-- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which
-- no longer triggers the **nvim-treesitter** module to be loaded in time.
-- Luckily, the only things that those plugins need are the custom queries, which we make available
-- during startup.
require('lazy.core.loader').add_to_rtp(plugin)
require 'nvim-treesitter.query_predicates'
end,
cmd = { 'TSUpdateSync', 'TSUpdate', 'TSInstall' },
keys = {
{ '<c-space>', desc = 'Increment Selection' },
{ '<bs>', desc = 'Decrement Selection', mode = 'x' },
},
opts_extend = { 'ensure_installed' },
---@type TSConfig
---@diagnostic disable-next-line: missing-fields
opts = {
highlight = { enable = true },
indent = { enable = true },
ensure_installed = {
'bash',
'c',
'diff',
'html',
'javascript',
'jsdoc',
'json',
'jsonc',
'lua',
'luadoc',
'luap',
'markdown',
'markdown_inline',
'printf',
'python',
'query',
'regex',
'toml',
'tsx',
'typescript',
'vim',
'vimdoc',
'xml',
'yaml',
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<C-space>',
node_incremental = '<C-space>',
scope_incremental = false,
node_decremental = '<bs>',
},
},
textobjects = {
move = {
enable = true,
goto_next_start = { [']f'] = '@function.outer', [']c'] = '@class.outer', [']a'] = '@parameter.inner' },
goto_next_end = { [']F'] = '@function.outer', [']C'] = '@class.outer', [']A'] = '@parameter.inner' },
goto_previous_start = { ['[f'] = '@function.outer', ['[c'] = '@class.outer', ['[a'] = '@parameter.inner' },
goto_previous_end = { ['[F'] = '@function.outer', ['[C'] = '@class.outer', ['[A'] = '@parameter.inner' },
},
},
},
---@param opts TSConfig
config = function(_, opts)
-- Ensure the list is deduplicated manually
if type(opts.ensure_installed) == 'table' then
local seen = {}
local deduped = {}
for _, item in ipairs(opts.ensure_installed) do
if not seen[item] then
table.insert(deduped, item)
seen[item] = true
end
end
opts.ensure_installed = deduped
end
require('nvim-treesitter.configs').setup(opts)
end,
},
{
'windwp/nvim-ts-autotag',
after = 'nvim-treesitter',
},
}

View File

@ -6,7 +6,7 @@ return {
config = function() config = function()
local lint = require 'lint' local lint = require 'lint'
lint.linters_by_ft = { lint.linters_by_ft = {
markdown = { 'markdownlint' }, markdown = {},
} }
-- To allow other plugins to add linters to require('lint').linters_by_ft, -- To allow other plugins to add linters to require('lint').linters_by_ft,

View File

@ -18,6 +18,48 @@ return {
window = { window = {
mappings = { mappings = {
['\\'] = 'close_window', ['\\'] = 'close_window',
-- Add a new key mapping to open a terminal in a floating window
['t'] = {
function(state)
-- Save the original working directory
local original_dir = vim.fn.getcwd()
-- Retrieve the current path from the NeoTree state
local current_dir = state.tree:get_node().path
if vim.fn.isdirectory(current_dir) == 0 then
current_dir = vim.fn.fnamemodify(current_dir, ':h')
end
vim.cmd('cd ' .. current_dir)
-- Configure floating window options
local width = math.floor(vim.o.columns * 0.8)
local height = math.floor(vim.o.lines * 0.8)
local opts = {
relative = 'editor',
width = width,
height = height,
col = math.floor((vim.o.columns - width) / 2),
row = math.floor((vim.o.lines - height) / 2),
style = 'minimal',
border = 'rounded', -- Other options: 'single', 'double', 'solid', 'shadow'
}
-- Create a new buffer for the terminal
local buf = vim.api.nvim_create_buf(false, true)
local win = vim.api.nvim_open_win(buf, true, opts)
-- Start terminal in the floating window
vim.fn.termopen(vim.o.shell)
vim.cmd 'startinsert'
-- Set a keymap to close the floating terminal window
vim.api.nvim_buf_set_keymap(buf, 't', '<Esc>', '<C-\\><C-n>:q!<CR>', { noremap = true, silent = true })
-- Restore the original working directory
vim.cmd('cd ' .. original_dir)
end,
desc = 'Open terminal in a floating window at current directory', -- Description for the keymap
},
}, },
}, },
}, },

49
lua/obsidian_keymaps.lua Normal file
View File

@ -0,0 +1,49 @@
local M = {}
-- Function to create a new personal note
function M.new_personal_note()
vim.cmd 'ObsidianWorkspace personal'
vim.cmd 'ObsidianNew'
end
-- Function to create a new work note
function M.new_work_note()
vim.cmd 'ObsidianWorkspace work'
vim.cmd 'ObsidianNew'
end
-- Function to create a new daily note
function M.new_daily_note()
vim.cmd 'ObsidianWorkspace daily'
vim.cmd 'ObsidianToday'
end
-- Function to follow back Link
function M.followLink()
vim.cmd 'ObsidianFollowLink'
end
-- Set up key mappings
function M.setup_keymaps()
vim.api.nvim_set_keymap(
'n',
'<leader>np',
'<cmd>lua require("obsidian_keymaps").new_personal_note()<CR>',
{ noremap = true, silent = true, desc = 'New [P]ersonal note' }
)
vim.api.nvim_set_keymap(
'n',
'<leader>nw',
'<cmd>lua require("obsidian_keymaps").new_work_note()<CR>',
{ noremap = true, silent = true, desc = 'New [W]ork note' }
)
vim.api.nvim_set_keymap(
'n',
'<leader>nd',
'<cmd>lua require("obsidian_keymaps").new_daily_note()<CR>',
{ noremap = true, silent = true, desc = 'New [D]aily note' }
)
vim.api.nvim_set_keymap('n', '<leader>nf', '<cmd>lua require("obsidian_keymaps").followLink()<CR>', { noremap = true, silent = true, desc = '[F]ollow Link' })
end
return M