nvim: use tabs
This commit is contained in:
parent
836cd21dbb
commit
57bea4647b
|
@ -1,5 +1,5 @@
|
|||
local ok, err = pcall(require, 'main')
|
||||
|
||||
if not ok then
|
||||
print('Error: ' .. err)
|
||||
print('Error: ' .. err)
|
||||
end
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "3afa6a053f680e9f1329c4a151db988a482306cd" },
|
||||
"dropbar.nvim": { "branch": "master", "commit": "2b546383bdf4daa254ac70c760ee1e5524bc60b1" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "4a143f13e122ab91abdc88f89eefbe70a4858a56" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"dropbar.nvim": { "branch": "master", "commit": "fd917b70535371d45285bc94f9eb6387677c6dce" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "47c8e3e571376b24de62408fd0c9d12f0a9fc0a3" },
|
||||
"haskell-tools.nvim": { "branch": "master", "commit": "65d6993eba1a56bbd5211ef13a100d26ce3e644a" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "08ed29989834f5f2606cb1ef9d5b24c5ea7b8fa5" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "fe5b2c9e2549862c3dc3f3c8e9cf7ddece0f40c2" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "eb4957442e3182f051b0ae11da32e06d22c190e3" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "7cbb524c85f87017df9c1ea2377a1d840ad8ed51" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||
|
@ -18,14 +18,14 @@
|
|||
"nvim-lspconfig": { "branch": "master", "commit": "4d38bece98300e3e5cd24a9aa0d0ebfea4951c16" },
|
||||
"nvim-nio": { "branch": "master", "commit": "7969e0a8ffabdf210edd7978ec954a47a737bbcc" },
|
||||
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "9a7ad2ff7a7ea81016aca2fc89c9b2c1a5365421" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "9636d5a3f4f531256fba147a30b882c44f28fae1" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
|
||||
"precognition.nvim": { "branch": "main", "commit": "5255b72c52b1159e9757f50389bde65e05e3bfb1" },
|
||||
"precognition.nvim": { "branch": "main", "commit": "9e6087fcd27dd5d2fc71b9d9471a101666c39f73" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "bc8c4b8f7606d5b7c067cd8369e25c1a7ff77bd0" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "5e45bb78f8da3444d35616934c180fce3742c439" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "e0b35a273df58b03612255783cf475a782ede7e0" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "0099511294f16b81c696004fa6a403b0ae61f7a0" }
|
||||
}
|
|
@ -3,43 +3,43 @@ local group = vim.api.nvim_create_augroup('UserGroup', {})
|
|||
|
||||
-- Remove trailing whitespace on write
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
group = group,
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
if vim.bo.filetype == 'markdown' then return end
|
||||
vim.cmd [[%s/\s\+$//e]]
|
||||
end
|
||||
group = group,
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
if vim.bo.filetype == 'markdown' then return end
|
||||
vim.cmd [[%s/\s\+$//e]]
|
||||
end
|
||||
})
|
||||
|
||||
-- Highlight yank
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
group = group,
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.highlight.on_yank { timeout = 250 }
|
||||
end
|
||||
group = group,
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.highlight.on_yank { timeout = 250 }
|
||||
end
|
||||
})
|
||||
|
||||
-- Restore cursor position
|
||||
vim.api.nvim_create_autocmd('BufReadPost', {
|
||||
group = group,
|
||||
callback = function(args)
|
||||
if
|
||||
vim.fn.line [['"]] >= 1 and
|
||||
vim.fn.line [['"]] < vim.fn.line '$' and
|
||||
vim.b[args.buf].filetype ~= 'commit'
|
||||
then
|
||||
vim.cmd [[normal! g`"]]
|
||||
end
|
||||
end
|
||||
group = group,
|
||||
callback = function(args)
|
||||
if
|
||||
vim.fn.line [['"]] >= 1 and
|
||||
vim.fn.line [['"]] < vim.fn.line '$' and
|
||||
vim.b[args.buf].filetype ~= 'commit'
|
||||
then
|
||||
vim.cmd [[normal! g`"]]
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Set indentation for Rust
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'rust',
|
||||
callback = function()
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.listchars:append { leadmultispace = '│ ' }
|
||||
end
|
||||
pattern = 'rust',
|
||||
callback = function()
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.listchars:append { leadmultispace = '│ ' }
|
||||
end
|
||||
})
|
||||
|
|
|
@ -5,37 +5,37 @@
|
|||
|
||||
---@type table<ComposerTag, boolean>
|
||||
local env = {
|
||||
standalone = not vim.g.vscode,
|
||||
linux = jit.os == 'Linux',
|
||||
standalone = not vim.g.vscode,
|
||||
linux = jit.os == 'Linux',
|
||||
}
|
||||
|
||||
---@param tags ComposerTag | ComposerTag[]
|
||||
---@return boolean
|
||||
local function is(tags)
|
||||
if type(tags) == 'string' then
|
||||
return env[tags] or false
|
||||
end
|
||||
if type(tags) == 'string' then
|
||||
return env[tags] or false
|
||||
end
|
||||
|
||||
for _, tag in ipairs(tags) do
|
||||
if not env[tag] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
for _, tag in ipairs(tags) do
|
||||
if not env[tag] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
return true
|
||||
end
|
||||
|
||||
---@param tags ComposerTag | ComposerTag[]
|
||||
local function when(tags)
|
||||
local match = is(tags)
|
||||
---@generic T
|
||||
---@param value `T`
|
||||
---@return T | nil
|
||||
return function(value)
|
||||
return match and value or nil
|
||||
end
|
||||
local match = is(tags)
|
||||
---@generic T
|
||||
---@param value `T`
|
||||
---@return T | nil
|
||||
return function(value)
|
||||
return match and value or nil
|
||||
end
|
||||
end
|
||||
|
||||
return function()
|
||||
return is, when
|
||||
return is, when
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
return {
|
||||
keymap = require 'config.helpers.keymap',
|
||||
visual = require 'config.helpers.visual',
|
||||
keymap = require 'config.helpers.keymap',
|
||||
visual = require 'config.helpers.visual',
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
local defaults = { noremap = true, silent = true }
|
||||
|
||||
|
||||
---@class KeymapOpts
|
||||
---@field [1]? string Shorthand description
|
||||
---@field desc? string Description
|
||||
|
@ -9,27 +10,27 @@ local defaults = { noremap = true, silent = true }
|
|||
---Wrapper around `vim.keymap.set`
|
||||
---@param modes string|string[]
|
||||
return function(modes)
|
||||
---@param lhs string
|
||||
return function(lhs)
|
||||
---@param rhs string|function
|
||||
return function(rhs)
|
||||
---@param opts string|KeymapOpts
|
||||
return function(opts)
|
||||
local kind = type(opts) ---@cast kind 'string'|'table'
|
||||
---@type table
|
||||
local options
|
||||
---@param lhs string
|
||||
return function(lhs)
|
||||
---@param rhs string|function
|
||||
return function(rhs)
|
||||
---@param opts string|KeymapOpts
|
||||
return function(opts)
|
||||
local kind = type(opts) ---@cast kind 'string'|'table'
|
||||
---@type table
|
||||
local options
|
||||
|
||||
if kind == 'string' then
|
||||
options = vim.tbl_extend('force', defaults, {desc=opts})
|
||||
else
|
||||
opts.desc = opts[1] or opts.desc
|
||||
opts.buffer = opts[2] or opts.buffer
|
||||
opts[1], opts[2] = nil, nil
|
||||
options = vim.tbl_extend('force', defaults, opts)
|
||||
end
|
||||
if kind == 'string' then
|
||||
options = vim.tbl_extend('force', defaults, { desc = opts })
|
||||
else
|
||||
opts.desc = opts[1] or opts.desc
|
||||
opts.buffer = opts[2] or opts.buffer
|
||||
opts[1], opts[2] = nil, nil
|
||||
options = vim.tbl_extend('force', defaults, opts)
|
||||
end
|
||||
|
||||
vim.keymap.set(modes, lhs, rhs, options)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.keymap.set(modes, lhs, rhs, options)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
---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]
|
||||
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
|
||||
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 }
|
||||
return { sr = sr, sc = sc, er = er, ec = ec }
|
||||
end
|
||||
|
|
|
@ -7,25 +7,25 @@ local nv = map {'n', 'v'}
|
|||
|
||||
|
||||
|
||||
n 'j' 'gj' 'Move: down by line'
|
||||
n 'k' 'gk' 'Move: up by line'
|
||||
n 'j' 'gj' 'Move: down by line'
|
||||
n 'k' 'gk' 'Move: up by line'
|
||||
|
||||
n '<Leader>bn' ':bn<CR>' 'Buffer: next'
|
||||
n '<Leader>bp' ':bp<CR>' 'Buffer: previous'
|
||||
n '<Leader>bd' ':bd<CR>' 'Buffer: delete'
|
||||
n '<Leader>bn' ':bn<CR>' 'Buffer: next'
|
||||
n '<Leader>bp' ':bp<CR>' 'Buffer: previous'
|
||||
n '<Leader>bd' ':bd<CR>' 'Buffer: delete'
|
||||
|
||||
t '<Esc><Esc>' [[<C-\><C-n>]] 'Exit from terminal mode'
|
||||
t '<Esc><Esc>' [[<C-\><C-n>]] 'Exit from terminal mode'
|
||||
|
||||
n '<C-h>' '<C-w>h' 'Window: move left'
|
||||
n '<C-j>' '<C-w>j' 'Window: move down'
|
||||
n '<C-k>' '<C-w>k' 'Window: move up'
|
||||
n '<C-l>' '<C-w>l' 'Window: move right'
|
||||
n '<C-h>' '<C-w>h' 'Window: move left'
|
||||
n '<C-j>' '<C-w>j' 'Window: move down'
|
||||
n '<C-k>' '<C-w>k' 'Window: move up'
|
||||
n '<C-l>' '<C-w>l' 'Window: move right'
|
||||
|
||||
|
||||
-- Indentation
|
||||
v '>' '>gv' 'Indent right'
|
||||
v '<' '<gv' 'Indent left'
|
||||
v '|' (indent.normalize) 'Indent normalize'
|
||||
v '>' '>gv' 'Indent right'
|
||||
v '<' '<gv' 'Indent left'
|
||||
v '|' (indent.normalize) 'Indent normalize'
|
||||
|
||||
|
||||
-- Diagnostics
|
||||
|
@ -36,20 +36,20 @@ 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 })
|
||||
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'
|
||||
v '<Leader>xs' ':sort<CR>' 'Execute: sort'
|
||||
|
||||
|
||||
-- Meta
|
||||
local function open_config()
|
||||
vim.fn.chdir '~/.config/nvim'
|
||||
vim.cmd 'Explore'
|
||||
vim.fn.chdir '~/.config/nvim'
|
||||
vim.cmd 'Explore'
|
||||
end
|
||||
|
||||
n '<leader>mn' (open_config) 'Meta: neovim config'
|
||||
|
@ -59,49 +59,49 @@ n '<leader>mm' ':Mason<CR>' 'Meta: mason'
|
|||
|
||||
-- LSP
|
||||
do
|
||||
local group = vim.api.nvim_create_augroup('UserLspConfig', {})
|
||||
local group = vim.api.nvim_create_augroup('UserLspConfig', {})
|
||||
|
||||
local function setup_lsp_keymaps(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
local function setup_lsp_keymaps(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
local function format()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end
|
||||
local function format()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
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 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()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end
|
||||
local function workspaces_list()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end
|
||||
|
||||
local buffer = ev.buf
|
||||
n 'K' (vim.lsp.buf.hover) {'LSP: show hover help', buffer}
|
||||
n '<C-k>' (vim.lsp.buf.signature_help) {'LSP: signature help', buffer}
|
||||
n '<Leader>ld' (vim.lsp.buf.definition) {'LSP: definition', buffer}
|
||||
n '<Leader>lD' (vim.lsp.buf.declaration) {'LSP: declaration', buffer}
|
||||
n '<Leader>li' (vim.lsp.buf.implementation) {'LSP: implementation', buffer}
|
||||
n '<Leader>lR' (vim.lsp.buf.references) {'LSP: references', buffer}
|
||||
n '<Leader>lt' (vim.lsp.buf.type_definition) {'LSP: type definition', buffer}
|
||||
n '<leader>lr' (vim.lsp.buf.rename) {'LSP: rename identifier', buffer}
|
||||
nv '<leader>la' (vim.lsp.buf.code_action) {'LSP: code actions', 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>wr' (vim.lsp.buf.remove_workspace_folder) {'LSP: remove workspace folder', buffer}
|
||||
n '<leader>wl' (workspaces_list) {'LSP: list workspace folders', buffer}
|
||||
end
|
||||
local buffer = ev.buf
|
||||
n 'K' (vim.lsp.buf.hover) {'LSP: show hover help', buffer}
|
||||
n '<C-k>' (vim.lsp.buf.signature_help) {'LSP: signature help', buffer}
|
||||
n '<Leader>ld' (vim.lsp.buf.definition) {'LSP: definition', buffer}
|
||||
n '<Leader>lD' (vim.lsp.buf.declaration) {'LSP: declaration', buffer}
|
||||
n '<Leader>li' (vim.lsp.buf.implementation) {'LSP: implementation', buffer}
|
||||
n '<Leader>lR' (vim.lsp.buf.references) {'LSP: references', buffer}
|
||||
n '<Leader>lt' (vim.lsp.buf.type_definition) {'LSP: type definition', buffer}
|
||||
n '<leader>lr' (vim.lsp.buf.rename) {'LSP: rename identifier', buffer}
|
||||
nv '<leader>la' (vim.lsp.buf.code_action) {'LSP: code actions', 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>wr' (vim.lsp.buf.remove_workspace_folder) {'LSP: remove workspace folder', buffer}
|
||||
n '<leader>wl' (workspaces_list) {'LSP: list workspace folders', buffer}
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = group,
|
||||
callback = setup_lsp_keymaps
|
||||
})
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = group,
|
||||
callback = setup_lsp_keymaps
|
||||
})
|
||||
end
|
||||
|
|
|
@ -3,27 +3,27 @@ local M = {}
|
|||
|
||||
|
||||
function M.normalize()
|
||||
local c = vim.fn.getpos '.'
|
||||
local s = get_visual()
|
||||
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
|
||||
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
|
||||
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)
|
||||
vim.fn.setpos('.', c)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -4,14 +4,14 @@ local path = data .. '/lazy/lazy.nvim'
|
|||
|
||||
-- Bootstrap
|
||||
if not vim.uv.fs_stat(path) then
|
||||
vim.fn.system {
|
||||
'git',
|
||||
'clone',
|
||||
'--filter=blob:none',
|
||||
'https://github.com/folke/lazy.nvim.git',
|
||||
'--branch=stable',
|
||||
path,
|
||||
}
|
||||
vim.fn.system {
|
||||
'git',
|
||||
'clone',
|
||||
'--filter=blob:none',
|
||||
'https://github.com/folke/lazy.nvim.git',
|
||||
'--branch=stable',
|
||||
path,
|
||||
}
|
||||
end
|
||||
vim.opt.rtp:prepend(path)
|
||||
|
||||
|
|
|
@ -1,42 +1,47 @@
|
|||
local g, opt = vim.g, vim.opt
|
||||
|
||||
|
||||
g.mapleader = [[ ]] -- use space for leader
|
||||
g.maplocalleader = [[\]] -- use backslash for local leader
|
||||
|
||||
-- Providers
|
||||
g.loaded_python3_provider = 0
|
||||
g.loaded_ruby_provider = 0
|
||||
g.loaded_perl_provider = 0
|
||||
g.loaded_node_provider = 0
|
||||
g.loaded_ruby_provider = 0
|
||||
g.loaded_perl_provider = 0
|
||||
g.loaded_node_provider = 0
|
||||
|
||||
-- General
|
||||
opt.clipboard = 'unnamedplus' -- Use system clipboard
|
||||
opt.swapfile = false -- Don't use swapfiles
|
||||
opt.completeopt = 'menuone,noinsert,noselect' -- Completion behavior
|
||||
opt.termguicolors = true
|
||||
opt.clipboard = 'unnamedplus' -- Use system clipboard
|
||||
opt.swapfile = false -- Don't use swapfiles
|
||||
opt.completeopt = 'menuone,noinsert,noselect' -- Completion behavior
|
||||
opt.termguicolors = true
|
||||
|
||||
-- Indentation
|
||||
opt.tabstop = 2 -- 1 tab = 2 spaces
|
||||
opt.shiftwidth = 2 -- Shift 2 spaces when tab
|
||||
opt.smartindent = true -- Autoindent new lines
|
||||
opt.expandtab = true -- Use spaces instead of tabs
|
||||
opt.shiftwidth = 2 -- shift 2 spaces when tab
|
||||
opt.smartindent = true -- autoindent new lines
|
||||
opt.expandtab = false -- use spaces instead of tabs
|
||||
opt.tabstop = 2 -- 1 tab = 2 spaces
|
||||
|
||||
-- UI
|
||||
opt.number = true -- Show current line number
|
||||
opt.relativenumber = true -- Show relative line numbers
|
||||
opt.colorcolumn = '80' -- Show soft char limit
|
||||
opt.list = true -- Show punctuation
|
||||
opt.listchars = { -- Punctuation marks
|
||||
trail = '·',
|
||||
nbsp = '␣',
|
||||
tab = '⇥ ',
|
||||
leadmultispace = '│ ',
|
||||
opt.number = true -- Show current line number
|
||||
opt.relativenumber = true -- Show relative line numbers
|
||||
opt.colorcolumn = '80' -- Show soft char limit
|
||||
opt.list = true -- Show punctuation
|
||||
opt.listchars = { -- Punctuation marks
|
||||
trail = '·',
|
||||
nbsp = '␣',
|
||||
tab = '│ ',
|
||||
leadmultispace = '│·',
|
||||
extends = '▶',
|
||||
precedes = '◀',
|
||||
}
|
||||
|
||||
-- Additional filetypes
|
||||
vim.filetype.add {
|
||||
extension = {
|
||||
mdx = 'mdx',
|
||||
typ = 'typst',
|
||||
purs = 'purescript',
|
||||
nu = 'nu',
|
||||
}
|
||||
extension = {
|
||||
mdx = 'mdx',
|
||||
typ = 'typst',
|
||||
purs = 'purescript',
|
||||
nu = 'nu',
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,374 +6,374 @@ local nv = map { 'n', 'v' }
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
|
||||
-- Theme
|
||||
{
|
||||
'rebelot/kanagawa.nvim',
|
||||
lazy = false,
|
||||
priority = math.huge,
|
||||
config = function()
|
||||
vim.cmd 'colorscheme kanagawa'
|
||||
end,
|
||||
},
|
||||
-- Theme
|
||||
{
|
||||
'rebelot/kanagawa.nvim',
|
||||
lazy = false,
|
||||
priority = math.huge,
|
||||
config = function()
|
||||
vim.cmd 'colorscheme kanagawa'
|
||||
end,
|
||||
},
|
||||
|
||||
-- Status line
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
-- Status line
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
|
||||
-- Fuzzy search
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
branch = '0.1.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
|
||||
},
|
||||
config = function()
|
||||
local telescope = require 'telescope'
|
||||
local builtin = require 'telescope.builtin'
|
||||
local ext = telescope.extensions
|
||||
-- Fuzzy search
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
branch = '0.1.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
|
||||
},
|
||||
config = function()
|
||||
local telescope = require 'telescope'
|
||||
local builtin = require 'telescope.builtin'
|
||||
local ext = telescope.extensions
|
||||
|
||||
telescope.load_extension 'fzf'
|
||||
telescope.load_extension 'notify'
|
||||
telescope.load_extension 'fzf'
|
||||
telescope.load_extension 'notify'
|
||||
|
||||
telescope.setup {
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = 'smart_case',
|
||||
}
|
||||
}
|
||||
}
|
||||
telescope.setup {
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = 'smart_case',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
n '<leader>ff' (builtin.find_files) 'Telescope: files'
|
||||
n '<leader>fb' (builtin.buffers) 'Telescope: buffers'
|
||||
n '<leader>fg' (builtin.live_grep) 'Telescope: grep'
|
||||
n '<leader>fh' (builtin.help_tags) 'Telescope: docs'
|
||||
n '<Leader>fk' (builtin.keymaps) 'Telescope: keymaps'
|
||||
n '<leader>fn' (ext.notify.notify) 'Telescope: notifications'
|
||||
end,
|
||||
},
|
||||
n '<leader>ff' (builtin.find_files) 'Telescope: files'
|
||||
n '<leader>fb' (builtin.buffers) 'Telescope: buffers'
|
||||
n '<leader>fg' (builtin.live_grep) 'Telescope: grep'
|
||||
n '<leader>fh' (builtin.help_tags) 'Telescope: docs'
|
||||
n '<Leader>fk' (builtin.keymaps) 'Telescope: keymaps'
|
||||
n '<leader>fn' (ext.notify.notify) 'Telescope: notifications'
|
||||
end,
|
||||
},
|
||||
|
||||
-- Keymap hints
|
||||
{
|
||||
'folke/which-key.nvim',
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
config = true
|
||||
},
|
||||
-- Keymap hints
|
||||
{
|
||||
'folke/which-key.nvim',
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
config = true
|
||||
},
|
||||
|
||||
-- Treesitter
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects'
|
||||
},
|
||||
config = function()
|
||||
local configs = require 'nvim-treesitter.configs'
|
||||
-- Treesitter
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects'
|
||||
},
|
||||
config = function()
|
||||
local configs = require 'nvim-treesitter.configs'
|
||||
|
||||
configs.setup {
|
||||
modules = {},
|
||||
auto_install = false,
|
||||
sync_install = false,
|
||||
ignore_install = {},
|
||||
ensure_installed = {
|
||||
-- neovim
|
||||
'vimdoc', 'lua', 'query', 'fennel',
|
||||
-- nix
|
||||
'nix',
|
||||
-- data
|
||||
'json', 'xml', 'yaml', 'toml',
|
||||
-- markdown
|
||||
'markdown', 'markdown_inline',
|
||||
-- latex
|
||||
'latex', 'bibtex',
|
||||
-- git
|
||||
'gitcommit', 'gitignore', 'diff',
|
||||
-- misc
|
||||
'comment', 'dockerfile', 'regex',
|
||||
-- shell
|
||||
'bash',
|
||||
-- python
|
||||
'python',
|
||||
-- systems
|
||||
'rust', 'c',
|
||||
-- webdev
|
||||
'html', 'css', 'scss', 'javascript', 'jsdoc', 'typescript', 'tsx', 'astro', 'svelte',
|
||||
-- haskell
|
||||
'haskell',
|
||||
},
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
node_incremental = 'v',
|
||||
node_decremental = 'V',
|
||||
},
|
||||
},
|
||||
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,
|
||||
init = function()
|
||||
local lang = vim.treesitter.language
|
||||
configs.setup {
|
||||
modules = {},
|
||||
auto_install = false,
|
||||
sync_install = false,
|
||||
ignore_install = {},
|
||||
ensure_installed = {
|
||||
-- neovim
|
||||
'vimdoc', 'lua', 'query', 'fennel',
|
||||
-- nix
|
||||
'nix',
|
||||
-- data
|
||||
'json', 'xml', 'yaml', 'toml',
|
||||
-- markdown
|
||||
'markdown', 'markdown_inline',
|
||||
-- latex
|
||||
'latex', 'bibtex',
|
||||
-- git
|
||||
'gitcommit', 'gitignore', 'diff',
|
||||
-- misc
|
||||
'comment', 'dockerfile', 'regex',
|
||||
-- shell
|
||||
'bash',
|
||||
-- python
|
||||
'python',
|
||||
-- systems
|
||||
'rust', 'c',
|
||||
-- webdev
|
||||
'html', 'css', 'scss', 'javascript', 'jsdoc', 'typescript', 'tsx', 'astro', 'svelte',
|
||||
-- haskell
|
||||
'haskell',
|
||||
},
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
node_incremental = 'v',
|
||||
node_decremental = 'V',
|
||||
},
|
||||
},
|
||||
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,
|
||||
init = function()
|
||||
local lang = vim.treesitter.language
|
||||
|
||||
lang.register('markdown', 'mdx')
|
||||
lang.register('markdown', 'lhaskell')
|
||||
end,
|
||||
},
|
||||
lang.register('markdown', 'mdx')
|
||||
lang.register('markdown', 'lhaskell')
|
||||
end,
|
||||
},
|
||||
|
||||
-- Configure LSP
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
config = function()
|
||||
local lsp = require 'lspconfig'
|
||||
local cmp = require 'cmp_nvim_lsp'
|
||||
-- Configure LSP
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
config = function()
|
||||
local lsp = require 'lspconfig'
|
||||
local cmp = require 'cmp_nvim_lsp'
|
||||
|
||||
lsp.nixd.setup {
|
||||
single_file_support = true,
|
||||
capabilities = cmp.default_capabilities(),
|
||||
}
|
||||
lsp.nixd.setup {
|
||||
single_file_support = true,
|
||||
capabilities = cmp.default_capabilities(),
|
||||
}
|
||||
|
||||
lsp.lua_ls.setup {
|
||||
single_file_support = true,
|
||||
capabilities = cmp.default_capabilities(),
|
||||
}
|
||||
lsp.lua_ls.setup {
|
||||
single_file_support = true,
|
||||
capabilities = cmp.default_capabilities(),
|
||||
}
|
||||
|
||||
local signs = {
|
||||
Error = "",
|
||||
Warn = "",
|
||||
Hint = "",
|
||||
Info = "",
|
||||
}
|
||||
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,
|
||||
},
|
||||
for sign, text in pairs(signs) do
|
||||
local name = 'DiagnosticSign' .. sign
|
||||
vim.fn.sign_define(name, { text = text, texthl = name })
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- Notifications
|
||||
{
|
||||
'rcarriga/nvim-notify',
|
||||
config = function()
|
||||
vim.notify = require 'notify'
|
||||
end
|
||||
},
|
||||
-- Notifications
|
||||
{
|
||||
'rcarriga/nvim-notify',
|
||||
config = function()
|
||||
vim.notify = require 'notify'
|
||||
end
|
||||
},
|
||||
|
||||
-- Project errors
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
config = function ()
|
||||
local trouble = require 'trouble'
|
||||
-- Project errors
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
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)'
|
||||
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,
|
||||
},
|
||||
trouble.setup {}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Breadcrumbs
|
||||
{
|
||||
'Bekaboo/dropbar.nvim',
|
||||
-- dependencies = {
|
||||
-- { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
|
||||
-- }
|
||||
},
|
||||
-- Breadcrumbs
|
||||
{
|
||||
'Bekaboo/dropbar.nvim',
|
||||
-- dependencies = {
|
||||
-- { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
|
||||
-- }
|
||||
},
|
||||
|
||||
{
|
||||
"tris203/precognition.nvim",
|
||||
config = function()
|
||||
local pc = require 'precognition'
|
||||
{
|
||||
'tris203/precognition.nvim',
|
||||
config = function()
|
||||
local pc = require 'precognition'
|
||||
|
||||
nv '<leader>p' (pc.toggle) "Precognition: toggle"
|
||||
nv '<leader>p' (pc.toggle) 'Precognition: toggle'
|
||||
|
||||
pc.setup {
|
||||
startVisible = false,
|
||||
}
|
||||
end,
|
||||
},
|
||||
pc.setup {
|
||||
startVisible = false,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Git - file hunks
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
config = function()
|
||||
local gs = require 'gitsigns'
|
||||
-- Git - file hunks
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
config = function()
|
||||
local gs = require 'gitsigns'
|
||||
|
||||
gs.setup {
|
||||
on_attach = function()
|
||||
n '<Leader>hp' (gs.preview_hunk) 'Hunk: preview'
|
||||
n '<Leader>hs' (gs.stage_hunk) 'Hunk: stage'
|
||||
n '<Leader>hu' (gs.undo_stage_hunk) 'Hunk: unstage'
|
||||
n '<Leader>hr' (gs.reset_hunk) 'Hunk: reset'
|
||||
n '<leader>hS' (gs.stage_buffer) 'Hunk: buffer stage'
|
||||
n '<leader>hR' (gs.reset_buffer) 'Hunk: buffer reset'
|
||||
n '<leader>hd' (gs.toggle_deleted) 'Hunk: show deleted'
|
||||
end
|
||||
}
|
||||
end,
|
||||
},
|
||||
gs.setup {
|
||||
on_attach = function()
|
||||
n '<Leader>hp' (gs.preview_hunk) 'Hunk: preview'
|
||||
n '<Leader>hs' (gs.stage_hunk) 'Hunk: stage'
|
||||
n '<Leader>hu' (gs.undo_stage_hunk) 'Hunk: unstage'
|
||||
n '<Leader>hr' (gs.reset_hunk) 'Hunk: reset'
|
||||
n '<leader>hS' (gs.stage_buffer) 'Hunk: buffer stage'
|
||||
n '<leader>hR' (gs.reset_buffer) 'Hunk: buffer reset'
|
||||
n '<leader>hd' (gs.toggle_deleted) 'Hunk: show deleted'
|
||||
end
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Git - project diff
|
||||
{
|
||||
'sindrets/diffview.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
config = function()
|
||||
local lib = require 'diffview.lib'
|
||||
-- Git - project diff
|
||||
{
|
||||
'sindrets/diffview.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
config = function()
|
||||
local lib = require 'diffview.lib'
|
||||
|
||||
local function toggle(name)
|
||||
return function()
|
||||
if not next(lib.views) then
|
||||
vim.cmd(name)
|
||||
else
|
||||
vim.cmd 'DiffviewClose'
|
||||
end
|
||||
end
|
||||
end
|
||||
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
|
||||
},
|
||||
n '<Leader>gd' (toggle 'DiffviewOpen') 'Git: Diff'
|
||||
n '<Leader>gh' (toggle 'DiffviewFileHistory') 'Git: History'
|
||||
end
|
||||
},
|
||||
|
||||
-- Color hints
|
||||
{
|
||||
'NvChad/nvim-colorizer.lua',
|
||||
ft = { 'css', 'scss' },
|
||||
config = true,
|
||||
},
|
||||
-- Color hints
|
||||
{
|
||||
'NvChad/nvim-colorizer.lua',
|
||||
ft = { 'css', 'scss' },
|
||||
config = true,
|
||||
},
|
||||
|
||||
-- {
|
||||
-- dir = '~/Desktop/disasm.nvim',
|
||||
-- ft = { 'c' },
|
||||
-- config = function()
|
||||
-- local disasm = require 'disasm'
|
||||
--
|
||||
-- n '<Leader>a' (disasm.disassemble) 'Disasm: Disassemble'
|
||||
-- n '<Leader>Af' (disasm.disassemble_full) 'Disasm: Disassemble full'
|
||||
-- n '<Leader>Ac' (disasm.reconfigure) 'Disasm: Configure'
|
||||
-- n '<Leader>AC' (disasm.save_config) 'Disasm: Save config'
|
||||
--
|
||||
-- disasm.setup()
|
||||
-- end
|
||||
-- },
|
||||
-- {
|
||||
-- dir = '~/Desktop/disasm.nvim',
|
||||
-- ft = { 'c' },
|
||||
-- config = function()
|
||||
-- local disasm = require 'disasm'
|
||||
--
|
||||
-- n '<Leader>a' (disasm.disassemble) 'Disasm: Disassemble'
|
||||
-- n '<Leader>Af' (disasm.disassemble_full) 'Disasm: Disassemble full'
|
||||
-- n '<Leader>Ac' (disasm.reconfigure) 'Disasm: Configure'
|
||||
-- n '<Leader>AC' (disasm.save_config) 'Disasm: Save config'
|
||||
--
|
||||
-- disasm.setup()
|
||||
-- end
|
||||
-- },
|
||||
|
||||
-- Completion
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
},
|
||||
config = require 'config.plugins.nvim-cmp'
|
||||
},
|
||||
-- Completion
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
},
|
||||
config = require 'config.plugins.nvim-cmp'
|
||||
},
|
||||
|
||||
-- Debugger adapter support
|
||||
{
|
||||
'mfussenegger/nvim-dap',
|
||||
dependencies = {
|
||||
'nvim-neotest/nvim-nio',
|
||||
'rcarriga/nvim-dap-ui',
|
||||
},
|
||||
config = function()
|
||||
local dap = require 'dap'
|
||||
local ui = require 'dapui'
|
||||
-- Debugger adapter support
|
||||
{
|
||||
'mfussenegger/nvim-dap',
|
||||
dependencies = {
|
||||
'nvim-neotest/nvim-nio',
|
||||
'rcarriga/nvim-dap-ui',
|
||||
},
|
||||
config = function()
|
||||
local dap = require 'dap'
|
||||
local ui = require 'dapui'
|
||||
|
||||
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 '<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'
|
||||
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' })
|
||||
-- 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,
|
||||
},
|
||||
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,
|
||||
},
|
||||
|
||||
-- Tools for Neovim
|
||||
{
|
||||
'folke/lazydev.nvim',
|
||||
ft = 'lua',
|
||||
opts = {
|
||||
library = {
|
||||
'lazy.nvim',
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Tools for Neovim
|
||||
{
|
||||
'folke/lazydev.nvim',
|
||||
ft = 'lua',
|
||||
opts = {
|
||||
library = {
|
||||
'lazy.nvim',
|
||||
'rustaceanvim',
|
||||
'haskell-tools.nvim',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Tools for Rust
|
||||
{
|
||||
'mrcjkb/rustaceanvim',
|
||||
version = '^3',
|
||||
ft = { 'rust' },
|
||||
init = function()
|
||||
require 'config.plugins.rustaceanvim'
|
||||
end
|
||||
},
|
||||
-- Tools for Rust
|
||||
{
|
||||
'mrcjkb/rustaceanvim',
|
||||
version = '^4',
|
||||
ft = { 'rust' },
|
||||
init = require 'config.plugins.rustaceanvim',
|
||||
},
|
||||
|
||||
-- Tools for Haskell
|
||||
{
|
||||
'mrcjkb/haskell-tools.nvim',
|
||||
version = '^3',
|
||||
ft = { 'haskell', 'lhaskell', 'cabal', 'cabalproject' },
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
init = require 'config.plugins.haskell-tools'
|
||||
},
|
||||
-- Tools for Haskell
|
||||
{
|
||||
'mrcjkb/haskell-tools.nvim',
|
||||
version = '^3',
|
||||
ft = { 'haskell', 'lhaskell', 'cabal', 'cabalproject' },
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-telescope/telescope.nvim',
|
||||
},
|
||||
init = require 'config.plugins.haskell-tools'
|
||||
},
|
||||
}
|
||||
|
|
|
@ -5,29 +5,29 @@ local n = map 'n'
|
|||
---@param buffer number
|
||||
---@param ht HaskellTools
|
||||
local function on_attach(_, buffer, ht)
|
||||
n '<leader>hc' (vim.lsp.codelens.run) {'Run codelens', buffer}
|
||||
n '<leader>hs' (ht.hoogle.hoogle_signature) {'Hoogle: search', buffer}
|
||||
n '<leader>he' (ht.lsp.buf_eval_all) {'Haskell: eval all', buffer}
|
||||
n '<leader>hc' (vim.lsp.codelens.run) { 'Run codelens', buffer }
|
||||
n '<leader>hs' (ht.hoogle.hoogle_signature) { 'Hoogle: search', buffer }
|
||||
n '<leader>he' (ht.lsp.buf_eval_all) { 'Haskell: eval all', buffer }
|
||||
|
||||
local function repl_file()
|
||||
local name = vim.api.nvim_buf_get_name(0)
|
||||
ht.repl.toggle(name)
|
||||
end
|
||||
local function repl_file()
|
||||
local name = vim.api.nvim_buf_get_name(0)
|
||||
ht.repl.toggle(name)
|
||||
end
|
||||
|
||||
n '<leader>rf' (repl_file) 'Repl: Toggle GHCi for the current buffer'
|
||||
n '<leader>rr' (ht.repl.toggle) {'Repl: Toggle GHCi for the current package', buffer}
|
||||
n '<leader>rq' (ht.repl.quit) {'Repl: Quit', buffer}
|
||||
n '<leader>rf' (repl_file) 'Repl: Toggle GHCi for the current buffer'
|
||||
n '<leader>rr' (ht.repl.toggle) { 'Repl: Toggle GHCi for the current package', buffer }
|
||||
n '<leader>rq' (ht.repl.quit) { 'Repl: Quit', buffer }
|
||||
|
||||
-- Detect nvim-dap launch configurations
|
||||
-- (requires nvim-dap and haskell-debug-adapter)
|
||||
-- ht.dap.discover_configurations(bufnr)
|
||||
-- Detect nvim-dap launch configurations
|
||||
-- (requires nvim-dap and haskell-debug-adapter)
|
||||
-- ht.dap.discover_configurations(bufnr)
|
||||
end
|
||||
|
||||
---@type HTConfig
|
||||
local config = {
|
||||
hls = { on_attach = on_attach }
|
||||
hls = { on_attach = on_attach }
|
||||
}
|
||||
|
||||
return function()
|
||||
vim.g.haskell_tools = config
|
||||
vim.g.haskell_tools = config
|
||||
end
|
||||
|
|
|
@ -1,52 +1,42 @@
|
|||
-- Reference: https://github.com/hrsh7th/nvim-cmp#recommended-configuration
|
||||
return function()
|
||||
local cmp = require "cmp"
|
||||
local cmp = require "cmp"
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.snippet.expand(args.body)
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
-- ['<Tab>'] = cmp.mapping(function(fallback)
|
||||
-- if cmp.visible() then
|
||||
-- cmp.select_next_item()
|
||||
-- elseif vim.snippet.jumpable(1) then
|
||||
-- vim.snippet.jump(1)
|
||||
-- else
|
||||
-- fallback()
|
||||
-- end
|
||||
-- end, { 'i', 's' }),
|
||||
-- And something similar for vim.snippet.jump(-1)
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-CR>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
},
|
||||
sources = cmp.config.sources({{ name = 'nvim_lsp' }}, {{ name = 'buffer' }})
|
||||
}
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.snippet.expand(args.body)
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-CR>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
},
|
||||
sources = cmp.config.sources({ { name = 'nvim_lsp' } }, { { name = 'buffer' } })
|
||||
}
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
end
|
||||
|
|
|
@ -2,36 +2,20 @@ local map = require 'config.helpers.keymap'
|
|||
local n = map 'n'
|
||||
|
||||
|
||||
vim.g.rustaceanvim = function()
|
||||
local mason = require 'mason-registry'
|
||||
local tools = require 'rustaceanvim'
|
||||
local config = require 'rustaceanvim.config'
|
||||
local function get_opts()
|
||||
local tools = require 'rustaceanvim'
|
||||
|
||||
local lsp_root = mason.get_package('codelldb'):get_install_path() .. '/extension/'
|
||||
local lsp_path = lsp_root .. 'adapter/codelldb'
|
||||
local lib_path = lsp_root .. 'lldb/lib/liblldb.so'
|
||||
|
||||
---@type RustaceanOpts
|
||||
return {
|
||||
server = {
|
||||
on_attach = function(_, bufnr)
|
||||
n '<C-b>' (tools.hover_actions.hover_actions) {buffer=bufnr}
|
||||
n '<Leader>a' (tools.code_action_group.code_action_group) {buffer=bufnr}
|
||||
end,
|
||||
},
|
||||
default_settings = {
|
||||
['rust-analyzer'] = {
|
||||
-- checkOnSave = {
|
||||
-- allFeatures = true,
|
||||
-- overrideCommand = {
|
||||
-- 'cargo', 'clippy', '--workspace', '--message-format=json',
|
||||
-- '--all-targets', '--all-features'
|
||||
-- }
|
||||
-- },
|
||||
},
|
||||
},
|
||||
dap = {
|
||||
adapter = config.get_codelldb_adapter(lsp_path, lib_path),
|
||||
},
|
||||
}
|
||||
---@type RustaceanOpts
|
||||
return {
|
||||
server = {
|
||||
on_attach = function(_, bufnr)
|
||||
n '<C-b>' (tools.hover_actions.hover_actions) { buffer = bufnr }
|
||||
n '<Leader>a' (tools.code_action_group.code_action_group) { buffer = bufnr }
|
||||
end,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return function()
|
||||
vim.g.rustaceanvim = get_opts
|
||||
end
|
||||
|
|
|
@ -5,14 +5,14 @@ require 'config.autocmd'
|
|||
|
||||
-- Are we inside Neovide?
|
||||
if vim.g.neovide then
|
||||
require 'config.neovide'
|
||||
require 'config.neovide'
|
||||
end
|
||||
|
||||
-- Try load package manager
|
||||
local ok, err = pcall(require, 'config.manager')
|
||||
|
||||
if not ok then
|
||||
vim.schedule(function()
|
||||
vim.notify(err, vim.log.levels.ERROR)
|
||||
end)
|
||||
vim.schedule(function()
|
||||
vim.notify(err, vim.log.levels.ERROR)
|
||||
end)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue