Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions after/ftplugin/haskell.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- local ht = require 'haskell-tools'
-- local bufnr = vim.api.nvim_get_current_buf()
-- local base_opts = { noremap = true, silent = true, buffer = bufnr }
--
-- vim.keymap.set('n', '<space>cl', vim.lsp.codelens.run, vim.tbl_extend('force', base_opts, { desc = 'Run all code lenses (e.g. eval, add signature)' }))
--
-- vim.keymap.set('n', '<space>hs', ht.hoogle.hoogle_signature, vim.tbl_extend('force', base_opts, { desc = 'Hoogle search for type signature under cursor' }))
--
-- vim.keymap.set('n', '<space>ea', ht.lsp.buf_eval_all, vim.tbl_extend('force', base_opts, { desc = 'Evaluate all code snippets in buffer' }))
--
-- vim.keymap.set('n', '<leader>rr', ht.repl.toggle, vim.tbl_extend('force', base_opts, { desc = 'Toggle GHCi repl for current package' }))
--
-- vim.keymap.set('n', '<leader>rf', function()
-- ht.repl.toggle(vim.api.nvim_buf_get_name(0))
-- end, vim.tbl_extend('force', base_opts, { desc = 'Toggle GHCi repl for current buffer' }))
--
-- vim.keymap.set('n', '<leader>rq', ht.repl.quit, vim.tbl_extend('force', base_opts, { desc = 'Quit GHCi repl' }))
35 changes: 35 additions & 0 deletions after/ftplugin/markdown.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
-- Add the key mappings only for Markdown files in a zk notebook.
if require('zk.util').notebook_root(vim.fn.expand '%:p') ~= nil then
local function map(...)
vim.api.nvim_buf_set_keymap(0, ...)
end
local opts = { noremap = true, silent = false }

-- Open the link under the caret.
map('n', '<CR>', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)

