-- vim.g.delimitMate_expand_space=1 -- vim.g.delimitMate_expand_cr = 1 require('mini.pairs').setup() require('mini.align').setup() require('mini.bracketed').setup() require('mini.splitjoin').setup() require('mini.move').setup() require('flash').setup() require('ts-comments').setup() vim.g.tagbar_left=1 vim.g.tagbar_autoclose=1 vim.g.tagbar_autofocus=1 vim.g.windowswap_map_keys=0 local c = require('vscode.colors').get_colors() require('vscode').setup({ style = 'light', -- Enable transparent background transparent = true, -- Enable italic comment -- italic_comments = true, -- Enable italic inlay type hints -- italic_inlayhints = true, -- Underline `@markup.link.*` variants underline_links = true, -- Disable nvim-tree background color disable_nvimtree_bg = true, -- Apply theme colors to terminal terminal_colors = true, -- Override colors (see ./lua/vscode/colors.lua) color_overrides = { vscLineNumber = '#AAAAAA', }, -- Override highlight groups (see ./lua/vscode/theme.lua) -- group_overrides = { -- -- this supports the same val table as vim.api.nvim_set_hl -- -- use colors from this colorscheme by requiring vscode.colors! -- Cursor = { fg=c.vscDarkBlue, bg=c.vscLightGreen, bold=true }, -- } group_overrides = { NormalFloat = { fg = c.vscFront, bg = "NONE" }, FloatBorder = { fg = c.vscFront, bg = "NONE" }, HoverTarget = { bg = "NONE" }, } }) vim.cmd.colorscheme "vscode" local cmp = require('cmp') local lspkind = require('lspkind') local ls = require('luasnip') cmp.setup({ snippet = { expand = function(args) ls.lsp_expand(args.body) end, }, window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, -- mapping = cmp.mapping.preset.insert({ -- -- [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. -- }), mapping = { [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), [''] = cmp.mapping(function(fallback) if cmp.visible() then if cmp.get_selected_entry() then if ls.expandable() then ls.expand() else cmp.confirm({ select = false, }) end else fallback() end else fallback() end end), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif ls.locally_jumpable(1) then ls.jump(1) else fallback() end end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif ls.locally_jumpable(-1) then ls.jump(-1) else fallback() end end, { "i", "s" }), }, sources = cmp.config.sources({ { name = 'nvim_lsp', priority = 1000 }, { name = 'buffer', priority = 800, keyword_length = 2 }, { name = 'path', priority = 600 }, { name = 'cmp_yanky', priority = 500 }, { name = 'git', priority = 400 }, { name = 'luasnip', priority = 300 }, { name = 'nvim_lua', priority = 200 }, }), formatting = { format = lspkind.cmp_format({ mode = "symbol", menu = ({ buffer = "[buf]", nvim_lsp = "[lsp]", vsnip = "[snip]", nvim_lua = "[lua]", latex_symbols = "[tex]", path = "[path]", cmp_yanky = "[yank]", }), }), }, }) cmp.setup.cmdline({ '/', '?' }, { mapping = cmp.mapping.preset.cmdline(), sources = { { name = 'buffer' } } }) cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), matching = { disallow_symbol_nonprefix_matching = false } }) local capabilities = require('cmp_nvim_lsp').default_capabilities() capabilities.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true } local language_servers = vim.lsp.get_clients() -- or list servers manually like {'gopls', 'clangd'} for _, ls in ipairs(language_servers) do if ls ~= nil then vim.lsp.config(ls).setup({ capabilities = capabilities -- you can add other fields for setting up lsp server in this table }) end end require('ufo').setup() require("yanky").setup({ ring = { history_length = 100, storage = "shada", sync_with_numbered_registers = true, cancel_event = "update", }, system_clipboard = { sync_with_ring = true, }, preserve_cursor_position = { enabled = true, }, }) require("telescope").setup { extensions = { ["ui-select"] = { require("telescope.themes").get_dropdown { } } } } require("telescope").load_extension("ui-select") require("telescope").load_extension("yank_history") require('lualine').setup({ options = { icons_enabled = true, theme = 'Tomorrow', component_separators = { left = '', right = ''}, section_separators = { left = '', right = ''}, disabled_filetypes = { statusline = {}, winbar = {}, }, ignore_focus = {}, always_divide_middle = true, globalstatus = true, refresh = { statusline = 1000, tabline = 1000, winbar = 1000, } }, sections = { lualine_a = {'mode'}, lualine_b = {'branch', 'diff', 'diagnostics'}, lualine_c = {'filename'}, lualine_x = {'encoding', 'fileformat', 'filetype'}, lualine_y = {'progress'}, lualine_z = {'location'} }, inactive_sections = { lualine_a = {}, lualine_b = {}, lualine_c = {'filename'}, lualine_x = {'location'}, lualine_y = {}, lualine_z = {} }, tabline = {}, winbar = {}, inactive_winbar = {}, extensions = {} }) vim.g.bullets_enabled_file_types = { 'markdown', 'text', 'gitcommit', 'scratch' } require("nvim-tree").setup({ sort = { sorter = "case_sensitive", }, view = { width = 30, }, renderer = { group_empty = true, }, -- filters = { -- dotfiles = true, -- }, }) require('gitsigns').setup { signs = { add = { text = '┃' }, change = { text = '┃' }, delete = { text = '_' }, topdelete = { text = '‾' }, changedelete = { text = '~' }, untracked = { text = '┆' }, }, signs_staged = { add = { text = '┃' }, change = { text = '┃' }, delete = { text = '_' }, topdelete = { text = '‾' }, changedelete = { text = '~' }, untracked = { text = '┆' }, }, signs_staged_enable = true, signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` numhl = false, -- Toggle with `:Gitsigns toggle_numhl` linehl = false, -- Toggle with `:Gitsigns toggle_linehl` word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` watch_gitdir = { follow_files = true }, auto_attach = true, attach_to_untracked = false, current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` current_line_blame_opts = { virt_text = true, virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' delay = 1000, ignore_whitespace = false, virt_text_priority = 100, use_focus = true, }, current_line_blame_formatter = ', - ', sign_priority = 6, update_debounce = 100, status_formatter = nil, -- Use default max_file_length = 40000, -- Disable if file is longer than this (in lines) preview_config = { -- Options passed to nvim_open_win style = 'minimal', relative = 'cursor', row = 0, col = 1 }, } require("conform").setup({ formatters_by_ft = { python = {"ruff_fix", "ruff_format", "ruff_organize_imports", lsp_format = "fallback"}, rust = {"rustfmt", lsp_format = "fallback"}, go = {"gofmt", "goimports", lsp_format = "fallback"}, lua = { "stylua", lsp_format = "fallback"}, sh = {"shfmt"}, bash = {"shfmt"}, zsh = {"shfmt"}, }, format_on_save = { timeout_ms = 500, lsp_fallback = true, }, }) require('lint').linters_by_ft = { markdown = {'vale'}, } require("trouble").setup() require("todo-comments").setup() require("dap-view").setup({ winbar = { -- sections = { "console", "scopes", "watches", "repl", "threads", "exceptions", "breakpoints" }, -- default_section = "console", sections = { "scopes", "watches", "repl", "threads", "exceptions", "breakpoints" }, default_section = "scopes", }, auto_toggle = "keep_terminal", }) require("nvim-dap-virtual-text").setup() local dap, dapui = require("dap"), require("dap-view") -- dap.listeners.before.attach.dapui_config = function() -- dapui.open() -- end -- dap.listeners.before.launch.dapui_config = function() -- dapui.open() -- end -- dap.listeners.before.event_terminated.dapui_config = function() -- dapui.close() -- end -- dap.listeners.before.event_exited.dapui_config = function() -- dapui.close() -- end dap.adapters.codelldb = { type = 'server', port = "${port}", executable = { command = "codelldb", args = {"--port", "${port}"}, } } dap.adapters.cppdbg = { type = "executable", command = "gdb", args = { "--interpreter=dap", -- Tells GDB to speak the DAP protocol "--eval-command", "set print pretty on" } } dap.adapters.debugpy = function(cb, config) if config.request == 'attach' then local port = (config.connect or config).port local host = (config.connect or config).host or '127.0.0.1' cb({ type = 'server', port = assert(port, '`connect.port` is required for a python `attach` configuration'), host = host, options = { source_filetype = 'python' }, }) else -- local system_python = vim.fn.exepath('python3') or vim.fn.exepath('python') cb({ type = 'executable', command = 'python', args = { '-m', 'debugpy.adapter' }, options = { source_filetype = 'python' }, }) end end -- dap.configurations.zig = { -- { -- name = "Launch Zig Program", -- type = "codelldb", -- request = "launch", -- program = function() -- -- Prompts for the executable path when you start debugging -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/zig-out/bin/', 'file') -- end, -- cwd = "${workspaceFolder}", -- stopOnEntry = false, -- }, -- } if _G.is_mac then workspaces = { { name = "privat", path = "~/Documents/notes/privat", }, { name = "joplin", path = "~/Documents/notes/fromjoplin", }, } daily_notes = { folder = "Journal", date_format = "%Y-%m-%d", default_tags = { "journal" }, template = "daily.md" } end if _G.is_work then workspaces = { { name = "work", path = "/mnt/c/Users/marti/Documents/notes/Work", }, { name = "privat", path = "/mnt/c/Users/marti/Documents/notes/privat", }, } daily_notes = {} end if _G.is_private_nixos then workspaces = { { name = "tech", path = "~/notes", }, } daily_notes = {} end require("obsidian").setup({ workspaces = workspaces, templates = { folder = "_templates", date_format = "%Y-%m-%d %a", time_format = "%H:%M", }, checkbox = { order = { " ", ">", "x", "!", "~" }, }, frontmatter = { enabled = true, func = function(note) -- Add the title of the note as an alias. if note.title then note:add_alias(note.title) end local out = { id = note.id, tags = note.tags } if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then for k, v in pairs(note.metadata) do out[k] = v end end return out end, }, note_path_func = function(spec) local path = spec.dir / spec.title return path:with_suffix(".md") end, daily_notes = daily_notes, legacy_commands = false, }) require('render-markdown').setup({ enabled = true, file_types = { 'markdown'}, completions = { lsp = { enabled = true } }, render_modes = { 'n', 'c', 't' }, checkbox = { enabled = true, render_modes = false, bullet = false, right_pad = 1, unchecked = { icon = '󰄱 ', highlight = 'RenderMarkdownUnchecked', scope_highlight = nil, }, checked = { icon = '󰱒 ', highlight = 'RenderMarkdownChecked', scope_highlight = nil, }, custom = { next = { raw = '[!]', rendered = ' ', highlight = 'RenderMarkdownNext', scope_highlight = nil }, ongoing = { raw = '[>]', rendered = '▶ ', highlight = 'RenderMarkdownOngoing', scope_highlight = nil }, waiting = { raw = '[~]', rendered = '󰥔 ', highlight = 'RenderMarkdownWaiting', scope_highlight = nil }, }, }, })