Compare commits
10 commits
d8896a66c8
...
b86d963a92
| Author | SHA1 | Date | |
|---|---|---|---|
| b86d963a92 | |||
| 78c524e19d | |||
| 1e9f6fe957 | |||
| c2d231d3f1 | |||
| 9530864b10 | |||
| e599a97e45 | |||
| 39c2e5db8c | |||
| dba8836381 | |||
| 36b0c67832 | |||
| 68b9c3b9b1 |
32 changed files with 82 additions and 106 deletions
1
.stylua.toml
Normal file
1
.stylua.toml
Normal file
|
|
@ -0,0 +1 @@
|
|||
indent_type = "Spaces"
|
||||
|
|
@ -22,6 +22,10 @@
|
|||
shellcheck = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
stylua = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
lua << EOF
|
||||
local wk = require("which-key")
|
||||
|
||||
local keys = {
|
||||
|
|
@ -9,4 +8,3 @@ local keys = {
|
|||
}
|
||||
|
||||
wk.register(keys, { prefix = "gc" })
|
||||
EOF
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
lua << EOF
|
||||
local wk = require("which-key")
|
||||
|
||||
local keys = {
|
||||
|
|
@ -6,4 +5,3 @@ local keys = {
|
|||
}
|
||||
|
||||
wk.register(keys, { prefix = "<leader>" })
|
||||
EOF
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
lua << EOF
|
||||
local wk = require("which-key")
|
||||
local telescope_builtin = require("telescope.builtin")
|
||||
|
||||
|
|
@ -14,5 +13,3 @@ local keys = {
|
|||
}
|
||||
|
||||
wk.register(keys, { prefix = "<leader>" })
|
||||
EOF
|
||||
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
lua << EOF
|
||||
local wk = require("which-key")
|
||||
|
||||
local motions = {
|
||||
|
|
@ -29,4 +28,3 @@ local objects = {
|
|||
|
||||
wk.register(motions, { mode = "n" })
|
||||
wk.register(objects, { mode = "o" })
|
||||
EOF
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
lua << EOF
|
||||
local wk = require("which-key")
|
||||
|
||||
local keys = {
|
||||
|
|
@ -31,7 +30,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",
|
||||
|
|
@ -61,7 +60,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
|
||||
|
|
@ -125,4 +124,3 @@ local keys = {
|
|||
}
|
||||
|
||||
wk.register(keys)
|
||||
EOF
|
||||
|
|
@ -54,8 +54,6 @@ in
|
|||
vim-beancount
|
||||
vim-jsonnet
|
||||
vim-nix
|
||||
vim-pandoc
|
||||
vim-pandoc-syntax
|
||||
vim-toml
|
||||
|
||||
# General enhancements
|
||||
|
|
|
|||
|
|
@ -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,5 +94,4 @@ M.on_attach = function(client, bufnr)
|
|||
wk.register(keys, { buffer = bufnr })
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ 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
|
||||
|
|
|
|||
9
home/vim/plugin/abbreviations.lua
Normal file
9
home/vim/plugin/abbreviations.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
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
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
" A few useful sets of abbreviations
|
||||
|
||||
" A few things that are hard to write in ASCII
|
||||
abbreviate (R) ©
|
||||
abbreviate (TM) ™
|
||||
23
home/vim/plugin/numbertoggle.lua
Normal file
23
home/vim/plugin/numbertoggle.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
-- 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",
|
||||
})
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
" 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
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
" Show completion menu in all cases, and don't select anything
|
||||
set completeopt=menu,menuone,noselect
|
||||
-- Show completion menu in all cases, and don't select anything
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
|
||||
lua << EOF
|
||||
local cmp = require("cmp")
|
||||
local cmp_under_comparator = require("cmp-under-comparator")
|
||||
local luasnip = require("luasnip")
|
||||
|
|
@ -29,7 +28,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(),
|
||||
|
|
@ -61,4 +60,3 @@ cmp.setup({
|
|||
ghost_text = true,
|
||||
},
|
||||
})
|
||||
EOF
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
lua << EOF
|
||||
local dressing = require("dressing")
|
||||
|
||||
dressing.setup({
|
||||
-- Use a relative prompt size
|
||||
prefer_width = 0.4,
|
||||
})
|
||||
EOF
|
||||
5
home/vim/plugin/settings/fastfold.lua
Normal file
5
home/vim/plugin/settings/fastfold.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
-- 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",
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
" 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'
|
||||
\ ]
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
lua << EOF
|
||||
local gitsigns = require('gitsigns')
|
||||
local gitsigns = require("gitsigns")
|
||||
local wk = require("which-key")
|
||||
|
||||
gitsigns.setup({
|
||||
|
|
@ -14,13 +13,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" },
|
||||
|
|
@ -57,4 +56,3 @@ local visual = {
|
|||
wk.register(keys, { buffer = bufnr })
|
||||
wk.register(objects, { buffer = bufnr, mode = "o" })
|
||||
wk.register(visual, { buffer = bufnr, mode = "x" })
|
||||
EOF
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
lua << EOF
|
||||
local lspconfig = require("lspconfig")
|
||||
local lsp = require("ambroisie.lsp")
|
||||
local utils = require("ambroisie.utils")
|
||||
|
|
@ -44,4 +43,3 @@ if utils.is_executable("rust-analyzer") then
|
|||
on_attach = lsp.on_attach,
|
||||
})
|
||||
end
|
||||
EOF
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
lua << EOF
|
||||
local lualine = require("lualine")
|
||||
local utils = require("ambroisie.utils")
|
||||
|
||||
|
|
@ -60,4 +59,3 @@ lualine.setup({
|
|||
"quickfix",
|
||||
},
|
||||
})
|
||||
EOF
|
||||
|
|
@ -1,3 +1 @@
|
|||
lua << EOF
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
EOF
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
lua << EOF
|
||||
local null_ls = require("null-ls")
|
||||
local lsp = require("ambroisie.lsp")
|
||||
local utils = require("ambroisie.utils")
|
||||
|
|
@ -66,7 +65,6 @@ null_ls.register({
|
|||
}),
|
||||
})
|
||||
|
||||
|
||||
-- Shell (non-POSIX)
|
||||
null_ls.register({
|
||||
null_ls.builtins.code_actions.shellcheck.with({
|
||||
|
|
@ -99,7 +97,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"),
|
||||
|
|
@ -122,4 +120,3 @@ null_ls.register({
|
|||
condition = utils.is_executable_condition("shfmt"),
|
||||
}),
|
||||
})
|
||||
EOF
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
" 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",
|
||||
\ ]
|
||||
|
|
@ -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 },
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
lua << EOF
|
||||
require("nvim-surround").setup({
|
||||
-- No configuration at the moment
|
||||
})
|
||||
EOF
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
lua << EOF
|
||||
local telescope = require("telescope")
|
||||
|
||||
telescope.setup({
|
||||
|
|
@ -8,8 +7,8 @@ telescope.setup({
|
|||
["<C-h>"] = "which_key",
|
||||
-- I want the normal readline mappings rather than scrolling
|
||||
["<C-u>"] = false,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
|
|
@ -23,4 +22,3 @@ telescope.setup({
|
|||
|
||||
telescope.load_extension("fzf")
|
||||
telescope.load_extension("lsp_handlers")
|
||||
EOF
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
lua << EOF
|
||||
local ts_config = require("nvim-treesitter.configs")
|
||||
ts_config.setup({
|
||||
highlight = {
|
||||
|
|
@ -55,4 +54,3 @@ ts_config.setup({
|
|||
},
|
||||
},
|
||||
})
|
||||
EOF
|
||||
|
|
@ -1,4 +1,2 @@
|
|||
lua << EOF
|
||||
local wk = require("which-key")
|
||||
wk.setup()
|
||||
EOF
|
||||
20
home/vim/plugin/signtoggle.lua
Normal file
20
home/vim/plugin/signtoggle.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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",
|
||||
})
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue