Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbuhr committed Feb 18, 2025
1 parent 3e08906 commit fd50ef2
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 39 deletions.
11 changes: 0 additions & 11 deletions ftplugin/python.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
vim.b.slime_cell_delimiter = '#\\s\\=%%'


local start_hamilton_lsp = function()
local client = vim.lsp.start_client({
cmd = { 'hamilton-lsp' },
filetypes = { 'python' },
on_attach = require('config.lsp').on_attach,
root_dir = require('lspconfig').util.root_pattern('.git', 'setup.py'),
})
end

start_hamilton_lsp()
2 changes: 1 addition & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ require 'config.lazy'
require 'config.autocommands'
-- require 'config.redir'

vim.cmd.colorscheme 'alabaster'
vim.cmd.colorscheme 'kanagawa'
22 changes: 16 additions & 6 deletions lua/config/global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ vim.api.nvim_set_hl(0, 'TermCursor', { fg = '#A6E3A1', bg = '#A6E3A1' })
vim.o.fillchars = 'eob: '

-- more opinionated
vim.opt.number = true -- show linenumbers
vim.opt.mouse = 'a' -- enable mouse
vim.opt.number = true -- show linenumbers
vim.opt.mouse = 'a' -- enable mouse
vim.opt.mousefocus = true
vim.opt.clipboard:append 'unnamedplus' -- use system clipboard

vim.opt.timeoutlen = 400 -- until which-key pops up
vim.opt.updatetime = 250 -- for autocommands and hovers
vim.opt.timeoutlen = 400 -- until which-key pops up
vim.opt.updatetime = 250 -- for autocommands and hovers

