├── lua ├── plugins │ ├── undotree.lua │ ├── vim-sleuth.lua │ ├── git │ │ ├── diffview.lua │ │ └── lazygit.lua │ ├── translate.lua │ ├── vim-rooter.lua │ ├── nvim-jdtls.lua │ ├── ui │ │ ├── wrapping.lua │ │ ├── minty.lua │ │ ├── todo-comments.lua │ │ ├── gitsigns.lua │ │ ├── better-ts-errors.lua │ │ ├── outline.lua │ │ ├── tiny-inline-diagnostic.lua │ │ ├── lualine.lua │ │ ├── vimade.lua │ │ ├── image.lua │ │ ├── hover.lua │ │ ├── markview-nvim.lua │ │ ├── transparent.lua │ │ ├── alpha.lua │ │ └── img-clip.lua │ ├── nvim-ts-autotag.lua │ ├── ai │ │ ├── goose.lua │ │ └── copilot.lua │ ├── lazydev.lua │ ├── telescope-repo.lua │ ├── jupyter_notebook │ │ ├── jupytext.lua │ │ ├── molten-nvim.lua │ │ └── quarto-nvim.lua │ ├── toggleterm.lua │ ├── mason.lua │ ├── vimtex.lua │ ├── go.lua │ ├── typr.lua │ ├── debugging │ │ ├── nvim-dap-cs.lua │ │ ├── dap.lua │ │ └── dap-ui.lua │ ├── snacks.lua │ ├── autopairs.lua │ ├── leetcode.lua │ ├── nvim-treesitter.lua │ ├── codesnap.lua │ ├── conform-nvim.lua │ ├── obsidian.lua │ ├── mini-nvim.lua │ ├── telescope.lua │ ├── nvim-cmp.lua │ ├── overseer.lua │ └── easy-dotnet.lua ├── colorschemes │ ├── tokyonight.lua │ ├── makruai-nvim.lua │ ├── catpppuccin.lua │ ├── nightfly.lua │ ├── material.lua │ ├── rose-pine.lua │ ├── cyberdream.lua │ ├── onedarkpro.lua │ ├── oldworld.lua │ ├── kanagawa.lua │ └── vague.lua ├── core │ ├── lazy.lua │ ├── autocmds.lua │ ├── options.lua │ └── keymaps.lua ├── setup.lua └── utils │ ├── autosave.lua │ └── obsidian_alpha_integration.lua ├── .gitignore ├── .luarc.json ├── ftplugin ├── markdown.lua └── java.lua ├── assets └── README-img │ ├── 2025-01-26-at-01-38-57.avif │ ├── 2025-01-26-at-01-40-22.avif │ ├── 2025-02-01-at-15-01-04.avif │ ├── 2025-02-01-at-15-02-21.avif │ ├── 2025-02-01-at-15-05-17.avif │ └── 2025-02-01-at-15-05-53.avif ├── init.lua ├── lsp ├── vtsls.lua ├── ltex.lua ├── vue_ls.lua ├── luals.lua ├── omnisharp.lua └── tailwindcss.lua ├── README.md └── lazy-lock.json /lua/plugins/undotree.lua: -------------------------------------------------------------------------------- 1 | return { "mbbill/undotree" } 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | typrstats 2 | /lua/custom/plugins/getauthors.py 3 | -------------------------------------------------------------------------------- /lua/plugins/vim-sleuth.lua: -------------------------------------------------------------------------------- 1 | return { "tpope/vim-sleuth" } 2 | -------------------------------------------------------------------------------- /lua/plugins/git/diffview.lua: -------------------------------------------------------------------------------- 1 | return { "sindrets/diffview.nvim" } 2 | -------------------------------------------------------------------------------- /lua/plugins/translate.lua: -------------------------------------------------------------------------------- 1 | return { "uga-rosa/translate.nvim" } 2 | -------------------------------------------------------------------------------- /lua/plugins/vim-rooter.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "airblade/vim-rooter", 3 | } 4 | -------------------------------------------------------------------------------- /lua/plugins/nvim-jdtls.lua: -------------------------------------------------------------------------------- 1 | return { "mfussenegger/nvim-jdtls", ft = "java" } 2 | -------------------------------------------------------------------------------- /.luarc.json: -------------------------------------------------------------------------------- 1 | { 2 | "diagnostics.disable": [ 3 | "missing-fields" 4 | ] 5 | } -------------------------------------------------------------------------------- /ftplugin/markdown.lua: -------------------------------------------------------------------------------- 1 | vim.wo.wrap = true 2 | vim.bo.textwidth = 80 3 | vim.opt_local.foldmethod = "syntax" 4 | -------------------------------------------------------------------------------- /assets/README-img/2025-01-26-at-01-38-57.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nxtkofi/LightningNvim/HEAD/assets/README-img/2025-01-26-at-01-38-57.avif -------------------------------------------------------------------------------- /assets/README-img/2025-01-26-at-01-40-22.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nxtkofi/LightningNvim/HEAD/assets/README-img/2025-01-26-at-01-40-22.avif -------------------------------------------------------------------------------- /assets/README-img/2025-02-01-at-15-01-04.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nxtkofi/LightningNvim/HEAD/assets/README-img/2025-02-01-at-15-01-04.avif -------------------------------------------------------------------------------- /assets/README-img/2025-02-01-at-15-02-21.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nxtkofi/LightningNvim/HEAD/assets/README-img/2025-02-01-at-15-02-21.avif -------------------------------------------------------------------------------- /assets/README-img/2025-02-01-at-15-05-17.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nxtkofi/LightningNvim/HEAD/assets/README-img/2025-02-01-at-15-05-17.avif -------------------------------------------------------------------------------- /assets/README-img/2025-02-01-at-15-05-53.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nxtkofi/LightningNvim/HEAD/assets/README-img/2025-02-01-at-15-05-53.avif -------------------------------------------------------------------------------- /lua/plugins/ui/wrapping.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "andrewferrier/wrapping.nvim", 3 | config = function() 4 | require("wrapping").setup() 5 | end, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/nvim-ts-autotag.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "windwp/nvim-ts-autotag", 3 | config = function() 4 | require("nvim-ts-autotag").setup() 5 | end, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/ui/minty.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { "nvzone/volt", lazy = true }, 3 | 4 | { 5 | "nvzone/minty", 6 | cmd = { "Shades", "Huefy" }, 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /lua/plugins/ui/todo-comments.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "folke/todo-comments.nvim", 3 | event = "VimEnter", 4 | dependencies = { "nvim-lua/plenary.nvim" }, 5 | opts = { signs = false }, 6 | } 7 | -------------------------------------------------------------------------------- /lua/colorschemes/tokyonight.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "folke/tokyonight.nvim", 3 | lazy = false, 4 | priority = 1000, 5 | opts = { transparent = vim.g.setup.transparent }, 6 | config = function() end, 7 | } 8 | -------------------------------------------------------------------------------- /lua/plugins/ai/goose.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "azorng/goose.nvim", 3 | config = function() 4 | require("goose").setup({}) 5 | end, 6 | dependencies = { 7 | "nvim-lua/plenary.nvim", 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /lua/plugins/lazydev.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "folke/lazydev.nvim", 3 | ft = "lua", 4 | opts = { 5 | library = { 6 | { path = "luvit-meta/library", words = { "vim%.uv" } }, 7 | }, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /lua/plugins/telescope-repo.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "cljoly/telescope-repo.nvim", 3 | requires = "nvim-telescope/telescope.nvim", 4 | config = function() 5 | require("telescope").load_extension("repo") 6 | end, 7 | } 8 | -------------------------------------------------------------------------------- /lua/colorschemes/makruai-nvim.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "Skardyy/makurai-nvim", 3 | cond = vim.g.setup.colorscheme == "makurai", 4 | lazy = false, 5 | priority = 1000, 6 | config = function() 7 | vim.cmd.colorscheme("makurai") 8 | end, 9 | } 10 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | vim.g.setup = require("setup") 2 | require("core.options") 3 | require("core.lazy") 4 | require("core.autocmds") 5 | require("core.keymaps") 6 | 7 | vim.lsp.enable({ 8 | "luals", 9 | "ltex", 10 | "vtsls", 11 | "vue_ls", 12 | "omnisharp", 13 | "tailwindcss", 14 | }) 15 | -------------------------------------------------------------------------------- /lua/plugins/jupyter_notebook/jupytext.lua: -------------------------------------------------------------------------------- 1 | return { 2 | lazy = false, 3 | "GCBallesteros/jupytext.nvim", 4 | config = function() 5 | require("jupytext").setup({ 6 | style = "markdown", 7 | output_extension = "md", 8 | force_ft = "markdown", 9 | }) 10 | end, 11 | } 12 | -------------------------------------------------------------------------------- /lua/plugins/toggleterm.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "akinsho/toggleterm.nvim", 3 | version = "*", 4 | config = function() 5 | require("toggleterm").setup({ 6 | start_in_insert = true, 7 | authochdir = true, 8 | direction = "horizontal", 9 | winblend = 0, 10 | }) 11 | end, 12 | } 13 | -------------------------------------------------------------------------------- /lua/plugins/ui/gitsigns.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "lewis6991/gitsigns.nvim", 3 | opts = { 4 | signs = { 5 | add = { text = "+" }, 6 | change = { text = "~" }, 7 | delete = { text = "_" }, 8 | topdelete = { text = "‾" }, 9 | changedelete = { text = "~" }, 10 | }, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /lua/plugins/ui/better-ts-errors.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "OlegGulevskyy/better-ts-errors.nvim", 3 | dependencies = { "MunifTanjim/nui.nvim" }, 4 | config = { 5 | keymaps = { 6 | toggle = "dd", -- default 'dd' 7 | go_to_definition = "dx", -- default 'dx' 8 | }, 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /lua/colorschemes/catpppuccin.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "catppuccin/nvim", 3 | priority = 1000, 4 | cond = vim.g.setup.colorscheme == "catppuccin", 5 | config = function() 6 | require("catppuccin").setup({ 7 | transparent_background = vim.g.setup.transparency, 8 | }) 9 | vim.cmd.colorscheme("catppuccin") 10 | end, 11 | } 12 | -------------------------------------------------------------------------------- /lua/colorschemes/nightfly.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "bluz71/vim-nightfly-colors", 3 | cond = vim.g.setup.colorscheme == "nightfly", 4 | name = "nightfly", 5 | lazy = false, 6 | priority = 1000, 7 | config = function() 8 | vim.g.nightflyTransparent = vim.g.setup.transparency 9 | vim.cmd.colorscheme("nightfly") 10 | end, 11 | } 12 | -------------------------------------------------------------------------------- /lua/colorschemes/material.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "marko-cerovac/material.nvim", 3 | priority = 1000, 4 | cond = vim.g.setup.colorscheme == "material", 5 | config = function() 6 | require("material").setup({ 7 | disable = { 8 | background = vim.g.setup.transparency, 9 | }, 10 | }) 11 | vim.cmd.colorscheme("material") 12 | end, 13 | } 14 | -------------------------------------------------------------------------------- /lua/plugins/ui/outline.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "hedyhli/outline.nvim", 3 | lazy = true, 4 | cmd = { "Outline", "OutlineOpen" }, 5 | keys = { -- Example mapping to toggle outline 6 | { "o", "Outline", desc = "Toggle outline" }, 7 | }, 8 | opts = { 9 | symbol_folding = { 10 | autofold_depth = false, 11 | -- autofold_depth = 1, 12 | }, 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /lua/plugins/git/lazygit.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "kdheepak/lazygit.nvim", 3 | lazy = true, 4 | cmd = { 5 | "LazyGit", 6 | "LazyGitConfig", 7 | "LazyGitCurrentFile", 8 | "LazyGitFilter", 9 | "LazyGitFilterCurrentFile", 10 | }, 11 | dependencies = { 12 | "nvim-lua/plenary.nvim", 13 | }, 14 | keys = { 15 | { "lg", "LazyGit", desc = "LazyGit" }, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lua/plugins/ui/tiny-inline-diagnostic.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "rachartier/tiny-inline-diagnostic.nvim", 3 | event = "LspAttach", 4 | priority = 9000, 5 | config = function() 6 | require("tiny-inline-diagnostic").setup({ 7 | preset = "ghost", 8 | options = { 9 | multilines = true, 10 | }, 11 | }) 12 | vim.diagnostic.config({ 13 | virtual_text = false, 14 | }) 15 | end, 16 | } 17 | -------------------------------------------------------------------------------- /lua/colorschemes/rose-pine.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "rose-pine/neovim", 3 | priority = 1000, 4 | name = "rose-pine", 5 | cond = vim.g.setup.colorscheme == "rose-pine", 6 | config = function() 7 | require("rose-pine").setup({ 8 | styles = { 9 | bold = true, 10 | italic = true, 11 | transparency = vim.g.setup.transparency, 12 | }, 13 | }) 14 | vim.cmd.colorscheme("rose-pine") 15 | end, 16 | } 17 | -------------------------------------------------------------------------------- /lua/plugins/mason.lua: -------------------------------------------------------------------------------- 1 | -- NOTE: This is only kept here due to easy formatters AND debuggers integration. 2 | -- WARNING: DO NOT use Mason to install LSP servers! Use Your systems Package Manager instead 3 | return { 4 | "williamboman/mason.nvim", 5 | opts = {}, 6 | dependencies = { 7 | { "WhoIsSethDaniel/mason-tool-installer.nvim" }, 8 | { "j-hui/fidget.nvim", opts = {} }, 9 | "hrsh7th/cmp-nvim-lsp", 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /lua/plugins/vimtex.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "lervag/vimtex", 3 | lazy = false, -- we don't want to lazy load VimTeX 4 | -- tag = "v2.15", -- uncomment to pin to a specific release 5 | init = function() 6 | -- VimTeX configuration goes here, e.g. 7 | vim.g.vimtex_view_method = "zathura" 8 | vim.g.vimtex_compiler_latexmk = { 9 | out_dir = "./build", 10 | } 11 | vim.g.vimtex_bibtex_program = "biber" 12 | end, 13 | } 14 | -------------------------------------------------------------------------------- /lua/plugins/go.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "ray-x/go.nvim", 3 | dependencies = { 4 | "ray-x/guihua.lua", 5 | "neovim/nvim-lspconfig", 6 | "nvim-treesitter/nvim-treesitter", 7 | }, 8 | config = function() 9 | require("go").setup() 10 | end, 11 | event = { "LspAttach" }, 12 | ft = { "go", "gomod", "gowork", "gotmpl" }, 13 | build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries 14 | } 15 | -------------------------------------------------------------------------------- /lua/plugins/typr.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvzone/typr", 3 | cmd = { "Typr", "TyprStats" }, 4 | dependencies = "nvzone/volt", 5 | opts = { 6 | on_attach = function(buf) 7 | vim.b[buf].minipairs_disable = true 8 | end, 9 | mappings = function(buf) 10 | local typr = require("typr") 11 | vim.keymap.set("n", "1", function() 12 | typr.linecount = 1 13 | end, { buffer = buf, desc = "Set linecount to 1" }) 14 | end, 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /lua/plugins/debugging/nvim-dap-cs.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nicholasmata/nvim-dap-cs", 3 | dependencies = { "mfussenegger/nvim-dap" }, 4 | config = function() 5 | require("dap-cs").setup({ 6 | dap_configurations = { 7 | { 8 | type = "coreclr", 9 | name = "Attach remote", 10 | mode = "remote", 11 | request = "attach", 12 | }, 13 | }, 14 | netcoredbg = { 15 | path = "netcoredbg", 16 | }, 17 | }) 18 | end, 19 | } 20 | -------------------------------------------------------------------------------- /lua/plugins/snacks.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "folke/snacks.nvim", 3 | opts = { 4 | explorer = {}, 5 | bigfile = { 6 | size = 1024 * 1024 * 1.5, 7 | }, 8 | picker = { 9 | sources = { 10 | explorer = { 11 | layout = { layout = { position = "right" } }, 12 | follow_file = true, 13 | hidden = true, 14 | jump = { close = false }, 15 | supports_live = false, 16 | git_untracked = true, 17 | }, 18 | }, 19 | }, 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /lua/plugins/autopairs.lua: -------------------------------------------------------------------------------- 1 | 2 | return { 3 | 'windwp/nvim-autopairs', 4 | event = 'InsertEnter', 5 | -- Optional dependency 6 | dependencies = { 'hrsh7th/nvim-cmp' }, 7 | config = function() 8 | require('nvim-autopairs').setup {} 9 | -- If you want to automatically add `(` after selecting a function or method 10 | local cmp_autopairs = require 'nvim-autopairs.completion.cmp' 11 | local cmp = require 'cmp' 12 | cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) 13 | end, 14 | } 15 | -------------------------------------------------------------------------------- /lua/plugins/ai/copilot.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "zbirenbaum/copilot.lua", 3 | cmd = "Copilot", 4 | event = "InsertEnter", 5 | config = function() 6 | require("copilot").setup({ 7 | filetypes = { 8 | yaml = false, 9 | markdown = false, 10 | help = false, 11 | gitcommit = false, 12 | gitrebase = false, 13 | hgcommit = false, 14 | svn = false, 15 | cvs = false, 16 | ["."] = false, 17 | typr = false, 18 | }, 19 | suggestion = { 20 | auto_trigger = true, 21 | }, 22 | }) 23 | end, 24 | } 25 | -------------------------------------------------------------------------------- /lua/colorschemes/cyberdream.lua: -------------------------------------------------------------------------------- 1 | return { 2 | cond = vim.g.setup.colorscheme == "cyberdream", 3 | "scottmckendry/cyberdream.nvim", 4 | lazy = false, 5 | priority = 1000, 6 | config = function() 7 | require("cyberdream").setup({ 8 | -- Set light or dark variant 9 | variant = "default", -- use "light" for the light variant. Also accepts "auto" to set dark or light colors based on the current value of `vim.o.background` 10 | transparent = vim.g.setup.transparency, 11 | }) 12 | vim.cmd.colorscheme("cyberdream") 13 | end, 14 | } 15 | -------------------------------------------------------------------------------- /lua/plugins/leetcode.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "kawre/leetcode.nvim", 3 | dependencies = { 4 | "nvim-telescope/telescope.nvim", 5 | "nvim-lua/plenary.nvim", 6 | "MunifTanjim/nui.nvim", 7 | }, 8 | opts = { 9 | ---@type string 10 | arg = "leetcode.nvim", 11 | ---@type lc.lang 12 | lang = "typescript", 13 | ---@type lc.storage 14 | storage = { 15 | home = vim.fn.stdpath("data") .. "/leetcode", 16 | cache = vim.fn.stdpath("cache") .. "/leetcode", 17 | }, 18 | ---@type lc.picker 19 | picker = { provider = "telescope" }, 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /lua/plugins/ui/lualine.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-lualine/lualine.nvim", 3 | opts = { 4 | options = { 5 | theme = "auto", 6 | section_separators = { left = "", right = "" }, 7 | component_separators = { left = "", right = "" }, 8 | }, 9 | sections = { 10 | lualine_a = { { "mode", separator = { left = "", right = "" }, right_padding = 2 } }, 11 | lualine_z = { 12 | { 13 | function() 14 | return " " .. os.date("%R") 15 | end, 16 | separator = { left = "", right = "" }, 17 | left_padding = 2, 18 | }, 19 | }, 20 | }, 21 | }, 22 | } 23 | -------------------------------------------------------------------------------- /lua/plugins/nvim-treesitter.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-treesitter/nvim-treesitter", 3 | lazy = true, 4 | build = ":TSUpdate", 5 | main = "nvim-treesitter.configs", 6 | depenencies = { 7 | "OXY2DEV/markview.nvim", 8 | }, 9 | opts = { 10 | ensure_installed = { 11 | "bash", 12 | "c", 13 | "diff", 14 | "html", 15 | "lua", 16 | "luadoc", 17 | "markdown", 18 | "markdown_inline", 19 | "query", 20 | "vim", 21 | "vimdoc", 22 | }, 23 | auto_install = true, 24 | highlight = { 25 | enable = true, 26 | }, 27 | indent = { enable = true, disable = { "ruby" } }, 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /lua/plugins/ui/vimade.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "tadaa/vimade", 3 | enabled = true, 4 | opts = { 5 | recipe = { "default", { animate = true } }, 6 | fadelevel = 0.65, 7 | enabled = false, 8 | tint = { 9 | fg = { rgb = { 120, 120, 120 }, intensity = 1 }, -- all text will be gray 10 | }, 11 | blocklist = { 12 | custom = { 13 | highlights = { 14 | "EndOfBuffer", 15 | -- "/^lualine.*/", -- Uncomment this if You want to make lualine transparent 16 | "/^.undotree.*/", 17 | "/^undotree_highlight.*/", 18 | "/^Undotree.*/", 19 | "/^Outline.*/", 20 | }, 21 | }, 22 | }, 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /lua/plugins/codesnap.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "mistricky/codesnap.nvim", 3 | build = "make", 4 | keys = { 5 | { "cc", "CodeSnap", mode = "x", desc = "Save selected code snapshot into clipboard" }, 6 | -- Included as it is a workaround to overcome this bug:https://github.com/mistricky/codesnap.nvim/issues/103 7 | }, 8 | 9 | config = function() 10 | require("codesnap").setup({ 11 | watermark = "", 12 | bg_x_padding = 60, 13 | bg_y_padding = 60, 14 | bg_padding = nil, 15 | watermark_font_family = "FiraCode Nerd Font Propo", 16 | has_breadcrumbs = true, 17 | bg_theme = "sea", 18 | }) 19 | end, 20 | } 21 | -------------------------------------------------------------------------------- /lua/plugins/jupyter_notebook/molten-nvim.lua: -------------------------------------------------------------------------------- 1 | -- Installation guide: https://github.com/benlubas/molten-nvim/blob/main/docs/Not-So-Quick-Start-Guide.md 2 | -- You also need this: https://github.com/benlubas/molten-nvim/blob/main/docs/Virtual-Environments.md 3 | return { 4 | { 5 | "benlubas/molten-nvim", 6 | version = "^1.0.0", -- use version <2.0.0 to avoid breaking changes 7 | dependencies = { "3rd/image.nvim" }, 8 | build = ":UpdateRemotePlugins", 9 | init = function() 10 | -- these are examples, not defaults. Please see the readme 11 | vim.g.molten_image_provider = "image.nvim" 12 | vim.g.molten_output_win_max_height = 20 13 | end, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /lua/colorschemes/onedarkpro.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "olimorris/onedarkpro.nvim", 3 | priority = 1000, 4 | cond = vim.g.setup.colorscheme == "onedarkpro", 5 | config = function() 6 | require("onedarkpro").setup({ 7 | filetypes = { markdown = false }, 8 | render_markdown = false, 9 | highlights = { 10 | CurSearch = { fg = "#0a805c", bg = "#add1d7", style = "reverse" }, 11 | }, 12 | options = { 13 | cursorline = false, 14 | terminal_colors = true, 15 | transparency = vim.g.setup.transparency, 16 | }, 17 | }) 18 | vim.cmd.colorscheme("onedark") 19 | for i = 1, 6 do 20 | vim.cmd("highlight clear markdownH" .. i) 21 | end 22 | end, 23 | } 24 | -------------------------------------------------------------------------------- /lua/core/lazy.lua: -------------------------------------------------------------------------------- 1 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 2 | vim.opt.rtp:prepend(lazypath) 3 | require("lazy").setup({ 4 | { import = "plugins" }, 5 | { import = "plugins.debugging" }, 6 | { import = "plugins.jupyter_notebook" }, 7 | { import = "colorschemes" }, 8 | { import = "plugins.ui" }, 9 | { import = "plugins.ai" }, 10 | { import = "plugins.git" }, 11 | }, { 12 | ui = { 13 | icons = vim.g.have_nerd_font and {} or { 14 | cmd = "⌘", 15 | config = "🛠", 16 | event = "📅", 17 | ft = "📂", 18 | init = "⚙", 19 | keys = "🗝", 20 | plugin = "🔌", 21 | runtime = "💻", 22 | require = "🌙", 23 | source = "📄", 24 | start = "🚀", 25 | task = "📌", 26 | lazy = "💤 ", 27 | }, 28 | }, 29 | change_detection = { 30 | notify = false, 31 | }, 32 | }) 33 | -------------------------------------------------------------------------------- /lua/plugins/jupyter_notebook/quarto-nvim.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "quarto-dev/quarto-nvim", 3 | dependencies = { 4 | "jmbuhr/otter.nvim", 5 | "nvim-treesitter/nvim-treesitter", 6 | }, 7 | config = function() 8 | require("quarto").setup({ 9 | lspFeatures = { 10 | -- NOTE: put whatever languages you want here: 11 | languages = { "python" }, 12 | chunks = "all", 13 | diagnostics = { 14 | enabled = true, 15 | triggers = { "BufWritePost" }, 16 | }, 17 | completion = { 18 | enabled = true, 19 | }, 20 | }, 21 | keymap = { 22 | -- NOTE: setup your own keymaps: 23 | hover = "H", 24 | definition = "gd", 25 | rename = "rn", 26 | references = "gr", 27 | format = "gf", 28 | }, 29 | codeRunner = { 30 | enabled = true, 31 | default_method = "molten", 32 | }, 33 | }) 34 | end, 35 | } 36 | -------------------------------------------------------------------------------- /lsp/vtsls.lua: -------------------------------------------------------------------------------- 1 | ---@module "vim.lsp.client" 2 | ---@class vim.lsp.ClientConfig 3 | -- NOTE: Download vtsls from Your package manager e.g `yay -S vtsls` 4 | return { 5 | cmd = { "vtsls", "--stdio" }, 6 | filetypes = { "javascript", "vue", "typescript", "typescriptreact" }, 7 | settings = { 8 | complete_function_calls = true, 9 | vtsls = { 10 | enableMoveToFileCodeAction = true, 11 | autoUseWorkspaceTsdk = true, 12 | tsserver = { 13 | globalPlugins = { 14 | { 15 | name = "@vue/typescript-plugin", 16 | location = "/usr/bin/vue-language-server", 17 | languages = { "vue" }, 18 | configNamespace = "typescript", 19 | }, 20 | }, 21 | }, 22 | }, 23 | }, 24 | on_attach = function(client, bufnr) 25 | if vim.bo[bufnr].filetype == "vue" then 26 | client.server_capabilities.semanticTokensProvider = nil 27 | end 28 | end, 29 | } 30 | -------------------------------------------------------------------------------- /lua/plugins/conform-nvim.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "stevearc/conform.nvim", 3 | event = { "BufWritePre" }, 4 | cmd = { "ConformInfo" }, 5 | keys = { 6 | { 7 | "f", 8 | function() 9 | vim.lsp.buf.code_action({ 10 | apply = true, 11 | context = { only = { "source.addMissingImports.ts" }, diagnostics = {} }, 12 | }) 13 | vim.lsp.buf.code_action({ 14 | apply = true, 15 | context = { only = { "source.removeUnused.ts" }, diagnostics = {} }, 16 | }) 17 | require("conform").format({ async = true, lsp_format = "fallback" }) 18 | end, 19 | mode = "", 20 | desc = "[F]ormat buffer and add missing imports", 21 | }, 22 | }, 23 | opts = { 24 | notify_on_error = false, 25 | format_on_save = { 26 | timeout_ms = 2500, 27 | lsp_fallback = true, 28 | }, 29 | formatters_by_ft = { 30 | lua = { "stylua" }, 31 | typescript = { "prettier" }, 32 | typescriptreact = { "prettier" }, 33 | vue = { "prettier" }, 34 | tex = { "latexindent" }, 35 | }, 36 | formatters = { 37 | latexindent = { 38 | prepend_args = { "-c=.indent" }, 39 | }, 40 | }, 41 | }, 42 | } 43 | -------------------------------------------------------------------------------- /lua/plugins/ui/image.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "3rd/image.nvim", 3 | config = function() 4 | require("image").setup({ 5 | backend = "kitty", 6 | kitty_method = "normal", 7 | integrations = { 8 | markdown = { 9 | enabled = true, 10 | clear_in_insert_mode = false, 11 | -- Set this to false if you don't want to render images coming from 12 | -- a URL 13 | download_remote_images = true, 14 | only_render_image_at_cursor = true, 15 | filetypes = { "markdown", "vimwiki" }, 16 | }, 17 | neorg = { 18 | enabled = true, 19 | clear_in_insert_mode = false, 20 | download_remote_images = true, 21 | only_render_image_at_cursor = false, 22 | filetypes = { "norg" }, 23 | }, 24 | html = { 25 | enabled = true, 26 | }, 27 | css = { 28 | enabled = true, 29 | }, 30 | }, 31 | max_width = 100, 32 | max_height = 28, 33 | max_width_window_percentage = math.huge, 34 | max_height_window_percentage = math.huge, 35 | window_overlap_clear_enabled = true, 36 | window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" }, 37 | 38 | editor_only_render_when_focused = true, 39 | 40 | hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, 41 | }) 42 | end, 43 | } 44 | -------------------------------------------------------------------------------- /lsp/ltex.lua: -------------------------------------------------------------------------------- 1 | -- NOTE: Download ltex-ls from Your package manager e.g `yay -S ltex-ls-bin` 2 | local language_id_mapping = { 3 | bib = "bibtex", 4 | plaintex = "tex", 5 | rnoweb = "rsweave", 6 | rst = "restructuredtext", 7 | tex = "latex", 8 | -- pandoc = 'markdown', 9 | -- text = 'plaintext', 10 | } 11 | 12 | local filetypes = { 13 | "bib", 14 | "gitcommit", 15 | -- 'markdown', 16 | "org", 17 | "plaintex", 18 | "rst", 19 | "rnoweb", 20 | "tex", 21 | -- 'pandoc', 22 | "quarto", 23 | "rmd", 24 | "context", 25 | "html", 26 | "xhtml", 27 | "mail", 28 | -- 'text', 29 | } 30 | 31 | local function get_language_id(_, filetype) 32 | local language_id = language_id_mapping[filetype] 33 | if language_id then 34 | return language_id 35 | else 36 | return filetype 37 | end 38 | end 39 | local enabled_ids = {} 40 | do 41 | local enabled_keys = {} 42 | for _, ft in ipairs(filetypes) do 43 | local id = get_language_id({}, ft) 44 | if not enabled_keys[id] then 45 | enabled_keys[id] = true 46 | table.insert(enabled_ids, id) 47 | end 48 | end 49 | end 50 | 51 | return { 52 | cmd = { "ltex-ls" }, 53 | filetypes = filetypes, 54 | root_markers = { ".git" }, 55 | get_language_id = get_language_id, 56 | settings = { 57 | ltex = { 58 | enabled = enabled_ids, 59 | }, 60 | }, 61 | } 62 | -------------------------------------------------------------------------------- /lsp/vue_ls.lua: -------------------------------------------------------------------------------- 1 | -- NOTE: Download vue-language-server from Your package manager e.g `yay -S vue-language-server` 2 | return { 3 | cmd = { "vue-language-server", "--stdio" }, 4 | filetypes = { "vue" }, 5 | root_markers = { "package.json" }, 6 | init_options = { 7 | typescript = { 8 | tsdk = "/usr/lib/node_modules/typescript/lib", 9 | }, 10 | }, 11 | on_init = function(client) 12 | client.handlers["tsserver/request"] = function(_, result, context) 13 | local clients = vim.lsp.get_clients({ bufnr = context.bufnr, name = "vtsls" }) 14 | if #clients == 0 then 15 | vim.notify( 16 | "Could not found `vtsls` lsp client, vue_lsp would not work without it.", 17 | vim.log.levels.ERROR 18 | ) 19 | return 20 | end 21 | local ts_client = clients[1] 22 | 23 | local param = unpack(result) 24 | local id, command, payload = unpack(param) 25 | ts_client:exec_cmd({ 26 | title = "vue_request_forward", 27 | command = "typescript.tsserverRequest", 28 | arguments = { 29 | command, 30 | payload, 31 | }, 32 | }, { bufnr = context.bufnr }, function(_, r) 33 | local response_data = { { id, r.body } } 34 | ---@diagnostic disable-next-line: param-type-mismatch 35 | client:notify("tsserver/response", response_data) 36 | end) 37 | end 38 | end, 39 | } 40 | -------------------------------------------------------------------------------- /lua/colorschemes/oldworld.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "dgox16/oldworld.nvim", 3 | cond = vim.g.setup.colorscheme == "oldworld", 4 | lazy = false, 5 | priority = 1000, 6 | config = function() 7 | require("oldworld").setup({ 8 | terminal_colors = true, -- enable terminal colors 9 | variant = "default", -- default, oled, cooler 10 | styles = { -- You can pass the style using the format: style = true 11 | comments = {}, -- style for comments 12 | keywords = {}, -- style for keywords 13 | identifiers = {}, -- style for identifiers 14 | functions = {}, -- style for functions 15 | variables = {}, -- style for variables 16 | booleans = {}, -- style for booleans 17 | }, 18 | integrations = { -- You can disable/enable integrations 19 | alpha = true, 20 | cmp = true, 21 | flash = true, 22 | gitsigns = true, 23 | hop = false, 24 | indent_blankline = true, 25 | lazy = true, 26 | lsp = true, 27 | markdown = true, 28 | mason = true, 29 | navic = false, 30 | neo_tree = false, 31 | neogit = false, 32 | neorg = false, 33 | noice = true, 34 | notify = true, 35 | rainbow_delimiters = true, 36 | telescope = true, 37 | treesitter = true, 38 | }, 39 | highlight_overrides = {}, 40 | }) 41 | 42 | vim.cmd.colorscheme("oldworld") 43 | end, 44 | } 45 | -------------------------------------------------------------------------------- /lua/colorschemes/kanagawa.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "rebelot/kanagawa.nvim", 3 | priority = 1000, 4 | cond = vim.g.setup.colorscheme == "kanagawa", 5 | config = function() 6 | require("kanagawa").setup({ 7 | transparent = vim.g.setup.transparency, 8 | 9 | overrides = function(colors) 10 | local theme = colors.theme 11 | return { 12 | TelescopeTitle = { fg = theme.ui.special, bold = true }, 13 | TelescopePromptNormal = { bg = theme.ui.bg_p1 }, 14 | TelescopePromptBorder = { fg = theme.ui.bg_p1, bg = theme.ui.bg_p1 }, 15 | TelescopeResultsNormal = { fg = theme.ui.fg_dim, bg = theme.ui.bg_m1 }, 16 | TelescopeResultsBorder = { fg = theme.ui.bg_m1, bg = theme.ui.bg_m1 }, 17 | TelescopePreviewNormal = { bg = theme.ui.bg_dim }, 18 | TelescopePreviewBorder = { bg = theme.ui.bg_dim, fg = theme.ui.bg_dim }, 19 | TelescopeSelection = { fg = "#d27e99", bg = "#334155" }, 20 | WinSeparator = { fg = "#7D7D7D" }, 21 | } 22 | end, 23 | }) 24 | vim.cmd.colorscheme("kanagawa-dragon") --kanagawa-dragon, kanagawa-lotus, kanagawa-wave 25 | local function changeVisual() 26 | if vim.o.background == "dark" and vim.g.colors_name == "kanagawa" then 27 | vim.api.nvim_set_hl(0, "Visual", { bg = "#334155" }) 28 | vim.api.nvim_set_hl(0, "@tag.tsx", { fg = "#fcb8d5" }) 29 | end 30 | end 31 | changeVisual() 32 | end, 33 | } 34 | -------------------------------------------------------------------------------- /lua/plugins/obsidian.lua: -------------------------------------------------------------------------------- 1 | local setup = require("setup") 2 | return { 3 | "obsidian-nvim/obsidian.nvim", 4 | version = "*", -- recommended, use latest release instead of latest commit 5 | config = function() 6 | require("obsidian").setup({ 7 | legacy_commands = false, 8 | ui = { 9 | enable = false, 10 | }, 11 | ft = "markdown", 12 | ---@return table 13 | note_frontmatter_func = function(note) 14 | if note.title then 15 | note:add_alias(note.title) 16 | end 17 | local out = { id = note.id, date = os.date("%d %B %Y") } 18 | if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then 19 | for k, v in pairs(note.metadata) do 20 | out[k] = v 21 | end 22 | end 23 | return out 24 | end, 25 | templates = { 26 | folder = setup.obsidian_dirs.templates, 27 | }, 28 | daily_notes = { 29 | folder = setup.obsidian_dirs.dailynotes, 30 | default_tags = { "daily-notes" }, 31 | template = "daily.md", 32 | }, 33 | completion = { 34 | nvim_cmp = true, 35 | min_chars = 2, 36 | }, 37 | attachments = { 38 | img_folder = setup.obsidian_dirs.attachments, 39 | }, 40 | dependencies = { 41 | "nvim-lua/plenary.nvim", 42 | }, 43 | workspaces = { 44 | { 45 | name = "personal", 46 | path = setup.obsidian_dirs.generalpath, 47 | }, 48 | }, 49 | }) 50 | end, 51 | } 52 | -------------------------------------------------------------------------------- /lua/plugins/mini-nvim.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "echasnovski/mini.nvim", 3 | config = function() 4 | -- Examples: 5 | -- - va) - [V]isually select [A]round [)]paren 6 | -- - yinq - [Y]ank [I]nside [N]ext [Q]uote 7 | -- - ci' - [C]hange [I]nside [']quote 8 | require("mini.ai").setup({ n_lines = 500 }) 9 | -- Add/delete/replace surroundings (brackets, quotes, etc.) 10 | -- 11 | -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren 12 | -- - sd' - [S]urround [D]elete [']quotes 13 | -- - sr)' - [S]urround [R]eplace [)] ['] 14 | require("mini.surround").setup() 15 | require("mini.hipatterns").setup({ 16 | highlighters = { 17 | hex_color = require("mini.hipatterns").gen_highlighter.hex_color(), 18 | }, 19 | }) 20 | -- Simple and easy statusline. 21 | -- You could remove this setup call if you don't like it, 22 | -- and try some other statusline plugin 23 | --[[ local statusline = require("mini.statusline") ]] 24 | --[[ -- set use_icons to true if you have a Nerd Font ]] 25 | --[[ statusline.setup({ use_icons = vim.g.have_nerd_font }) ]] 26 | --[[ -- You can configure sections in the statusline by overriding their ]] 27 | --[[ -- default behavior. For example, here we set the section for ]] 28 | --[[ -- cursor location to LINE:COLUMN ]] 29 | --[[ ---@diagnostic disable-next-line: duplicate-set-field ]] 30 | --[[ statusline.section_location = function() ]] 31 | --[[ return "%2l:%-2v" ]] 32 | --[[ end ]] 33 | -- Check out: https://github.com/echasnovski/mini.nvim 34 | end, 35 | } 36 | -------------------------------------------------------------------------------- /lua/plugins/ui/hover.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "lewis6991/hover.nvim", 3 | config = function() 4 | require("hover").setup({ 5 | init = function() 6 | -- Require providers 7 | require("hover.providers.lsp") 8 | -- require('hover.providers.gh') 9 | -- require('hover.providers.gh_user') 10 | -- require('hover.providers.jira') 11 | require("hover.providers.dap") 12 | require("hover.providers.fold_preview") 13 | require("hover.providers.diagnostic") 14 | -- require('hover.providers.man') 15 | -- require('hover.providers.dictionary') 16 | -- require('hover.providers.highlight') 17 | end, 18 | preview_opts = { 19 | border = "rounded", 20 | }, 21 | -- Whether the contents of a currently open hover window should be moved 22 | -- to a :h preview-window when pressing the hover keymap. 23 | preview_window = false, 24 | title = true, 25 | mouse_providers = { 26 | "LSP", 27 | }, 28 | mouse_delay = 1000, 29 | }) 30 | 31 | -- Setup keymaps 32 | vim.keymap.set("n", "K", require("hover").hover, { desc = "hover.nvim" }) 33 | vim.keymap.set("n", "gK", require("hover").hover_select, { desc = "hover.nvim (select)" }) 34 | vim.keymap.set("n", "", function() 35 | require("hover").hover_switch("previous") 36 | end, { desc = "hover.nvim (previous source)" }) 37 | vim.keymap.set("n", "", function() 38 | require("hover").hover_switch("next") 39 | end, { desc = "hover.nvim (next source)" }) 40 | 41 | -- Mouse support 42 | vim.keymap.set("n", "", require("hover").hover_mouse, { desc = "hover.nvim (mouse)" }) 43 | vim.o.mousemoveevent = true 44 | end, 45 | } 46 | -------------------------------------------------------------------------------- /lua/setup.lua: -------------------------------------------------------------------------------- 1 | local setup = { 2 | priority = 3000, 3 | transparency = false, 4 | colorscheme = "oldworld", 5 | search_dirs = { 6 | -- Point to your projects folder 7 | -- Allows You to navigte through projects with sp 8 | "~/dev/projects", 9 | }, 10 | -- Define Your paths here 11 | -- It's important to keep the formatting as it is. 12 | -- Obsidian.nvim has a very specific directory pointers so be sure to 'mimic' below configuration. 13 | -- Make sure the formatting is right! 14 | -- The following configuration assumes that You have somewhat similar path setup in Your zettelkasten: 15 | -- ~/path/to/vault/ 16 | -- templates/ 17 | -- daily/ 18 | -- myAssets/ 19 | -- botchats/ 20 | -- ...any other folders 21 | -- You can change folder names to Your liking. 22 | -- Just make sure that You don't change formattings. Leave '~' and './' where they are. 23 | obsidian_dirs = { 24 | templates = "templates/", -- point to a templates folder in Your zettelkasten like so: ~/myvaults/mainvault/templates/ 25 | dailynotes = "./daily", -- point to a daily notes folder in Your zettelkasten like so: ./daily/ 26 | attachments = "myAssets/", -- point to an assets folder in Your zettelkasten like so: assets/ 27 | generalpath = "~/path/to/vault/", -- ~/myvaults/mainvault/ 28 | mainnotes = "~/path/to/vault/mainnotes/", -- This direction specifies what is the main folder for Your notes. This information is used in dashboard - to pick a random note from Your main notes. 29 | }, 30 | chat_dir = "~/path/to/vault/botchats/", -- This folder can be anywhere in the filesystem. I just happen to want to have my LLM chats inside zettelkasten, so I can reference to them anytime I want. 31 | } 32 | 33 | return setup 34 | -------------------------------------------------------------------------------- /lua/plugins/telescope.lua: -------------------------------------------------------------------------------- 1 | local setup = require("setup") 2 | return { 3 | "nvim-telescope/telescope.nvim", 4 | event = "VimEnter", 5 | branch = "0.1.x", 6 | dependencies = { 7 | "nvim-lua/plenary.nvim", 8 | { 9 | "nvim-telescope/telescope-fzf-native.nvim", 10 | build = "make", 11 | cond = function() 12 | return vim.fn.executable("make") == 1 13 | end, 14 | }, 15 | { "nvim-telescope/telescope-ui-select.nvim" }, 16 | { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, 17 | }, 18 | config = function() 19 | local actions = require("telescope.actions") 20 | require("telescope").setup({ 21 | defaults = { 22 | mappings = { 23 | n = { 24 | [""] = require("telescope.actions").delete_buffer, 25 | }, 26 | }, 27 | }, 28 | extensions = { 29 | file_browser = { hijack_netrw = true }, 30 | ["ui-select"] = { 31 | require("telescope.themes").get_dropdown(), 32 | }, 33 | repo = { 34 | list = { 35 | search_dirs = setup.search_dirs, 36 | mappings = { 37 | i = { 38 | [""] = function(prompt_bufnr) 39 | actions.close(prompt_bufnr) 40 | --[[ -- Set current repository path as neo-tree path ]] 41 | --[[ vim.cmd("Neotree close") -- CLose neo-tree if it's opened ]] 42 | --[[ vim.cmd(string.format("Neotree filesystem left dir=%s", entry.value)) -- Użycie string.format do otwarcia Neo-tree ]] 43 | --[[ print("Opened Neo-tree in directory: " .. entry.value) ]] 44 | end, 45 | }, 46 | }, 47 | }, 48 | }, 49 | }, 50 | }) 51 | pcall(require("telescope").load_extension, "fzf") 52 | pcall(require("telescope").load_extension, "ui-select") 53 | end, 54 | } 55 | -------------------------------------------------------------------------------- /lsp/luals.lua: -------------------------------------------------------------------------------- 1 | -- NOTE: Download lua-language-server from Your package manager e.g `yay -S lua-language-server` 2 | return { 3 | cmd = { "lua-language-server" }, 4 | filetypes = { "lua" }, 5 | root_markers = { ".luarc.json", ".luarc.jsonc" }, 6 | telemetry = { enabled = false }, 7 | formatters = { 8 | ignoreComments = false, 9 | }, 10 | settings = { 11 | Lua = { 12 | runtime = { 13 | version = "LuaJIT", 14 | }, 15 | signatureHelp = { enabled = true }, 16 | completion = { 17 | callSnippet = "Replace", 18 | }, 19 | workspace = { 20 | -- Nie każ serwerowi ładować ogromnej liczby plików przy starcie 21 | maxPreload = 2000, 22 | preloadFileSize = 1000, 23 | -- WAŻNE: Lista katalogów do ignorowania. Dostosuj ją do swoich potrzeb. 24 | ignoreDir = { 25 | ".git", 26 | "node_modules", 27 | "__pycache__", 28 | ".cache", 29 | ".local", 30 | ".config", 31 | "Downloads", 32 | "Pictures", 33 | "Documents", 34 | "Videos", 35 | "apps", 36 | "games", 37 | }, 38 | -- To rozwiązuje problem nr 1: nierozpoznawanie 'vim' 39 | -- Informuje serwer o bibliotekach środowiska Neovim 40 | library = { 41 | [vim.fn.expand("$VIMRUNTIME/lua")] = true, 42 | [vim.fn.stdpath("config") .. "/lua"] = true, 43 | }, 44 | }, 45 | -- To również pomaga w problemie nr 1 46 | diagnostics = { 47 | -- Daj serwerowi znać, że 'vim' jest predefiniowaną zmienną globalną 48 | globals = { "vim" }, 49 | }, 50 | -- Poprawia wydajność, wyłączając diagnostykę dla plików, których nie otworzyłeś 51 | diagnosticsOnOpen = true, 52 | diagnosticsOnSave = true, 53 | -- Wyłącz diagnostykę dla całego workspace, używaj tylko dla otwartych plików 54 | workspaceDiagnostics = false, 55 | }, 56 | }, 57 | } 58 | -------------------------------------------------------------------------------- /lua/plugins/ui/markview-nvim.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "OXY2DEV/markview.nvim", 3 | lazy = false, 4 | priority = 49, -- 49 because treesitter is 50. issue: https://github.com/OXY2DEV/markview.nvim/issues/365 -- 5 | ft = { "markdown", "norg", "rmd", "org", "vimwiki", "Avante" }, 6 | opts = { 7 | filetypes = { 8 | "markdown", 9 | "norg", 10 | "rmd", 11 | "org", 12 | "vimwiki", 13 | "Avante", 14 | }, 15 | }, 16 | config = function() 17 | local presets_checkboxes = require("markview.presets").checkboxes 18 | local presets_headings = require("markview.presets").headings 19 | local presets_horizontal = require("markview.presets").horizontal_rules 20 | require("markview").setup({ 21 | preview = { 22 | enable = true, 23 | modes = { "n", "i", "c" }, 24 | hybrid_modes = { "n", "i", "c" }, 25 | render_distance = { 200, 200 }, 26 | debounce = 50, 27 | }, 28 | markdown = { 29 | headings = presets_headings.glow, --other cool opts are or presets.glow_center 30 | horizontal_rules = presets_horizontal.thick, 31 | }, 32 | markdown_inline = { 33 | checkboxes = presets_checkboxes.nerd, 34 | }, 35 | latex = { 36 | enable = true, 37 | inlines = { enable = true }, 38 | commands = { 39 | ["sin"] = {}, 40 | }, 41 | }, 42 | }) 43 | 44 | require("markview.extras.checkboxes").setup({ 45 | ---@type string 46 | default = "X", 47 | ---@type 48 | ---| "disable" 49 | ---| "checkbox" 50 | ---| "list_item" 51 | remove_style = "disable", 52 | ---@type string[][] 53 | states = { 54 | { " ", "/", "X" }, 55 | { "<", ">" }, 56 | { "?", "!", "*" }, 57 | { '"' }, 58 | { "l", "b", "i" }, 59 | { "S", "I" }, 60 | { "p", "c" }, 61 | { "f", "k", "w" }, 62 | { "u", "d" }, 63 | }, 64 | }) 65 | end, 66 | dependencies = { 67 | "nvim-treesitter/nvim-treesitter", 68 | "nvim-tree/nvim-web-devicons", 69 | }, 70 | } 71 | -------------------------------------------------------------------------------- /lua/plugins/ui/transparent.lua: -------------------------------------------------------------------------------- 1 | return { 2 | cond = vim.g.setup.transparency, 3 | "xiyaowong/transparent.nvim", 4 | priority = 1099, 5 | config = function() 6 | require("transparent").setup({ 7 | groups = { 8 | "CursorLine", 9 | "NonText", 10 | "Operator", 11 | "Structure", 12 | "SignColumn", 13 | "LineNr", 14 | "WinSeparator", 15 | "CursorLineNr", 16 | "Normal", 17 | "NormalNC", 18 | "Comment", 19 | "Constant", 20 | "Special", 21 | "Identifier", 22 | "Statement", 23 | "PreProc", 24 | "Type", 25 | "Underlined", 26 | "Todo", 27 | "String", 28 | "Function", 29 | "Conditional", 30 | "Repeat", 31 | }, 32 | extra_groups = { 33 | "GitSignsText", 34 | "GitSignsAdd", 35 | "GitSignsAdded", 36 | "GitSignsChange", 37 | "GitSignsChanged", 38 | "GitSignsDelete", 39 | "GitSignsDeleted", 40 | "GitSignsUpdate", 41 | "GitSignsUpdated", 42 | "GitSignsTopdelete", 43 | "GitSignsTopdeleteNr", 44 | "GitSignsUntracked", 45 | "GitSignsUntrackedNr", 46 | "DiagnosticSignError", 47 | "DiagnosticSignWarn", 48 | "DiagnosticSignInfo", 49 | "DiagnosticSignHint", 50 | }, 51 | exclude_groups = { 52 | "TinyInlineDiagnosticVirtualTextError", 53 | "TinyInlineDiagnosticVirtualTextWarn", 54 | "TinyInlineDiagnosticVirtualTextInfo", 55 | "TinyInlineDiagnosticVirtualTextHint", 56 | "TinyInlineDiagnosticVirtualTextArrow", 57 | "TinyInlineInvDiagnosticVirtualTextError", 58 | "TinyInlineInvDiagnosticVirtualTextWarn", 59 | "TinyInlineInvDiagnosticVirtualTextInfo", 60 | "TinyInlineInvDiagnosticVirtualTextHint", 61 | "MsgArea", 62 | "WinBar", 63 | "WinBarNC", 64 | "EndOfBuffer", 65 | "Float", 66 | "NormalFloat", 67 | "FloatBorder", 68 | "Term", 69 | "StatusLine", 70 | "StatusLineNC", 71 | "VertSplit", 72 | "Split", 73 | "Separator", 74 | "Horizontal", 75 | }, 76 | }) 77 | end, 78 | } 79 | -------------------------------------------------------------------------------- /lua/utils/autosave.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | function M.setup() 3 | local api = vim.api 4 | local fn = vim.fn 5 | 6 | local delay = 1000 -- ms 7 | local autosave_enabled = true -- Flaga, czy autosave jest włączony 8 | 9 | -- Funkcja przełączająca stan autosave 10 | function _G.toggle_autosave() 11 | autosave_enabled = not autosave_enabled 12 | if autosave_enabled then 13 | vim.notify("Autosave enabled") 14 | else 15 | vim.notify("Autosave disabled") 16 | end 17 | end 18 | 19 | local autosave = api.nvim_create_augroup("autosave", { clear = true }) 20 | 21 | -- Initialization 22 | api.nvim_create_autocmd("BufRead", { 23 | pattern = "*", 24 | group = autosave, 25 | callback = function(ctx) 26 | api.nvim_buf_set_var(ctx.buf, "autosave_queued", false) 27 | api.nvim_buf_set_var(ctx.buf, "autosave_block", false) 28 | end, 29 | }) 30 | 31 | api.nvim_create_autocmd({ "InsertLeave", "TextChanged" }, { 32 | pattern = "*", 33 | group = autosave, 34 | callback = function(ctx) 35 | -- Sprawdź, czy autosave jest włączony 36 | if not autosave_enabled then 37 | return 38 | end 39 | 40 | -- conditions that do not do autosave 41 | local disabled_ft = { "acwrite", "oil" } 42 | if 43 | not vim.bo.modified 44 | or fn.findfile(ctx.file, ".") == "" -- a new file 45 | or ctx.file:match("wezterm.lua") 46 | or vim.tbl_contains(disabled_ft, vim.bo[ctx.buf].ft) 47 | then 48 | return 49 | end 50 | 51 | local ok, queued = pcall(api.nvim_buf_get_var, ctx.buf, "autosave_queued") 52 | if not ok then 53 | return 54 | end 55 | 56 | if not queued then 57 | vim.cmd("silent w") 58 | api.nvim_buf_set_var(ctx.buf, "autosave_queued", true) 59 | vim.notify("Saved at " .. os.date("%H:%M:%S")) 60 | end 61 | 62 | local block = api.nvim_buf_get_var(ctx.buf, "autosave_block") 63 | if not block then 64 | api.nvim_buf_set_var(ctx.buf, "autosave_block", true) 65 | vim.defer_fn(function() 66 | if api.nvim_buf_is_valid(ctx.buf) then 67 | api.nvim_buf_set_var(ctx.buf, "autosave_queued", false) 68 | api.nvim_buf_set_var(ctx.buf, "autosave_block", false) 69 | end 70 | end, delay) 71 | end 72 | end, 73 | }) 74 | end 75 | 76 | return M 77 | -------------------------------------------------------------------------------- /lua/colorschemes/vague.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "vague2k/vague.nvim", 3 | cond = vim.g.setup.colorscheme == "vague", 4 | config = function() 5 | -- NOTE: you do not need to call setup if you don't want to. 6 | require("vague").setup({ 7 | transparent = vim.g.setup.transparency, -- don't set background 8 | style = { 9 | -- "none" is the same thing as default. But "italic" and "bold" are also valid options 10 | boolean = "bold", 11 | number = "none", 12 | float = "none", 13 | error = "bold", 14 | comments = "italic", 15 | conditionals = "none", 16 | functions = "none", 17 | headings = "bold", 18 | operators = "none", 19 | strings = "italic", 20 | variables = "none", 21 | 22 | -- keywords 23 | keywords = "none", 24 | keyword_return = "italic", 25 | keywords_loop = "none", 26 | keywords_label = "none", 27 | keywords_exception = "none", 28 | 29 | -- builtin 30 | builtin_constants = "bold", 31 | builtin_functions = "none", 32 | builtin_types = "bold", 33 | builtin_variables = "none", 34 | }, 35 | -- plugin styles where applicable 36 | -- make an issue/pr if you'd like to see more styling options! 37 | plugins = { 38 | cmp = { 39 | match = "bold", 40 | match_fuzzy = "bold", 41 | }, 42 | dashboard = { 43 | footer = "italic", 44 | }, 45 | lsp = { 46 | diagnostic_error = "bold", 47 | diagnostic_hint = "none", 48 | diagnostic_info = "italic", 49 | diagnostic_warn = "bold", 50 | }, 51 | neotest = { 52 | focused = "bold", 53 | adapter_name = "bold", 54 | }, 55 | telescope = { 56 | match = "bold", 57 | }, 58 | }, 59 | -- Override colors 60 | colors = { 61 | bg = "#141415", 62 | fg = "#cdcdcd", 63 | floatBorder = "#878787", 64 | line = "#252530", 65 | comment = "#606079", 66 | builtin = "#b4d4cf", 67 | func = "#c48282", 68 | string = "#e8b589", 69 | number = "#e0a363", 70 | property = "#c3c3d5", 71 | constant = "#aeaed1", 72 | parameter = "#bb9dbd", 73 | visual = "#333738", 74 | error = "#d8647e", 75 | warning = "#f3be7c", 76 | hint = "#7e98e8", 77 | operator = "#90a0b5", 78 | keyword = "#6e94b2", 79 | type = "#9bb4bc", 80 | search = "#405065", 81 | plus = "#7fa563", 82 | delta = "#f3be7c", 83 | }, 84 | }) 85 | vim.cmd.colorscheme("vague") 86 | end, 87 | } 88 | -------------------------------------------------------------------------------- /lsp/omnisharp.lua: -------------------------------------------------------------------------------- 1 | -- yay -S mono-msbuild 2 | -- Download OmniSharp from their official github, unpack it and place it in Your PATH 3 | local util = require("lspconfig.util") 4 | 5 | return { 6 | cmd = { 7 | vim.fn.executable("OmniSharp") == 1 and "OmniSharp" or "omnisharp", 8 | "-z", -- https://github.com/OmniSharp/omnisharp-vscode/pull/4300 9 | "--hostPID", 10 | tostring(vim.fn.getpid()), 11 | "DotNet:enablePackageRestore=false", 12 | "--encoding", 13 | "utf-8", 14 | "--languageserver", 15 | }, 16 | filetypes = { "cs", "vb" }, 17 | root_dir = function(bufnr, on_dir) 18 | local fname = vim.api.nvim_buf_get_name(bufnr) 19 | on_dir( 20 | util.root_pattern("*.sln")(fname) 21 | or util.root_pattern("*.csproj")(fname) 22 | or util.root_pattern("omnisharp.json")(fname) 23 | or util.root_pattern("function.json")(fname) 24 | ) 25 | end, 26 | init_options = {}, 27 | capabilities = { 28 | workspace = { 29 | workspaceFolders = false, -- https://github.com/OmniSharp/omnisharp-roslyn/issues/909 30 | }, 31 | }, 32 | settings = { 33 | FormattingOptions = { 34 | -- Enables support for reading code style, naming convention and analyzer 35 | -- settings from .editorconfig. 36 | EnableEditorConfigSupport = true, 37 | -- Specifies whether 'using' directives should be grouped and sorted during 38 | -- document formatting. 39 | OrganizeImports = true, 40 | }, 41 | MsBuild = { 42 | -- If true, MSBuild project system will only load projects for files that 43 | -- were opened in the editor. This setting is useful for big C# codebases 44 | -- and allows for faster initialization of code navigation features only 45 | -- for projects that are relevant to code that is being edited. With this 46 | -- setting enabled OmniSharp may load fewer projects and may thus display 47 | -- incomplete reference lists for symbols. 48 | LoadProjectsOnDemand = nil, 49 | }, 50 | RoslynExtensionsOptions = { 51 | EnableAnalyzersSupport = true, 52 | EnableImportCompletion = true, 53 | AnalyzeOpenDocumentsOnly = nil, 54 | EnableDecompilationSupport = nil, 55 | }, 56 | RenameOptions = { 57 | RenameInComments = nil, 58 | RenameOverloads = nil, 59 | RenameInStrings = nil, 60 | }, 61 | Sdk = { 62 | -- Specifies whether to include preview versions of the .NET SDK when 63 | -- determining which version to use for project loading. 64 | IncludePrereleases = true, 65 | }, 66 | }, 67 | } 68 | -------------------------------------------------------------------------------- /lua/core/autocmds.lua: -------------------------------------------------------------------------------- 1 | -- Autocmd for molten 2 | vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { 3 | pattern = "*", 4 | callback = function() 5 | if vim.bo.filetype == "markdown" and vim.fn.expand("%:e") == "ipynb" then 6 | vim.notify("ipynb detected") 7 | vim.keymap.set( 8 | "n", 9 | "mi", 10 | ":MoltenInit", 11 | { silent = true, desc = "Initialize the plugin", buffer = true } 12 | ) 13 | vim.keymap.set( 14 | "n", 15 | "e", 16 | ":MoltenEvaluateOperator", 17 | { silent = true, desc = "Run operator selection", buffer = true } 18 | ) 19 | vim.keymap.set( 20 | "n", 21 | "rl", 22 | ":MoltenEvaluateLine", 23 | { silent = true, desc = "Evaluate line", buffer = true } 24 | ) 25 | vim.keymap.set( 26 | "n", 27 | "rr", 28 | ":MoltenReevaluateCell", 29 | { silent = true, desc = "Re-evaluate cell", buffer = true } 30 | ) 31 | vim.keymap.set( 32 | "v", 33 | "r", 34 | ":MoltenEvaluateVisualgv", 35 | { silent = true, desc = "Evaluate visual selection", buffer = true } 36 | ) 37 | 38 | vim.keymap.set("n", "ip", function() 39 | local venv = os.getenv("VIRTUAL_ENV") or os.getenv("CONDA_PREFIX") 40 | if venv ~= nil then 41 | venv = string.match(venv, "/.+/(.+)") 42 | vim.cmd(("MoltenInit %s"):format(venv)) 43 | else 44 | vim.cmd("MoltenInit python3") 45 | end 46 | end, { desc = "Initialize Molten for python3", silent = true, buffer = true }) 47 | end 48 | end, 49 | }) 50 | -- Restore cursor to file position in previous editing session -- 51 | vim.api.nvim_create_autocmd("BufReadPost", { 52 | callback = function(args) 53 | local mark = vim.api.nvim_buf_get_mark(args.buf, '"') 54 | local line_count = vim.api.nvim_buf_line_count(args.buf) 55 | if mark[1] > 0 and mark[1] <= line_count then 56 | vim.cmd('normal! g`"zz') 57 | end 58 | end, 59 | }) 60 | -- resize on = 61 | vim.api.nvim_create_autocmd("VimResized", { 62 | command = "wincmd =", 63 | }) 64 | -- self explanatory 65 | vim.api.nvim_create_autocmd("TextYankPost", { 66 | desc = "Highlight when yanking (copying) text", 67 | group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }), 68 | callback = function() 69 | vim.highlight.on_yank({ higroup = "YankHighlight", timeout = 150 }) 70 | end, 71 | }) 72 | require("utils.autosave").setup() 73 | -------------------------------------------------------------------------------- /lua/plugins/nvim-cmp.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "hrsh7th/nvim-cmp", 3 | event = "InsertEnter", 4 | dependencies = { 5 | "mlaursen/vim-react-snippets", 6 | { 7 | "L3MON4D3/LuaSnip", 8 | build = (function() 9 | if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then 10 | return 11 | end 12 | return "make install_jsregexp" 13 | end)(), 14 | dependencies = { 15 | -- `friendly-snippets` contains a variety of premade snippets. 16 | -- See the README about individual language/framework/plugin snippets: 17 | -- https://github.com/rafamadriz/friendly-snippets 18 | -- { 19 | -- 'rafamadriz/friendly-snippets', 20 | -- config = function() 21 | -- require('luasnip.loaders.from_vscode').lazy_load() 22 | -- end, 23 | -- }, 24 | }, 25 | }, 26 | "saadparwaiz1/cmp_luasnip", 27 | "hrsh7th/cmp-nvim-lsp", 28 | "hrsh7th/cmp-path", 29 | }, 30 | config = function() 31 | require("vim-react-snippets").lazy_load() 32 | local cmp = require("cmp") 33 | local luasnip = require("luasnip") 34 | luasnip.config.setup({}) 35 | 36 | cmp.setup({ 37 | window = { 38 | documentation = cmp.config.window.bordered(), 39 | completion = cmp.config.window.bordered({ 40 | winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None", 41 | }), 42 | }, 43 | snippet = { 44 | expand = function(args) 45 | luasnip.lsp_expand(args.body) 46 | end, 47 | }, 48 | completion = { completeopt = "menu,menuone,noinsert" }, 49 | 50 | -- For an understanding of why these mappings were 51 | -- chosen, you will need to read `:help ins-completion` 52 | -- 53 | -- No, but seriously. Please read `:help ins-completion`, it is really good! 54 | mapping = cmp.mapping.preset.insert({ 55 | [""] = cmp.mapping.select_next_item(), 56 | [""] = cmp.mapping.select_prev_item(), 57 | [""] = cmp.mapping.scroll_docs(-4), 58 | [""] = cmp.mapping.scroll_docs(4), 59 | [""] = cmp.mapping.confirm({ select = true }), 60 | [""] = cmp.mapping.complete({}), 61 | -- Think of as moving to the right of your snippet expansion. 62 | -- So if you have a snippet that's like: 63 | -- function $name($args) 64 | -- $body 65 | -- end 66 | -- 67 | -- will move you to the right of each of the expansion locations. 68 | -- is similar, except moving you backwards. 69 | [""] = cmp.mapping(function() 70 | if luasnip.expand_or_locally_jumpable() then 71 | luasnip.expand_or_jump() 72 | end 73 | end, { "i", "s" }), 74 | [""] = cmp.mapping(function() 75 | if luasnip.locally_jumpable(-1) then 76 | luasnip.jump(-1) 77 | end 78 | end, { "i", "s" }), 79 | }), 80 | sources = { 81 | { 82 | name = "lazydev", 83 | -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it 84 | group_index = 0, 85 | }, 86 | { name = "nvim_lsp" }, 87 | { name = "luasnip" }, 88 | { name = "path" }, 89 | }, 90 | }) 91 | end, 92 | } 93 | -------------------------------------------------------------------------------- /lsp/tailwindcss.lua: -------------------------------------------------------------------------------- 1 | return { 2 | cmd = { "tailwindcss-language-server", "--stdio" }, 3 | -- filetypes copied and adjusted from tailwindcss-intellisense 4 | filetypes = { 5 | -- html 6 | "aspnetcorerazor", 7 | "astro", 8 | "astro-markdown", 9 | "blade", 10 | "clojure", 11 | "django-html", 12 | "htmldjango", 13 | "edge", 14 | "eelixir", -- vim ft 15 | "elixir", 16 | "ejs", 17 | "erb", 18 | "eruby", -- vim ft 19 | "gohtml", 20 | "gohtmltmpl", 21 | "haml", 22 | "handlebars", 23 | "hbs", 24 | "html", 25 | "htmlangular", 26 | "html-eex", 27 | "heex", 28 | "jade", 29 | "leaf", 30 | "liquid", 31 | "markdown", 32 | "mdx", 33 | "mustache", 34 | "njk", 35 | "nunjucks", 36 | "php", 37 | "razor", 38 | "slim", 39 | "twig", 40 | -- css 41 | "css", 42 | "less", 43 | "postcss", 44 | "sass", 45 | "scss", 46 | "stylus", 47 | "sugarss", 48 | -- js 49 | "javascript", 50 | "javascriptreact", 51 | "reason", 52 | "rescript", 53 | "typescript", 54 | "typescriptreact", 55 | -- mixed 56 | "vue", 57 | "svelte", 58 | "templ", 59 | }, 60 | settings = { 61 | tailwindCSS = { 62 | validate = true, 63 | lint = { 64 | cssConflict = "warning", 65 | invalidApply = "error", 66 | invalidScreen = "error", 67 | invalidVariant = "error", 68 | invalidConfigPath = "error", 69 | invalidTailwindDirective = "error", 70 | recommendedVariantOrder = "warning", 71 | }, 72 | classAttributes = { 73 | "class", 74 | "className", 75 | "class:list", 76 | "classList", 77 | "ngClass", 78 | }, 79 | includeLanguages = { 80 | eelixir = "html-eex", 81 | elixir = "phoenix-heex", 82 | eruby = "erb", 83 | heex = "phoenix-heex", 84 | htmlangular = "html", 85 | templ = "html", 86 | }, 87 | }, 88 | }, 89 | before_init = function(_, config) 90 | if not config.settings then 91 | config.settings = {} 92 | end 93 | if not config.settings.editor then 94 | config.settings.editor = {} 95 | end 96 | if not config.settings.editor.tabSize then 97 | config.settings.editor.tabSize = vim.lsp.util.get_effective_tabstop() 98 | end 99 | end, 100 | workspace_required = true, 101 | root_dir = function(bufnr, on_dir) 102 | local root_files = { 103 | -- Generic 104 | "tailwind.config.js", 105 | "tailwind.config.cjs", 106 | "tailwind.config.mjs", 107 | "tailwind.config.ts", 108 | "postcss.config.js", 109 | "postcss.config.cjs", 110 | "postcss.config.mjs", 111 | "postcss.config.ts", 112 | -- Django 113 | "theme/static_src/tailwind.config.js", 114 | "theme/static_src/tailwind.config.cjs", 115 | "theme/static_src/tailwind.config.mjs", 116 | "theme/static_src/tailwind.config.ts", 117 | "theme/static_src/postcss.config.js", 118 | } 119 | local fname = vim.api.nvim_buf_get_name(bufnr) 120 | root_files = util.insert_package_json(root_files, "tailwindcss", fname) 121 | root_files = util.root_markers_with_field(root_files, { "mix.lock", "Gemfile.lock" }, "tailwind", fname) 122 | on_dir(vim.fs.dirname(vim.fs.find(root_files, { path = fname, upward = true })[1])) 123 | end, 124 | } 125 | -------------------------------------------------------------------------------- /lua/core/options.lua: -------------------------------------------------------------------------------- 1 | -- Set as the leader key 2 | vim.g.mapleader = " " 3 | vim.g.maplocalleader = " " 4 | vim.g.python3_host_prog = vim.fn.expand("~/.virtualenvs/neovim/bin/python3") -- We're setting virtual environment for jupyter notebook (molten-nvim) 5 | 6 | vim.filetype.add({ 7 | extension = { 8 | ipynb = "python", 9 | }, 10 | }) 11 | 12 | vim.g.python3_host_prog = vim.fn.expand("~/.virtualenvs/neovim/bin/python3") 13 | 14 | -- Set markdown folding to 1 15 | vim.opt.foldenable = true 16 | vim.opt.foldlevelstart = 99 17 | vim.g.markdown_folding = 1 18 | 19 | -- Set to true if you have a Nerd Font installed and selected in the terminal 20 | vim.g.have_nerd_font = true 21 | -- See `:help vim.opt` 22 | -- For more options, you can see `:help option-list` 23 | 24 | -- Make line numbers default 25 | vim.opt.conceallevel = 1 26 | vim.opt.number = true 27 | 28 | -- Relative line numbers 29 | vim.opt.relativenumber = true 30 | 31 | -- Enable mouse mode 32 | vim.opt.mouse = "a" 33 | 34 | -- Don't show the mode, it's already in the status line 35 | vim.opt.showmode = false 36 | 37 | -- Sync clipboard between OS and Neovim. 38 | -- Schedule the setting after `UiEnter` because it can increase startup-time. 39 | -- Remove this option if you want your OS clipboard to remain independent. 40 | -- See `:help 'clipboard'` 41 | vim.schedule(function() 42 | vim.opt.clipboard = "unnamedplus" 43 | end) 44 | 45 | -- Enable break indent 46 | vim.opt.breakindent = true 47 | 48 | -- Save undo history 49 | vim.opt.undofile = true 50 | 51 | -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term 52 | vim.opt.ignorecase = true 53 | vim.opt.smartcase = true 54 | 55 | -- Keep signcolumn on by default 56 | vim.opt.signcolumn = "yes" 57 | 58 | -- Decrease update time 59 | vim.opt.updatetime = 250 60 | 61 | -- Decrease mapped sequence wait time 62 | vim.opt.timeoutlen = 300 63 | 64 | -- Configure how new splits should be opened 65 | vim.opt.splitright = true 66 | vim.opt.splitbelow = true 67 | 68 | -- Sets how neovim will display certain whitespace characters in the editor. 69 | -- vim.opt.list = true 70 | -- vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } 71 | 72 | -- Preview substitutions live, as you type! 73 | vim.opt.inccommand = "split" 74 | 75 | -- Show which line your cursor is on 76 | -- vim.opt.cursorline = false 77 | 78 | -- Minimal number of screen lines to keep above and below the cursor. 79 | vim.opt.scrolloff = 10 80 | vim.opt.sidescrolloff = 24 81 | 82 | -- Remove the ~ tilde signs at the end of the buffer 83 | vim.opt.fillchars = { eob = " " } 84 | 85 | -- conditionally render colorschemes. 86 | if vim.g.setup.colorscheme == "miss-dracula" then 87 | require("colorschemes.miss-dracula").setup() 88 | end 89 | 90 | vim.api.nvim_set_hl(0, "Visual", { bg = "#475569" }) 91 | vim.api.nvim_set_hl(0, "YankHighlight", { bg = "#00274D", fg = "#ADD8E6", bold = true }) 92 | -- open init.lua on :config 93 | 94 | local function open_config() 95 | local config_path = vim.fn.stdpath("config") .. "/init.lua" 96 | vim.cmd("edit " .. config_path) 97 | end 98 | 99 | vim.api.nvim_create_user_command("Config", open_config, { 100 | desc = "Opens the Neovim configuration file (init.lua)", 101 | }) 102 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > [!Note] 2 | > Most of people and most of stars are coming from those looking to get that juicy header image generation on their own. I myself have lost motivation (and interest) towards maintaining this repository as a Neovim repository, which it used to be. I have personally switched to [LazyVim](https://www.lazyvim.org/) and I maintain my own set of plugins there. Having the ability to simply download an `Extra` for a certain language (C#/Java/Go / whatever) is a bliss and I refuse to compete with that. I am leaving this readme purely as a tutorial on how to set up those `alpha-nvim` images. Alpha-nvim config should still be reliable to use from this config (as well as generated images and commands in obsidian plugin). 3 | 4 | ## Preview 5 | 6 | ![arcane_ekko image preview](./assets/README-img/2025-02-01-at-15-01-04.avif) 7 | *Arcane_ekko.jpg image preview* 8 | --- 9 | ![Arcane wild rune image](./assets/README-img/2025-02-01-at-15-02-21.avif) 10 | *You can change images while at dashboard with `w` key* 11 | --- 12 | ![Manage tasks](./assets/README-img/2025-02-01-at-15-05-17.avif) 13 | *`` Let's You manage Your daily tasks from Your Zettelkasten!* 14 | --- 15 | ![Updated task](./assets/README-img/2025-02-01-at-15-05-53.avif) 16 | *And You can see them update in real-time!* 17 | --- 18 | ![Running typr from dashboard](./assets/README-img/2025-01-26-at-01-38-57.avif) 19 | *Running Typr plugin directly from dashboard* 20 | --- 21 | ![Quick markdown look](./assets/README-img/2025-01-26-at-01-40-22.avif) 22 | *Quick markdown look* 23 | --- 24 | 25 | ## Dashboard images 26 | How do I set my own dashboard images? Very easy! We're going 27 | to use [Asthestarsfalll's img2art github repository](https://github.com/Asthestarsfalll/img2art) but 28 | with a quick style fix from me, that's going to speed up the 29 | process by 90%. 30 | 31 | >[!important] 32 | > For more details or custom output options visit [Asthestarsfalll's img2art github repository](https://github.com/Asthestarsfalll/img2art)
33 | > Without him none of this would be possible! 34 | 35 | #### img2art Installation 36 | 37 | ##### Prerequisites 38 | Due to the fix that we had to apply make sure that You have python's `poetry` installed on your system. 39 | 1. Clone [my fork](https://github.com/nxtkofi/img2art) of ASthestarsfalll's repository. 40 | `git clone https://github.com/nxtkofi/img2art` 41 | 2. Install requirements inside the project root 42 | ``` 43 | cd img2art 44 | python -m venv ./venv 45 | source venv/bin/activate 46 | pip install typer opencv-python numpy 47 | ``` 48 | 49 | 3. We're now ready to go! Run: 50 | `poetry run python -m img2art.cli ~/path/to/picture.jpg --scale 0.3 --threshold 20 --save-raw ./test.lua --alpha` 51 | 52 | What does it do: 53 | - `--scale 0.3` This is scaling for our image. Pick a value so it fits into Your dashboard 54 | - `--threshold 20` This is black-white threshold point. I suggest You play around it for a bit to see what's the best outcome for Your picture. Usually it's something between 20-150 55 | - `./test.lua` This is where our output file will go and what name will it receive. Leave .lua extension. You may change the name. 56 | - `--alpha` This makes sure that we get our picture in desired output style (ready to paste into alpha's dashboard!). 57 | 58 | You should have Your output file now! 59 | Move it into header_img folder. 60 | Now to set a header image go ahead and check out my ./lua/custom/plugins/alpha.lua file.
61 | Function `load_random_header()` loads random header image from header_img folder on nvim startup. 62 | 63 | >[!important] 64 | > Make sure you add `local header = load_random_header()` - otherwise Your image will not get initialized. 65 | 66 | >[!tip] 67 | > I also wrote a function `change_header()` which let's you change header when you press `w` in dashboard. 68 | 69 | ## Keymaps 70 | All keymaps are defined in /lua/keymaps.lua (except for 71 | those that were defined in plugin files - those are listed 72 | at the end of keymaps.lua so You can easily find them!) 73 | -------------------------------------------------------------------------------- /lua/plugins/debugging/dap.lua: -------------------------------------------------------------------------------- 1 | -- lua/plugins/dap.lua 2 | return { 3 | "mfussenegger/nvim-dap", 4 | dependencies = { 5 | "nvim-neotest/nvim-nio", 6 | { 7 | "microsoft/vscode-js-debug", 8 | version = "1.x", 9 | build = "npm i && npm run compile vsDebugServerBundle && mv dist out", 10 | }, 11 | 12 | "mxsdev/nvim-dap-vscode-js", 13 | }, 14 | 15 | config = function() 16 | local dap = require("dap") 17 | local js_debug_path = vim.fn.stdpath("data") 18 | .. "/mason/packages/js-debug-adapter/js-debug/src/dapDebugServer.js" 19 | local node_path = vim.fn.exepath("node") -- używa node z PATH 20 | 21 | for _, adapterType in ipairs({ "node", "chrome", "msedge" }) do 22 | local pwaType = "pwa-" .. adapterType 23 | 24 | dap.adapters[pwaType] = { 25 | type = "server", 26 | host = "localhost", 27 | port = "${port}", 28 | executable = { 29 | command = node_path, 30 | args = { js_debug_path, "${port}" }, 31 | }, 32 | } 33 | 34 | dap.adapters[adapterType] = function(cb, config) 35 | local nativeAdapter = dap.adapters[pwaType] 36 | 37 | config.type = pwaType 38 | 39 | if type(nativeAdapter) == "function" then 40 | nativeAdapter(cb, config) 41 | else 42 | cb(nativeAdapter) 43 | end 44 | end 45 | end 46 | 47 | local enter_launch_url = function() 48 | local co = coroutine.running() 49 | return coroutine.create(function() 50 | vim.ui.input({ prompt = "Enter URL: ", default = "http://localhost:3000" }, function(url) 51 | if url and url ~= "" then 52 | coroutine.resume(co, url) 53 | end 54 | end) 55 | end) 56 | end 57 | 58 | for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact", "vue" }) do 59 | dap.configurations[language] = { 60 | { 61 | type = "pwa-node", 62 | request = "launch", 63 | name = "Debug TS file via ts-node", 64 | program = "${file}", 65 | cwd = "${workspaceFolder}", 66 | runtimeArgs = { "-r", "ts-node/register" }, 67 | sourceMaps = true, 68 | skipFiles = { "/**" }, 69 | console = "integratedTerminal", 70 | }, 71 | { 72 | type = "pwa-node", 73 | request = "attach", 74 | name = "Attach to process using Node.js (nvim-dap)", 75 | processId = require("dap.utils").pick_process, 76 | cwd = "${workspaceFolder}", 77 | }, 78 | { 79 | type = "pwa-node", 80 | request = "launch", 81 | name = "Launch file using ts-node/register (nvim-dap)", 82 | program = "${file}", 83 | cwd = "${workspaceFolder}", 84 | runtimeArgs = { "-r", "ts-node/register" }, 85 | }, 86 | { 87 | type = "pwa-chrome", 88 | request = "launch", 89 | name = "Launch Chrome (nvim-dap)", 90 | url = enter_launch_url, 91 | webRoot = "${workspaceFolder}", 92 | sourceMaps = true, 93 | }, 94 | { 95 | type = "pwa-msedge", 96 | request = "launch", 97 | name = "Launch Edge (nvim-dap)", 98 | url = enter_launch_url, 99 | webRoot = "${workspaceFolder}", 100 | sourceMaps = true, 101 | }, 102 | } 103 | end 104 | 105 | dap.configurations.java = { 106 | { 107 | name = "Debug Launch (2GB)", 108 | type = "java", 109 | request = "launch", 110 | vmArgs = "-Xmx2g", 111 | }, 112 | { 113 | name = "Debug Attach (8000)", 114 | type = "java", 115 | request = "attach", 116 | hostName = "127.0.0.1", 117 | port = 8000, 118 | }, 119 | { 120 | name = "Debug Attach (5005)", 121 | type = "java", 122 | request = "attach", 123 | hostName = "127.0.0.1", 124 | port = 5005, 125 | }, 126 | { 127 | name = "My Custom Java Run Configuration", 128 | type = "java", 129 | request = "launch", 130 | mainClass = "replace.with.your.fully.qualified.MainClass", 131 | vmArgs = "-Xmx2g", 132 | }, 133 | } 134 | print("nvim-dap core configured.") 135 | end, 136 | } 137 | -------------------------------------------------------------------------------- /lua/plugins/overseer.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "stevearc/overseer.nvim", 3 | cmd = { "OverseerRun", "OverseerOpen", "OverseerToggle" }, 4 | config = function() 5 | local overseer = require("overseer") 6 | overseer.setup({}) 7 | overseer.register_template({ 8 | name = "cyfrowydochod: Rest API", 9 | builder = function() 10 | return { 11 | label = "Run BE", 12 | cmd = { "mvn", "spring-boot:run" }, 13 | cwd = "server", 14 | components = { "default" }, 15 | } 16 | end, 17 | }) 18 | overseer.register_template({ 19 | name = "cyfrowydochod: AI microservice", 20 | builder = function() 21 | return { 22 | label = "Run AIm", 23 | cmd = { "mvn", "spring-boot:run" }, 24 | cwd = "aiservice", 25 | components = { "default" }, 26 | } 27 | end, 28 | }) 29 | overseer.register_template({ 30 | name = "cyfrowydochod: Frontend Dev Server", 31 | builder = function() 32 | return { 33 | label = "Run FE", 34 | cmd = { "npm", "run", "dev" }, 35 | cwd = "client", 36 | components = { "default" }, 37 | } 38 | end, 39 | }) 40 | overseer.register_template({ 41 | name = "cyfrowydochod: Full Stack", 42 | builder = function() 43 | return { 44 | name = "WebDevelopment", 45 | strategy = { 46 | "orchestrator", 47 | tasks = { 48 | { 49 | { "cyfrowydochod: AI microservice" }, 50 | { "cyfrowydochod: Rest API" }, 51 | { "cyfrowydochod: Frontend Dev Server" }, 52 | }, 53 | }, 54 | }, 55 | components = { "default" }, 56 | } 57 | end, 58 | }) 59 | -- r016/openSPACE 60 | overseer.register_template({ 61 | 62 | name = "openSPACE:Docker", 63 | builder = function() 64 | return { 65 | label = "Run docker", 66 | cmd = { "docker", "compose", "up", "-d" }, 67 | cwd = "src/database", 68 | components = { "default" }, 69 | } 70 | end, 71 | }) 72 | overseer.register_template({ 73 | name = "openSPACE:API", 74 | builder = function() 75 | return { 76 | label = "Run REST Api", 77 | cmd = { "dotnet", "run", "--launch-profile", "https" }, 78 | cwd = "src/openSPACE.API/src/openSPACE.API", 79 | components = { "default" }, 80 | } 81 | end, 82 | }) 83 | overseer.register_template({ 84 | name = "openSPACE:Frontend", 85 | builder = function() 86 | return { 87 | label = "Run nuxt front-end", 88 | cmd = { "npm", "run", "dev" }, 89 | cwd = "src/openSPACE.ClientApp", 90 | components = { "default" }, 91 | } 92 | end, 93 | }) 94 | overseer.register_template({ 95 | name = "openSPACE: Start Full Stack", 96 | builder = function() 97 | return { 98 | name = "WebDevelopment", 99 | strategy = { 100 | "orchestrator", 101 | tasks = { 102 | { { "openSPACE:Docker" }, { "openSPACE:API" }, { "openSPACE:Frontend" } }, 103 | }, 104 | }, 105 | components = { "default" }, 106 | } 107 | end, 108 | }) 109 | 110 | overseer.register_template({ 111 | name = "florart: Strapi API", 112 | builder = function() 113 | return { 114 | label = "Run Strapi", 115 | cmd = { "npm", "run", "dev" }, 116 | cwd = "server/strapi", 117 | components = { "default" }, 118 | } 119 | end, 120 | }) 121 | overseer.register_template({ 122 | name = "florart: Front-end", 123 | builder = function() 124 | return { 125 | label = "Run front", 126 | cmd = { "npm", "run", "dev" }, 127 | cwd = "client", 128 | components = { "default" }, 129 | } 130 | end, 131 | }) 132 | overseer.register_template({ 133 | name = "florart: Full Stack", 134 | builder = function() 135 | return { 136 | name = "WebDevelopment", 137 | strategy = { 138 | "orchestrator", 139 | tasks = { 140 | { { "florart: Strapi API" }, { "florart: Front-end" } }, 141 | }, 142 | }, 143 | components = { "default" }, 144 | } 145 | end, 146 | }) 147 | end, 148 | } 149 | -------------------------------------------------------------------------------- /lua/plugins/ui/alpha.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "goolord/alpha-nvim", 3 | event = "VimEnter", 4 | config = function() 5 | local alpha = require("alpha") 6 | local dashboard = require("alpha.themes.dashboard") 7 | local obsidian_alpha_integration = require("utils.obsidian_alpha_integration") 8 | _Gopts = { 9 | position = "center", 10 | hl = "Type", 11 | wrap = "overflow", 12 | } 13 | 14 | local function get_all_files_in_dir(dir) 15 | local files = {} 16 | local scan = vim.fn.globpath(dir, "**/*.lua", true, true) 17 | for _, file in ipairs(scan) do 18 | table.insert(files, file) 19 | end 20 | return files 21 | end 22 | 23 | local function load_random_header() 24 | math.randomseed(os.time()) 25 | local header_folder = vim.fn.stdpath("config") .. "/lua/alpha_images/" 26 | local files = get_all_files_in_dir(header_folder) 27 | 28 | if #files == 0 then 29 | return nil 30 | end 31 | 32 | local random_file = files[math.random(#files)] 33 | local relative_path = random_file:sub(#header_folder + 1) 34 | local module_name = "alpha_images." .. relative_path:gsub("/", "."):gsub("\\", "."):gsub("%.lua$", "") 35 | 36 | package.loaded[module_name] = nil 37 | 38 | local ok, module = pcall(require, module_name) 39 | if ok and module.header then 40 | return module.header 41 | else 42 | return nil 43 | end 44 | end 45 | 46 | local function change_header() 47 | local new_header = load_random_header() 48 | if new_header then 49 | dashboard.config.layout[2] = new_header 50 | vim.cmd("AlphaRedraw") 51 | else 52 | print("No images inside header_img folder.") 53 | end 54 | end 55 | 56 | local header = load_random_header() 57 | if header then 58 | dashboard.config.layout[2] = header 59 | else 60 | print("No images inside header_img folder.") 61 | end 62 | 63 | dashboard.section.tasks = { 64 | type = "text", 65 | val = obsidian_alpha_integration.get_today_tasks(), 66 | opts = { 67 | position = "center", 68 | hl = "Comment", 69 | width = 50, 70 | }, 71 | } 72 | 73 | dashboard.section.buttons.val = { 74 | dashboard.button("", "📝 Open daily-notes", ":Obsidian today"), 75 | dashboard.button( 76 | "", 77 | "❓ Open random note", 78 | ":lua require('utils.obsidian_alpha_integration').open_random_note()" 79 | ), 80 | dashboard.button("", "✅ Toggle tasks", function() 81 | obsidian_alpha_integration.show_interactive_tasks() 82 | end), 83 | dashboard.button("w", "🖌️ Change header image", function() 84 | change_header() 85 | end), 86 | dashboard.button("c", "🛠️ Settings", ":e $HOME/.config/nvim/init.lua"), 87 | dashboard.button("r", "⌛ Recent files", ":Telescope oldfiles "), 88 | dashboard.button("t", "🖮 Practice typing with Typr ", ":Typr"), 89 | dashboard.button("u", "🔌 Update plugins", "Lazy update"), 90 | } 91 | 92 | dashboard.config.layout = { 93 | { type = "padding", val = 3 }, 94 | header, 95 | { type = "padding", val = 2 }, 96 | { 97 | type = "group", 98 | val = { 99 | { 100 | type = "group", 101 | val = { 102 | { 103 | type = "text", 104 | val = "📅 Tasks for today", 105 | opts = { hl = "Keyword", position = "center" }, 106 | }, 107 | dashboard.section.tasks, 108 | }, 109 | opts = { spacing = 1 }, 110 | }, 111 | { 112 | type = "group", 113 | val = dashboard.section.buttons.val, 114 | opts = { spacing = 1 }, 115 | }, 116 | }, 117 | opts = { 118 | layout = "horizontal", 119 | }, 120 | }, 121 | { type = "padding", val = 2 }, 122 | dashboard.section.footer, 123 | } 124 | vim.api.nvim_create_autocmd("User", { 125 | pattern = "VimStarted", 126 | desc = "Add Alpha dashboard footer", 127 | once = true, 128 | callback = function() 129 | local stats = require("lazy").stats() 130 | local ms = math.floor(stats.startuptime * 100 + 0.5) / 100 131 | dashboard.section.footer.val = 132 | { " ", " ", " ", " Loaded " .. stats.count .. " plugins  in " .. ms .. " ms " } 133 | dashboard.section.header.opts.hl = "DashboardFooter" 134 | pcall(vim.cmd.AlphaRedraw) 135 | end, 136 | }) 137 | 138 | dashboard.opts.opts.noautocmd = true 139 | alpha.setup(dashboard.opts) 140 | end, 141 | } 142 | -------------------------------------------------------------------------------- /lua/plugins/debugging/dap-ui.lua: -------------------------------------------------------------------------------- 1 | -- lua/plugins/dap-ui.lua 2 | return { 3 | "rcarriga/nvim-dap-ui", 4 | event = "VeryLazy", -- Można też rozważyć 'BufReadPre' lub 'BufNewFile' jeśli chcesz, by UI było gotowe od razu 5 | -- Zależności specyficzne dla UI lub integracji z DAP UI 6 | dependencies = { 7 | "mfussenegger/nvim-dap", -- Kluczowa zależność! 8 | "theHamsta/nvim-dap-virtual-text", -- Tekst inline 9 | "nvim-telescope/telescope-dap.nvim", -- Integracja z Telescope 10 | }, 11 | opts = { 12 | -- Twoje opcje dla dap-ui (skopiowane z oryginalnej konfiguracji) 13 | controls = { 14 | element = "repl", 15 | enabled = true, -- Zmieniono na true, aby kontrolki były widoczne (jeśli chcesz) 16 | icons = { 17 | disconnect = "", 18 | pause = "", 19 | play = "", 20 | run_last = "", 21 | step_back = "", 22 | step_into = "", 23 | step_out = "", 24 | step_over = "", 25 | terminate = "", 26 | }, 27 | }, 28 | element_mappings = {}, 29 | expand_lines = true, 30 | floating = { 31 | border = "single", 32 | mappings = { 33 | close = { "q", "" }, 34 | }, 35 | }, 36 | force_buffers = true, 37 | icons = { 38 | collapsed = "", 39 | current_frame = "", 40 | expanded = "", 41 | }, 42 | layouts = { 43 | { 44 | elements = { 45 | { id = "scopes", size = 0.50 }, 46 | { id = "stacks", size = 0.30 }, 47 | { id = "watches", size = 0.10 }, 48 | { id = "breakpoints", size = 0.10 }, 49 | }, 50 | size = 40, 51 | position = "left", 52 | }, 53 | { 54 | elements = { -- Poprawiono formatowanie 55 | { id = "repl", size = 0.5 }, 56 | { id = "console", size = 0.5 }, 57 | }, 58 | size = 10, 59 | position = "bottom", 60 | }, 61 | }, 62 | mappings = { 63 | edit = "e", 64 | expand = { "", "<2-LeftMouse>" }, 65 | open = "o", 66 | remove = "d", 67 | repl = "r", 68 | toggle = "t", 69 | }, 70 | render = { 71 | indent = 1, 72 | max_value_lines = 100, 73 | }, 74 | }, 75 | config = function(_, opts) 76 | local dap = require("dap") 77 | local dapui = require("dapui") 78 | 79 | -- 1. Skonfiguruj dapui z przekazanymi opcjami (opts) 80 | dapui.setup(opts) 81 | 82 | -- 2. Skonfiguruj listenery DAP do kontrolowania UI 83 | dap.listeners.after.event_initialized["dapui_config"] = function() 84 | dapui.open() 85 | end 86 | dap.listeners.before.event_terminated["dapui_config"] = function() 87 | -- Zostawiono zakomentowane zgodnie z Twoim kodem 88 | -- dapui.close() 89 | end 90 | dap.listeners.before.event_exited["dapui_config"] = function() 91 | -- Zostawiono zakomentowane zgodnie z Twoim kodem 92 | -- dapui.close() 93 | end 94 | 95 | -- 3. Skonfiguruj nvim-dap-virtual-text (jeśli nie ma osobnej konfiguracji) 96 | local dap_virtual_text_present, dap_virtual_text = pcall(require, "nvim-dap-virtual-text") 97 | if dap_virtual_text_present then 98 | dap_virtual_text.setup({ 99 | -- Domyślne opcje, dostosuj wg potrzeb 100 | enabled = true, 101 | enabled_commands = true, 102 | highlight_changed_variables = true, 103 | highlight_new_as_changed = false, 104 | show_stop_reason = true, 105 | commented = false, 106 | only_first_definition = true, 107 | all_references = false, 108 | clear_on_continue = false, -- Ustaw na true, jeśli chcesz czyścić tekst po kontynuacji 109 | --- Virt text settings 110 | virt_text_pos = "eol", -- Position of virtual text 111 | all_frames = false, -- Show virtual text for all stack frames 112 | virt_lines = false, -- Show virtual lines instead of virtual text (will flicker!) 113 | virt_text_win_col = nil, -- Virtual text is printed below normal text this many columns wide 114 | }) 115 | else 116 | vim.notify("nvim-dap-virtual-text not found. Skipping setup.", vim.log.levels.WARN) 117 | end 118 | 119 | -- 4. Skonfiguruj telescope-dap (jeśli nie ma osobnej konfiguracji) 120 | local telescope_present, telescope = pcall(require, "telescope") 121 | if telescope_present then 122 | -- Można załadować rozszerzenie tutaj lub w konfiguracji telescope 123 | pcall(telescope.load_extension, "dap") 124 | -- Można dodać mapowania dla telescope-dap tutaj 125 | -- np. vim.keymap.set('n', 'db', require('telescope').extensions.dap.breakpoints, { desc = 'DAP Breakpoints' }) 126 | else 127 | vim.notify("Telescope not found. Skipping telescope-dap setup.", vim.log.levels.WARN) 128 | end 129 | 130 | print("nvim-dap-ui configured.") -- Komunikat kontrolny 131 | end, 132 | } 133 | -------------------------------------------------------------------------------- /lua/plugins/easy-dotnet.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- enabled = false, 3 | "GustavEikaas/easy-dotnet.nvim", 4 | -- 'nvim-telescope/telescope.nvim' or 'ibhagwan/fzf-lua' or 'folke/snacks.nvim' 5 | -- are highly recommended for a better experience 6 | dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim" }, 7 | config = function() 8 | local function get_secret_path(secret_guid) 9 | local path = "" 10 | local home_dir = vim.fn.expand("~") 11 | if require("easy-dotnet.extensions").isWindows() then 12 | local secret_path = home_dir 13 | .. "\\AppData\\Roaming\\Microsoft\\UserSecrets\\" 14 | .. secret_guid 15 | .. "\\secrets.json" 16 | path = secret_path 17 | else 18 | local secret_path = home_dir .. "/.microsoft/usersecrets/" .. secret_guid .. "/secrets.json" 19 | path = secret_path 20 | end 21 | return path 22 | end 23 | 24 | local dotnet = require("easy-dotnet") 25 | -- Options are not required 26 | dotnet.setup({ 27 | --Optional function to return the path for the dotnet sdk (e.g C:/ProgramFiles/dotnet/sdk/8.0.0) 28 | -- easy-dotnet will resolve the path automatically if this argument is omitted, for a performance improvement you can add a function that returns a hardcoded string 29 | -- You should define this function to return a hardcoded path for a performance improvement 🚀 30 | get_sdk_path = get_sdk_path, 31 | ---@type TestRunnerOptions 32 | test_runner = { 33 | ---@type "split" | "float" | "buf" 34 | viewmode = "float", 35 | enable_buffer_test_execution = true, --Experimental, run tests directly from buffer 36 | noBuild = true, 37 | noRestore = true, 38 | icons = { 39 | passed = "", 40 | skipped = "", 41 | failed = "", 42 | success = "", 43 | reload = "", 44 | test = "", 45 | sln = "󰘐", 46 | project = "󰘐", 47 | dir = "", 48 | package = "", 49 | }, 50 | mappings = { 51 | run_test_from_buffer = { lhs = "r", desc = "run test from buffer" }, 52 | filter_failed_tests = { lhs = "fe", desc = "filter failed tests" }, 53 | debug_test = { lhs = "d", desc = "debug test" }, 54 | go_to_file = { lhs = "g", desc = "go to file" }, 55 | run_all = { lhs = "R", desc = "run all tests" }, 56 | run = { lhs = "r", desc = "run test" }, 57 | peek_stacktrace = { lhs = "p", desc = "peek stacktrace of failed test" }, 58 | expand = { lhs = "o", desc = "expand" }, 59 | expand_node = { lhs = "E", desc = "expand node" }, 60 | expand_all = { lhs = "-", desc = "expand all" }, 61 | collapse_all = { lhs = "W", desc = "collapse all" }, 62 | close = { lhs = "q", desc = "close testrunner" }, 63 | refresh_testrunner = { lhs = "", desc = "refresh testrunner" }, 64 | }, 65 | --- Optional table of extra args e.g "--blame crash" 66 | additional_args = {}, 67 | }, 68 | new = { 69 | project = { 70 | prefix = "sln", -- "sln" | "none" 71 | }, 72 | }, 73 | ---@param action "test" | "restore" | "build" | "run" 74 | terminal = function(path, action, args) 75 | local commands = { 76 | run = function() 77 | return string.format("dotnet run --project %s %s", path, args) 78 | end, 79 | test = function() 80 | return string.format("dotnet test %s %s", path, args) 81 | end, 82 | restore = function() 83 | return string.format("dotnet restore %s %s", path, args) 84 | end, 85 | build = function() 86 | return string.format("dotnet build %s %s", path, args) 87 | end, 88 | watch = function() 89 | return string.format("dotnet watch --project %s %s", path, args) 90 | end, 91 | } 92 | 93 | local command = commands[action]() .. "\r" 94 | vim.cmd("vsplit") 95 | vim.cmd("term " .. command) 96 | end, 97 | secrets = { 98 | path = get_secret_path, 99 | }, 100 | csproj_mappings = true, 101 | fsproj_mappings = true, 102 | auto_bootstrap_namespace = { 103 | --block_scoped, file_scoped 104 | type = "block_scoped", 105 | enabled = true, 106 | }, 107 | -- choose which picker to use with the plugin 108 | -- possible values are "telescope" | "fzf" | "snacks" | "basic" 109 | -- if no picker is specified, the plugin will determine 110 | -- the available one automatically with this priority: 111 | -- telescope -> fzf -> snacks -> basic 112 | picker = "telescope", 113 | background_scanning = true, 114 | }) 115 | 116 | -- Example command 117 | vim.api.nvim_create_user_command("Secrets", function() 118 | dotnet.secrets() 119 | end, {}) 120 | 121 | -- Example keybinding 122 | vim.keymap.set("n", "", function() 123 | dotnet.run_project() 124 | end) 125 | end, 126 | } 127 | -------------------------------------------------------------------------------- /lua/utils/obsidian_alpha_integration.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.open_random_note() 4 | local vault_path = vim.g.setup.obsidian_dirs.mainnotes 5 | if not vault_path then 6 | vim.notify("Mainnotes directory not configured", vim.log.levels.ERROR) 7 | return 8 | end 9 | local expanded_path = vim.fn.expand(vault_path) 10 | local md_files = vim.split(vim.fn.globpath(expanded_path, "**/*.md"), "\n") 11 | md_files = vim.tbl_filter(function(file) 12 | return file ~= "" 13 | end, md_files) 14 | if #md_files == 0 then 15 | vim.notify("No markdown files found in: " .. expanded_path, vim.log.levels.WARN) 16 | return 17 | end 18 | math.randomseed(os.time()) 19 | local random_file = md_files[math.random(#md_files)] 20 | vim.cmd("e " .. vim.fn.fnameescape(random_file)) 21 | end 22 | 23 | function M.get_today_tasks() 24 | if not vim.g.setup.obsidian_dirs.generalpath then 25 | return { "Daily directory not specified" } 26 | end 27 | 28 | local generalpath = vim.fn.expand(vim.g.setup.obsidian_dirs.generalpath) 29 | local daily_path = generalpath .. "/daily 📝/" 30 | local today_file = os.date("%Y-%m-%d") .. ".md" 31 | local file_path = daily_path .. today_file 32 | 33 | if vim.fn.filereadable(file_path) == 0 then 34 | return { "Daily note not found: " .. today_file } 35 | end 36 | 37 | local content = vim.fn.readfile(file_path) 38 | local tasks = {} 39 | local in_todo = false 40 | 41 | for _, line in ipairs(content) do 42 | if line:lower():match("^#+%s*todo") then 43 | in_todo = true 44 | elseif in_todo and line:match("^#+") then 45 | break 46 | elseif in_todo and line:match("^%s*-%s*%[%s?x?%s?%]") then 47 | table.insert(tasks, line) 48 | end 49 | end 50 | 51 | return #tasks > 0 and tasks or { "No task in TODO section" } 52 | end 53 | function M.refresh_alpha_tasks() 54 | local alpha = require("alpha") 55 | local dashboard = require("alpha.themes.dashboard") 56 | dashboard.section.tasks.val = M.get_today_tasks() 57 | alpha.setup(dashboard.opts) 58 | vim.schedule(function() 59 | vim.cmd("AlphaRedraw") 60 | end) 61 | end 62 | function M.toggle_task(task_line) 63 | local date = os.date("%Y-%m-%d") 64 | local generalpath = vim.fn.expand(vim.g.setup.obsidian_dirs.generalpath) 65 | local daily_path = generalpath .. "/daily 📝/" 66 | local file_path = daily_path .. date .. ".md" 67 | 68 | if vim.fn.filereadable(file_path) == 0 then 69 | vim.notify("File doesn't exist: " .. file_path, vim.log.levels.ERROR) 70 | return 71 | end 72 | local lines = vim.fn.readfile(file_path) 73 | local modified = false 74 | local modified_line = nil 75 | local normalized_task = task_line:gsub("%[✓%]", "[x]"):gsub("^%s*", ""):gsub("%s*$", "") 76 | 77 | for i, line in ipairs(lines) do 78 | local normalized_line = line:gsub("^%s*", ""):gsub("%s*$", "") 79 | if normalized_line:match(vim.pesc(normalized_task:sub(6))) then 80 | if line:match("%[%s%]") then 81 | lines[i] = line:gsub("%[%s%]", "[x]") 82 | else 83 | lines[i] = line:gsub("%[x%]", "[ ]") 84 | end 85 | 86 | modified = true 87 | modified_line = lines[i] 88 | break 89 | end 90 | end 91 | 92 | if modified then 93 | vim.fn.writefile(lines, file_path) 94 | vim.cmd("checktime") 95 | M.refresh_alpha_tasks() 96 | 97 | if modified_line then 98 | vim.schedule(function() 99 | vim.notify("✓ Task updated: " .. modified_line, vim.log.levels.INFO) 100 | end) 101 | end 102 | else 103 | vim.notify("Couldn't find any task in file: " .. normalized_task, vim.log.levels.WARN) 104 | end 105 | end 106 | function M.show_interactive_tasks() 107 | local tasks = M.get_today_tasks() 108 | local reversed_tasks = vim.fn.reverse(vim.deepcopy(tasks)) 109 | 110 | local pickers = require("telescope.pickers") 111 | local finders = require("telescope.finders") 112 | local conf = require("telescope.config").values 113 | local actions = require("telescope.actions") 114 | local action_state = require("telescope.actions.state") 115 | 116 | pickers 117 | .new({}, { 118 | prompt_title = "✅ Manage Your tasks - Enter: toggle, ESC: close window", 119 | finder = finders.new_table({ 120 | results = reversed_tasks, 121 | entry_maker = function(entry) 122 | return { 123 | value = entry, 124 | display = entry:gsub("%[%s%]", "[ ]"):gsub("%[x%]", "[✓]"), 125 | ordinal = entry, 126 | } 127 | end, 128 | }), 129 | sorter = conf.generic_sorter({}), 130 | attach_mappings = function(prompt_bufnr) 131 | actions.select_default:replace(function() 132 | local selection = action_state.get_selected_entry() 133 | actions.close(prompt_bufnr) 134 | if selection then 135 | M.toggle_task(selection.value) 136 | end 137 | end) 138 | return true 139 | end, 140 | }) 141 | :find() 142 | end 143 | return M 144 | -------------------------------------------------------------------------------- /ftplugin/java.lua: -------------------------------------------------------------------------------- 1 | -- JDTLS (Java LSP) configuration 2 | local home = vim.env.HOME -- Get the home directory 3 | 4 | local jdtls = require("jdtls") 5 | local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") 6 | local workspace_dir = home .. "/jdtls-workspace/" .. project_name 7 | 8 | local system_os = "" 9 | 10 | -- Determine OS 11 | if vim.fn.has("mac") == 1 then 12 | system_os = "mac" 13 | elseif vim.fn.has("unix") == 1 then 14 | system_os = "linux" 15 | elseif vim.fn.has("win32") == 1 or vim.fn.has("win64") == 1 then 16 | system_os = "win" 17 | else 18 | print("OS not found, defaulting to 'linux'") 19 | system_os = "linux" 20 | end 21 | 22 | -- Needed for debugging 23 | local bundles = { 24 | vim.fn.glob(home .. "/.local/share/nvim/mason/share/java-debug-adapter/com.microsoft.java.debug.plugin.jar"), 25 | } 26 | 27 | -- Needed for running/debugging unit tests 28 | vim.list_extend(bundles, vim.split(vim.fn.glob(home .. "/.local/share/nvim/mason/share/java-test/*.jar", 1), "\n")) 29 | 30 | -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. 31 | local config = { 32 | -- The command that starts the language server 33 | -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line 34 | cmd = { 35 | "java", 36 | "-Declipse.application=org.eclipse.jdt.ls.core.id1", 37 | "-Dosgi.bundles.defaultStartLevel=4", 38 | "-Declipse.product=org.eclipse.jdt.ls.core.product", 39 | "-Dlog.protocol=true", 40 | "-Dlog.level=ALL", 41 | "-javaagent:" .. home .. "/.local/share/nvim/mason/share/jdtls/lombok.jar", 42 | "-Xmx4g", 43 | "--add-modules=ALL-SYSTEM", 44 | "--add-opens", 45 | "java.base/java.util=ALL-UNNAMED", 46 | "--add-opens", 47 | "java.base/java.lang=ALL-UNNAMED", 48 | 49 | -- Eclipse jdtls location 50 | "-jar", 51 | home .. "/.local/share/nvim/mason/share/jdtls/plugins/org.eclipse.equinox.launcher.jar", 52 | "-configuration", 53 | home .. "/.local/share/nvim/mason/packages/jdtls/config_" .. system_os, 54 | "-data", 55 | workspace_dir, 56 | }, 57 | 58 | -- This is the default if not provided, you can remove it. Or adjust as needed. 59 | -- One dedicated LSP server & client will be started per unique root_dir 60 | root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "pom.xml", "build.gradle" }), 61 | 62 | -- Here you can configure eclipse.jdt.ls specific settings 63 | -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request 64 | settings = { 65 | java = { 66 | -- TODO Replace this with the absolute path to your main java version (JDK 17 or higher) 67 | home = "/usr/lib/jvm/java-21-openjdk", 68 | eclipse = { 69 | downloadSources = true, 70 | }, 71 | configuration = { 72 | updateBuildConfiguration = "interactive", 73 | -- TODO Update this by adding any runtimes that you need to support your Java projects and removing any that you don't have installed 74 | -- The runtime name parameters need to match specific Java execution environments. See https://github.com/tamago324/nlsp-settings.nvim/blob/2a52e793d4f293c0e1d61ee5794e3ff62bfbbb5d/schemas/_generated/jdtls.json#L317-L334 75 | runtimes = { 76 | { 77 | name = "JavaSE-20", 78 | path = "/usr/lib/jvm/java-21-openjdk/", 79 | }, 80 | }, 81 | }, 82 | maven = { 83 | downloadSources = true, 84 | }, 85 | implementationsCodeLens = { 86 | enabled = true, 87 | }, 88 | referencesCodeLens = { 89 | enabled = true, 90 | }, 91 | references = { 92 | includeDecompiledSources = true, 93 | }, 94 | signatureHelp = { enabled = true }, 95 | format = { 96 | enabled = true, 97 | -- Formatting works by default, but you can refer to a specific file/URL if you choose 98 | -- settings = { 99 | -- url = "https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml", 100 | -- profile = "GoogleStyle", 101 | -- }, 102 | }, 103 | completion = { 104 | favoriteStaticMembers = { 105 | "org.hamcrest.MatcherAssert.assertThat", 106 | "org.hamcrest.Matchers.*", 107 | "org.hamcrest.CoreMatchers.*", 108 | "org.junit.jupiter.api.Assertions.*", 109 | "java.util.Objects.requireNonNull", 110 | "java.util.Objects.requireNonNullElse", 111 | "org.mockito.Mockito.*", 112 | }, 113 | importOrder = { 114 | "java", 115 | "javax", 116 | "com", 117 | "org", 118 | }, 119 | }, 120 | sources = { 121 | organizeImports = { 122 | starThreshold = 9999, 123 | staticStarThreshold = 9999, 124 | }, 125 | }, 126 | codeGeneration = { 127 | toString = { 128 | template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}", 129 | }, 130 | useBlocks = true, 131 | }, 132 | }, 133 | }, 134 | -- Needed for auto-completion with method signatures and placeholders 135 | capabilities = require("cmp_nvim_lsp").default_capabilities(), 136 | flags = { 137 | allow_incremental_sync = true, 138 | }, 139 | init_options = { 140 | -- References the bundles defined above to support Debugging and Unit Testing 141 | bundles = bundles, 142 | extendedClientCapabilities = jdtls.extendedClientCapabilities, 143 | }, 144 | } 145 | 146 | -- Needed for debugging 147 | config["on_attach"] = function(client, bufnr) 148 | jdtls.setup_dap({ hotcodereplace = "auto" }) 149 | require("jdtls.dap").setup_dap_main_class_configs() 150 | end 151 | 152 | -- This starts a new client & server, or attaches to an existing client & server based on the `root_dir`. 153 | jdtls.start_or_attach(config) 154 | -------------------------------------------------------------------------------- /lua/plugins/ui/img-clip.lua: -------------------------------------------------------------------------------- 1 | local function find_assets_dir(max_depth) 2 | local current_path = vim.fn.expand("%:p:h") 3 | local visited_paths = {} 4 | 5 | local function search_up_and_down(path, depth) 6 | if depth > max_depth or visited_paths[path] then 7 | return nil 8 | end 9 | visited_paths[path] = true 10 | 11 | -- Sprawdź, czy w bieżącym katalogu istnieje folder `assets` 12 | if vim.fn.isdirectory(path .. "/assets") == 1 then 13 | return path .. "/assets" 14 | end 15 | 16 | -- Rekurencyjne przeszukiwanie: w górę 17 | local parent = vim.fn.fnamemodify(path, ":h") 18 | if parent ~= path then 19 | local found_up = search_up_and_down(parent, depth + 1) 20 | if found_up then 21 | return found_up 22 | end 23 | end 24 | 25 | -- Rekurencyjne przeszukiwanie: w dół 26 | local children = vim.fn.glob(path .. "/*", 1, 1) 27 | for _, child in ipairs(children) do 28 | if vim.fn.isdirectory(child) == 1 then 29 | local found_down = search_up_and_down(child, depth + 1) 30 | if found_down then 31 | return found_down 32 | end 33 | end 34 | end 35 | 36 | return nil 37 | end 38 | 39 | return search_up_and_down(current_path, 0) 40 | end 41 | 42 | local function sanitize_filename(filename) 43 | -- Zamień spacje na "-" 44 | return filename:gsub("%s", "-") 45 | end 46 | 47 | return { 48 | "HakonHarnes/img-clip.nvim", 49 | event = "VeryLazy", 50 | opts = { 51 | default = { 52 | use_absolute_path = false, ---@type boolean 53 | -- uncomment for Windows users 54 | --[[ use_absolute_path = true, ]] 55 | drag_and_drop = { insert_mode = true }, 56 | 57 | -- make dir_path relative to current file rather than the cwd 58 | -- To see your current working directory run `:pwd` 59 | -- So if this is set to false, the image will be created in that cwd 60 | -- In my case, I want images to be where the file is, so I set it to true 61 | relative_to_current_file = false, ---@type boolean 62 | dir_path = function() 63 | local assets_dir = find_assets_dir(3) -- Maksymalna głębokość 3 64 | if assets_dir then 65 | local sanitized_name = sanitize_filename(vim.fn.expand("%:t:r")) 66 | return assets_dir .. "/" .. sanitized_name .. "-img" 67 | else 68 | error("No 'assets' directory found within 3 levels.") 69 | end 70 | end, 71 | prompt_for_file_name = false, ---@type boolean 72 | file_name = "%Y-%m-%d-at-%H-%M-%S", ---@type string 73 | -- -- Set the extension that the image file will have 74 | -- -- I'm also specifying the image options with the `process_cmd` 75 | -- -- Notice that I HAVE to convert the images to the desired format 76 | -- -- If you don't specify the output format, you won't see the size decrease 77 | 78 | extension = "avif", ---@type string 79 | process_cmd = "convert - -quality 75 avif:-", ---@type string 80 | 81 | -- -- Here are other conversion options to play around 82 | -- -- Notice that with this other option you resize all the images 83 | -- process_cmd = "convert - -quality 75 -resize 50% png:-", ---@type string 84 | -- extension = "webp", ---@type string 85 | -- process_cmd = "convert - -quality 75 webp:-", ---@type string 86 | 87 | -- extension = "png", ---@type string 88 | -- process_cmd = "convert - -quality 75 png:-", ---@type string 89 | 90 | --extension = "jpg", ---@type string 91 | --process_cmd = "convert - -quality 75 jpg:-", ---@type string 92 | 93 | -- -- Other parameters I found in stackoverflow 94 | -- -- https://stackoverflow.com/a/27269260 95 | -- -- 96 | -- -- -depth value 97 | -- -- Color depth is the number of bits per channel for each pixel. For 98 | -- -- example, for a depth of 16 using RGB, each channel of Red, Green, and 99 | -- -- Blue can range from 0 to 2^16-1 (65535). Use this option to specify 100 | -- -- the depth of raw images formats whose depth is unknown such as GRAY, 101 | -- -- RGB, or CMYK, or to change the depth of any image after it has been read. 102 | -- -- 103 | -- -- compression-filter (filter-type) 104 | -- -- compression level, which is 0 (worst but fastest compression) to 9 (best but slowest) 105 | -- process_cmd = "convert - -depth 24 -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 png:-", 106 | -- 107 | -- -- These are for jpegs 108 | -- process_cmd = "convert - -sampling-factor 4:2:0 -strip -interlace JPEG -colorspace RGB -quality 75 jpg:-", 109 | -- process_cmd = "convert - -strip -interlace Plane -gaussian-blur 0.05 -quality 75 jpg:-", 110 | -- 111 | }, 112 | 113 | -- filetype specific options 114 | filetypes = { 115 | markdown = { 116 | -- encode spaces and special characters in file path 117 | url_encode_path = true, ---@type boolean 118 | 119 | -- -- The template is what specifies how the alternative text and path 120 | -- -- of the image will appear in your file 121 | -- 122 | -- -- $CURSOR will paste the image and place your cursor in that part so 123 | -- -- you can type the "alternative text", keep in mind that this will 124 | -- -- not affect the name that the image physically has 125 | template = "![$CURSOR]($FILE_PATH)", ---@type string 126 | -- 127 | -- -- This will just statically type "Image" in the alternative text 128 | -- template = "![Image]($FILE_PATH)", ---@type string 129 | -- 130 | -- -- This will dynamically configure the alternative text to show the 131 | -- -- same that you configured as the "file_name" above 132 | --template = "![$FILE_NAME]($FILE_PATH)", ---@type string 133 | }, 134 | }, 135 | }, 136 | keys = { 137 | -- suggested keymap 138 | { "v", "PasteImage", desc = "Paste image from system clipboard" }, 139 | }, 140 | } 141 | -------------------------------------------------------------------------------- /lazy-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "LuaSnip": { "branch": "master", "commit": "de10d8414235b0a8cabfeba60d07c24304e71f5c" }, 3 | "alpha-nvim": { "branch": "main", "commit": "2b3cbcdd980cae1e022409289245053f62fb50f6" }, 4 | "better-ts-errors.nvim": { "branch": "main", "commit": "d57a7794b271e1a0010d0328e5d3f18e20f1face" }, 5 | "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, 6 | "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, 7 | "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, 8 | "codesnap.nvim": { "branch": "main", "commit": "be6d6b9a3b5e6999edbda76b16dace03d9bfcd3d" }, 9 | "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, 10 | "copilot.lua": { "branch": "master", "commit": "4c98663ba12db653bc1127ed4c124cdde89f8ca8" }, 11 | "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, 12 | "easy-dotnet.nvim": { "branch": "main", "commit": "1e138ba5f13b8200b3730de8f05573aac1c2a85d" }, 13 | "fidget.nvim": { "branch": "main", "commit": "4ec7bed6c86b671ddde03ca1b227343cfa3e65fa" }, 14 | "gitsigns.nvim": { "branch": "main", "commit": "8270378ab83540b03d09c0194ba3e208f9d0cb72" }, 15 | "go.nvim": { "branch": "master", "commit": "28d9618bfe4385d3af60fed15a4c9f9445ae1f10" }, 16 | "goose.nvim": { "branch": "main", "commit": "ada7651562bbcd0601d08896741cf7b4862178a8" }, 17 | "guihua.lua": { "branch": "master", "commit": "87bea7b98429405caf2a0ce4d029b027bb017c70" }, 18 | "hover.nvim": { "branch": "main", "commit": "fdc5b4fc3f5300c87fbde16cab0aeb122ba6324a" }, 19 | "image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" }, 20 | "img-clip.nvim": { "branch": "main", "commit": "d8b6b030672f9f551a0e3526347699985a779d93" }, 21 | "jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" }, 22 | "kanagawa.nvim": { "branch": "master", "commit": "988082eb00b845e4afbcaa4fd8e903da8a3ab3b9" }, 23 | "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, 24 | "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, 25 | "lazygit.nvim": { "branch": "main", "commit": "cdd3527e251f96eb0527162b156ad839286fcd97" }, 26 | "leetcode.nvim": { "branch": "master", "commit": "422b6beb4a64eca0524fbff94edd9550c156afc5" }, 27 | "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, 28 | "markview.nvim": { "branch": "main", "commit": "ec33f2aa333ca1d76f51847922578434d7aeadf7" }, 29 | "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, 30 | "mason.nvim": { "branch": "main", "commit": "3671ab0d40aa5bd24b1686562bd0a23391ecf76a" }, 31 | "material.nvim": { "branch": "main", "commit": "c8ff153d2c2b22f8b2c9bcce0d741ab55c00cfed" }, 32 | "mini.nvim": { "branch": "main", "commit": "c122e852517adaf7257688e435369c050da113b1" }, 33 | "minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" }, 34 | "molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" }, 35 | "nightfly": { "branch": "master", "commit": "8c55003e89f321a48a8cd4bb426dd3e7c58f0646" }, 36 | "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, 37 | "nvim": { "branch": "main", "commit": "fa42eb5e26819ef58884257d5ae95dd0552b9a66" }, 38 | "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, 39 | "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, 40 | "nvim-dap": { "branch": "master", "commit": "5dd4d50f2e6a2eaf9e57fad023d294ef371bda35" }, 41 | "nvim-dap-cs": { "branch": "main", "commit": "16e5debe8cb7fb73c8799d20969ee00883586602" }, 42 | "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, 43 | "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, 44 | "nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" }, 45 | "nvim-jdtls": { "branch": "master", "commit": "4d77ff02063cf88963d5cf10683ab1fd15d072de" }, 46 | "nvim-lspconfig": { "branch": "master", "commit": "d0dbf489a8810672fa9a61f4a86e5cf89214b772" }, 47 | "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, 48 | "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, 49 | "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, 50 | "nvim-web-devicons": { "branch": "master", "commit": "4a8369f4c78ef6f6f895f0cec349e48f74330574" }, 51 | "obsidian.nvim": { "branch": "main", "commit": "705cc9b4f66eca1e54040ac819102e80a32896d3" }, 52 | "oldworld.nvim": { "branch": "main", "commit": "568a09aca87e165aa9720ee70378668c0c0aef8d" }, 53 | "onedarkpro.nvim": { "branch": "main", "commit": "9f92da13ef8e44c97f1b31ccb3bddd30ab30ec9a" }, 54 | "otter.nvim": { "branch": "main", "commit": "fcc8cf1eeb39f16c309bb27a7ff140ddf87c9fcb" }, 55 | "outline.nvim": { "branch": "main", "commit": "0eb9289ab39c91caf8b3ed0e3a17764809d69558" }, 56 | "overseer.nvim": { "branch": "master", "commit": "fe7b2f9ba263e150ab36474dfc810217b8cf7400" }, 57 | "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, 58 | "quarto-nvim": { "branch": "main", "commit": "5325af3731ac9840b308791f08ad660958d76163" }, 59 | "rose-pine": { "branch": "main", "commit": "7718965bdd1526b233f082da17e88b8bde7a7e6e" }, 60 | "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, 61 | "telescope-dap.nvim": { "branch": "master", "commit": "783366bd6c1e7fa0a5c59c07db37f49c805a28df" }, 62 | "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, 63 | "telescope-repo.nvim": { "branch": "master", "commit": "a5395a4bf0fd742cc46b4e8c50e657062f548ba9" }, 64 | "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, 65 | "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, 66 | "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "7dcf8542059fb15c978de845fc8665428ae13a04" }, 67 | "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, 68 | "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, 69 | "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, 70 | "translate.nvim": { "branch": "main", "commit": "1a841e56407ba02e919ed9af573dbe531404aebb" }, 71 | "transparent.nvim": { "branch": "main", "commit": "8ac59883de84e9cd1850ea25cf087031c5ba7d54" }, 72 | "typr": { "branch": "main", "commit": "bdd9ef7143702851edd1dac85101e0a537056d2f" }, 73 | "undotree": { "branch": "master", "commit": "28f2f54a34baff90ea6f4a735ef1813ad875c743" }, 74 | "vague.nvim": { "branch": "main", "commit": "19af21a7767d95a7130e49790bf4dea333d2c2d5" }, 75 | "vim-react-snippets": { "branch": "main", "commit": "fb49804b6e6b8cdf1661bee45f7f3a60e59ad8e1" }, 76 | "vim-rooter": { "branch": "master", "commit": "51402fb77c4d6ae94994e37dc7ca13bec8f4afcc" }, 77 | "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, 78 | "vimade": { "branch": "master", "commit": "7a7252406918c60992c01fd9d8ad08152815ba67" }, 79 | "vimtex": { "branch": "master", "commit": "7f2633027c8f496a85284de0c11aa32f1e07e049" }, 80 | "volt": { "branch": "main", "commit": "7b8c5e790120d9f08c8487dcb80692db6d2087a1" }, 81 | "vscode-js-debug": { "branch": "main", "commit": "f8f4253879aa6cd81e5c776a4f9a619771ec2fc3" }, 82 | "wrapping.nvim": { "branch": "master", "commit": "f26fdeabd17cf1bf5197badbdadc2e2f08b6ab0f" } 83 | } 84 | -------------------------------------------------------------------------------- /lua/core/keymaps.lua: -------------------------------------------------------------------------------- 1 | local map = function(mode, keys, func, desc, opts) 2 | opts = opts or {} 3 | opts.desc = desc 4 | vim.keymap.set(mode, keys, func, opts) 5 | end 6 | 7 | local setup = require("setup") 8 | local builtin = require("telescope.builtin") 9 | local dap = require("dap") 10 | 11 | -- Set keymaps to control the debugger 12 | map("n", "", dap.continue) 13 | 14 | map("n", "", dap.step_back) 15 | map("n", "", dap.step_into) 16 | map("n", "", dap.step_over) 17 | map("n", "", dap.step_out) 18 | map("n", "tb", dap.toggle_breakpoint) 19 | map("n", "B", function() 20 | require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) 21 | end) 22 | -- LSP and Diagnostics 23 | map("n", "", vim.lsp.buf.code_action, "Code Action") 24 | map("n", "[d", function() 25 | vim.diagnostic.jump({ count = -1, float = true }) 26 | end, "Go to prev [D]iagnostic message") 27 | map("n", "]d", function() 28 | vim.diagnostic.jump({ count = 1, float = true }) 29 | end, "Go to next [D]iagnostic message") 30 | map("n", "q", vim.diagnostic.setloclist, "Open diagnostic [Q]uickfix list") 31 | 32 | map("n", "gK", function() 33 | local new_config = not vim.diagnostic.config().virtual_lines 34 | vim.diagnostic.config({ virtual_lines = new_config }) 35 | end) 36 | 37 | -- Terminal 38 | map("n", "1", function() 39 | require("toggleterm").toggle(1) 40 | end, "erminal 1") 41 | 42 | map("n", "2", function() 43 | require("toggleterm").toggle(2) 44 | end, "Toggle terminal 2") 45 | 46 | -- Exit search highlight 47 | map("n", "", "nohlsearch", "Clear search highlight") 48 | map("t", "", "", "Exit terminal mode") 49 | -- Window navigation 50 | -- This depends on Your preferences, I was always using and have never had any problems with it, therefore I don't need those mappings 51 | --[[ map("n", "", "", "Move focus to the left window") ]] 52 | --[[ map("n", "", "", "Move focus to the right window") ]] 53 | --[[ map("n", "", "", "Move focus to the lower window") ]] 54 | --[[ map("n", "", "", "Move focus to the upper window") ]] 55 | 56 | -- Arrow keys hint 57 | map("n", "", 'echo "Use h to move!!"', "Hint: Use h") 58 | map("n", "", 'echo "Use l to move!!"', "Hint: Use l") 59 | map("n", "", 'echo "Use k to move!!"', "Hint: Use k") 60 | map("n", "", 'echo "Use j to move!!"', "Hint: Use j") 61 | 62 | -- Open URL in Firefox 63 | map("n", "", function() 64 | -- Pobierz linię, w której znajduje się kursor 65 | local line = vim.fn.getline(".") 66 | -- Pobierz pozycję kursora w tej linii 67 | local cursor_col = vim.fn.col(".") 68 | 69 | -- Funkcja do sprawdzania, czy kursor znajduje się w zakresie 70 | local function is_cursor_within_range(start_pos, end_pos) 71 | return cursor_col >= start_pos and cursor_col <= end_pos 72 | end 73 | 74 | -- Wyszukaj Markdown-style linki `[tekst](url)` 75 | for label, url in line:gmatch("%[(.-)%]%((.-)%)") do 76 | local start_pos, end_pos = line:find("%[" .. label .. "%]%(" .. url .. "%)") 77 | if start_pos and end_pos and is_cursor_within_range(start_pos, end_pos) then 78 | vim.fn.jobstart({ "zen-browser", url }, { detach = true }) 79 | return 80 | end 81 | end 82 | 83 | -- Wyszukaj URL w nawiasach `()` 84 | for url in line:gmatch("%b()") do 85 | local clean_url = url:sub(2, -2) -- Usuń nawiasy 86 | if clean_url:match("^https?://") or clean_url:match("^http://") then 87 | vim.fn.jobstart({ "zen-browser", clean_url }, { detach = true }) 88 | return 89 | end 90 | end 91 | 92 | -- Wyszukaj surowy URL bez Markdown-style linków 93 | for url in line:gmatch("https?://[%w._~:/?#@!$&'()*+,;=-]+") do 94 | local start_pos, end_pos = line:find(url, 1, true) 95 | if start_pos and end_pos and is_cursor_within_range(start_pos, end_pos) then 96 | vim.fn.jobstart({ "zen-browser", url }, { detach = true }) 97 | return 98 | end 99 | end 100 | 101 | print("No valid URL detected.") 102 | end, "Open URL in Firefox") 103 | 104 | -- Telescope commands 105 | map("n", "sp", ":Telescope repo list", "[S]earch Git [P]rojects", { noremap = true, silent = true }) 106 | map("n", "sh", builtin.help_tags, "[S]earch [H]elp") 107 | map("n", "sk", builtin.keymaps, "[S]earch [K]eymaps") 108 | map("n", "p", builtin.find_files, "[S]earch [F]iles") 109 | map("n", "ss", builtin.builtin, "[S]earch [S]elect Telescope") 110 | map("n", "sw", builtin.grep_string, "[S]earch current [W]ord") 111 | map("n", "sg", builtin.live_grep, "[S]earch by [G]rep") 112 | map("n", "sd", builtin.diagnostics, "[S]earch [D]iagnostics") 113 | map("n", "sr", builtin.resume, "[S]earch [R]esume") 114 | map("n", "s.", builtin.oldfiles, '[S]earch Recent Files ("." for repeat)') 115 | map("n", "", builtin.buffers, "[ ] Find existing buffers") 116 | map("n", "gd", builtin.lsp_definitions, "[G]oto [D]efinition") 117 | map("n", "gr", builtin.lsp_references, "[G]oto [R]eferences") 118 | map("n", "gI", builtin.lsp_implementations, "[G]oto [I]mplementation") 119 | map("n", "D", builtin.lsp_type_definitions, "Type [D]efinition") 120 | map("n", "ds", builtin.lsp_document_symbols, "[D]ocument [S]ymbols") 121 | map("n", "ws", builtin.lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols") 122 | map("n", "rn", vim.lsp.buf.rename, "[R]e[n]ame") 123 | map("n", "gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") 124 | local zettelkasten_directory = vim.fn.expand(setup.obsidian_dirs.generalpath) 125 | vim.keymap.set("n", "zt", function() 126 | builtin.live_grep({ cwd = zettelkasten_directory }) 127 | end, { desc = "Search [Z]ettelkasten [T]ext." }) 128 | vim.keymap.set("n", "zf", function() 129 | builtin.find_files({ cwd = zettelkasten_directory }) 130 | end, { desc = "Search [Z]ettelkasten [F]iles." }) 131 | 132 | -- TODO: exclude /daily from search 133 | -- 134 | vim.keymap.set("n", "sl", function() 135 | local word = vim.fn.input("Search in current line: ") 136 | local line_number = vim.fn.line(".") 137 | vim.cmd("/\\%" .. line_number .. "l" .. word) 138 | end, { desc = "[S]earch [L]ine for word " }) 139 | 140 | -- Advanced Telescope examples 141 | map("n", "/", function() 142 | builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ 143 | winblend = 4, 144 | previewer = false, 145 | })) 146 | end, "[/] Fuzzily search in current buffer") 147 | 148 | map("n", "s/", function() 149 | builtin.live_grep({ 150 | grep_open_files = true, 151 | prompt_title = "Live Grep in Open Files", 152 | }) 153 | end, "[S]earch [/] in Open Files") 154 | 155 | map("n", "sn", function() 156 | builtin.find_files({ cwd = vim.fn.stdpath("config") }) 157 | end, "[S]earch [N]eovim files") 158 | 159 | -- UndoTree and file explorer 160 | map("n", "u", ":UndotreeToggle", "Toggle UndoTree") 161 | map("n", "b", ":lua Snacks.explorer()", "Toggle file explorer", { noremap = true, silent = true }) 162 | 163 | -- Diffview 164 | map("n", "dvo", ":DiffviewOpen", "DiffView Open") 165 | map("n", "dvc", ":DiffviewClose", "DiffView Close") 166 | 167 | -- Translate 168 | map("n", "tp", ":Translate pl", "Translate to Polish") 169 | map("v", "tp", ":Translate pl", "Translate to Polish (Visual)") 170 | map("n", "te", ":Translate en", "Translate to English") 171 | map("v", "te", ":Translate en", "Translate to English (Visual)") 172 | -- Diagnostics toggle 173 | map("n", "ts", toggle_autosave, "Toggle Autosave") 174 | map("n", "th", function() 175 | vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf })) 176 | end, "[T]oggle Inlay [H]ints") 177 | -- Quickfix navigation 178 | map("n", "", ":cnext", "Next Quickfix") 179 | map("n", "", ":cprev", "Previous Quickfix") 180 | 181 | -- Moving around markdown headers 182 | map("n", "j", [[/^##\+ .*]], "Go to previous markdown header") 183 | map("n", "k", [[?^##\+ .*]], "Go to next markdown header") 184 | 185 | -- Toggle between markview hybrid and normal mode (whether or not You want to see line under cursor being rendered) 186 | map("n", "mt", ":Markview hybridToggle", "[M]arkview [T]oggle Hybrid Mode") 187 | -- LazyGit - declared in lazygit.lua - lg - Opens Lazygit 188 | -- CodeSnap - declared in codesnap.lua - cc - Takes beautiful snapshot of code and saves in clipboard 189 | 190 | -- Overseer 191 | map("n", "ot", ":OverseerToggle", "[O]verseer [T]oggle") 192 | map("n", "or", ":OverseerRun", "[O]verseer [R]un") 193 | -- Jupyter Notebook 194 | local runner = require("quarto.runner") 195 | vim.keymap.set("n", "rc", runner.run_cell, { desc = "run cell", silent = true }) 196 | vim.keymap.set("n", "ra", runner.run_above, { desc = "run cell and above", silent = true }) 197 | vim.keymap.set("n", "rA", runner.run_all, { desc = "run all cells", silent = true }) 198 | vim.keymap.set("n", "rl", runner.run_line, { desc = "run line", silent = true }) 199 | vim.keymap.set("v", "r", runner.run_range, { desc = "run visual range", silent = true }) 200 | vim.keymap.set( 201 | "n", 202 | "eo", 203 | ":noautocmd MoltenEnterOutput", 204 | { silent = true, desc = "Show/enter output", buffer = true } 205 | ) 206 | vim.keymap.set("n", "RA", function() 207 | runner.run_all(true) 208 | end, { desc = "run all cells of all languages", silent = true }) 209 | 210 | local default_notebook = [[ 211 | { 212 | "cells": [ 213 | { 214 | "cell_type": "markdown", 215 | "metadata": {}, 216 | "source": [ 217 | "" 218 | ] 219 | } 220 | ], 221 | "metadata": { 222 | "kernelspec": { 223 | "display_name": "Python 3", 224 | "language": "python", 225 | "name": "python3" 226 | }, 227 | "language_info": { 228 | "codemirror_mode": { 229 | "name": "ipython" 230 | }, 231 | "file_extension": ".py", 232 | "mimetype": "text/x-python", 233 | "name": "python", 234 | "nbconvert_exporter": "python", 235 | "pygments_lexer": "ipython3" 236 | } 237 | }, 238 | "nbformat": 4, 239 | "nbformat_minor": 5 240 | } 241 | ]] 242 | 243 | local function new_notebook(filename) 244 | local path = filename .. ".ipynb" 245 | local file = io.open(path, "w") 246 | if file then 247 | file:write(default_notebook) 248 | file:close() 249 | vim.cmd("edit " .. path) 250 | else 251 | print("Error: Could not open new notebook file for writing.") 252 | end 253 | end 254 | 255 | vim.api.nvim_create_user_command("NewNotebook", function(opts) 256 | new_notebook(opts.args) 257 | end, { 258 | nargs = 1, 259 | complete = "file", 260 | }) 261 | 262 | local function create_obsidian_trade_note() 263 | local template_dir = vim.fn.expand(setup.obsidian_dirs.templates) 264 | local vault_path = vim.fn.expand(setup.obsidian_dirs.generalpath) 265 | local trade_folder_name = "8 - Trading" -- Potwierdzona nazwa folderu 266 | 267 | -- Get current date and time 268 | local date = os.date("%Y-%m-%d") 269 | local time = os.date("%H:%M") 270 | local id_date = os.date("%d-%m-%Y") -- Data w formacie DD-MM-YYYY dla ID 271 | 272 | -- Build target directory path 273 | local target_dir = vault_path .. "/" .. trade_folder_name .. "/" .. date 274 | 275 | -- Create directory if it doesn't exist 276 | if vim.fn.isdirectory(target_dir) == 0 then 277 | vim.fn.mkdir(target_dir, "p") 278 | vim.notify("Created directory: " .. target_dir) 279 | end 280 | 281 | -- Build new file path 282 | local new_file_name = "trade-" .. os.date("%H:%M") .. ".md" 283 | local new_file_path = target_dir .. "/" .. new_file_name 284 | 285 | local template_file = template_dir .. "/trading-template.md" 286 | local template_content = "" 287 | local file = io.open(template_file, "r") 288 | if file then 289 | template_content = file:read("*a") 290 | file:close() 291 | else 292 | vim.notify("Template file not found: " .. template_file, vim.log.levels.WARN) 293 | end 294 | 295 | -- Replace {{id}} with current date (DD-MM-YYYY) 296 | template_content = template_content:gsub("{{id}}", "trade-" .. time .. "_" .. id_date) 297 | 298 | -- Write template content to the new file 299 | local new_file = io.open(new_file_path, "w") 300 | if new_file then 301 | new_file:write(template_content) 302 | new_file:close() 303 | vim.notify("Created new trade note: " .. new_file_path) 304 | vim.cmd("edit " .. vim.fn.fnameescape(new_file_path)) 305 | else 306 | vim.notify("Error creating new trade note: " .. new_file_path, vim.log.levels.ERROR) 307 | end 308 | end 309 | 310 | vim.api.nvim_create_user_command("ObsidianTrade", create_obsidian_trade_note, { 311 | desc = "Create a new Obsidian trade note with template", 312 | }) 313 | 314 | local function create_obsidian_work_note() 315 | local template_dir = vim.fn.expand(setup.obsidian_dirs.templates) 316 | local vault_path = vim.fn.expand(setup.obsidian_dirs.generalpath) 317 | local work_folder_name = "work" -- Nazwa folderu 'work' 318 | 319 | -- Get current date for file name 320 | local date = os.date("%Y-%m-%d") 321 | 322 | -- Build target directory path 323 | local target_dir = vault_path .. "/" .. work_folder_name 324 | 325 | -- Build target file path (date as file name with prefix) 326 | local new_file_name = "work-" .. date .. ".md" 327 | local new_file_path = target_dir .. "/" .. new_file_name 328 | 329 | -- Check if directory exists and create if not 330 | if vim.fn.isdirectory(target_dir) == 0 then 331 | vim.fn.mkdir(target_dir, "p") 332 | vim.notify("Created directory: " .. target_dir) 333 | end 334 | 335 | -- *** Now, check if the file already exists *** 336 | if vim.fn.filereadable(new_file_path) == 1 then 337 | -- If file exists, just open it 338 | vim.notify("File already exists. Opening: " .. new_file_path) 339 | vim.cmd("edit " .. vim.fn.fnameescape(new_file_path)) 340 | else 341 | -- If file does not exist, create it 342 | local template_file = template_dir .. "/work-template.md" -- Szablon work-template.md 343 | local template_content = "" 344 | local file = io.open(template_file, "r") 345 | if file then 346 | template_content = file:read("*a") 347 | file:close() 348 | vim.notify("Using template: " .. template_file) 349 | else 350 | vim.notify("Template file not found: " .. template_file .. ". Creating empty file.", vim.log.levels.WARN) 351 | -- Jeśli szablon nie istnieje, utwórz pusty plik 352 | template_content = "" 353 | end 354 | 355 | -- Write template content to the new file 356 | local new_file = io.open(new_file_path, "w") 357 | if new_file then 358 | new_file:write(template_content) 359 | new_file:close() 360 | vim.notify("Created new work note: " .. new_file_path) 361 | vim.cmd("edit " .. vim.fn.fnameescape(new_file_path)) 362 | else 363 | vim.notify("Error creating new work note: " .. new_file_path, vim.log.levels.ERROR) 364 | end 365 | end 366 | end 367 | 368 | vim.api.nvim_create_user_command("ObsidianWork", create_obsidian_work_note, { 369 | desc = "Create or open a new Obsidian work note with date as title and template", 370 | }) 371 | --------------------------------------------------------------------------------