-- Create a new note after asking for its title.
-- This overrides the global `<leader>zn` mapping to create the note in the same directory as the current buffer.
map('n', '<leader>zn', "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
-- Create a new note in the same directory as the current buffer, using the current selection for title.
map('v', '<leader>znt', ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }<CR>", opts)
-- Create a new note in the same directory as the current buffer, using the current selection for note content and asking for its title.
map('v', '<leader>znc', ":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)

-- Open notes linking to the current buffer.
map('n', '<leader>zb', '<Cmd>ZkBacklinks<CR>', opts)
-- Alternative for backlinks using pure LSP and showing the source context.
--map('n', '<leader>zb', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
-- Open notes linked by the current buffer.
map('n', '<leader>zl', '<Cmd>ZkLinks<CR>', opts)

-- Preview a linked note.
map('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
-- Open the code actions for a visual selection.
map('v', '<leader>za', ":'<,'>lua vim.lsp.buf.range_code_action()<CR>", opts)

-- Insert a link to a note.
map('n', '<leader>zi', '<Cmd>ZkInsertLink<CR>', opts)
-- Insert a link to a note using the current selection for the link text.
map('v', '<leader>zil', ":'<,'>ZkInsertLinkAtSelection<CR>", opts)
end
13 changes: 13 additions & 0 deletions after/ftplugin/rust.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
local bufnr = vim.api.nvim_get_current_buf()
vim.keymap.set('n', '<leader>a', function()
vim.cmd.RustLsp 'codeAction' -- supports rust-analyzer's grouping
-- or vim.lsp.buf.codeAction() if you don't want grouping.
end, { silent = true, buffer = bufnr })
vim.keymap.set(
'n',
'K', -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions
function()
vim.cmd.RustLsp { 'hover', 'actions' }
end,
{ silent = true, buffer = bufnr }
)
88 changes: 84 additions & 4 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' '

-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false
vim.g.have_nerd_font = true

-- [[ Setting options ]]
-- See `:help vim.o`
Expand Down Expand Up @@ -344,6 +344,7 @@ require('lazy').setup({
-- instead of just disabling it here, to keep your config clean.
enabled = true,
event = 'VimEnter',
tag = 'v0.2.0',
dependencies = {
'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
Expand Down Expand Up @@ -641,6 +642,80 @@ require('lazy').setup({
Lua = {},
},
},
bashls = {
-- cmd = {},
filetypes = { 'bash', 'zsh', 'sh' },
-- capabilities = {},
-- settings = {},
},
yamlls = {},
taplo = { -- for TOML
cmd = { 'taplo', 'lsp', 'stdio' },
filetypes = { 'toml' },
capabilities = {},
settings = {},
},
rust_analyzer = {
cmd = {},
filetypes = {},
capabilities = {},
settings = {
['rust-analyzer'] = {
checkOnSave = {
enable = true,
},
diagnostics = {
enable = true,
underline = false,
},
imports = {
granularity = {
group = 'module',
},
prefix = 'self',
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
},
},
hls = {
cmd = { 'haskell-language-server-wrapper', '--lsp' },
filetypes = { 'haskell', 'lhaskell', 'cabal' },
capabilities = {},
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
local util = require 'neovim.util'
on_dir(util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project', '*.cabal', 'package.yaml')(fname))
end,
settings = {
haskell = {
cabalFormattingProvider = 'cabalfmt',
formattingProvider = 'ormolu',
},
},
},
tinymist = {
cmd = { 'tinymist' },
filetypes = { 'typ' },
settings = {
formatterMode = 'typStyle',
exportPdf = 'onType',
semanticTokens = 'disable',
},
},
-- vale_ls = {
-- cmd = { 'vale', 'lsp' },
-- filetypes = { 'markdown', 'mdx' },
-- capabilities = {},
-- settings = {},
Comment on lines +716 to +717
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the rust_analyzer server config, setting cmd = {} and filetypes = {} overrides lspconfig defaults with empty lists, which will prevent the server from starting/attaching. Remove these keys (or set them to the real command/filetypes) so lspconfig can use its defaults.

Suggested change
-- capabilities = {},
-- settings = {},

Copilot uses AI. Check for mistakes.
-- },
}

-- Ensure the servers and tools above are installed
Expand All @@ -652,7 +727,11 @@ require('lazy').setup({
-- You can press `g?` for help in this menu.
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
-- You can add other tools here that you want Mason to install
'stylua', -- Used to format Lua code
'beautysh',
'markdownlint',
'hlint',
'tinymist',
})

require('mason-tool-installer').setup { ensure_installed = ensure_installed }
Expand Down Expand Up @@ -696,6 +775,7 @@ require('lazy').setup({
end,
formatters_by_ft = {
lua = { 'stylua' },
markdown = { 'markdownlint' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
Expand Down Expand Up @@ -874,7 +954,7 @@ require('lazy').setup({
branch = 'main',
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
config = function()
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'd2' }
require('nvim-treesitter').install(parsers)
vim.api.nvim_create_autocmd('FileType', {
callback = function(args)
Expand Down Expand Up @@ -920,7 +1000,7 @@ require('lazy').setup({
-- This is the easiest way to modularize your config.
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!
Expand Down
6 changes: 6 additions & 0 deletions lua/custom/plugins/amp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
return {
'sourcegraph/amp.nvim',
branch = 'main',
lazy = false,
opts = { auto_start = true, log_level = 'info' },
}
7 changes: 7 additions & 0 deletions lua/custom/plugins/better-escape.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- lua with lazy.nvim
return {
'max397574/better-escape.nvim',
config = function()
require('better_escape').setup()
end,
}
5 changes: 5 additions & 0 deletions lua/custom/plugins/bg.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
return {
'typicode/bg.nvim',
lazy = false,
priority = 1000,
}
9 changes: 9 additions & 0 deletions lua/custom/plugins/bufferline.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
return {
'akinsho/bufferline.nvim',
lazy = false,
version = '*',
dependencies = 'nvim-tree/nvim-web-devicons',
config = function()
require('bufferline').setup {}
end,
}
58 changes: 58 additions & 0 deletions lua/custom/plugins/catpuccin.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
return {
'catppuccin/nvim',
name = 'catppuccin',
priority = 1000,
config = function()
require('catppuccin').setup {
flavour = 'auto', -- latte, frappe, macchiato, mocha
background = { -- :h background
light = 'latte',
dark = 'mocha',
},
transparent_background = false, -- disables setting the background color.
show_end_of_buffer = false, -- shows the '~' characters after the end of buffers
term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`)
dim_inactive = {
enabled = false, -- dims the background color of inactive window
shade = 'dark',
percentage = 0.15, -- percentage of the shade to apply to the inactive window
},
no_italic = false, -- Force no italic
no_bold = false, -- Force no bold
no_underline = false, -- Force no underline
styles = { -- Handles the styles of general hi groups (see `:h highlight-args`):
comments = { 'italic' }, -- Change the style of comments
conditionals = { 'italic' },
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
operators = {},
-- miscs = {}, -- Uncomment to turn off hard-coded styles
},
color_overrides = {},
custom_highlights = {},
default_integrations = true,
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
treesitter = true,
notify = false,
mini = {
enabled = true,
indentscope_color = '',
},
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
},
}

-- setup must be called before loading
-- vim.cmd.colorscheme 'catppuccin'
end,
}
7 changes: 7 additions & 0 deletions lua/custom/plugins/ccc.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
return {
'uga-rosa/ccc.nvim',
event = 'VeryLazy',
config = function()
require('ccc').setup {}
end,
}
67 changes: 67 additions & 0 deletions lua/custom/plugins/claudecode.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
return {
'coder/claudecode.nvim',
dependencies = { 'folke/snacks.nvim' },
config = true,
opts = {
-- Server Configuration
port_range = { min = 10000, max = 65535 },
auto_start = true,
log_level = 'info', -- "trace", "debug", "info", "warn", "error"
terminal_cmd = nil, -- Custom terminal command (default: "claude")
-- For local installations: "~/.claude/local/claude"
-- For native binary: use output from 'which claude'

-- Send/Focus Behavior
-- When true, successful sends will focus the Claude terminal if already connected
focus_after_send = false,

-- Selection Tracking
track_selection = true,
visual_demotion_delay_ms = 50,

-- Terminal Configuration
terminal = {
split_side = 'right', -- "left" or "right"
split_width_percentage = 0.30,
provider = 'auto', -- "auto", "snacks", "native", "external", "none", or custom provider table
auto_close = true,
snacks_win_opts = {}, -- Opts to pass to `Snacks.terminal.open()` - see Floating Window section below

-- Provider-specific options
provider_opts = {
-- Command for external terminal provider. Can be:
-- 1. String with %s placeholder: "alacritty -e %s" (backward compatible)
-- 2. String with two %s placeholders: "alacritty --working-directory %s -e %s" (cwd, command)
-- 3. Function returning command: function(cmd, env) return "alacritty -e " .. cmd end
external_terminal_cmd = nil,
},
},

-- Diff Integration
diff_opts = {
auto_close_on_accept = true,
vertical_split = true,
open_in_current_tab = true,
keep_terminal_focus = false, -- If true, moves focus back to terminal after diff opens
},
},
keys = {
{ '<leader>a', nil, desc = 'AI/Claude Code' },
{ '<leader>ac', '<cmd>ClaudeCode<cr>', desc = 'Toggle Claude' },
{ '<leader>af', '<cmd>ClaudeCodeFocus<cr>', desc = 'Focus Claude' },
{ '<leader>ar', '<cmd>ClaudeCode --resume<cr>', desc = 'Resume Claude' },
{ '<leader>aC', '<cmd>ClaudeCode --continue<cr>', desc = 'Continue Claude' },
{ '<leader>am', '<cmd>ClaudeCodeSelectModel<cr>', desc = 'Select Claude model' },
{ '<leader>ab', '<cmd>ClaudeCodeAdd %<cr>', desc = 'Add current buffer' },
{ '<leader>as', '<cmd>ClaudeCodeSend<cr>', mode = 'v', desc = 'Send to Claude' },
{
'<leader>as',
'<cmd>ClaudeCodeTreeAdd<cr>',
desc = 'Add file',
ft = { 'NvimTree', 'neo-tree', 'oil', 'minifiles', 'netrw' },
},
-- Diff management
{ '<leader>aa', '<cmd>ClaudeCodeDiffAccept<cr>', desc = 'Accept diff' },
{ '<leader>ad', '<cmd>ClaudeCodeDiffDeny<cr>', desc = 'Deny diff' },
},
}
Loading
Loading