-- don't ask about existing swap files
vim.opt.shortmess:append 'A'
Expand Down Expand Up @@ -79,7 +79,8 @@ let g:currentmode={

math.randomseed(os.time())
local i = math.random(#animals)
vim.opt.statusline = '%{%g:currentmode[mode()]%} %{%reg_recording()%} %* %t | %y | %* %= c:%c l:%l/%L %p%% %#NonText# ' .. animals[i] .. ' %*'
vim.opt.statusline = '%{%g:currentmode[mode()]%} %{%reg_recording()%} %* %t | %y | %* %= c:%c l:%l/%L %p%% %#NonText# ' ..
animals[i] .. ' %*'

-- hide cmdline when not used
vim.opt.cmdheight = 1
Expand All @@ -95,11 +96,20 @@ vim.opt.showtabline = 1
vim.opt.winbar = '%f'

-- don't continue comments automagically
-- https://neovim.io/doc/user/options.html#'formatoptions'
vim.opt.formatoptions:remove 'c'
vim.opt.formatoptions:remove 'r'
vim.opt.formatoptions:remove 'o'

-- set formatoptions again in an autocmd to override
-- ft specific plugins
vim.api.nvim_create_autocmd({ "BufEnter" }, {
callback = function(_)
vim.opt.formatoptions:remove 'c'
vim.opt.formatoptions:remove 'r'
vim.opt.formatoptions:remove 'o'
end
})

-- scroll before end of window
vim.opt.scrolloff = 5

Expand Down
17 changes: 13 additions & 4 deletions lua/plugins/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ return {
{ -- new completion plugin
'saghen/blink.cmp',
enabled = true,
version = '*',
dev = false,
-- version = '*',
dev = true,
-- OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
-- build = 'cargo build --release',
build = 'cargo build --release',
lazy = false,
dependencies = {
{ 'rafamadriz/friendly-snippets' },
{ 'moyiz/blink-emoji.nvim' },
{ 'Kaiser-Yang/blink-cmp-git' },
{
'saghen/blink.compat',
dev = false,
Expand All @@ -38,7 +39,7 @@ return {
['<c-y>'] = { 'show_documentation', 'hide_documentation' },
},
sources = {
default = { "lazydev", "lsp", "path", "snippets", "buffer", "emoji" },
default = { "lazydev", "lsp", "path", "git", "snippets", "buffer", "emoji" },
cmdline = {},
providers = {
emoji = {
Expand All @@ -52,6 +53,14 @@ return {
-- make lazydev completions top priority (see `:h blink.cmp`)
score_offset = 100,
},
git = {
module = 'blink-cmp-git',
name = 'Git',
opts = {},
enabled = function()
return vim.tbl_contains({ 'octo', 'gitcommit', 'git' }, vim.bo.filetype)
end,
},
references = {
name = "pandoc_references",
module = "blink.compat.source",
Expand Down
33 changes: 18 additions & 15 deletions lua/plugins/lsp.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

return {

{ -- for lsp features in code cells / embedded code
'jmbuhr/otter.nvim',
dev = false,
dev = true,
dependencies = {
{
'neovim/nvim-lspconfig',
Expand All @@ -13,7 +12,7 @@ return {
opts = {
buffers = {
set_filetype = true,
write_to_disk = true
write_to_disk = false
}
}
},
Expand Down Expand Up @@ -52,7 +51,12 @@ return {

require('mason').setup()
require('mason-lspconfig').setup {
automatic_installation = true,
automatic_installation = {
exclude = {
'rust_analyzer',
}
},

}
require('mason-tool-installer').setup {
ensure_installed = {
Expand Down Expand Up @@ -88,8 +92,12 @@ return {
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', function () if vim.fn.has("nvim-0.11.0") == 1 then vim.diagnostic.jump({count = 1}) else vim.diagnostic.goto_next() end end,'next [d]iagnostic ')
map('[d', function () if vim.fn.has("nvim-1.11.0") == 1 then vim.diagnostic.jump({count = -1}) else vim.diagnostic.goto_prev() end end,'previous [d]iagnostic ')
map(']d',
function() if vim.fn.has("nvim-0.11.0") == 1 then vim.diagnostic.jump({ count = 1 }) else vim.diagnostic
.goto_next() end end, 'next [d]iagnostic ')
map('[d',
function() if vim.fn.has("nvim-1.11.0") == 1 then vim.diagnostic.jump({ count = -1 }) else vim.diagnostic
.goto_prev() end end, 'previous [d]iagnostic ')
map('<leader>ll', vim.lsp.codelens.run, '[l]ens run')
map('<leader>lR', vim.lsp.buf.rename, '[l]sp [R]ename')
map('<leader>lf', vim.lsp.buf.format, '[l]sp [f]ormat')
Expand Down Expand Up @@ -121,6 +129,7 @@ return {
lspconfig.r_language_server.setup {
capabilities = capabilities,
flags = lsp_flags,
filetypes = { 'r', 'rmd', 'rmarkdown' }, -- not directly using it for quarto (as that is handled by otter and often contains more languanges than just R)
settings = {
r = {
lsp = {
Expand Down Expand Up @@ -269,15 +278,10 @@ return {
flags = lsp_flags,
}

lspconfig.rust_analyzer.setup{
lspconfig.rust_analyzer.setup {
capabilities = capabilities,
flags = lsp_flags,
}

-- lspconfig.ruff.setup {
-- capabilities = capabilities,
-- flags = lsp_flags,
-- }
}

-- lspconfig.ruff_lsp.setup {
-- capabilities = capabilities,
Expand Down Expand Up @@ -307,10 +311,9 @@ return {
},
},
root_dir = function(fname)
return util.root_pattern('.git', 'setup.py', 'setup.cfg', 'pyproject.toml', 'requirements.txt')(fname) or util.path.dirname(fname)
return util.root_pattern('.git', 'setup.py', 'setup.cfg', 'pyproject.toml', 'requirements.txt')(fname)
end,
}

end,
},
}
6 changes: 4 additions & 2 deletions lua/plugins/notes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ return {
{
'epwalsh/obsidian.nvim',
enabled = true,
-- lazy = false,
ft = 'markdown',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-lua/plenary.nvim',
},
keys = {
{ '<leader>nd', ':ObsidianToday<cr>', desc = 'obsidian [d]aily' },
{ '<leader>nt', ':ObsidianToday 1<cr>', desc = 'obsidian [t]omorrow' },
{ '<leader>nt', ':e ~/notes/readme.md<cr>', desc = 'obsidian [t]odo' },
{ '<leader>ny', ':ObsidianToday -1<cr>', desc = 'obsidian [y]esterday' },
{ '<leader>nb', ':ObsidianBacklinks<cr>', desc = 'obsidian [b]acklinks' },
{ '<leader>nl', ':ObsidianLink<cr>', desc = 'obsidian [l]ink selection' },
Expand Down

0 comments on commit fd50ef2

Please sign in to comment.