Compare commits

..

No commits in common. "b86d963a923b21b3b925eb403798df29ffdf4a34" and "d8896a66c8e3e19dd03e6b6177648a62dfeb6158" have entirely different histories.

32 changed files with 106 additions and 82 deletions

View file

@ -1 +0,0 @@
indent_type = "Spaces"

View file

@ -22,10 +22,6 @@
shellcheck = {
enable = true;
};
stylua = {
enable = true;
};
};
};
};

View file

@ -1,3 +1,4 @@
lua << EOF
local wk = require("which-key")
local keys = {
@ -8,3 +9,4 @@ local keys = {
}
wk.register(keys, { prefix = "gc" })
EOF

View file

@ -1,3 +1,4 @@
lua << EOF
local wk = require("which-key")
local keys = {
@ -5,3 +6,4 @@ local keys = {
}
wk.register(keys, { prefix = "<leader>" })
EOF

View file

@ -1,3 +1,4 @@
lua << EOF
local wk = require("which-key")
local telescope_builtin = require("telescope.builtin")
@ -13,3 +14,5 @@ local keys = {
}
wk.register(keys, { prefix = "<leader>" })
EOF

View file

@ -1,3 +1,4 @@
lua << EOF
local wk = require("which-key")
local motions = {
@ -28,3 +29,4 @@ local objects = {
wk.register(motions, { mode = "n" })
wk.register(objects, { mode = "o" })
EOF

View file

@ -1,3 +1,4 @@
lua << EOF
local wk = require("which-key")
local keys = {
@ -30,7 +31,7 @@ local keys = {
x = "XML encode",
y = "C string encode",
-- Custom
d = { vim.diagnostic.goto_prev, "Previous diagnostic" },
d = { vim.diagnostic.goto_prev, "Previous diagnostic" }
},
["]"] = {
name = "Next",
@ -60,7 +61,7 @@ local keys = {
x = "XML decode",
y = "C string decode",
-- Custom
d = { vim.diagnostic.goto_next, "Next diagnostic" },
d = { vim.diagnostic.goto_next, "Next diagnostic" }
},
-- Option mappings
@ -124,3 +125,4 @@ local keys = {
}
wk.register(keys)
EOF

View file

@ -54,6 +54,8 @@ in
vim-beancount
vim-jsonnet
vim-nix
vim-pandoc
vim-pandoc-syntax
vim-toml
# General enhancements

View file

@ -39,7 +39,7 @@ M.on_attach = function(client, bufnr)
-- * nothing displayed
-- * single diagnostic at the end of the line (`virtual_text`)
-- * full diagnostics using virtual text (`virtual_lines`)
local text = vim.diagnostic.config().virtual_text
local text = vim.diagnostic.config().virtual_text
local lines = vim.diagnostic.config().virtual_lines
-- Text -> Lines transition
@ -63,7 +63,7 @@ M.on_attach = function(client, bufnr)
end
local function show_buffer_diagnostics()
vim.diagnostic.open_float(nil, { scope = "buffer" })
vim.diagnostic.open_float(nil, { scope="buffer" })
end
local keys = {
@ -94,4 +94,5 @@ M.on_attach = function(client, bufnr)
wk.register(keys, { buffer = bufnr })
end
return M

View file

@ -17,9 +17,7 @@ end
---@param cmd string? command to check
---@return fun(cmd: string): boolean executable
M.is_executable_condition = function(cmd)
return function()
return M.is_executable(cmd)
end
return function() return M.is_executable(cmd) end
end
-- whether or not we are currently in an SSH connection

View file

@ -1,9 +0,0 @@
local abbreviations = {
-- A few things that are hard to write in ASCII
["(R)"] = "©",
["(TM)"] = "",
}
for text, result in pairs(abbreviations) do
vim.cmd.abbreviate(text, result)
end

View file

@ -0,0 +1,5 @@
" A few useful sets of abbreviations
" A few things that are hard to write in ASCII
abbreviate (R) ©
abbreviate (TM)

View file

@ -1,23 +0,0 @@
-- Show lines numbers
vim.opt.number = true
local numbertoggle = vim.api.nvim_create_augroup("numbertoggle", { clear = true })
-- Toggle numbers between relative and absolute when changing buffers
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, {
pattern = "*",
group = numbertoggle,
command = "if &nu | setlocal rnu | endif",
})
vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" }, {
pattern = "*",
group = numbertoggle,
command = "if &nu | setlocal nornu | endif",
})
-- Never show the sign column in a terminal buffer
vim.api.nvim_create_autocmd({ "TermOpen" }, {
pattern = "*",
group = numbertoggle,
command = "setlocal nonu nornu",
})

View file

@ -0,0 +1,13 @@
" Idea for toggling taken from jeffkreeftmeijer
" Show line numbers
set number
augroup numbertoggle
autocmd!
" Toggle numbers between relative and absolute when changing buffers
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu | set rnu | endif
autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
" Disable line numbers and relative line numbers in terminal
autocmd TermOpen * setlocal nonu nornu
augroup END

View file

@ -1,6 +1,7 @@
-- Show completion menu in all cases, and don't select anything
vim.opt.completeopt = { "menu", "menuone", "noselect" }
" Show completion menu in all cases, and don't select anything
set completeopt=menu,menuone,noselect
lua << EOF
local cmp = require("cmp")
local cmp_under_comparator = require("cmp-under-comparator")
local luasnip = require("luasnip")
@ -28,7 +29,7 @@ cmp.setup({
end,
["<C-n>"] = cmp.mapping(cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), { "i", "c" }),
["<C-p>"] = cmp.mapping(cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), { "i", "c" }),
["<C-d>"] = cmp.mapping.scroll_docs(-5),
["<C-d>"] = cmp.mapping.scroll_docs(-5),
["<C-f>"] = cmp.mapping.scroll_docs(5),
["<C-y>"] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = false }),
["<C-e>"] = cmp.mapping.abort(),
@ -60,3 +61,4 @@ cmp.setup({
ghost_text = true,
},
})
EOF

View file

@ -1,6 +1,8 @@
lua << EOF
local dressing = require("dressing")
dressing.setup({
-- Use a relative prompt size
prefer_width = 0.4,
})
EOF

View file

@ -1,5 +0,0 @@
-- Intercept all fold commands
-- stylua: ignore
vim.g.fastfold_fold_command_suffixes = {
"x", "X", "a", "A", "o", "O", "c", "C", "r", "R", "m", "M", "i", "n", "N",
}

View file

@ -0,0 +1,5 @@
" Intercept all fold commands
let g:fastfold_fold_command_suffixes=[
\ 'x', 'X', 'a', 'A', 'o', 'O', 'c', 'C',
\ 'r', 'R', 'm', 'M', 'i', 'n', 'N'
\ ]

View file

@ -1,4 +1,5 @@
local gitsigns = require("gitsigns")
lua << EOF
local gitsigns = require('gitsigns')
local wk = require("which-key")
gitsigns.setup({
@ -13,13 +14,13 @@ local keys = {
["[c"] = { "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'", "Previous hunk/diff", expr = true },
["]c"] = { "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", "Next hunk/diff", expr = true },
-- Commands
["<leader>g"] = {
name = "Git",
-- Actions
b = { gitsigns.toggle_current_line_blame, "Toggle blame virtual text" },
d = { gitsigns.diffthis, "Diff buffer" },
-- stylua: ignore
D = { function() gitsigns.diffthis("~") end, "Diff buffer against last commit" },
g = { "<cmd>Git<CR>", "Git status" },
h = { gitsigns.toggle_deleted, "Show deleted hunks" },
@ -56,3 +57,4 @@ local visual = {
wk.register(keys, { buffer = bufnr })
wk.register(objects, { buffer = bufnr, mode = "o" })
wk.register(visual, { buffer = bufnr, mode = "x" })
EOF

View file

@ -1,3 +1,4 @@
lua << EOF
local lspconfig = require("lspconfig")
local lsp = require("ambroisie.lsp")
local utils = require("ambroisie.utils")
@ -43,3 +44,4 @@ if utils.is_executable("rust-analyzer") then
on_attach = lsp.on_attach,
})
end
EOF

View file

@ -1,3 +1,4 @@
lua << EOF
local lualine = require("lualine")
local utils = require("ambroisie.utils")
@ -59,3 +60,4 @@ lualine.setup({
"quickfix",
},
})
EOF

View file

@ -1 +1,3 @@
lua << EOF
require("luasnip.loaders.from_vscode").lazy_load()
EOF

View file

@ -1,3 +1,4 @@
lua << EOF
local null_ls = require("null-ls")
local lsp = require("ambroisie.lsp")
local utils = require("ambroisie.utils")
@ -65,6 +66,7 @@ null_ls.register({
}),
})
-- Shell (non-POSIX)
null_ls.register({
null_ls.builtins.code_actions.shellcheck.with({
@ -97,7 +99,7 @@ null_ls.register({
-- Shell (POSIX)
null_ls.register({
null_ls.builtins.code_actions.shellcheck.with({
-- Restrict to POSIX sh
-- Restrict to POSIX sh
filetypes = { "sh" },
-- Only used if available
condition = utils.is_executable_condition("shellcheck"),
@ -120,3 +122,4 @@ null_ls.register({
condition = utils.is_executable_condition("shfmt"),
}),
})
EOF

View file

@ -0,0 +1,20 @@
" Which code-block languages should I expect to be high-lighted.
let g:pandoc#syntax#codeblocks#embeds#langs=[
\ "bash=sh",
\ "c",
\ "cpp",
\ "go",
\ "haskell",
\ "python",
\ "rust",
\ "sh",
\ "vim",
\ "yaml",
\ "tex",
\ "toml",
\ "perl",
\ "json",
\ "latex=tex",
\ "make",
\ "makefile=make",
\ ]

View file

@ -3,15 +3,15 @@ if not require("ambroisie.utils").is_ssh() then
end
local function copy(lines, _)
require("osc52").copy(table.concat(lines, "\n"))
require('osc52').copy(table.concat(lines, '\n'))
end
local function paste()
return { vim.fn.split(vim.fn.getreg(""), "\n"), vim.fn.getregtype("") }
return {vim.fn.split(vim.fn.getreg(''), '\n'), vim.fn.getregtype('')}
end
vim.g.clipboard = {
name = "osc52",
copy = { ["+"] = copy, ["*"] = copy },
paste = { ["+"] = paste, ["*"] = paste },
name = 'osc52',
copy = {['+'] = copy, ['*'] = copy},
paste = {['+'] = paste, ['*'] = paste},
}

View file

@ -1,3 +1,5 @@
lua << EOF
require("nvim-surround").setup({
-- No configuration at the moment
})
EOF

View file

@ -1,3 +1,4 @@
lua << EOF
local telescope = require("telescope")
telescope.setup({
@ -7,8 +8,8 @@ telescope.setup({
["<C-h>"] = "which_key",
-- I want the normal readline mappings rather than scrolling
["<C-u>"] = false,
},
},
}
}
},
extensions = {
fzf = {
@ -22,3 +23,4 @@ telescope.setup({
telescope.load_extension("fzf")
telescope.load_extension("lsp_handlers")
EOF

View file

@ -1,3 +1,4 @@
lua << EOF
local ts_config = require("nvim-treesitter.configs")
ts_config.setup({
highlight = {
@ -54,3 +55,4 @@ ts_config.setup({
},
},
})
EOF

View file

@ -1,2 +1,4 @@
lua << EOF
local wk = require("which-key")
wk.setup()
EOF

View file

@ -1,20 +0,0 @@
local signtoggle = vim.api.nvim_create_augroup("signtoggle", { clear = true })
-- Only show sign column for the currently focused buffer
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "WinEnter" }, {
pattern = "*",
group = signtoggle,
command = "setlocal signcolumn=yes",
})
vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "WinLeave" }, {
pattern = "*",
group = signtoggle,
command = "setlocal signcolumn=yes",
})
-- Never show the sign column in a terminal buffer
vim.api.nvim_create_autocmd({ "TermOpen" }, {
pattern = "*",
group = signtoggle,
command = "setlocal signcolumn=no",
})

View file

@ -0,0 +1,8 @@
augroup signtoggle
autocmd!
" Only show the sign column for the current focused buffer
autocmd BufEnter,FocusGained,WinEnter * set signcolumn=yes
autocmd BufLeave,FocusLost,WinLeave * set signcolumn=no
" Disable the sign column in terminal
autocmd TermOpen * setlocal signcolumn=no
augroup END