Skip to content

Commit

Permalink
blink wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbuhr committed Nov 6, 2024
1 parent 67f39e0 commit 1db9d4a
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 14 deletions.
1 change: 1 addition & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ require 'config.redir'
-- vim.treesitter.language.add('pandoc_markdown_inline', { path = "/usr/local/lib/libtree-sitter-pandoc-markdown-inline.so" })
-- vim.treesitter.language.register('pandoc_markdown', { 'quarto', 'rmarkdown' })

vim.treesitter.language.register("markdown", 'quarto')
vim.treesitter.language.register("markdown", 'text')

85 changes: 84 additions & 1 deletion lua/plugins/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,90 @@ return {
end,
},

{ -- new completion plugin
'saghen/blink.cmp',
enabled = true,
lazy = false, -- lazy loading handled internally
-- optional: provides snippets for the snippet source
dependencies = {
{ 'rafamadriz/friendly-snippets' },
{ 'saghen/blink.compat' },
{ 'jmbuhr/cmp-pandoc-references',
dev = true,
ft = {'quarto', 'markdown', 'rmarkdown'},
config = function ()
vim.api.nvim_create_autocmd('FileType', {
pattern = {"markdown", "quarto", "rmarkdown"},
callback = function ()
require('cmp-pandoc-references.lsp').start()
end
})
end
},
{ 'hrsh7th/cmp-emoji' },
{ 'kdheepak/cmp-latex-symbols' },
},

-- use a release tag to download pre-built binaries
version = 'v0.*',
-- OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
-- build = 'cargo build --release',
-- If you use nix, you can build from source using latest nightly rust with:
-- build = 'nix run .#build-plugin',

---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
-- 'default' for mappings similar to built-in completion
-- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
-- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
-- see the "default configuration" section below for full documentation on how to define
-- your own keymap.
keymap = { preset = 'enter' },

sources = {
completion = {
enabled_providers = { "lsp", "path", "snippets", "buffer", "lazydev", "references", "emoji", "symbols" },
},
providers = {
-- dont show LuaLS require statements when lazydev has items
lsp = { fallback_for = { "lazydev" } },
lazydev = { name = "LazyDev", module = "lazydev.integrations.blink" },
-- references = {
-- name = "pandoc_references",
-- module = "blink.compat.source",
-- opts = {
-- impersonate_nvim_cmp = true,
-- enable_events = true,
-- debug = true,
-- }
-- },
emoji = { name = "emoji", module = "blink.compat.source" },
symbols = { name = "symbols", module = "blink.compat.source" },
},
},

highlight = {
-- sets the fallback highlight groups to nvim-cmp's highlight groups
-- useful for when your theme doesn't support blink.cmp
-- will be removed in a future release, assuming themes add support
use_nvim_cmp_as_default = true,
},
-- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- adjusts spacing to ensure icons are aligned
nerd_font_variant = 'mono',

-- experimental auto-brackets support
accept = { auto_brackets = { enabled = true } },

-- experimental signature help support
trigger = { signature_help = { enabled = true } },
}
},

{ -- completion
'hrsh7th/nvim-cmp',
enabled = false,
event = 'InsertEnter',
dependencies = {
'hrsh7th/cmp-nvim-lsp',
Expand Down Expand Up @@ -154,7 +236,7 @@ return {

{ -- gh copilot
'zbirenbaum/copilot.lua',
enabled = false,
enabled = true,
config = function()
require('copilot').setup {
suggestion = {
Expand All @@ -177,6 +259,7 @@ return {

{ -- LLMs
"olimorris/codecompanion.nvim",
enabled = false,
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
Expand Down
27 changes: 14 additions & 13 deletions lua/plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ return {

-- for lsp features in code cells / embedded code
'jmbuhr/otter.nvim',
dev = false,
dev = true,
dependencies = {
{
'neovim/nvim-lspconfig',
Expand Down Expand Up @@ -44,16 +44,16 @@ return {
},
},
{ 'Bilal2453/luvit-meta', lazy = true }, -- optional `vim.uv` typings
{ -- optional completion source for require statements and module annotations
'hrsh7th/nvim-cmp',
opts = function(_, opts)
opts.sources = opts.sources or {}
table.insert(opts.sources, {
name = 'lazydev',
group_index = 0, -- set group index to 0 to skip loading LuaLS completions
})
end,
},
-- { -- optional completion source for require statements and module annotations
-- 'hrsh7th/nvim-cmp',
-- opts = function(_, opts)
-- opts.sources = opts.sources or {}
-- table.insert(opts.sources, {
-- name = 'lazydev',
-- group_index = 0, -- set group index to 0 to skip loading LuaLS completions
-- })
-- end,
-- },
-- { "folke/neodev.nvim", enabled = false }, -- make sure to uninstall or disable neodev.nvim
},
{ 'folke/neoconf.nvim', opts = {}, enabled = false },
Expand Down Expand Up @@ -116,8 +116,9 @@ return {
}

local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
capabilities.textDocument.completion.completionItem.snippetSupport = true
-- capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
-- capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities = require('blink.cmp').get_lsp_capabilities(capabilities)

-- also needs:
-- $home/.config/marksman/config.toml :
Expand Down

0 comments on commit 1db9d4a

Please sign in to comment.