Compare commits
1 Commits
main
...
b4018bc19a
| Author | SHA1 | Date | |
|---|---|---|---|
| b4018bc19a |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,3 @@
|
||||
lazy-lock.json
|
||||
spell/*.spl
|
||||
local.lua
|
||||
lua/local.lua
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
local opts = { buffer = true, remap = false, silent = true }
|
||||
vim.keymap.set('x', '0', ':PreProcIfWrap<CR>', opts)
|
||||
vim.keymap.set('v', '0', ':PreProcIfWrap<CR>', opts)
|
||||
|
||||
@@ -2,4 +2,5 @@ vim.opt.commentstring = '//%s'
|
||||
vim.opt.matchpairs:append('<:>')
|
||||
|
||||
local opts = { buffer = true, remap = false, silent = true }
|
||||
vim.keymap.set('x', '0', ':PreProcIfWrap<CR>', opts)
|
||||
-- vim.keymap.set('n', '0', ':PreProcIfWrap<CR>', opts)
|
||||
vim.keymap.set('v', '0', ':PreProcIfWrap<CR>', opts)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
vim.o.signcolumn = 'no'
|
||||
@@ -1,4 +0,0 @@
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.tabstop = 8
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.softtabstop = 4
|
||||
2
after/indent/python.lua
Normal file
2
after/indent/python.lua
Normal file
@@ -0,0 +1,2 @@
|
||||
-- Use treesitter for Python indenting since regex indenting is broken
|
||||
vim.opt.indentexpr = 'nvim_treesitter#indent()'
|
||||
4
init.lua
4
init.lua
@@ -1,5 +1,3 @@
|
||||
vim.loader.enable()
|
||||
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
@@ -13,7 +11,7 @@ end
|
||||
pcall(function() require('local') end)
|
||||
|
||||
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
||||
if not vim.uv.fs_stat(lazypath) then
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({ 'git', 'clone', '--filter=blob:none',
|
||||
'https://github.com/folke/lazy.nvim.git', '--branch=stable', lazypath })
|
||||
end
|
||||
|
||||
@@ -36,7 +36,6 @@ local kanagawa = {
|
||||
-- Don't lighlight TODO specially in comments
|
||||
for _, todo_group in pairs({
|
||||
'confTodo',
|
||||
'mojoTodo',
|
||||
'ps1CommentTodo',
|
||||
'pythonTodo',
|
||||
'zshTodo',
|
||||
|
||||
@@ -30,11 +30,23 @@ return {
|
||||
|
||||
-- UI plugins
|
||||
require('dap-view').setup({
|
||||
auto_toggle = true,
|
||||
winbar = {
|
||||
sections = {
|
||||
"console", "watches", "scopes", "exceptions",
|
||||
"breakpoints", "threads", "disassembly", "repl",
|
||||
},
|
||||
-- Must be one of the sections declared above
|
||||
default_section = "console",
|
||||
}
|
||||
})
|
||||
require('nvim-dap-virtual-text').setup({})
|
||||
require('dap-disasm').setup({
|
||||
dapview_register = true,
|
||||
-- dapview = {
|
||||
-- keymap = "D",
|
||||
-- label = "Disassembly [D]",
|
||||
-- short_label = " [D]",
|
||||
-- },
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
|
||||
6
lua/plugins/mdx.lua
Normal file
6
lua/plugins/mdx.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
'davidmh/mdx.nvim',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
}
|
||||
@@ -1,23 +1,22 @@
|
||||
local has_tree_sitter_cli = vim.fn.executable('tree-sitter') == 1
|
||||
|
||||
if not has_tree_sitter_cli then
|
||||
vim.schedule(function()
|
||||
vim.notify(
|
||||
'tree-sitter-cli not found on PATH; tree-sitter-manager.nvim disabled',
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
'romus204/tree-sitter-manager.nvim',
|
||||
cond = has_tree_sitter_cli,
|
||||
lazy = false,
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
branch = 'master',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
{ 'nvim-treesitter/nvim-treesitter-context', opts = {} },
|
||||
-- TODO: Fork this and add CMake support
|
||||
-- TODO: Add shell support (sh/bash/zsh if/for/while/etc)
|
||||
'RRethy/nvim-treesitter-endwise',
|
||||
},
|
||||
build = ':TSUpdate',
|
||||
config = function()
|
||||
require('tree-sitter-manager').setup({
|
||||
-- Enable core highlighting for every installed parser.
|
||||
highlight = true,
|
||||
require('nvim-treesitter').setup()
|
||||
require('nvim-treesitter.configs').setup({
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = false },
|
||||
|
||||
-- List of languages that must be available
|
||||
ensure_installed = {
|
||||
'asm',
|
||||
'bash',
|
||||
@@ -52,7 +51,6 @@ return {
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'meson',
|
||||
'mlir',
|
||||
'ninja',
|
||||
'objc',
|
||||
'objdump',
|
||||
@@ -73,48 +71,32 @@ return {
|
||||
'xml',
|
||||
'yaml',
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
branch = 'main',
|
||||
config = function()
|
||||
require('nvim-treesitter-textobjects').setup({
|
||||
-- After opening statements insert end statements
|
||||
endwise = { enable = true },
|
||||
|
||||
-- Text objects using Tree-sitter groups
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
-- include_surrounding_whitespace = true,
|
||||
keymaps = {
|
||||
-- Class text objects
|
||||
['ac'] = '@class.outer',
|
||||
['ic'] = '@class.inner',
|
||||
-- Function text objects
|
||||
['af'] = '@function.outer',
|
||||
['if'] = '@function.inner',
|
||||
-- Parameter/argument text objects
|
||||
['a,'] = '@parameter.outer',
|
||||
['i,'] = '@parameter.inner',
|
||||
-- Comment text objects
|
||||
['a/'] = '@comment.outer',
|
||||
['i/'] = '@comment.inner',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local select = require('nvim-treesitter-textobjects.select')
|
||||
local function map(lhs, query)
|
||||
vim.keymap.set({ 'x', 'o' }, lhs, function()
|
||||
select.select_textobject(query, 'textobjects')
|
||||
end, { desc = 'Select ' .. query })
|
||||
end
|
||||
|
||||
map('ac', '@class.outer') -- Class text objects
|
||||
map('ic', '@class.inner')
|
||||
map('af', '@function.outer') -- Function text objects
|
||||
map('if', '@function.inner')
|
||||
map('a,', '@parameter.outer') -- Parameter/argument text objects
|
||||
map('i,', '@parameter.inner')
|
||||
map('a/', '@comment.outer') -- Comment text objects
|
||||
map('i/', '@comment.inner')
|
||||
end,
|
||||
},
|
||||
|
||||
{ 'nvim-treesitter/nvim-treesitter-context', opts = {} },
|
||||
|
||||
{
|
||||
'danymat/neogen',
|
||||
config = function()
|
||||
require('neogen').setup({ snippet_engine = 'luasnip' })
|
||||
vim.keymap.set('n', '<leader>d', require('neogen').generate,
|
||||
{ desc = 'Generate documentation' })
|
||||
end,
|
||||
},
|
||||
|
||||
'davidmh/mdx.nvim',
|
||||
}
|
||||
|
||||
@@ -33,30 +33,8 @@ local noice = {
|
||||
|
||||
return {
|
||||
-- noice,
|
||||
{
|
||||
'echasnovski/mini.comment',
|
||||
opts = {
|
||||
options = {
|
||||
ignore_blank_line = true,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
'tpope/vim-unimpaired',
|
||||
lazy = false,
|
||||
},
|
||||
{ 'echasnovski/mini.comment', opts = { options = { ignore_blank_line = true } } },
|
||||
{ 'tpope/vim-unimpaired', lazy = false },
|
||||
{ 'stevearc/dressing.nvim' },
|
||||
{ 'kevinhwang91/nvim-bqf' },
|
||||
{
|
||||
'vihu/penview.nvim',
|
||||
ft = 'markdown',
|
||||
run = function()
|
||||
require("penview.build").install()
|
||||
end,
|
||||
config = function()
|
||||
require('penview').setup({
|
||||
browser = 'firefox',
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ vim.api.nvim_create_user_command('Remove', function(opts)
|
||||
end
|
||||
end
|
||||
-- Actually remove the file using the selected callback.
|
||||
vim.uv.fs_unlink(path, callback)
|
||||
vim.loop.fs_unlink(path, callback)
|
||||
end, { bang = true })
|
||||
|
||||
-- :Move the file associated with the current buffer
|
||||
@@ -62,7 +62,7 @@ vim.api.nvim_create_user_command('Move', function(opts)
|
||||
if vim.fn.isdirectory(dest) ~= 0 then
|
||||
dest = vim.fn.resolve(dest .. '/' .. vim.fn.expand('%:t'))
|
||||
end
|
||||
vim.uv.fs_rename(source, dest, function(err, success)
|
||||
vim.loop.fs_rename(source, dest, function(err, success)
|
||||
if success then
|
||||
vim.schedule(function()
|
||||
vim.cmd.edit(dest)
|
||||
@@ -87,7 +87,7 @@ vim.api.nvim_create_user_command('Rename', function(opts)
|
||||
dest = vim.fn.resolve(dir .. '/' .. opts.args)
|
||||
end
|
||||
local buffer = vim.api.nvim_get_current_buf()
|
||||
vim.uv.fs_rename(source, dest, function(err, success)
|
||||
vim.loop.fs_rename(source, dest, function(err, success)
|
||||
if not success then
|
||||
error(err)
|
||||
else
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
cl = 'opencl',
|
||||
def = 'cpp.def',
|
||||
inc = 'cpp.inc',
|
||||
def = 'cpp',
|
||||
ll = 'llvm',
|
||||
md = 'markdown',
|
||||
ronn = 'markdown',
|
||||
|
||||
@@ -29,7 +29,7 @@ vim.keymap.set('', '<leader>p', '"+p', opts)
|
||||
vim.keymap.set('', '<leader>P', '"+P', opts)
|
||||
|
||||
-- Undo neovim's default mapping of Y to y$
|
||||
vim.keymap.del('n', 'Y')
|
||||
vim.cmd.unmap('Y')
|
||||
|
||||
-- Make nvim :terminal more like vim :terminal
|
||||
vim.keymap.set('t', '<C-w>N', '<C-\\><C-n>', opts)
|
||||
@@ -50,16 +50,3 @@ vim.keymap.set('v', '<leader>rg', ":'<,'>Rg<CR>", opts)
|
||||
|
||||
-- Mapping to toggle checkboxes
|
||||
vim.keymap.set('n', '<leader><CR>', ':CheckboxToggle<CR>', opts)
|
||||
|
||||
-- Format whole file using internal algorithm
|
||||
vim.keymap.set('n', '<leader>gw', function()
|
||||
local view = vim.fn.winsaveview()
|
||||
vim.cmd('normal! gggwG')
|
||||
vim.fn.winrestview(view)
|
||||
end, { desc = 'Format whole file with gw' })
|
||||
|
||||
vim.keymap.set('n', '<leader>fm', function()
|
||||
if vim.o.foldexpr == 'v:lua.vim.treesitter.foldexpr()' then
|
||||
vim.opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -89,9 +89,9 @@ vim.opt.joinspaces = false
|
||||
-- Set fold level to something high
|
||||
vim.opt.foldlevel = 20
|
||||
vim.opt.foldmethod = 'expr'
|
||||
vim.opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||
vim.opt.foldtext = ''
|
||||
vim.opt.fillchars = { fold = ' ' }
|
||||
vim.opt.fillchars = 'fold: '
|
||||
|
||||
-- Enable all mouse features
|
||||
vim.opt.mouse = 'a'
|
||||
|
||||
@@ -89,12 +89,11 @@ local function generic(group, name)
|
||||
line = line .. '%#StatusLineDark#'
|
||||
end
|
||||
line = line .. ' %<%f'
|
||||
-- Display readonly, nomodifiable, and executable if set.
|
||||
-- Display readonly and nomodifiable if set.
|
||||
line = line
|
||||
.. '%#StatusLineDark#'
|
||||
.. '%{&readonly ? " 🔒" : ""}'
|
||||
.. '%{&modifiable ? "" : " ⛔"}'
|
||||
.. '%{getfperm(expand("%:p"))[2] ==# "x" ? " " : ""}'
|
||||
-- Display filetype if set.
|
||||
line = line .. '%=' .. '%#StatusLineDark# %{&filetype} '
|
||||
-- Display fileencoding if not utf-8 and fileformat if not unix with dusk
|
||||
@@ -162,14 +161,25 @@ function _G.statusline_inactive()
|
||||
return line
|
||||
end
|
||||
|
||||
-- Pick the active or inactive variant for the window currently being drawn.
|
||||
function _G.statusline_render()
|
||||
if vim.api.nvim_get_current_win() == tonumber(vim.g.actual_curwin or '-1') then
|
||||
return _G.statusline_active()
|
||||
-- Setup autocmds to set the statusline per buffer.
|
||||
local group = vim.api.nvim_create_augroup('statusline', { clear = true })
|
||||
-- Dynamically update the current buffer mode and color changes using %! to
|
||||
-- call a function which is always evaluated on statusline update.
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'WinEnter', 'BufWinEnter' }, {
|
||||
pattern = '*',
|
||||
group = group,
|
||||
callback = function()
|
||||
vim.cmd.setlocal("statusline=%{%v:lua.statusline_active()%}")
|
||||
end
|
||||
return _G.statusline_inactive()
|
||||
end
|
||||
})
|
||||
|
||||
vim.o.statusline = '%{%v:lua.statusline_render()%}'
|
||||
-- Statically set the statusline when leaving the buffer.
|
||||
vim.api.nvim_create_autocmd({ 'BufLeave', 'WinLeave' }, {
|
||||
pattern = '*',
|
||||
group = group,
|
||||
callback = function()
|
||||
vim.cmd.setlocal("statusline=%{%v:lua.statusline_inactive()%}")
|
||||
end
|
||||
})
|
||||
|
||||
return statusline
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
-- Customise LSP UI
|
||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover, {
|
||||
border = 'rounded',
|
||||
title = 'Hover',
|
||||
}
|
||||
)
|
||||
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
|
||||
vim.lsp.handlers.signature_help, {
|
||||
border = 'rounded',
|
||||
title = 'Signature Help',
|
||||
}
|
||||
)
|
||||
|
||||
-- Customise diagnostic UI
|
||||
vim.diagnostic.config({
|
||||
float = {
|
||||
|
||||
@@ -45,12 +45,6 @@ local snippets = {
|
||||
end, key('guard')),
|
||||
}, {}),
|
||||
|
||||
snippet('externc', {
|
||||
text({ '#ifdef __cplusplus', 'extern "C" {', '#endif', '', '' }),
|
||||
insert(0, ''),
|
||||
text({ '', '', '#ifdef __cplusplus', '}', '#endif' }),
|
||||
}),
|
||||
|
||||
-- Doxygen
|
||||
snippet('p', {
|
||||
text('@param'),
|
||||
|
||||
Reference in New Issue
Block a user