Compare commits

...

10 commits

11 changed files with 350 additions and 231 deletions

View file

@ -32,18 +32,17 @@ export GPG_TTY=$(tty)
export VISUAL="$(command -v nvim 2>/dev/null)" export VISUAL="$(command -v nvim 2>/dev/null)"
export EDITOR="$(command -v nvim 2>/dev/null || command -v vim 2>/dev/null || command -v nano)" export EDITOR="$(command -v nvim 2>/dev/null || command -v vim 2>/dev/null || command -v nano)"
[ -x "$(command -v nvim 2> /dev/null)" ] && alias vim='nvim' [ -x "$(command -v nvim 2> /dev/null)" ] && alias vim='nvim'
[ -x "$(command -v neovide 2> /dev/null)" ] && alias nvim='WINIT_X11_SCALE_FACTOR=1.0 neovide' [ -x "$(command -v neovide 2> /dev/null)" ] && alias nvim='neovide'
# ghcup (Haskell) # Haskell
[ -f "$HOME/.ghcup/env" ] && source "$HOME/.ghcup/env" # ghcup-env [ -f "$HOME/.ghcup/env" ] && source "$HOME/.ghcup/env" # ghcup-env
# NodeJS # NodeJS
export npm_config_prefix="$HOME/.local" export npm_config_prefix="$HOME/.local" # This is where global packages are installed
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.local/bin:$PATH"
# Bun # Nix
export BUN_INSTALL="$HOME/.bun" export PATH="$HOME/.nix-profile/bin:$PATH"
export PATH="$BUN_INSTALL/bin:$PATH"
# Julia # Rust
export PATH="$HOME/.juliaup/bin:$PATH" export PATH="$HOME/.cargo/bin/:$PATH"

View file

