diff --git a/after/queries/r/highlights.scm b/after/queries/r/highlights.scm new file mode 100644 index 0000000..a6cf60a --- /dev/null +++ b/after/queries/r/highlights.scm @@ -0,0 +1,5 @@ +;extends +( +(comment) @comment +(#match? @comment "^\\#\\|") +) @text.literal diff --git a/ftplugin/quarto.lua b/ftplugin/quarto.lua new file mode 100644 index 0000000..5061196 --- /dev/null +++ b/ftplugin/quarto.lua @@ -0,0 +1 @@ +vim.b.slime_cell_delimiter = "```" diff --git a/highlights.scm b/highlights.scm new file mode 100644 index 0000000..9130ba0 --- /dev/null +++ b/highlights.scm @@ -0,0 +1,94 @@ +;; From MDeiml/tree-sitter-markdown +[ + (code_span) + (link_title) +] @text.literal + +[ + (emphasis_delimiter) + (code_span_delimiter) +] @punctuation.delimiter + +(emphasis) @text.emphasis + +(strong_emphasis) @text.strong + +(strikethrough) @text.strike + +[ + (link_destination) + (uri_autolink) +] @text.uri + +[ + (link_label) + (link_text) + (image_description) +] @text.reference + +[ + (backslash_escape) + (hard_line_break) +] @string.escape + +; "(" not part of query because of +; https://github.com/nvim-treesitter/nvim-treesitter/issues/2206 +; TODO: Find better fix for this +(image ["!" "[" "]" "(" ")"] @punctuation.delimiter) +(inline_link ["[" "]" "(" ")"] @punctuation.delimiter) +(shortcut_link ["[" "]"] @punctuation.delimiter) + +; Conceal codeblock and text style markers +([ + (code_span_delimiter) + (emphasis_delimiter) +] @conceal +(#set! conceal "")) + +; Conceal inline links +(inline_link + [ + "[" + "]" + "(" + (link_destination) + ")" + ] @conceal + (#set! conceal "")) + +; Conceal image links +(image + [ + "!" + "[" + "]" + "(" + (link_destination) + ")" + ] @conceal + (#set! conceal "")) + +; Conceal full reference links +(full_reference_link + [ + "[" + "]" + (link_label) + ] @conceal + (#set! conceal "")) + +; Conceal collapsed reference links +(collapsed_reference_link + [ + "[" + "]" + ] @conceal + (#set! conceal "")) + +; Conceal shortcut links +(shortcut_link + [ + "[" + "]" + ] @conceal + (#set! conceal "")) diff --git a/lazy-lock.json b/lazy-lock.json index c345fd4..e2007e6 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,63 +1,68 @@ { - "Comment.nvim": { "branch": "master", "commit": "d9cfae1059b62f7eacc09dba181efe4894e3b086" }, - "LuaSnip": { "branch": "master", "commit": "563827f00bb4fe43269e3be653deabc0005f1302" }, - "alpha-nvim": { "branch": "main", "commit": "21a0f2520ad3a7c32c0822f943368dc063a569fb" }, - "catppuccin": { "branch": "main", "commit": "26e498db297607fe17a6206c5a28f0f4cb532954" }, + "Comment.nvim": { "branch": "master", "commit": "418d3117dab2f54c4340ea73e0070dd78fc81753" }, + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, + "LuaSnip": { "branch": "master", "commit": "500981ff6cefc7343e3959ef0f939bd0bfd49ba9" }, + "alpha-nvim": { "branch": "main", "commit": "d35b99e36e32040ba06c48a25b5bd3e75be2a566" }, + "catppuccin": { "branch": "main", "commit": "c5ed88194ae1d581d3083725a0dc7c90dd3446be" }, "clipboard-image.nvim": { "branch": "main", "commit": "d1550dc26729b7954f95269952e90471b838fa25" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-calc": { "branch": "main", "commit": "50792f34a628ea6eb31d2c90e8df174671e4e7a0" }, "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, - "cmp-latex-symbols": { "branch": "main", "commit": "1ec2e4f47cde6c7ffcebec92cfec58ddc1f6689a" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" }, - "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "d2768cb1b83de649d57d967085fe73c5e01f8fd7" }, - "cmp-pandoc-references": { "branch": "master", "commit": "01b2d0df8c1f16ab98f1b29c4e978c9650a7d207" }, + "cmp-latex-symbols": { "branch": "main", "commit": "165fb66afdbd016eaa1570e41672c4c557b57124" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, + "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, + "cmp-pandoc-references": { "branch": "master", "commit": "3b77a5c223b54bc2ebc9911bc57264ffbb610b71" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-plugins": { "branch": "main", "commit": "e321688e92e557851cfeee8ca552659a095b908c" }, "cmp-spell": { "branch": "master", "commit": "60584cb75e5e8bba5a0c9e4c3ab0791e0698bffa" }, "cmp-treesitter": { "branch": "master", "commit": "b40178b780d547bcf131c684bc5fd41af17d05f2" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, - "flit.nvim": { "branch": "main", "commit": "be110f9814a45788d10537fd59b3c76d956bb7ad" }, - "friendly-snippets": { "branch": "main", "commit": "320865dfe76c03a5c60513d4f34ca22effae56f2" }, - "git-blame.nvim": { "branch": "master", "commit": "5ddf157139ecfc0d2161f00c2cce4874578dc355" }, - "indent-blankline.nvim": { "branch": "master", "commit": "db7cbcb40cc00fc5d6074d7569fb37197705e7f6" }, - "lazy.nvim": { "branch": "main", "commit": "4f60facf18b34ae06d164485aa2ce879e21e44fc" }, - "leap.nvim": { "branch": "main", "commit": "a968ab4250840dc879e805f918b4f3b892310a12" }, + "friendly-snippets": { "branch": "main", "commit": "1645e7cd98ed99e766c84ab3cf13a1612c77dcee" }, + "git-blame.nvim": { "branch": "master", "commit": "17840d01f42ee308e1dbbcc2cde991297aee36c9" }, + "git-conflict.nvim": { "branch": "main", "commit": "80bc8931d4ed8c8c4d289a08e1838fcf4741408d" }, + "gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" }, + "hologram.nvim": { "branch": "main", "commit": "f5194f71ec1578d91b2e3119ff08e574e2eab542" }, + "indent-blankline.nvim": { "branch": "master", "commit": "8299fe7703dfff4b1752aeed271c3b95281a952d" }, + "lazy.nvim": { "branch": "main", "commit": "c249ea376bcd3e5d121b79eac595837b7d0c73a4" }, "lspkind-nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, - "lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "610f5919fe633ac872239a0ab786572059f0d91d" }, - "mason.nvim": { "branch": "main", "commit": "d825d3d1612c31caaff60901e0a6600cab8624d3" }, - "neoconf.nvim": { "branch": "main", "commit": "3e3294631ef23599b9fccb87dee2592c73d11c60" }, - "neodev.nvim": { "branch": "main", "commit": "b836d7f573d9612e8f5c3c1eea7acbe8929ff968" }, - "neogit": { "branch": "master", "commit": "981207efd10425fef82ca09fa8bd22c3ac3e622d" }, + "lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "93e58e100f37ef4fb0f897deeed20599dae9d128" }, + "mason.nvim": { "branch": "main", "commit": "bce3009ad4570eff9f64ccbb3f339b2eb46dd047" }, + "neoconf.nvim": { "branch": "main", "commit": "627794ccb18521d7c7d11606d2cf2674f9ed515e" }, + "neodev.nvim": { "branch": "main", "commit": "a81e749d0fe8429cd340b2e40f274b344bef42ac" }, + "neogen": { "branch": "main", "commit": "fbc3952024d2c0d57b92a3802e9e29c789abcd18" }, + "neogit": { "branch": "master", "commit": "089d388876a535032ac6a3f80e19420f09e4ddda" }, "neotest": { "branch": "master", "commit": "fee5ce9bdc3dff4706a29b012e75025ab376becb" }, - "neotest-python": { "branch": "master", "commit": "e53920d145d37783c8d8428365a0a230e0a18cb5" }, - "nightfox.nvim": { "branch": "main", "commit": "a637479382f6a592a202ccfbff1bb27d604afce8" }, - "nord.nvim": { "branch": "master", "commit": "418e2507dcff84a7cb993ae4f37697b98e0c92ca" }, - "nvim-autopairs": { "branch": "master", "commit": "f00eb3b766c370cb34fdabc29c760338ba9e4c6c" }, + "neotest-python": { "branch": "master", "commit": "a76fb6760fc2f653c2088f79152338cc99380cf1" }, + "nightfox.nvim": { "branch": "main", "commit": "4d410ea0da0af5d0e3277bc6dba4e152c26a39ee" }, + "nord.nvim": { "branch": "master", "commit": "9824b8511dcb7d89de628d7e9bab5fa65c9d59d1" }, + "nvim-autopairs": { "branch": "master", "commit": "45ae3122a4c7744db41298b41f9f5a3f092123e6" }, "nvim-cmp": { "branch": "main", "commit": "983453e32cb35533a119725883c04436d16c0120" }, "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, - "nvim-lspconfig": { "branch": "master", "commit": "2df0fbdadd947cd2995566a0117b8802a9ba74f4" }, + "nvim-lspconfig": { "branch": "master", "commit": "255e07ce2a05627d482d2de77308bba51b90470c" }, "nvim-scrollview": { "branch": "main", "commit": "ba6c48bf7919dd48a371e7b9c683b8858053e885" }, - "nvim-tree.lua": { "branch": "master", "commit": "e8a89db1bbc06510a76fc935754b4e99a3e5e8a7" }, - "nvim-treesitter": { "branch": "master", "commit": "69388e84c34d40c3d5c7d2f310db13276f2179e1" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "2fb97bd6c53d78517d2022a0b84422c18ce5686e" }, - "nvim-web-devicons": { "branch": "master", "commit": "6c38926351372ea87034dec26182b62c835ff3bc" }, - "otter.nvim": { "branch": "main", "commit": "0c3c1a278f931d85646b5046f3c1ff8ba7de2ff5" }, - "playground": { "branch": "master", "commit": "01c27f37a1f067200680cacfb7b96f5ad2fa5cd6" }, + "nvim-tree.lua": { "branch": "master", "commit": "08a0aa1a3b7411ee0a7887c8818528b1558cef96" }, + "nvim-treesitter": { "branch": "master", "commit": "ad9ae9e7def54fee446c3e186ed0a0d44cca7b90" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "15d9c62cb04079cf440ceb6882f2cbfaed66eda1" }, + "nvim-web-devicons": { "branch": "master", "commit": "bb6d4fd1e010300510172b173ab5205d37af084f" }, + "otter.nvim": { "branch": "main", "commit": "e32e432988fddc7fc96f08300e56750a838f0893" }, + "playground": { "branch": "master", "commit": "c481c660fa903a0e295902b1765ecfbd6e76a556" }, "plenary.nvim": { "branch": "master", "commit": "9d81624fbcedd3dd43b38d7e13a1e7b3f873d8cd" }, - "quarto-nvim": { "branch": "main", "commit": "5140fc2b0598b6bad35f98096a9242e0f6d8c1a5" }, - "symbols-outline.nvim": { "branch": "master", "commit": "6a3ed24c5631da7a5d418bced57c16b32af7747c" }, + "projections.nvim": { "branch": "main", "commit": "6820ad90343b5ec78f236bbe0e13d9c8078a0c48" }, + "quarto-nvim": { "branch": "main", "commit": "b44f8772686241e563c7d0f200748fd71766b64e" }, + "quarto-vim": { "branch": "master", "commit": "216247339470794e74a5fda5e5515008d6dc1057" }, + "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" }, "tabby.nvim": { "branch": "main", "commit": "187b604da1a6452c700ce21fdf340ffbea956298" }, - "telescope-file-browser.nvim": { "branch": "master", "commit": "304508fb7bea78e3c0eeddd88c4837501e403ae8" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "fab3e2212e206f4f8b3bbaa656e129443c9b802e" }, - "telescope-project.nvim": { "branch": "master", "commit": "8e8ee37b7210761502cdf2c3a82b5ba8fb5b2972" }, + "telescope-file-browser.nvim": { "branch": "master", "commit": "9c2ff3bb54fa55646b5f6739649fdaaed284309c" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" }, "telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" }, "toggleterm.nvim": { "branch": "main", "commit": "2a787c426ef00cb3488c11b14f5dcf892bbd0bda" }, - "tokyonight.nvim": { "branch": "main", "commit": "def91651c41f6d1d43ebcb50763324d35331baee" }, - "trouble.nvim": { "branch": "main", "commit": "83ec606e7065adf134d17f4af6bae510e3c491c1" }, + "tokyonight.nvim": { "branch": "main", "commit": "a0abe53df53616d13da327636cb0bcac3ea7f5af" }, + "trouble.nvim": { "branch": "main", "commit": "556ef3089709a6e253df1e500381fec5eb48e48a" }, + "vim-pandoc-syntax": { "branch": "master", "commit": "4268535e1d33117a680a91160d845cd3833dfe28" }, "vim-repeat": { "branch": "master", "commit": "8106e142dfdc278ff3eaaadd7b362ad7949d4357" }, "vim-slime": { "branch": "main", "commit": "5308556987857eb0fc5f1a774496b29d8dd70f34" }, "vim-surround": { "branch": "master", "commit": "aeb933272e72617f7c4d35e1f003be16836b948d" }, - "which-key.nvim": { "branch": "main", "commit": "16ed12a8493628c377606da2ebac50d80736ed37" } -} + "which-key.nvim": { "branch": "main", "commit": "5224c261825263f46f6771f1b644cae33cd06995" } +} \ No newline at end of file diff --git a/lua/config/global.lua b/lua/config/global.lua index 0bce738..2acca7e 100644 --- a/lua/config/global.lua +++ b/lua/config/global.lua @@ -1,4 +1,3 @@ - vim.g.markdown_fenced_languages = { 'html', 'python', 'bash=sh', 'R=r' } vim.opt.termguicolors = true @@ -6,7 +5,7 @@ vim.opt.termguicolors = true vim.opt.number = true -- show linenumbers vim.opt.timeoutlen = 400 -- until which-key pops up vim.opt.updatetime = 250 -- for autocommands and hovers -vim.opt.mouse= 'a' -- enable mouse +vim.opt.mouse = 'a' -- enable mouse vim.opt.mousefocus = true vim.opt.clipboard:append 'unnamedplus' -- use system clipboard @@ -57,13 +56,10 @@ vim.opt.showtabline = 1 vim.opt.winbar = '%t' --don't continue comments automagically -vim.opt.formatoptions:remove({'c', 'r', 'o'}) - +vim.opt.formatoptions:remove({ 'c', 'r', 'o' }) -- hide cmdline when not used vim.opt.cmdheight = 0 -vim.opt.conceallevel = 0 - -- plugins -- slime, general diff --git a/lua/config/keymap.lua b/lua/config/keymap.lua index 76802d3..7faa26e 100644 --- a/lua/config/keymap.lua +++ b/lua/config/keymap.lua @@ -151,7 +151,7 @@ local function open_plugin() vim.cmd(cmd) end -vim.keymap.set('n', 'vp', open_plugin) +local otter = require("otter") --show kepbindings with whichkey --add your own here if you want them to @@ -170,7 +170,9 @@ wk.register( }, v = { name = 'vim', + p = {open_plugin, 'open plugin'}, t = { switchTheme, 'switch theme' }, + c = { ':Telescope colorscheme', 'colortheme' }, l = { ':Lazy', 'Lazy' }, m = { ':Mason', 'Mason' }, s = { ':e $MYVIMRC | :cd %:p:h | split . | wincmd k', 'Settings' }, @@ -189,9 +191,11 @@ wk.register( d = { vim.diagnostic.disable, 'disable' }, e = { vim.diagnostic.enable, 'enable' }, }, + g = { ':Neogen', 'neogen docstring'} }, q = { name = 'quarto', + a = { ":QuartoActivate", 'activate' }, p = { ":lua require'quarto'.quartoPreview()", 'preview' }, q = { ":lua require'quarto'.quartoClosePreview()", 'close' }, h = { ":QuartoHelp ", 'help' }, @@ -214,7 +218,12 @@ wk.register( q = { "Telescope quickfix", "quickfix" }, l = { "Telescope loclist", "loclist" }, j = { "Telescope jumplist", "marks" }, - p = { "Telescope project", "project" }, + p = { "project" }, + }, + h = { + name = 'hidden', + h = {':set conceallevel=1', 'hide/conceal'}, + s = {':set conceallevel=0', 'show/unconceal'}, }, s = { name = "spellcheck", diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua index 7eda15d..ecba39d 100644 --- a/lua/plugins/completion.lua +++ b/lua/plugins/completion.lua @@ -106,6 +106,7 @@ return { { name = 'path' }, { name = 'plugins' }, { name = 'nvim_lsp' }, + { name = 'nvim_lsp_signature_help' }, { name = 'luasnip', keyword_length = 3, max_item_count = 3 }, { name = 'pandoc_references' }, { name = 'buffer', keyword_length = 5, max_item_count = 3 }, diff --git a/lua/plugins/editing.lua b/lua/plugins/editing.lua index ce5662b..def46a9 100644 --- a/lua/plugins/editing.lua +++ b/lua/plugins/editing.lua @@ -10,8 +10,15 @@ return { }, -- commenting with e.g. `gcc` or `gcip` -- respects TS, so it works in quarto documents - { 'numToStr/Comment.nvim', config = function() + { 'numToStr/Comment.nvim', + version = nil, + branch = 'master', + config = function() require('Comment').setup {} end }, + { "danymat/neogen", + dependencies = "nvim-treesitter/nvim-treesitter", + config = true + } } diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index 0cf5dc9..351c17f 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -14,21 +14,20 @@ return { } end }, - -- { 'lewis6991/gitsigns.nvim', config = function() - -- require('gitsigns').setup {} - -- end - -- }, - -- { 'akinsho/git-conflict.nvim', config = function() - -- require('git-conflict').setup { - -- default_mappings = true, - -- disable_diagnostics = true, - -- } - -- end - -- }, - -- { 'f-person/git-blame.nvim' }, + { 'lewis6991/gitsigns.nvim', config = function() + require('gitsigns').setup {} + end + }, + { 'akinsho/git-conflict.nvim', config = function() + require('git-conflict').setup { + default_mappings = true, + disable_diagnostics = true, + } + end + }, + { 'f-person/git-blame.nvim' }, -- github PRs and the like with gh-cli -- { 'pwntester/octo.nvim', config = function() -- require "octo".setup() - -- end - -- }, + -- end }, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index b1a4c30..0b7a2d4 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -9,6 +9,9 @@ return { "hrsh7th/cmp-nvim-lsp", }, config = function() + -- IMPORTANT: make sure to setup neodev BEFORE lspconfig + require("neodev").setup() + local lspconfig = require('lspconfig') local cmp_nvim_lsp = require('cmp_nvim_lsp') local configs = require 'lspconfig.configs' diff --git a/lua/plugins/quarto.lua b/lua/plugins/quarto.lua index 3c6cd49..d8d60ac 100644 --- a/lua/plugins/quarto.lua +++ b/lua/plugins/quarto.lua @@ -1,10 +1,49 @@ return { { 'quarto-dev/quarto-nvim', + -- version = nil, + -- branch = 'quarto-ft', dependencies = { - 'jmbuhr/otter.nvim', + { 'jmbuhr/otter.nvim', }, + { 'quarto-dev/quarto-vim', + ft = 'quarto', + dependencies = { 'vim-pandoc/vim-pandoc-syntax' }, + -- note: needs additional vim highlighting enabled + -- for markdown in treesitter.lua + }, 'neovim/nvim-lspconfig' }, config = function() + + -- conceal can be tricky because both + -- the treesitter highlighting and the + -- regex vim syntax files can define conceals + -- + -- conceallevel + -- 0 Text is shown normally + -- 1 Each block of concealed text is replaced with one + -- character. If the syntax item does not have a custom + -- replacement character defined (see |:syn-cchar|) the + -- character defined in 'listchars' is used. + -- It is highlighted with the "Conceal" highlight group. + -- 2 Concealed text is completely hidden unless it has a + -- custom replacement character defined (see + -- |:syn-cchar|). + -- 3 Concealed text is completely hidden. + vim.opt.conceallevel = 1 + + -- disable conceal in markdown/quarto + vim.g['pandoc#syntax#conceal#use'] = false + + -- embeds are already handled by treesitter injectons + vim.g['pandoc#syntax#codeblocks#embeds#use'] = false + + vim.g['pandoc#syntax#conceal#blacklist'] = { 'codeblock_delim', 'codeblock_start' } + + -- but allow some types of conceal in math reagions: + -- a=accents/ligatures d=delimiters m=math symbols + -- g=Greek s=superscripts/subscripts + vim.g['tex_conceal'] = 'gm' + require 'quarto'.setup { lspFeatures = { enabled = true, @@ -20,11 +59,17 @@ return { } end }, - -- send code from python/r/qmd docuemts to a terminal + -- send code from python/r/qmd docuemts to the terminal + -- thanks to tmux can be used for any repl -- like ipython, R, bash { 'jpalardy/vim-slime' }, -- paste an image to markdown from the clipboard - -- with :PasteImg, + -- :PasteImg, 'ekickx/clipboard-image.nvim', + -- display images in the terminal! + { 'edluffy/hologram.nvim', + config = function() + end + }, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 84087e1..fd58706 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,64 +1,70 @@ return { - { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate', config = function() - require 'nvim-treesitter.configs'.setup { - ensure_installed = { 'r', 'python', 'markdown', 'markdown_inline', 'julia', 'yaml', 'lua', 'vim', 'query', 'help' }, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - indent = { - enable = true, - }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "gnn", - node_incremental = "grn", - scope_incremental = "grc", - node_decremental = "grm", + { 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate', + config = function() + require 'nvim-treesitter.configs'.setup { + ensure_installed = { 'r', 'python', 'markdown', 'markdown_inline', 'julia', 'yaml', 'lua', 'vim', 'query', 'help', + 'latex' }, + highlight = { + enable = true, + additional_vim_regex_highlighting = { 'markdown' }, + -- additional_vim_regex_highlighting = false, + -- note: the vim regex based highlighting from + -- quarto-vim / vim-pandoc set the wrong comment character + -- for some sections where there is `$` math. }, - }, - textobjects = { - select = { + indent = { enable = true, - lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', - ['ao'] = '@codechunk.outer', - ['io'] = '@codechunk.inner', - }, }, - move = { + incremental_selection = { enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - [']m'] = '@function.outer', - [']c'] = '@codechunk.inner', - [']]'] = '@class.outer', - }, - goto_next_end = { - [']M'] = '@function.outer', - [']['] = '@class.outer', + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", }, - goto_previous_start = { - ['[m'] = '@function.outer', - ['[c'] = '@codechunk.inner', - -- ['[['] = '@class.outer', + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + ['ao'] = '@codechunk.outer', + ['io'] = '@codechunk.inner', + }, }, - goto_previous_end = { - ['[M'] = '@function.outer', - ['[]'] = '@class.outer', + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']c'] = '@codechunk.inner', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[c'] = '@codechunk.inner', + -- ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, }, }, - }, - } + } - end }, + end }, 'nvim-treesitter/nvim-treesitter-textobjects', 'nvim-treesitter/playground', - } diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index e7762a3..0014e40 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -53,14 +53,14 @@ return { telescope.load_extension('fzf') telescope.load_extension('ui-select') telescope.load_extension('file_browser') - telescope.load_extension('project') + -- telescope.load_extension('project') end }, { 'nvim-telescope/telescope-ui-select.nvim' }, { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, -- { 'nvim-telescope/telescope-dap.nvim' }, { 'nvim-telescope/telescope-file-browser.nvim' }, - { 'nvim-telescope/telescope-project.nvim' }, + -- { 'nvim-telescope/telescope-project.nvim' }, { 'nvim-lualine/lualine.nvim', dependencies = { { 'f-person/git-blame.nvim' }, @@ -80,6 +80,9 @@ return { return "" end + local function macro_reg() + return vim.fn.reg_recording() + end require('lualine').setup { options = { section_separators = '', @@ -88,10 +91,11 @@ return { theme = "catppuccin", }, sections = { + lualine_a = {'mode', {macro_reg, type = 'lua_expr', color = 'WarningMsg'} }, + lualine_b = {'branch', { search_count, type = 'lua_expr' } }, lualine_c = { { git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available } }, - lualine_b = {'branch', { search_count, type = "lua_expr" } } }, extensions = { 'nvim-tree' }, } diff --git a/lua/plugins/workspaces.lua b/lua/plugins/workspaces.lua new file mode 100644 index 0000000..6b03370 --- /dev/null +++ b/lua/plugins/workspaces.lua @@ -0,0 +1,38 @@ +return { + { 'gnikdroy/projections.nvim', + config = function() + + vim.opt.sessionoptions:append("localoptions") -- Save localoptions to session file + require("projections").setup { + store_hooks = { + pre = function() + -- nvim-tree + local nvim_tree_present, api = pcall(require, "nvim-tree.api") + if nvim_tree_present then api.tree.close() end + + -- neo-tree + if pcall(require, "neo-tree") then vim.cmd [[Neotree action=close]] end + end + } + } + + -- Bind fp to Telescope projections + require('telescope').load_extension('projections') + vim.keymap.set("n", "fp", function() vim.cmd("Telescope projections") end) + + -- Autostore session on VimExit + local Session = require("projections.session") + vim.api.nvim_create_autocmd({ 'VimLeavePre' }, { + callback = function() Session.store(vim.loop.cwd()) end, + }) + + -- Switch to project if vim was started in a project dir + local switcher = require("projections.switcher") + vim.api.nvim_create_autocmd({ "VimEnter" }, { + callback = function() + if vim.fn.argc() == 0 then switcher.switch(vim.loop.cwd()) end + end, + }) + end + } +} diff --git a/queries/markdown/highlights.scm b/queries/markdown/highlights.scm new file mode 100644 index 0000000..299bd48 --- /dev/null +++ b/queries/markdown/highlights.scm @@ -0,0 +1,74 @@ +;From MDeiml/tree-sitter-markdown +(atx_heading (inline) @text.title) +(setext_heading (paragraph) @text.title) + +[ + (atx_h1_marker) + (atx_h2_marker) + (atx_h3_marker) + (atx_h4_marker) + (atx_h5_marker) + (atx_h6_marker) + (setext_h1_underline) + (setext_h2_underline) +] @punctuation.special + +[ + (link_title) + (indented_code_block) + (fenced_code_block) +] @text.literal + +(pipe_table_header (pipe_table_cell) @text.title) + +(pipe_table_header "|" @punctuation.special) +(pipe_table_row "|" @punctuation.special) +(pipe_table_delimiter_row "|" @punctuation.special) +(pipe_table_delimiter_cell) @punctuation.special + +[ + (fenced_code_block_delimiter) +] @punctuation.delimiter + +(code_fence_content) @none + +[ + (link_destination) +] @text.uri + +[ + (link_label) +] @text.reference + +[ + (list_marker_plus) + (list_marker_minus) + (list_marker_star) + (list_marker_dot) + (list_marker_parenthesis) + (thematic_break) +] @punctuation.special + + +(task_list_marker_unchecked) @text.todo.unchecked +(task_list_marker_checked) @text.todo.checked + +(block_quote) @text.quote + +[ + (block_continuation) + (block_quote_marker) +] @punctuation.special + +[ + (backslash_escape) +] @string.escape + +; ([ +; ; (info_string) +; (fenced_code_block_delimiter) +; ] @conceal +; (#set! conceal "")) + +(inline) @spell + diff --git a/queries/markdown_inline/highlights.scm b/queries/markdown_inline/highlights.scm new file mode 100644 index 0000000..8a5a64f --- /dev/null +++ b/queries/markdown_inline/highlights.scm @@ -0,0 +1,96 @@ +;; From MDeiml/tree-sitter-markdown +;; https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/markdown_inline/highlights.scm +[ + (code_span) + (link_title) +] @text.literal + +[ + (emphasis_delimiter) + (code_span_delimiter) +] @punctuation.delimiter + +(emphasis) @text.emphasis + +(strong_emphasis) @text.strong + +(strikethrough) @text.strike + +[ + (link_destination) + (uri_autolink) +] @text.uri + +[ + (link_label) + (link_text) + (image_description) +] @text.reference + +[ + (backslash_escape) + (hard_line_break) +] @string.escape + +; "(" not part of query because of +; https://github.com/nvim-treesitter/nvim-treesitter/issues/2206 +; TODO: Find better fix for this +(image ["!" "[" "]" "(" ")"] @punctuation.delimiter) +(inline_link ["[" "]" "(" ")"] @punctuation.delimiter) +(shortcut_link ["[" "]"] @punctuation.delimiter) + +; Conceal codeblock and text style markers +; ([ +; (code_span_delimiter) +; (emphasis_delimiter) +; ] @conceal +; (#set! conceal "")) + +; Conceal inline links +; (inline_link +; [ +; "[" +; "]" +; "(" +; (link_destination) +; ")" +; ] @conceal +; (#set! conceal "")) + +; Conceal image links +; (image +; [ +; "!" +; "[" +; "]" +; "(" +; (link_destination) +; ")" +; ] @conceal +; (#set! conceal "")) + +; Conceal full reference links +; (full_reference_link +; [ +; "[" +; "]" +; (link_label) +; ] @conceal +; (#set! conceal "")) + +; Conceal collapsed reference links +; (collapsed_reference_link +; [ +; "[" +; "]" +; ] @conceal +; (#set! conceal "")) + +; Conceal shortcut links +; (shortcut_link +; [ +; "[" +; "]" +; ] @conceal +; (#set! conceal "")) + diff --git a/snips/snippets/quarto.json b/snips/snippets/quarto.json new file mode 120000 index 0000000..c42c0bb --- /dev/null +++ b/snips/snippets/quarto.json @@ -0,0 +1 @@ +markdown.json \ No newline at end of file