4 Commits
Author SHA1 Message Date
Mariano Uvalle 98779b9a2c feat: Refactor neovim to a more modern stack. 2026-09-25 19:44:57 +00:00
jmug 6cc9c8f5e3 Add herdr config. 2026-09-07 16:58:44 -07:00
jmug 90628cf036 [macbook] Add handmade-gitea ssh target. 2026-09-07 16:58:44 -07:00
jmug a7664be021 [macbook] Install github cli. 2026-09-07 16:58:44 -07:00
34 changed files with 294 additions and 1004 deletions
@@ -1,177 +0,0 @@
;---Most generic types---
(module) @module
(identifier) @variable
(concrete_type) @type
;---annotations----
(annotation_type_def
(annotation_pre_colon
(identifier) @type))
(annotation_type_def
(annotation_pre_colon
(identifier) @function)
(function_type))
;----decleration types----
(value_declaration
(decl_left
(identifier_pattern
(identifier) @variable.parameter)))
;---records----
(field_name) @variable.member
(record_field_pattern
(_
(identifier) @variable))
;matches the second identifier and all subsequent ones
(field_access_expr
(identifier) @variable.member)
;highlight module members as records instead of free variables
; avoids highlighting them as out-of-scope vars
(variable_expr
(module) (identifier) @variable.member)
;----comments----
(line_comment) @comment @spell
(doc_comment) @comment.documentation @spell
;-----Punctuation----
[
"?"
(arrow)
(fat_arrow)
"|"
","
":"
] @punctuation.delimiter
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
[
"|"
"&"
"<-"
".."
(operator)
] @operator
(wildcard_pattern) @constant.builtin
[
"if"
"then"
"else"
] @keyword.conditional
[
(implements)
(when)
(is)
"as"
(to)
] @keyword
;----headers-----
[
"app"
"expect"
"module"
"package"
"import"
] @keyword
[
(import_as)
"imports"
] @keyword.import
(value_declaration
(decl_left
(identifier_pattern
(identifier) @function))
(expr_body
(anon_fun_expr)))
;----tags----
(tags_type
(tag_type) @constructor)
[
(tag)
(opaque_tag)
] @constructor
;-----builtins----
(variable_expr
(module) @module
(identifier) @boolean
(#any-of? @boolean "true" "false")
(#eq? @module "Bool"))
"dbg" @keyword.debug
;----function invocations ----
(function_call_pnc_expr
caller: (variable_expr
(identifier) @function.call))
(function_call_pnc_expr
caller: (field_access_expr
(identifier) @function.call .))
(bin_op_expr
(operator
"|>") @operator
(variable_expr
(identifier) @function))
;----function arguments----
(argument_patterns
(identifier_pattern
(identifier) @variable.parameter))
(argument_patterns
(_
(identifier_pattern
(identifier) @variable.parameter)))
(argument_patterns
(_
(_
(identifier_pattern
(identifier) @variable.parameter))))
;-----consts-----
[
(int)
(uint)
(iint)
(xint)
(natural)
] @number
[
(decimal)
(float)
] @number.float
(string) @string
(multiline_string) @string
(char) @character
@@ -1,61 +0,0 @@
; (value_declaration(expr_body(anon_fun_expr)))@indent.ignore
[
(when_is_expr)
(when_is_branch)
(record_expr)
(anon_fun_expr)
(list_expr)
(parenthesized_expr)
(function_call_pnc_expr)
(tuple_expr)
(backpassing_expr)
(imports)
(exposes)
(exposes_list)
(exposing)
;;patterns
(record_pattern)
(tuple_pattern)
(list_pattern)
;;ability stuff
(ability_implementation)
(opaque_type_def)
;;types
(record_type)
(tags_type)
(record_expr)
(implements_implementation)
"{"
"("
"["
]
@indent.begin
; ((record_type)
; @indent.align
; (#set! indent.open_delimiter "{")
; (#set! indent.close_delimiter "}"))
; ((record_expr)
; @indent.align
; (#set! indent.open_delimiter "{")
; (#set! indent.close_delimiter "}"))
; ((tags_type) @indent.align
; (#set! indent.open_delimiter "[")
; (#set! indent.close_delimiter "]"))
; ((implements_implementation) @indent.align
; (#set! indent.open_delimiter "[")
; (#set! indent.close_delimiter "]"))
(expr_body)@indent.begin
(ERROR "=")@indent.begin
(then )@indent.begin
(else)@indent.begin
[
; result:(_)
"]"
"}"
")"
]@indent.branch
@@ -1,57 +0,0 @@
;injection from function calls
(function_call_pnc_expr
(variable_expr (identifier) @injection.language)
(const [(multiline_string) (string)] @injection.content)
(#any-eq? @injection.language
"json"
"toml"
"yaml"
"xml"
"sql"
"lua"
"js"
"html"
"css"
"http"
"jq"
"latex"
"md"
"nix"
"regex"
)
)
;injection from piping function calls
(bin_op_expr
part: (const
[(multiline_string) (string)] @injection.content
)
part: (operator)
part: (variable_expr
(identifier) @injection.language
)
(#any-eq? @injection.language
"json"
"toml"
"yaml"
"xml"
"sql"
"lua"
"js"
"html"
"css"
"http"
"jq"
"latex"
"md"
"nix"
"regex"
)
)
(
[
(line_comment)
(doc_comment)
] @injection.content
(#set! injection.language "comment")
)
@@ -1,42 +0,0 @@
(expr_body) @local.scope
(argument_patterns
(identifier_pattern
(identifier) @local.definition))
; (argument_patterns(long_identifier)@local.definition)
(exposes_list
(identifier) @local.reference)
(import_expr(as)(module)@local.definition)
(opaque_type_def
(apply_type
(concrete_type) @local.definition.type))
(alias_type_def
(apply_type
(concrete_type) @local.definition.type))
(value_declaration
(decl_left
(identifier_pattern
(identifier) @local.definition.function))
(expr_body
(anon_fun_expr)))
(value_declaration
(decl_left
(identifier_pattern
(identifier) @local.definition.var)))
(identifier_pattern
(identifier) @local.definition)
(when_is_branch pattern: (_ (identifier_pattern (identifier) @local.definition)))
(spread_pattern (identifier) @local.definition)
(identifier) @local.reference
(tag_expr
(tag)) @local.reference
@@ -1,33 +0,0 @@
(anon_fun_expr
(expr_body) @function.inner
) @function.outer
(argument_patterns
((_) @parameter.inner . ","? @parameter.outer) @parameter.outer
)
(function_type
((_) @parameter.inner . ","? @parameter.outer) @parameter.outer(#not-eq? @parameter.inner "->")
)
(function_pnc_expr
.
(_)
(parenthesized_expr (expr_body) @parameter.inner) @parameter.outer
)
(function_pnc_expr
.
(_) ((_) @parameter.inner) @parameter.outer
)
[
(annotation_type_def ) @class.inner
(alias_type_def ) @class.inner
(opaque_type_def ) @class.inner
] @class.outer
(apply_type_arg) @parameter.inner
(line_comment) @comment.outer
(doc_comment) @comment.outer
+4 -25
View File
@@ -1,30 +1,9 @@
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
require('settings')
require('nv-globals')
require('plugins')
require('colorscheme')
require('settings')
-- Must go after plugins.
require("oil").setup()
-- LSP
require('lsp')
require('lsp.typescript-ls')
require('lsp.python-ls')
require('lsp.lua-ls')
require('lsp.go-ls')
require('lsp.zls-ls')
require('lsp.clang-ls')
require('lsp.rust-analyzer')
-- Completion
require('completion')
require('nv-prettier')
require('nv-telescope')
-- require('langs.roc')
-- Set up keymaps after everything is configured.
require('lsp')
require('keymappings')
@@ -0,0 +1,34 @@
{
"auto-pairs": { "branch": "master", "commit": "39f06b873a8449af8ff6a3eee716d3da14d63a76" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp-snippy": { "branch": "master", "commit": "6e39210aa3a74e2bf6462f492eaf0d436cd2b7d3" },
"conform.nvim": { "branch": "master", "commit": "016802de402556da54c36bd7359b441266b01cdd" },
"gitsigns.nvim": { "branch": "main", "commit": "070a5d7b985546cc57e1fc61e5bc507fecac6045" },
"grug-far.nvim": { "branch": "main", "commit": "11595bf747edc270bce2069d1020502ad4ae56cf" },
"indent-blankline.nvim": { "branch": "master", "commit": "f1e186e44d3b7f9ae918008e2c28ce37c6023d2d" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lightline.vim": { "branch": "master", "commit": "d042c506cb2e7a59112a72447e0b5fe8739d9d1d" },
"nvim-cmp": { "branch": "main", "commit": "2ffe79f1f021def8dd1fcd81deb16f1bb0d989f3" },
"nvim-lspconfig": { "branch": "master", "commit": "046b1a797af1effe8e0474b9af9657a3761ec58a" },
"nvim-snippy": { "branch": "master", "commit": "1f5a5c82cb4902522806a58cf25479f6f8fe16ac" },
"nvim-web-devicons": { "branch": "master", "commit": "58447c1fca354bbf184425e4a8d01deecbd6f3c4" },
"oil.nvim": { "branch": "master", "commit": "b73018b75affd13fa38e2fc94ef753b465f770d7" },
"palenight.vim": { "branch": "master", "commit": "9e9b102c54b830b72f51917b6b86c3b3b02dcea2" },
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "84b9ba066d1860f7a586ce9cd732fd6c4f77d1d9" },
"transparent.nvim": { "branch": "main", "commit": "a4145c52f5421f1626a4d7dc0f41e785c4439944" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" },
"vim-gitbranch": { "branch": "master", "commit": "1a8ba866f3eaf0194783b9f8573339d6ede8f1ed" },
"vim-go": { "branch": "master", "commit": "47694979496d4bf2e90ce75d95f1dec3f41cbefb" },
"vim-polyglot": { "branch": "master", "commit": "f061eddb7cdcc614c8406847b2bfb53099832a4e" },
"vim-rooter": { "branch": "master", "commit": "51402fb77c4d6ae94994e37dc7ca13bec8f4afcc" },
"vim-smoothie": { "branch": "master", "commit": "df1e324e9f3395c630c1c523d0555a01d2eb1b7e" },
"vim-styled-components": { "branch": "main", "commit": "75e178916fc3e61385350933a23055927f5f60b7" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim_current_word": { "branch": "master", "commit": "967c73804e38e5b2ceaa536328a4f76f1157a482" },
"zig.vim": { "branch": "master", "commit": "4842ab8cb1b000a9acb0a06170d404d12a154918" }
}
@@ -1,5 +1,5 @@
vim.api.nvim_set_option('background', 'dark')
vim.api.nvim_set_option('termguicolors', true)
vim.opt.background = 'dark'
vim.opt.termguicolors = true
-- colorscheme
vim.cmd([[
@@ -1,10 +1,9 @@
vim.o.completeopt = "menuone,noselect"
-- Avoid having a "Pattern not found" message
vim.cmd("set shortmess+=c")
local cmp = require'cmp'
local cmp = require('cmp')
local snippy = require('snippy')
vim.opt.completeopt = { 'menuone', 'noselect' }
vim.opt.shortmess:append('c')
cmp.setup({
window = {
completion = cmp.config.window.bordered(),
@@ -23,11 +22,11 @@ cmp.setup({
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'async_path' },
{ name = 'path' },
{ name = 'snippy' },
}, {
{ name = 'buffer' },
})
}),
})
snippy.setup({
@@ -38,81 +37,3 @@ snippy.setup({
},
},
})
require('lspsaga').setup({})
-- require'compe'.setup {
-- enabled = true;
-- autocomplete = true;
-- debug = false;
-- min_length = 1;
-- preselect = 'always';
-- throttle_time = 80;
-- source_timeout = 200;
-- incomplete_delay = 400;
-- max_abbr_width = 100;
-- max_kind_width = 100;
-- max_menu_width = 100;
-- documentation = true;
-- source = {
-- path = true;
-- buffer = false;
-- calc = false;
-- vsnip = false; -- Could be used if I want to start using snippets.
-- nvim_lsp = true;
-- nvim_lua = true;
-- tags = true;
-- snippets_nvim = true;
-- treesitter = true;
-- };
-- }
-- vim.cmd([[
-- autocmd FileType ocaml call compe#setup({
-- \ 'preselect': 'disable'
-- \ }, 0)
-- ]])
-- local t = function(str)
-- return vim.api.nvim_replace_termcodes(str, true, true, true)
-- end
-- _G.comp_jump_if_avail = function()
-- if vim.fn.pumvisible() == 1 then
-- return t "<C-n>"
-- end
-- end
-- _G.comp_jump_prev_if_avail = function()
-- if vim.fn.pumvisible() == 1 then
-- return t "<C-p>"
-- end
-- end
-- _G.tab_complete = function()
-- if vim.fn.pumvisible() == 1 then
-- return vim.fn['compe#confirm']('')
-- else
-- return t "<Tab>"
-- end
-- end
-- _G.enter_complete = function()
-- if vim.bo.filetype == "ocaml" then
-- return t "<CR>"
-- elseif vim.fn.pumvisible() == 1 then
-- return vim.fn['compe#confirm']('')
-- else
-- return t "<CR>"
-- end
-- end
-- vim.api.nvim_set_keymap("i", "<C-n>", "v:lua.comp_jump_if_avail()", {expr = true})
-- vim.api.nvim_set_keymap("s", "<C-n>", "v:lua.comp_jump_if_avail()", {expr = true})
-- vim.api.nvim_set_keymap("i", "<C-e>", "v:lua.comp_jump_prev_if_avail()", {expr = true})
-- vim.api.nvim_set_keymap("s", "<C-e>", "v:lua.comp_jump_prev_if_avail()", {expr = true})
-- -- The next 4 funtcions don't work if compe doesn't automatically select the first option.
-- -- meaning the preselect option has to be set to alwasy.
-- vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
-- vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
-- vim.api.nvim_set_keymap("i", "<CR>", "v:lua.enter_complete()", {expr = true})
-- vim.api.nvim_set_keymap("s", "<CR>", "v:lua.enter_complete()", {expr = true})
@@ -1,97 +1,44 @@
local lsp = vim.lsp
local handlers = lsp.handlers
-- local saga = require('lspsaga')
-- saga.init_lsp_saga()
local map = vim.keymap.set
-- Space as leader.
vim.api.nvim_set_keymap('n', '<Space>', '<NOP>', {noremap = true, silent = true})
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
map('n', '<Space>', '<Nop>', { silent = true })
map('i', ',m', '<Esc>', { silent = true })
-- Exit insert mode with ,h.
vim.api.nvim_set_keymap('i', ',m', '<ESC>', {noremap = true, silent = true})
for _, mode in ipairs({ 'n', 'i', 'v', 's', 'x', 'c', 'o', 't' }) do
map(mode, '<C-g>', '<Esc>', { silent = true })
end
map('i', '<C-l>', '<Right>', { silent = true })
-- Remap for colemak-dhm.
-- Left.
-- vim.api.nvim_set_keymap('', 'm', 'h', {noremap = true, silent = true})
-- vim.api.nvim_set_keymap('', 'h', 'm', {noremap = true, silent = true})
-- Down.
-- vim.api.nvim_set_keymap('', 'j', 'n', {noremap = true, silent = true})
-- vim.api.nvim_set_keymap('', 'n', 'j', {noremap = true, silent = true})
-- Up.
-- vim.api.nvim_set_keymap('', 'k', 'e', {noremap = true, silent = true})
-- vim.api.nvim_set_keymap('', 'e', 'k', {noremap = true, silent = true})
-- Right.
-- vim.api.nvim_set_keymap('', 'l', 'i', {noremap = true, silent = true})
-- vim.api.nvim_set_keymap('', 'i', 'l', {noremap = true, silent = true})
for _, direction in ipairs({ 'h', 'j', 'k', 'l' }) do
map('n', '<leader>w' .. direction, '<C-w>' .. direction, { desc = 'Move to window ' .. direction })
end
map('n', '<leader>fw', '<cmd>write<cr>', { desc = 'Write file' })
map('n', '<leader><leader>', '<C-^>', { desc = 'Alternate buffer' })
-- C-g as ESC
vim.api.nvim_set_keymap('n', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('i', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('v', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('s', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('x', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('c', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('o', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('l', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('t', '<C-g>', '<ESC>', {silent = true})
map('n', '<leader>ff', '<cmd>Telescope find_files<cr>', { desc = 'Find files' })
map('n', '<leader>fb', '<cmd>Oil .<cr>', { desc = 'Browse current directory' })
map('n', '<leader>fc', '<cmd>Oil<cr>', { desc = 'Browse file directory' })
map('n', '<leader>fo', '<cmd>Oil<cr>', { desc = 'Open file directory' })
map('n', '<leader>ps', '<cmd>Telescope live_grep<cr>', { desc = 'Search text' })
map('n', '<leader>bs', '<cmd>Telescope buffers<cr>', { desc = 'Search buffers' })
map('n', '<leader>sr', '<cmd>GrugFar<cr>', { desc = 'Search and replace' })
map('n', '<leader>rsr', '<cmd>GrugFarWithin<cr>', { desc = 'Open range replacement' })
-- Move right when in insert mode.
vim.api.nvim_set_keymap("i", '<C-l>', '<Right>', {noremap = true, silent = true})
map({ 'n', 'x' }, '<leader>ca', vim.lsp.buf.code_action, { desc = 'Code action' })
map('n', '<leader>lgd', vim.lsp.buf.definition, { desc = 'Go to definition' })
map('n', '<leader>lgD', vim.lsp.buf.declaration, { desc = 'Go to declaration' })
map('n', '<leader>lgr', vim.lsp.buf.references, { desc = 'Find references' })
map('n', '<leader>lgi', vim.lsp.buf.implementation, { desc = 'Go to implementation' })
map('n', '<leader>lr', vim.lsp.buf.rename, { desc = 'Rename symbol' })
map('n', '<leader>lf', function()
require('conform').format({ async = true, lsp_format = 'fallback' })
end, { desc = 'Format buffer' })
map('x', '<leader>lrf', vim.lsp.buf.format, { desc = 'Format selection' })
map('n', 'K', function()
vim.lsp.buf.hover({ border = 'rounded', max_width = 80 })
end, { desc = 'Hover documentation' })
-- Leader window movement.
vim.api.nvim_set_keymap("n", '<Leader>wh', '<C-w>h', {noremap = true, silent = true})
vim.api.nvim_set_keymap("n", '<Leader>wj', '<C-w>j', {noremap = true, silent = true})
vim.api.nvim_set_keymap("n", '<Leader>wk', '<C-w>k', {noremap = true, silent = true})
vim.api.nvim_set_keymap("n", '<Leader>wl', '<C-w>l', {noremap = true, silent = true})
-- Quick save.
vim.api.nvim_set_keymap('n', '<Leader>fw', ':w<CR>', {silent = true})
-- Toggle between buffers.
vim.api.nvim_set_keymap('n', '<Leader><Leader>', '<C-^>', {noremap = true, silent = true})
-- Find files inside the current folder.
vim.api.nvim_set_keymap('n', '<Leader>ff', '<cmd>Telescope find_files<cr>',{})
-- Find files and folders allowing creation.
vim.api.nvim_set_keymap('n', '<Leader>fb', '<cmd>Telescope file_browser<cr>', {noremap = true})
-- File brosers starting at the cwd.
vim.api.nvim_set_keymap('n', '<Leader>fc', '<cmd>Telescope file_browser path=%:p:h<cr>', {noremap = true})
-- File browser that allows edits in-buffer.
vim.keymap.set("n", "<Leader>fo", "<CMD>Oil<CR>", { desc = "Open parent directory" })
-- Do a grep search in the current folder.
vim.api.nvim_set_keymap('n', '<Leader>ps', ':Rg<cr>',{})
-- Search among the currently open buffers.
vim.api.nvim_set_keymap('n', '<Leader>bs', '<cmd>Telescope buffers<cr>',{})
-- Code actions.
vim.api.nvim_set_keymap('n', '<Leader>ca', "<Cmd>lua vim.lsp.buf.code_action()<CR>",{silent = true, noremap = true})
vim.api.nvim_set_keymap('x', '<Leader>ca', "<Cmd>lua vim.lsp.buf.range_code_action()<CR>",{silent = true, noremap = true})
-- Search and replace.
vim.api.nvim_set_keymap('n', '<Leader>sr', ':GrugFar<cr>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<Leader>rsr', ':GrugFarWithin<cr>', {noremap = true, silent = true})
-- Hover doc popup
local pop_opts = { border = "rounded", max_width = 80 }
handlers["textDocument/hover"] = lsp.with(handlers.hover, pop_opts)
handlers["textDocument/signatureHelp"] = lsp.with(handlers.signature_help, pop_opts)
vim.api.nvim_set_keymap('n', '<Leader>lgd', '<cmd>lua vim.lsp.buf.definition()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<Leader>lgD', '<cmd>lua vim.lsp.buf.declaration()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<Leader>lgr', '<cmd>lua vim.lsp.buf.references()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<Leader>lgi', '<cmd>lua vim.lsp.buf.implementation()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<Leader>lf', '<cmd>lua require("conform").format({ async = true, lsp_fallback = true })<CR>', {noremap = true, silent = true})
vim.keymap.set('v', '<Leader>lrf', vim.lsp.buf.format)
vim.api.nvim_set_keymap('n', '<Leader>lr', '<cmd>Lspsaga rename<CR>', {silent = true})
vim.api.nvim_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', {noremap = true, silent = true})
------ Trouble
vim.api.nvim_set_keymap("n", "<leader>lld", '<cmd>lua vim.diagnostic.open_float({scope="line"})<CR>',
{silent = true, noremap = true}
) -- Mnemonic "lsp line diagnostics"
vim.api.nvim_set_keymap("n", "<leader>lwd", "<cmd>Trouble workspace_diagnostics<cr>",
{silent = true, noremap = true}
) -- Mnemonic "lsp workspace diagnostics"
vim.api.nvim_set_keymap("n", "<leader>ldd", "<cmd>Trouble document_diagnostics<cr>",
{silent = true, noremap = true}
) -- Mnemonic "lsp document diagnostics"
map('n', '<leader>lld', function()
vim.diagnostic.open_float({ scope = 'line', border = 'rounded' })
end, { desc = 'Line diagnostics' })
map('n', '<leader>lwd', '<cmd>Trouble diagnostics toggle<cr>', { desc = 'Workspace diagnostics' })
map('n', '<leader>ldd', '<cmd>Trouble diagnostics toggle filter.buf=0<cr>', { desc = 'Buffer diagnostics' })
@@ -1,26 +0,0 @@
-- make .roc files have the correct filetype
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = { "*.roc" },
command = "set filetype=roc",
})
-- add roc tree-sitter
local parsers = require("nvim-treesitter.parsers").get_parser_configs()
parsers.roc = {
install_info = {
url = "https://github.com/faldor20/tree-sitter-roc",
files = { "src/parser.c", "src/scanner.c" },
},
}
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
-- additional_vim_regex_highlighting = false,
},
}
@@ -1,9 +0,0 @@
require'lspconfig'.arduino_language_server.setup {
cmd = {
"arduino-language-server",
"-cli-config", "/Users/aym/Library/Arduino15/arduino-cli.yaml",
"-fqbn", "adafruit:nrf52:feather52841",
"-cli", "arduino-cli",
"-clangd", "clangd"
}
}
@@ -1 +0,0 @@
vim.lsp.enable('clangd')
@@ -1,8 +0,0 @@
local elixir_ls_binary = "/Users/" .. USER .. "/.config/nvim/lang-srvrs/elixir-ls/language_server.sh"
require'lspconfig'.elixirls.setup{
cmd = { elixir_ls_binary };
}
vim.api.nvim_command('autocmd BufWritePost *.ex :lua vim.lsp.buf.formatting()')
vim.api.nvim_command('autocmd BufWritePost *.exs :lua vim.lsp.buf.formatting()')
@@ -1,3 +0,0 @@
require("flutter-tools").setup{
} -- use defaults
@@ -1,74 +0,0 @@
-- local capabilities = require('cmp_nvim_lsp').default_capabilities()
--vim.lsp.config('gopls', {
-- on_attach = function(client, bufnr)
-- require "lsp_signature".on_attach({
-- bind = true,
-- -- floating_window = true,
-- --hint_enable = true,
-- fix_pos = true,
-- use_lspsaga = true,
-- handler_opts = {
-- border = "rounded" -- double, single, shadow, none
-- },
-- })
-- end,
-- cmd = {"gopls", "serve"},
-- settings = {
-- autostart = true,
-- gopls = {
-- analyses = {
-- unusedparams = true,
-- },
-- staticcheck = true,
-- },
-- },
-- autostart = true,
-- root_dir = require('lspconfig').util.root_pattern(".git","go.mod"),
-- init_options = {usePlaceholders = false, completeUnimported = true},
-- -- capabilities = capabilities,
-- single_file_support = true;
--})
vim.lsp.enable('gopls')
------ Configre vim-go
-- Disable autocomplete since we already have it with native lsp.
vim.g.go_code_completion_enabled = 0
-- Disable gopls for the same reasons as above.
vim.g.go_gopls_enabled = 0
-- Simplify code when formatting.
vim.g.go_fmt_command = 'gofmt'
vim.g.go_fmt_options = {
gofmt = '-s',
}
vim.g.go_imports_mode = 'goimports'
-- Could confilg with lsp saga, should experiment.
vim.g.go_doc_keywordprg_enabled = 0
-- Use my own universal mappings for lsp.
vim.g.go_def_mapping_enabled = 0
-- Use globally installed binaries first. (gopls) installed through brew.
vim.g.go_search_bin_path_first = 0
-- When auto-creating a template file, use the package rather than a file.
vim.g.go_template_use_pkg = 1
-- Configure folding.
-- vim.cmd("autocmd FileType go setlocal foldmethod=syntax")
-- vim.g.go_fmt_experimental = 1
-- Use a ruler for go files.
vim.cmd("autocmd FileType go setlocal colorcolumn=80")
-- Automatically add comment symbol on next line and wrap it.
vim.cmd("autocmd FileType go setlocal fo+=c fo+=r")
-- Highlights.
vim.g.go_highlight_operators = 1
vim.g.go_highlight_types = 1
vim.g.go_highlight_extra_types = 1
vim.g.go_highlight_functions = 1
vim.g.go_highlight_function_calls = 1
@@ -0,0 +1,24 @@
local capabilities = require('cmp_nvim_lsp').default_capabilities()
for _, server in ipairs({ 'ts_ls', 'basedpyright', 'gopls', 'zls', 'clangd', 'rust_analyzer' }) do
vim.lsp.config(server, { capabilities = capabilities })
vim.lsp.enable(server)
end
vim.lsp.config('lua_ls', {
capabilities = capabilities,
on_init = function(client)
local workspace = client.workspace_folders and client.workspace_folders[1]
if workspace and (vim.uv.fs_stat(workspace.name .. '/.luarc.json')
or vim.uv.fs_stat(workspace.name .. '/.luarc.jsonc')) then
return
end
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua or {}, {
runtime = { version = 'LuaJIT' },
workspace = { checkThirdParty = false, library = { vim.env.VIMRUNTIME } },
})
end,
settings = { Lua = {} },
})
vim.lsp.enable('lua_ls')
@@ -1,36 +0,0 @@
local capabilities = require('cmp_nvim_lsp').default_capabilities()
vim.lsp.config('lua_ls', {
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if vim.uv.fs_stat(path..'/.luarc.json') or vim.uv.fs_stat(path..'/.luarc.jsonc') then
return
end
end
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
runtime = {
-- Tell the language server which version of Lua you're using
-- (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT'
},
-- Make the server aware of Neovim runtime files
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME
-- Depending on the usage, you might want to add additional paths here.
-- "${3rd}/luv/library"
-- "${3rd}/busted/library",
}
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189)
-- library = vim.api.nvim_get_runtime_file("", true)
}
})
end,
settings = {
Lua = {}
},
capabilities = capabilities,
})
vim.lsp.enable('lua_ls')
@@ -1 +0,0 @@
require'lspconfig'.ocamllsp.setup{}
@@ -1,7 +0,0 @@
-- require'lspconfig'.pyright.setup{}
vim.lsp.enable('basedpyright')
-- Autoformat on save.
-- vim.cmd("autocmd BufWritePre *.py execute ':Black'")
@@ -1,12 +0,0 @@
require'lspconfig'.roc_ls.setup{
offset_encoding = "utf-8",
}
-- Should get rid of this once semantic highlighting gets better!
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
local client = vim.lsp.get_client_by_id(ev.data.client_id)
client.server_capabilities.semanticTokensProvider = nil
end,
})
@@ -1 +0,0 @@
vim.lsp.enable('rust_analyzer')
@@ -1,7 +0,0 @@
local lspconfig = require "lspconfig"
local capabilities = require('cmp_nvim_lsp').default_capabilities()
lspconfig.millet.setup{
cmd = { "millet-ls" },
capabilities = capabilities,
}
@@ -1,5 +0,0 @@
vim.lsp.config('ts_ls', {
filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" },
root_dir = require('lspconfig/util').root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")
})
vim.lsp.enable('ts_ls')
@@ -1 +0,0 @@
vim.lsp.enable('zls')
@@ -1,2 +0,0 @@
DATA_PATH = vim.fn.stdpath('data')
CACHE_PATH = vim.fn.stdpath('cache')
@@ -1,4 +0,0 @@
vim.g["prettier#autoformat"] = 1
vim.g["prettier#autoformat_require_pragma"] = 0
vim.g["prettier#exec_cmd_async"] = 1
@@ -1,11 +1,7 @@
-- This is your opts table
require("telescope").setup {
require('telescope').setup({
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {}
}
}
}
['ui-select'] = require('telescope.themes').get_dropdown({}),
},
})
require("telescope").load_extension("ui-select")
require("telescope").load_extension "file_browser"
require('telescope').load_extension('ui-select')
@@ -1,155 +1,89 @@
local execute = vim.api.nvim_command
local fn = vim.fn
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.uv.fs_stat(lazypath) then
local output = vim.fn.system({
'git', 'clone', '--filter=blob:none', '--branch=stable',
'https://github.com/folke/lazy.nvim.git', lazypath,
})
if vim.v.shell_error ~= 0 then
error('Could not install lazy.nvim: ' .. output)
end
end
vim.opt.rtp:prepend(lazypath)
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
execute 'packadd packer.nvim'
-- Home Manager links the checked-in snapshot into the read-only Nix store.
-- Seed a writable lockfile once. After :Lazy update, copy the state lockfile
-- back to lazy-lock.json in this repo to commit reviewed plugin revisions.
local lockfile = vim.fn.stdpath('state') .. '/lazy-lock.json'
local snapshot = vim.fn.stdpath('config') .. '/lazy-lock.json'
if not vim.uv.fs_stat(lockfile) and vim.uv.fs_stat(snapshot) then
vim.fn.mkdir(vim.fn.fnamemodify(lockfile, ':h'), 'p')
vim.fn.writefile(vim.fn.readfile(snapshot), lockfile)
end
return require('packer').startup(function(use)
-- Packer can manage itself as an optional plugin
use 'wbthomason/packer.nvim'
require('lazy').setup({
-- LSP and completion
{ 'neovim/nvim-lspconfig', lazy = false },
{ 'hrsh7th/nvim-cmp', dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'dcampos/nvim-snippy',
'dcampos/cmp-snippy',
}, lazy = false },
-- LSP
use 'neovim/nvim-lspconfig'
use ({
'nvimdev/lspsaga.nvim',
config = function()
require('lspsaga').setup({})
end,
-- Appearance and syntax
{ 'drewtempelmeyer/palenight.vim', lazy = false, priority = 1000 },
'nvim-tree/nvim-web-devicons',
'sheerun/vim-polyglot',
'https://codeberg.org/ziglang/zig.vim',
'styled-components/vim-styled-components',
'dominikduda/vim_current_word',
{ 'lukas-reineke/indent-blankline.nvim', main = 'ibl', ft = { 'yaml', 'helm' }, opts = {
scope = { enabled = false },
} },
'itchyny/lightline.vim',
'itchyny/vim-gitbranch',
{ 'tribela/transparent.nvim', opts = {} },
-- Navigation and search
'airblade/vim-rooter',
{ 'nvim-telescope/telescope.nvim', tag = 'v0.1.9', dependencies = {
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope-ui-select.nvim',
}, config = function()
require('nv-telescope')
end },
{ 'stevearc/oil.nvim', opts = {} },
{ 'MagicDuck/grug-far.nvim', opts = {} },
-- Diagnostics, Git, and editing
{ 'folke/trouble.nvim', opts = {} },
{ 'lewis6991/gitsigns.nvim', opts = {} },
'jiangmiao/auto-pairs',
{ 'fatih/vim-go', init = function()
vim.g.go_code_completion_enabled = 0
vim.g.go_gopls_enabled = 0
vim.g.go_fmt_command = 'gofmt'
vim.g.go_fmt_options = { gofmt = '-s' }
vim.g.go_imports_mode = 'goimports'
vim.g.go_doc_keywordprg_enabled = 0
vim.g.go_def_mapping_enabled = 0
vim.g.go_search_bin_path_first = 0
vim.g.go_template_use_pkg = 1
vim.g.go_highlight_operators = 1
vim.g.go_highlight_types = 1
vim.g.go_highlight_extra_types = 1
vim.g.go_highlight_functions = 1
vim.g.go_highlight_function_calls = 1
end },
{ 'stevearc/conform.nvim', opts = {
formatters_by_ft = { ocaml = { 'ocamlformat' } },
} },
'tpope/vim-commentary',
'tpope/vim-surround',
'psliwka/vim-smoothie',
}, {
lockfile = lockfile,
checker = { enabled = false },
change_detection = { notify = false },
})
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
}
-- Autocomplete
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'https://codeberg.org/FelipeLema/cmp-async-path'
use 'dcampos/nvim-snippy'
use 'dcampos/cmp-snippy'
use 'hrsh7th/nvim-cmp'
-- Function signatures
use "ray-x/lsp_signature.nvim"
-- Theme
use 'drewtempelmeyer/palenight.vim'
use 'kyazdani42/nvim-web-devicons'
-- Syntax
use 'sheerun/vim-polyglot'
use 'https://codeberg.org/ziglang/zig.vim'
-- use {
--- 'prettier/vim-prettier',
-- run = "yarn install",
-- ft = {"javascript", "typescript", "json"}
-- }
use {'styled-components/vim-styled-components', branch = "main"}
use 'dominikduda/vim_current_word'
use {
'lukas-reineke/indent-blankline.nvim',
ft = {'yaml', 'yml', 'helm'},
config = function()
vim.opt.list = true
vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("eol:↴")
require("indent_blankline").setup {
show_end_of_line = true,
space_char_blankline = " ",
}
end
}
use 'airblade/vim-rooter'
-- Find tools.
use { "nvim-telescope/telescope-file-browser.nvim" }
use {'nvim-telescope/telescope-ui-select.nvim' }
use {
'nvim-telescope/telescope.nvim',
requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}},
}
use { "junegunn/fzf" }
use { "junegunn/fzf.vim" }
use { "MagicDuck/grug-far.nvim" }
-- Diagnostics
-- Lua
use {
"folke/trouble.nvim",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("trouble").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
}
end
}
-- Git symobls.
use {
'lewis6991/gitsigns.nvim',
tag = 'release',
config = function()
require('gitsigns').setup()
end
}
use 'jiangmiao/auto-pairs'
use 'itchyny/lightline.vim'
use 'itchyny/vim-gitbranch'
-- Golang
use 'fatih/vim-go'
-- Flutter/Dart
use {'akinsho/flutter-tools.nvim', requires = 'nvim-lua/plenary.nvim'}
-- Pyhton
-- use 'a-vrma/black-nvim'
use {
'psf/black', branch = "stable"
}
-- Ocaml
use {
"stevearc/conform.nvim",
config = function()
require("conform").setup({
formatters_by_ft = {
ocaml = { "ocamlformat" },
},
})
end,
}
use 'tpope/vim-commentary'
use 'tpope/vim-surround'
-- Smooth scrolling
use 'psliwka/vim-smoothie'
-- Yuck (Eww config language).
-- use 'elkowar/yuck.vim'
-- Better file viewer
use({
"stevearc/oil.nvim",
config = function()
require("oil").setup()
end,
})
use({
"tribela/transparent.nvim",
config = function()
require("transparent").setup({})
end,
})
end)
@@ -1,45 +1,40 @@
-- Comes from the Chris@Machine config.
vim.opt.iskeyword:append('-')
vim.opt.hidden = true
vim.opt.wrap = false
vim.opt.fileencoding = 'utf-8'
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.conceallevel = 0
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.cursorline = true
vim.opt.showmode = false
vim.opt.backup = false
vim.opt.writebackup = false
vim.opt.signcolumn = 'yes'
vim.opt.updatetime = 300
vim.opt.timeoutlen = 500
vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object"
vim.o.hidden = true -- Required to keep multiple buffers open multiple buffers
vim.wo.wrap = false -- Display long lines as just one line
vim.o.fileencoding = "utf-8" -- The encoding written to file
vim.o.splitbelow = true -- Horizontal splits will automatically be below
vim.o.splitright = true -- Vertical splits will automatically be to the right
vim.o.conceallevel = 0 -- So that I can see `` in markdown files
vim.cmd('set ts=4') -- Insert 2 spaces for a tab
vim.cmd('set sw=4') -- Change the number of space characters inserted for indentation
vim.bo.expandtab = true -- Converts tabs to spaces
vim.bo.smartindent = true -- Makes indenting smart
vim.wo.number = true -- set numbered lines
vim.wo.cursorline = true -- Enable highlighting of the current line
--vim.o.showtabline = 2 -- Always show tabs
vim.o.showmode = false -- We don't need to see things like -- INSERT -- anymore
vim.o.backup = false -- This is recommended by coc
vim.o.writebackup = false -- This is recommended by coc
vim.wo.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
vim.o.updatetime = 300 -- Faster completion
vim.o.timeoutlen = 500 -- By default timeoutlen is 1000 ms
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'helm', 'yaml', 'yml' },
callback = function()
vim.opt_local.fixendofline = false
vim.opt_local.list = true
vim.opt_local.listchars:append({ space = '⋅', eol = '↴' })
end,
})
vim.cmd(":set number relativenumber")
vim.cmd("autocmd FileType helm set nofixendofline")
vim.cmd("autocmd FileType yaml set nofixendofline")
vim.cmd("autocmd FileType yml set nofixendofline")
vim.cmd("autocmd BufReadPost * :lua require('gitsigns').setup()")
------ Folding
-- vim.o.foldlevel = 99
-- Persist folds.
-- Ignore errors.
-- vim.cmd([[
-- augroup AutoSaveFolds
-- autocmd!
-- autocmd BufWinLeave * silent! mkview
-- autocmd BufWinEnter * silent! loadview
-- augroup END
-- ]])
vim.api.nvim_create_autocmd('FileType', {
pattern = 'go',
callback = function()
vim.opt_local.colorcolumn = '80'
vim.opt_local.formatoptions:append({ 'c', 'r' })
end,
})
-- Show full file path in lightline.
vim.cmd([[
@@ -65,21 +60,8 @@ function! FilenameForLightline()
endfunction
]])
-- Custom command for ripgrep.
-- vim.cmd([[
-- function! RipgrepFzf(query, fullscreen)
-- let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true'
-- let initial_command = printf(command_fmt, shellescape(a:query))
-- let reload_command = printf(command_fmt, '{q}')
-- let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
-- call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
-- endfunction
-- command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)
-- ]])
-- Use upstream zig plugin instead of polyglot.
vim.g.polyglot_disabled = { "zig" }
vim.g.polyglot_disabled = { 'zig' }
-- Prioritize Objective-C
vim.filetype.add({
@@ -89,17 +71,15 @@ vim.filetype.add({
})
-- Soft line wrapping for markdown.
local markdown_group = vim.api.nvim_create_augroup("MarkdownSpecific", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
pattern = { "markdown" }, -- Match markdown file patterns
local markdown_group = vim.api.nvim_create_augroup('MarkdownSpecific', { clear = true })
vim.api.nvim_create_autocmd('FileType', {
pattern = 'markdown',
group = markdown_group,
callback = function()
vim.opt_local.wrap = true
vim.opt_local.linebreak = true
vim.opt_local.textwidth = 0 -- Visual wrap to window edge
-- Optionally remap j/k for wrapped line navigation
vim.keymap.set('n', 'j', 'gj', { noremap = true, silent = true, buffer = true })
vim.keymap.set('n', 'k', 'gk', { noremap = true, silent = true, buffer = true })
vim.opt_local.textwidth = 0
vim.keymap.set('n', 'j', 'gj', { silent = true, buffer = true })
vim.keymap.set('n', 'k', 'gk', { silent = true, buffer = true })
end,
})
+41
View File
@@ -0,0 +1,41 @@
{ ... }: {
home.file.".config/herdr/config.toml" = {
text = ''
[keys]
prefix = "ctrl+a"
# Use tmux-style session selection for workspace navigation.
workspace_picker = "prefix+s"
settings = "prefix+shift+s"
# Side-by-side panes (tmux's "|" / "\" split -h).
# NOTE: "backslash" as a key name is inferred, not confirmed in the docs.
# Verify against `herdr --default-config` and adjust if it doesn't bind.
split_vertical = "prefix+backslash"
# Stacked panes (tmux's "-" / "_" split -v).
split_horizontal = "prefix+minus"
detach = "prefix+d"
# Kept "f" for next-tab like the old tmux config; herdr's
# previous_tab default (prefix+p) already matched.
next_tab = "prefix+f"
close_pane = "prefix+w"
close_tab = "prefix+shift+w"
# Kept "," for rename-tab like the old tmux default.
rename_tab = "prefix+,"
[ui]
mouse_capture = true
[session]
# Replaces tmux-resurrect/continuum: agents and panes come back on reattach.
resume_agents_on_restore = true
'';
};
}
+1 -2
View File
@@ -39,9 +39,9 @@
};
taps = [
# "agavra/tap"
];
brews = [
"gh"
"watchman"
"vite"
"pipx"
@@ -49,7 +49,6 @@
"glow"
"chromaprint"
"libiconv"
# "agavra/tap/tuicr"
"automake"
"autoconf"
"pkg-config"
+4 -2
View File
@@ -24,6 +24,7 @@ in {
../../home-modules/secretive.nix
../../home-modules/starship.nix
../../home-modules/tmux.nix
../../home-modules/herdr.nix
../../home-modules/opencode-config.nix
../../home-modules/zsh.nix
];
@@ -116,9 +117,10 @@ in {
hostname = "82.180.160.149";
forwardAgent = true;
};
handmaderunner = {
handmade-gitea = {
user = "jmug";
hostname = "2.25.209.218";
hostname = "40.160.241.66";
forwardAgent = true;
};
racknerd = {
user = "jmug";