@ -1,34 +1,36 @@
{ {
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" }, "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
"gitsigns.nvim": { "branch": "main", "commit": "0a2a93f687ec051292943a4d139366332ac93688" }, "gitsigns.nvim": { "branch": "main", "commit": "805610a9393fa231f2c2b49cb521bfa413fadb3d" },
"haskell-tools.nvim": { "branch": "master", "commit": "2faa2c879c82652f1df3974c185901cf93c6367c" }, "haskell-tools.nvim": { "branch": "master", "commit": "35ac2d964b004d0d0e0cc9bab039b70be36ca0f7" },
"kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" }, "kanagawa.nvim": { "branch": "master", "commit": "860e4f80df71221d18bf2cd9ef1deb4d364274d2" },
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, "lazy.nvim": { "branch": "main", "commit": "d3974346b6cef2116c8e7b08423256a834cb7cbc" },
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "b9084b1f42f790d6230dc66dbcb6bcc35b148552" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" },
"mason.nvim": { "branch": "main", "commit": "9c9416817c9f4e6f333c749327a1ed5355cfab61" }, "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "2f2d08894bbc679d4d181604c16bb7079f646384" }, "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
"neodev.nvim": { "branch": "main", "commit": "3408a4daeca5ff8f41cb2c668b6d8fcc665f793a" }, "nvim-cmp": { "branch": "main", "commit": "cd2cf0c124d3de577fb5449746568ee8e601afc8" },
"neogit": { "branch": "master", "commit": "ce0c369ccdba3f644a3b28f4c053421f435352c9" }, "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, "nvim-dap": { "branch": "master", "commit": "615a1b2046e1eaf7995e0ba8e8a65f344201349d" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, "nvim-dap-ui": { "branch": "master", "commit": "5934302d63d1ede12c0b22b6f23518bb183fc972" },
"nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" }, "nvim-lspconfig": { "branch": "master", "commit": "a3d9395455f2b2e3b50a0b0f37b8b4c23683f44a" },
"nvim-dap-ui": { "branch": "master", "commit": "d845ebd798ad1cf30aa4abd4c4eff795cdcfdd4f" }, "nvim-nio": { "branch": "master", "commit": "8765cbc4d0c629c8158a5341e1b4305fd93c3a90" },
"nvim-lspconfig": { "branch": "master", "commit": "8917d2c830e04bf944a699b8c41f097621283828" }, "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" },
"nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" }, "nvim-surround": { "branch": "main", "commit": "6d0dc3dbb557bcc6a024969da461df4ba803fc48" },
"nvim-treesitter": { "branch": "master", "commit": "ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a" }, "nvim-treesitter": { "branch": "master", "commit": "fa1515b015ab9894aa9866410b1c23e03d2be4af" },
"nvim-web-devicons": { "branch": "master", "commit": "b427ac5f9dff494f839e81441fb3f04a58cbcfbc" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "dfa4178c0cadb44f687603d72ad0908474c28dd9" },
"plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" }, "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" },
"plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" },
"rustaceanvim": { "branch": "master", "commit": "bc8c4b8f7606d5b7c067cd8369e25c1a7ff77bd0" }, "rustaceanvim": { "branch": "master", "commit": "bc8c4b8f7606d5b7c067cd8369e25c1a7ff77bd0" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, "telescope.nvim": { "branch": "0.1.x", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
"trouble.nvim": { "branch": "dev", "commit": "b4b9a11b3578d510963f6f681fecb4631ae992c3" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
} }

View file

@ -1,3 +1,4 @@
return { return {
keymap = require 'config.helpers.keymap', keymap = require 'config.helpers.keymap',
visual = require 'config.helpers.visual',
} }

View file

@ -0,0 +1,19 @@
---@class VisualArea
---@field sr number Start row
---@field sc number Start col
---@field er number End row
---@field ec number End col
---Get current visual selection area
---@return VisualArea
return function()
local select = vim.fn.getpos 'v'
local cursor = vim.fn.getpos '.'
local sr, er = select[2], cursor[2]
local sc, ec = select[3], cursor[3]
if sc > ec then sc, ec = ec, sc end
if sr > er then sr, er = er, sr end
return { sr = sr, sc = sc, er = er, ec = ec }
end

View file

@ -1,11 +1,11 @@
local indent = require 'config.keymaps.indent'
local map = require 'config.helpers.keymap' local map = require 'config.helpers.keymap'
local n = map 'n' local n = map 'n'
local v = map 'v'
local t = map 't' local t = map 't'
local nv = map {'n', 'v'} local nv = map {'n', 'v'}
n '<Leader>ex' ':Explore<CR>' 'Netrw: open'
n '<Leader>hl' ':nohl<CR>' 'Hide highlights'
n 'j' 'gj' 'Move: down by line' n 'j' 'gj' 'Move: down by line'
n 'k' 'gk' 'Move: up by line' n 'k' 'gk' 'Move: up by line'
@ -22,26 +22,42 @@ n '<C-k>' '<C-w>k' 'Window: move up'
n '<C-l>' '<C-w>l' 'Window: move right' n '<C-l>' '<C-w>l' 'Window: move right'
-- Diagnostics -- Indentation
v '>' '>gv' 'Indent right'
v '<' '<gv' 'Indent left'
v '|' (indent.normalize) 'Indent normalize'
-- Diagnostics
n '<leader>e' (vim.diagnostic.open_float) 'Open error diagnostics' n '<leader>e' (vim.diagnostic.open_float) 'Open error diagnostics'
n '[d' (vim.diagnostic.goto_prev) 'Previous diagnostic message' n '[d' (vim.diagnostic.goto_prev) 'Previous diagnostic message'
n ']d' (vim.diagnostic.goto_next) 'Next diagnostic message' n ']d' (vim.diagnostic.goto_next) 'Next diagnostic message'
n '<leader>dl' (vim.diagnostic.setloclist) 'Diagnostic: list messages' n '<leader>dl' (vim.diagnostic.setloclist) 'Diagnostic: list messages'
-- X
local function insert_date()
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
local text = os.date '!%Y-%m-%dT%H:%M:%SZ' ---@cast text string
col = math.min(#vim.api.nvim_get_current_line(), col + 1)
vim.api.nvim_buf_set_text(0, row - 1, col, row - 1, col, { text })
end
n '<Leader>xd' (insert_date) 'Execute: full date'
v '<Leader>xs' ':sort<CR>' 'Execute: sort'
-- Meta -- Meta
local function open_config() local function open_config()
vim.fn.chdir '~/.config/nvim' vim.fn.chdir '~/.config/nvim'
vim.cmd [[:Explore]] vim.cmd 'Explore'
end end
n '<leader>mn' (open_config) 'Meta: neovim config' n '<leader>mn' (open_config) 'Meta: neovim config'
n '<leader>ml' ':Lazy<CR>' 'Meta: lazy'
n '<leader>mm' ':Mason<CR>' 'Meta: mason'
-- LSP -- LSP
do do
local group = vim.api.nvim_create_augroup('UserLspConfig', {}) local group = vim.api.nvim_create_augroup('UserLspConfig', {})
@ -53,6 +69,16 @@ do
vim.lsp.buf.format({ async = true }) vim.lsp.buf.format({ async = true })
end end
local function format_selection()
vim.lsp.buf.format({
async = true,
range = {
["start"] = vim.api.nvim_buf_get_mark(0, "<"),
["end"] = vim.api.nvim_buf_get_mark(0, ">"),
}
})
end
local function workspaces_list() local function workspaces_list()
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end end
@ -68,6 +94,7 @@ do
n '<leader>lr' (vim.lsp.buf.rename) {'LSP: rename identifier', buffer} n '<leader>lr' (vim.lsp.buf.rename) {'LSP: rename identifier', buffer}
nv '<leader>la' (vim.lsp.buf.code_action) {'LSP: code actions', buffer} nv '<leader>la' (vim.lsp.buf.code_action) {'LSP: code actions', buffer}
n '<leader>lf' (format) {'LSP: format file', buffer} n '<leader>lf' (format) {'LSP: format file', buffer}
v '<leader>lf' (format_selection) {'LSP: format file', buffer}
n '<leader>wa' (vim.lsp.buf.add_workspace_folder) {'LSP: add workspace folder', buffer} n '<leader>wa' (vim.lsp.buf.add_workspace_folder) {'LSP: add workspace folder', buffer}
n '<leader>wr' (vim.lsp.buf.remove_workspace_folder) {'LSP: remove workspace folder', buffer} n '<leader>wr' (vim.lsp.buf.remove_workspace_folder) {'LSP: remove workspace folder', buffer}
n '<leader>wl' (workspaces_list) {'LSP: list workspace folders', buffer} n '<leader>wl' (workspaces_list) {'LSP: list workspace folders', buffer}

View file

@ -0,0 +1,29 @@
local get_visual = require 'config.helpers.visual'
local M = {}
function M.normalize()
local c = vim.fn.getpos '.'
local s = get_visual()
local max = 0
for line = s.sr, s.er do
local indent = vim.fn.indent(line)
max = indent > max and indent or max
end
for line = s.sr, s.er do
local content = vim.fn.getline(line)
if content:len() > 0 then
local current = vim.fn.indent(line)
if current ~= max then
local new = string.rep(' ', max - current)
vim.fn.setline(line, new .. content)
end
end
end
vim.fn.setpos('.', c)
end
return M

View file

@ -2,6 +2,7 @@ local options = {
scroll_animation_far_lines = 100, scroll_animation_far_lines = 100,
scroll_animation_length = 0.05, scroll_animation_length = 0.05,
cursor_animation_length = 0.05, cursor_animation_length = 0.05,
scale_factor = 0.8,
} }
for key, val in pairs(options) do for key, val in pairs(options) do

View file

@ -1,6 +1,7 @@
local is, when = require 'config.compose' () local is, when = require 'config.compose' ()
local map = require 'config.helpers.keymap' local map = require 'config.helpers.keymap'
local n = map 'n' local n = map 'n'
local nv = map { 'n', 'v' }
---@type LazySpec ---@type LazySpec
@ -24,18 +25,10 @@ return {
dependencies = { dependencies = {
'nvim-tree/nvim-web-devicons', 'nvim-tree/nvim-web-devicons',
}, },
config = function() config = true,
local lualine = require 'lualine'
lualine.setup {
tabline = {
lualine_a = { 'buffers' },
}
}
end
}, },
-- Telescope -- Fuzzy search
{ {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
enabled = is 'standalone', enabled = is 'standalone',
@ -79,8 +72,23 @@ return {
{ {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate', build = ':TSUpdate',
dependencies = {
-- 'nvim-treesitter/nvim-treesitter-textobjects'
},
config = function() config = function()
local configs = require 'nvim-treesitter.configs' local configs = require 'nvim-treesitter.configs'
local parsers = require('nvim-treesitter.parsers').get_parser_configs()
-- parsers['rescript'] = {
-- install_info = {
-- url = 'https://github.com/rescript-lang/tree-sitter-rescript',
-- branch = 'main',
-- files = { 'src/parser.c', 'src/scanner.c' },
-- generate_requires_npm = false,
-- requires_generate_from_grammar = true,
-- use_makefile = true,
-- },
-- }
configs.setup { configs.setup {
modules = {}, modules = {},
@ -89,7 +97,7 @@ return {
ignore_install = {}, ignore_install = {},
ensure_installed = { ensure_installed = {
-- neovim -- neovim
'vimdoc', 'lua', 'query', 'luadoc', 'vimdoc', 'lua', 'query',
-- data -- data
'json', 'xml', 'yaml', 'toml', 'json', 'xml', 'yaml', 'toml',
-- markdown -- markdown
@ -104,8 +112,8 @@ return {
'bash', 'bash',
-- python -- python
'python', 'python',
-- rust -- systems
'rust', 'rust', 'c',
-- webdev -- webdev
'html', 'css', 'scss', 'javascript', 'jsdoc', 'typescript', 'tsx', 'astro', 'svelte', 'html', 'css', 'scss', 'javascript', 'jsdoc', 'typescript', 'tsx', 'astro', 'svelte',
-- haskell -- haskell
@ -116,12 +124,30 @@ return {
incremental_selection = { incremental_selection = {
enable = true, enable = true,
keymaps = { keymaps = {
init_selection = '<CR>', node_incremental = 'v',
scope_incremental = '<CR>', node_decremental = 'V',
node_incremental = '<TAB>',
node_decremental = '<S-TAB>',
}, },
}, },
textobjects = {
select = {
enable = true,
keymaps = {
['af'] = '@function.outer',
['if'] = '@function.inner',
['a?'] = '@conditional.outer',
['i?'] = '@conditional.inner',
}
},
move = {
enable = true,
goto_next_start = {
[']f'] = '@function.outer',
},
goto_previous_start = {
['[f'] = '@function.outer',
}
}
}
} }
end, end,
init = function() init = function()
@ -132,6 +158,50 @@ return {
end, end,
}, },
-- Keymap hints
{
'folke/which-key.nvim',
enabled = is 'standalone',
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
end,
config = true
},
-- Notifications
{
'rcarriga/nvim-notify',
enabled = is 'standalone',
config = function()
vim.notify = require 'notify'
end
},
-- Project errors
{
"folke/trouble.nvim",
branch = "dev",
config = function ()
local trouble = require 'trouble'
n '<leader>tt' '<cmd>Trouble diagnostics toggle<cr>' 'Trouble: Diagnostics'
n '<leader>tT' '<cmd>Trouble diagnostics toggle filter.buf=0<cr>' 'Trouble: Diagnostics (buffer)'
n '<leader>ts' '<cmd>Trouble symbols toggle focus=false<cr>' 'Trouble: Symbols'
-- n '<leader>cl' '<cmd>Trouble lsp toggle focus=false win.position=right<cr>' 'LSP Definitions / references / ... (Trouble)'
-- n '<leader>xL' '<cmd>Trouble loclist toggle<cr>' 'Location List (Trouble)'
-- n '<leader>xQ' '<cmd>Trouble qflist toggle<cr>' 'Quickfix List (Trouble)'
trouble.setup {}
end,
},
-- Comments
{
'numToStr/Comment.nvim',
config = true,
},
-- Git - file hunks -- Git - file hunks
{ {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
@ -162,74 +232,44 @@ return {
'nvim-tree/nvim-web-devicons', 'nvim-tree/nvim-web-devicons',
}, },
config = function() config = function()
n '<Leader>gd' ':DiffviewOpen<CR>' 'Git: Diff' local lib = require 'diffview.lib'
n '<Leader>gc' ':DiffviewClose<CR>' 'Git: Close'
n '<Leader>gh' ':DiffviewFileHistory<CR>' 'Git: History' local function toggle(name)
return function()
if not next(lib.views) then
vim.cmd(name)
else
vim.cmd 'DiffviewClose'
end
end
end
n '<Leader>gd' (toggle 'DiffviewOpen') 'Git: Diff'
n '<Leader>gh' (toggle 'DiffviewFileHistory') 'Git: History'
end end
}, },
-- Git: ops -- Color hints
{ {
'NeogitOrg/neogit', 'NvChad/nvim-colorizer.lua',
enabled = is 'standalone', ft = { 'css', 'scss' },
dependencies = {
'nvim-lua/plenary.nvim',
'sindrets/diffview.nvim',
'nvim-telescope/telescope.nvim'
},
config = function()
local neogit = require 'neogit'
neogit.setup {
graph_style = 'unicode',
integrations = {
telescope = true,
diffview = true,
}
}
n '<Leader>gn' (neogit.open) 'Git: Neogit'
end
},
-- Comments
{
'numToStr/Comment.nvim',
config = true, config = true,
}, },
-- Shortcut hints -- {
{ -- dir = '~/Desktop/disasm.nvim',
'folke/which-key.nvim', -- ft = { 'c' },
enabled = is 'standalone', -- config = function()
event = 'VeryLazy', -- local disasm = require 'disasm'
init = function() --
vim.o.timeout = true -- n '<Leader>a' (disasm.disassemble) 'Disasm: Disassemble'
vim.o.timeoutlen = 300 -- n '<Leader>Af' (disasm.disassemble_full) 'Disasm: Disassemble full'
end, -- n '<Leader>Ac' (disasm.reconfigure) 'Disasm: Configure'
opts = {} -- n '<Leader>AC' (disasm.save_config) 'Disasm: Save config'
}, --
-- disasm.setup()
-- Notifications -- end
{ -- },
'rcarriga/nvim-notify',
enabled = is 'standalone',
config = function()
vim.notify = require 'notify'
end
},
-- File tree
{
'nvim-neo-tree/neo-tree.nvim',
enabled = is 'standalone',
branch = 'v3.x',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons',
'MunifTanjim/nui.nvim',
},
},
-- Snippet engine -- Snippet engine
{ {
@ -260,23 +300,40 @@ return {
{ {
'mfussenegger/nvim-dap', 'mfussenegger/nvim-dap',
enabled = is { 'standalone', 'linux' }, enabled = is { 'standalone', 'linux' },
dependencies = {
'nvim-neotest/nvim-nio',
'rcarriga/nvim-dap-ui',
},
config = function() config = function()
local dap = require 'dap' local dap = require 'dap'
local ui = require 'dapui'
n '<leader>b' (dap.toggle_breakpoint) 'DAP: Toggle breakpoint' n '<F5>' (dap.continue) 'Debugger: continue'
n '<F10>' (dap.step_over) 'Debugger: step over'
n '<F11>' (dap.step_into) 'Debugger: step into'
n '<F12>' (dap.step_out) 'Debugger: step out'
n '<leader>db' (dap.toggle_breakpoint) 'Debugger: toggle breakpoint'
n '<leader>du' (ui.toggle) 'Debugger: toggle UI'
nv '<leader>de' (ui.eval) 'Debugger: eval'
-- vim.api.nvim_set_hl(0, 'DapBreakpoint', { ctermbg = 0, fg = '#993939', bg = '#31353f' })
-- vim.api.nvim_set_hl(0, 'DapLogPoint', { ctermbg = 0, fg = '#61afef', bg = '#31353f' })
-- vim.api.nvim_set_hl(0, 'DapStopped', { ctermbg = 0, fg = '#98c379', bg = '#31353f' })
--
-- vim.fn.sign_define('DapBreakpoint', { text='', texthl='DapBreakpoint', linehl='DapBreakpoint', numhl='DapBreakpoint' })
-- vim.fn.sign_define('DapBreakpointCondition', { text='ﳁ', texthl='DapBreakpoint', linehl='DapBreakpoint', numhl='DapBreakpoint' })
-- vim.fn.sign_define('DapBreakpointRejected', { text='', texthl='DapBreakpoint', linehl='DapBreakpoint', numhl= 'DapBreakpoint' })
-- vim.fn.sign_define('DapLogPoint', { text='', texthl='DapLogPoint', linehl='DapLogPoint', numhl= 'DapLogPoint' })
-- vim.fn.sign_define('DapStopped', { text='', texthl='DapStopped', linehl='DapStopped', numhl= 'DapStopped' })
ui.setup()
dap.listeners.after.event_initialized["dapui_config"] = ui.open
dap.listeners.after.event_terminated["dapui_config"] = ui.close
dap.listeners.before.event_exited["dapui_config"] = ui.close
end, end,
}, },
-- Debugger UI
{
'rcarriga/nvim-dap-ui',
enabled = is { 'standalone', 'linux' },
dependencies = {
'mfussenegger/nvim-dap',
},
config = require 'config.plugins.nvim-dap-ui'
},
-- Mason -- Mason
{ {
'williamboman/mason.nvim', 'williamboman/mason.nvim',
@ -301,22 +358,22 @@ return {
config.setup { config.setup {
automatic_installation = true, automatic_installation = true,
-- NOTE -- NOTE: Haskell is managed via GHCup
-- Haskell: Managed by GHCup
ensure_installed = { ensure_installed = {
'lua_ls', -- Lua 'lua_ls', -- Lua
'rust_analyzer', -- Rust 'rust_analyzer', -- Rust
'bashls', -- Bash -- 'clangd', -- C
-- 'bashls', -- Bash
'html', -- HTML 'html', -- HTML
'cssls', -- CSS / SCSS 'cssls', -- CSS / SCSS
'tsserver', -- TypeScript 'tsserver', -- TypeScript
'astro', -- Astro -- 'astro', -- Astro
'svelte', -- Svelte -- 'svelte', -- Svelte
'pyright', -- Python -- 'pyright', -- Python
'rnix', -- Nix -- 'rnix', -- Nix
'purescriptls', -- Purescript -- 'purescriptls', -- Purescript
'ltex', -- Literate - LaTeX, Markdown, etc. 'ltex', -- Literate - LaTeX, Markdown, etc.
'julials', -- Julia 'rescriptls', -- ReScript
}, },
} }
@ -329,6 +386,18 @@ return {
end, end,
['rust_analyzer'] = noop, ['rust_analyzer'] = noop,
} }
local signs = {
Error = "",
Warn = "",
Hint = "",
Info = "󰙎",
}
for sign, text in pairs(signs) do
local name = 'DiagnosticSign' .. sign
vim.fn.sign_define(name, { text = text, texthl = name })
end
end, end,
}, },
@ -347,6 +416,7 @@ return {
automatic_installation = true, automatic_installation = true,
ensure_installed = { ensure_installed = {
'codelldb', 'codelldb',
--'js-debug-adapter',
}, },
} }
end, end,
@ -397,4 +467,50 @@ return {
init = require 'config.plugins.haskell-tools' init = require 'config.plugins.haskell-tools'
}, },
-- JS debugger
-- {
-- 'mxsdev/nvim-dap-vscode-js',
-- dependencies = {
-- 'microsoft/vscode-js-debug',
-- version = '1.x',
-- build = 'npm i && npm run compile vsDebugServerBundle && mv dist out',
-- },
-- config = function()
-- local dap = require 'dap'
-- --local utils = require 'dap.utils'
-- local dap_js = require 'dap-vscode-js'
-- --local mason = require 'mason-registry'
--
-- ---@diagnostic disable-next-line: missing-fields
-- dap_js.setup {
-- -- debugger_path = mason.get_package('js-debug-adapter'):get_install_path(),
-- debugger_path = vim.fn.stdpath 'data' .. '/lazy/vscode-js-debug',
-- adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' },
-- }
--
-- local langs = { 'javascript', 'typescript', 'svelte', 'astro' }
-- for _, lang in ipairs(langs) do
-- dap.configurations[lang] = {
-- {
-- type = 'pwa-node',
-- request = 'attach',
-- name = 'Attach debugger to existing `node --inspect` process',
-- cwd = '${workspaceFolder}',
-- skipFiles = {
-- '${workspaceFolder}/node_modules/**/*.js',
-- '${workspaceFolder}/packages/**/node_modules/**/*.js',
-- '${workspaceFolder}/packages/**/**/node_modules/**/*.js',
-- '<node_internals>/**',
-- 'node_modules/**',
-- },
-- sourceMaps = true,
-- resolveSourceMapLocations = {
-- '${workspaceFolder}/**',
-- '!**/node_modules/**',
-- },
-- },
-- }
-- end
-- end,
-- },
} }

View file

@ -23,10 +23,11 @@ local function on_attach(_, buffer, ht)
-- ht.dap.discover_configurations(bufnr) -- ht.dap.discover_configurations(bufnr)
end end
---@type HTConfig
return function() local config = {
vim.g.haskell_tools = {
---@type HaskellLspClientOpts`
hls = { on_attach = on_attach } hls = { on_attach = on_attach }
} }
return function()
vim.g.haskell_tools = config
end end

View file

@ -1,87 +0,0 @@
return function()
local dap = require "dap"
local dapui = require "dapui"
dapui.setup({
icons = { expanded = "", collapsed = "", current_frame = "" },
mappings = {
-- Use a table to apply multiple mappings
expand = { "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
edit = "e",
repl = "r",
toggle = "t",
},
-- Expand lines larger than the window
-- Requires >= 0.7
expand_lines = vim.fn.has("nvim-0.7") == 1,
-- Layouts define sections of the screen to place windows.
-- The position can be "left", "right", "top" or "bottom".
-- The size specifies the height/width depending on position. It can be an Int
-- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while
-- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns)
-- Elements are the elements shown in the layout (in order).
-- Layouts are opened in order so that earlier layouts take priority in window sizing.
layouts = {
{
elements = {
-- Elements can be strings or table with id and size keys.
"breakpoints",
"stacks",
"watches",
{ id = "scopes", size = 0.25 },
},
size = 40, -- 40 columns
position = "left",
},
{
elements = {
"repl",
"console",
},
size = 0.25, -- 25% of total lines
position = "bottom",
},
},
controls = {
-- Requires Neovim nightly (or 0.8 when released)
enabled = true,
-- Display controls in this element
element = "repl",
icons = {
pause = "",
play = "",
step_into = "",
step_over = "",
step_out = "",
step_back = "",
run_last = "",
terminate = "",
},
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = "single", -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
max_value_lines = 100, -- Can be integer or nil.
},
})
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
-- dap.listeners.before.event_terminated["dapui_config"] = function()
-- dapui.close()
-- end
-- dap.listeners.before.event_exited["dapui_config"] = function()
-- dapui.close()
-- end
end

View file

@ -19,6 +19,17 @@ vim.g.rustaceanvim = function()
n '<Leader>a' (tools.code_action_group.code_action_group) {buffer=bufnr} n '<Leader>a' (tools.code_action_group.code_action_group) {buffer=bufnr}
end, end,
}, },
default_settings = {
['rust-analyzer'] = {
-- checkOnSave = {
-- allFeatures = true,
-- overrideCommand = {
-- 'cargo', 'clippy', '--workspace', '--message-format=json',
-- '--all-targets', '--all-features'
-- }
-- },
},
},
dap = { dap = {
adapter = config.get_codelldb_adapter(lsp_path, lib_path), adapter = config.get_codelldb_adapter(lsp_path, lib_path),
}, },