Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbuhr committed Jun 28, 2024
1 parent 77c9616 commit dbd2460
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 30 deletions.
6 changes: 3 additions & 3 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
-- (may be outdated with newer versions of the plugins,
-- check for yourself if you're interested in using them)

require 'config.global'
require 'config.lazy'
require 'config.autocommands'
require("config.global")
require("config.lazy")
require("config.autocommands")
65 changes: 48 additions & 17 deletions lua/plugins/lsp.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
return {

{

-- for lsp features in code cells / embedded code
'jmbuhr/otter.nvim',
dev = false,
dev = true,
dependencies = {
{
'neovim/nvim-lspconfig',
Expand Down Expand Up @@ -37,7 +38,31 @@ return {
enabled = false,
opts = {},
},
{ 'folke/neodev.nvim', opts = {}, enabled = true },
{
{
'folke/lazydev.nvim',
ft = 'lua', -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
{ '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,
},
-- { "folke/neodev.nvim", enabled = false }, -- make sure to uninstall or disable neodev.nvim
},
{ 'folke/neoconf.nvim', opts = {}, enabled = false },
},
config = function()
Expand Down Expand Up @@ -73,13 +98,13 @@ return {
---@diagnostic disable-next-line: inject-field
client.server_capabilities.document_formatting = true

map('gS', telescope.lsp_document_symbols, '[g]o so [S]ymbols')
map('gD', telescope.lsp_type_definitions, '[g]o to type [D]efinition')
map('gd', telescope.lsp_definitions, '[g]o to [d]efinition')
map('K', '<cmd>lua vim.lsp.buf.hover()<CR>', '[K] hover documentation')
map('gh', '<cmd>lua vim.lsp.buf.signature_help()<CR>', '[g]o to signature [h]elp')
map('gI', telescope.lsp_implementations, '[g]o to [I]mplementation')
map('gr', telescope.lsp_references, '[g]o to [r]eferences')
map('gS', vim.lsp.buf.document_symbol, '[g]o so [S]ymbols')
map('gD', vim.lsp.buf.type_definition, '[g]o to type [D]efinition')
map('gd', vim.lsp.buf.definition, '[g]o to [d]efinition')
map('K', vim.lsp.buf.hover, '[K] hover documentation')
map('gh', vim.lsp.buf.signature_help, '[g]o to signature [h]elp')
map('gI', vim.lsp.buf.implementation, '[g]o to [I]mplementation')
map('gr', vim.lsp.buf.references, '[g]o to [r]eferences')
map('[d', vim.diagnostic.goto_prev, 'previous [d]iagnostic ')
map(']d', vim.diagnostic.goto_next, 'next [d]iagnostic ')
map('<leader>ll', vim.lsp.codelens.run, '[l]ens run')
Expand All @@ -93,8 +118,12 @@ return {
allow_incremental_sync = true,
debounce_text_changes = 150,
}

local telescope_builtin = require 'telescope.builtin'
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = require('misc.style').border })
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = require('misc.style').border })
-- TODO: handle this
vim.lsp.handlers['textDocument/references'] = telescope_builtin.lsp_references

local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
Expand All @@ -104,11 +133,11 @@ return {
-- $home/.config/marksman/config.toml :
-- [core]
-- markdown.file_extensions = ["md", "markdown", "qmd"]
lspconfig.marksman.setup {
capabilities = capabilities,
filetypes = { 'markdown', 'quarto' },
root_dir = util.root_pattern('.git', '.marksman.toml', '_quarto.yml'),
}
-- lspconfig.marksman.setup {
-- capabilities = capabilities,
-- filetypes = { 'markdown', 'quarto' },
-- root_dir = util.root_pattern('.git', '.marksman.toml', '_quarto.yml'),
-- }

lspconfig.r_language_server.setup {
capabilities = capabilities,
Expand Down Expand Up @@ -201,16 +230,18 @@ return {
},
runtime = {
version = 'LuaJIT',
plugin = lua_plugin_paths,
-- plugin = lua_plugin_paths,
},
diagnostics = {
globals = { 'vim', 'quarto', 'pandoc', 'io', 'string', 'print', 'require', 'table' },
disable = { 'trailing-space' },
},
workspace = {
library = lua_library_files,
-- library = lua_library_files,
checkThirdParty = false,
},
doc = {
privateName = { '^_' },
},
telemetry = {
enable = false,
},
Expand Down
2 changes: 1 addition & 1 deletion lua/plugins/quarto.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ return {
-- for complete functionality (language features)
'quarto-dev/quarto-nvim',
ft = { 'quarto' },
dev = false,
dev = true,
opts = {
lspFeatures = {
languages = { 'r', 'python', 'julia', 'bash', 'lua', 'html', 'dot', 'javascript', 'typescript', 'ojs' },
Expand Down
10 changes: 1 addition & 9 deletions lua/plugins/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -333,15 +333,6 @@ return {
enabled = true,
dev = false,
ft = { 'markdown', 'quarto', 'vimwiki' },
dependencies = {
{
'vhyrro/luarocks.nvim',
priority = 1001, -- this plugin needs to run before anything else
opts = {
rocks = { 'magick' },
},
},
},
config = function()
-- Requirements
-- https://github.com/3rd/image.nvim?tab=readme-ov-file#requirements
Expand All @@ -350,6 +341,7 @@ return {
-- sudo apt install imagemagick
-- sudo apt install libmagickwand-dev
-- sudo apt install liblua5.1-0-dev
-- sudo apt install lua5.1
-- sudo apt installl luajit

local image = require 'image'
Expand Down

0 comments on commit dbd2460

Please sign in to comment.