Use nixvim
This commit is contained in:
parent
f0217e4640
commit
ecb2a05d60
72 changed files with 691 additions and 1664 deletions
146
flake.lock
generated
146
flake.lock
generated
|
@ -80,6 +80,27 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-parts": {
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": [
|
||||||
|
"nixvim",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1743550720,
|
||||||
|
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-parts_2": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": [
|
"nixpkgs-lib": [
|
||||||
"nur",
|
"nur",
|
||||||
|
@ -100,6 +121,24 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533236,
|
||||||
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
@ -142,6 +181,34 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ixx": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": [
|
||||||
|
"nixvim",
|
||||||
|
"nuschtosSearch",
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixvim",
|
||||||
|
"nuschtosSearch",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1748294338,
|
||||||
|
"narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=",
|
||||||
|
"owner": "NuschtOS",
|
||||||
|
"repo": "ixx",
|
||||||
|
"rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NuschtOS",
|
||||||
|
"ref": "v0.0.8",
|
||||||
|
"repo": "ixx",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1748634340,
|
"lastModified": 1748634340,
|
||||||
|
@ -258,9 +325,32 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nur": {
|
"nixvim": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nuschtosSearch": "nuschtosSearch",
|
||||||
|
"systems": "systems_3"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1748564405,
|
||||||
|
"narHash": "sha256-uCmQLJmdg0gKWBs+vhNmS9RIPJW8/ddo6TvQ/a4gupc=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixvim",
|
||||||
|
"rev": "8b3a69cfea5ba2fa008c6c57ab79c99c513a349b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nur": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-parts": "flake-parts_2",
|
||||||
"nixpkgs": "nixpkgs_4",
|
"nixpkgs": "nixpkgs_4",
|
||||||
"treefmt-nix": "treefmt-nix"
|
"treefmt-nix": "treefmt-nix"
|
||||||
},
|
},
|
||||||
|
@ -278,6 +368,29 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nuschtosSearch": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"ixx": "ixx",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixvim",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1748298102,
|
||||||
|
"narHash": "sha256-PP11GVwUt7F4ZZi5A5+99isuq39C59CKc5u5yVisU/U=",
|
||||||
|
"owner": "NuschtOS",
|
||||||
|
"repo": "search",
|
||||||
|
"rev": "f8a1c221afb8b4c642ed11ac5ee6746b0fe1d32f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NuschtOS",
|
||||||
|
"repo": "search",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"agenix": "agenix",
|
"agenix": "agenix",
|
||||||
|
@ -287,6 +400,7 @@
|
||||||
"nixos-wsl": "nixos-wsl",
|
"nixos-wsl": "nixos-wsl",
|
||||||
"nixpkgs": "nixpkgs_3",
|
"nixpkgs": "nixpkgs_3",
|
||||||
"nixpkgs-stable": "nixpkgs-stable",
|
"nixpkgs-stable": "nixpkgs-stable",
|
||||||
|
"nixvim": "nixvim",
|
||||||
"nur": "nur"
|
"nur": "nur"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -305,6 +419,36 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"systems_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems_3": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"treefmt-nix": {
|
"treefmt-nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
|
|
||||||
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
|
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
|
||||||
|
|
||||||
|
nixvim.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
nixvim.url = "github:nix-community/nixvim";
|
||||||
|
|
||||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
|
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/spell/*.spl
|
|
|
@ -1,8 +0,0 @@
|
||||||
vim.opt_local.colorcolumn = "50,72"
|
|
||||||
vim.opt_local.spell = true
|
|
||||||
vim.opt_local.textwidth = 72
|
|
||||||
|
|
||||||
-- autocmd FileType gitcommit highlight ColorColumn ctermbg=8
|
|
||||||
-- filetype indent on
|
|
||||||
-- filetype on
|
|
||||||
-- filetype plugin on
|
|
|
@ -1,9 +0,0 @@
|
||||||
-- TODO: Interim fix for https://github.com/nvim-treesitter/nvim-treesitter-context/issues/431.
|
|
||||||
vim.opt_local.spell = true
|
|
||||||
vim.opt_local.wrap = true
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>su", "Bi{{site.url}}/<Esc>")
|
|
||||||
|
|
||||||
-- Convert lines into a markdown list.
|
|
||||||
vim.keymap.set("n", "<leader>l", "vip:norm I- <CR>")
|
|
||||||
vim.keymap.set("v", "<leader>l", ":norm I- <CR>")
|
|
|
@ -1,3 +0,0 @@
|
||||||
vim.keymap.set("v", "<leader>dd", "yodd(['<Esc>pA', <Esc>pA]);<Esc>")
|
|
||||||
vim.keymap.set("v", "<leader>du", "yodump(['<Esc>pA', <Esc>pA]);<Esc>")
|
|
||||||
vim.keymap.set("v", "<leader>vd", "yovar_dump(['<Esc>pA', <Esc>pA]);<Esc>")
|
|
|
@ -1,20 +0,0 @@
|
||||||
local opt = vim.opt_local
|
|
||||||
|
|
||||||
opt.spell = true
|
|
||||||
opt.wrap = true
|
|
||||||
|
|
||||||
local cmp = require "cmp"
|
|
||||||
local sources = cmp.get_config().sources
|
|
||||||
|
|
||||||
-- TODO: confirm these aren't aleady in the list of sources to avoid duplicate suggestions.
|
|
||||||
table.insert(sources, { name = "buffer" })
|
|
||||||
table.insert(sources, { name = "path" })
|
|
||||||
|
|
||||||
cmp.setup.buffer { sources = sources }
|
|
||||||
|
|
||||||
-- Convert lines into a list.
|
|
||||||
vim.keymap.set("n", "<leader>l", "vip:norm I* <CR>")
|
|
||||||
vim.keymap.set("v", "<leader>l", ":norm I* <CR>")
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>ta", '_iTextAnnotation "<Esc>A"<Esc>j')
|
|
||||||
vim.keymap.set("v", "<leader>ta", ':norm ITextAnnotation "<Esc>gv:norm A"<Esc>')
|
|
|
@ -1,4 +0,0 @@
|
||||||
setlocal norelativenumber
|
|
||||||
setlocal nonumber
|
|
||||||
|
|
||||||
setlocal scrolloff=0
|
|
|
@ -1,21 +0,0 @@
|
||||||
local opt = vim.opt_local
|
|
||||||
|
|
||||||
opt.number = false
|
|
||||||
opt.relativenumber = false
|
|
||||||
opt.spell = true
|
|
||||||
opt.wrap = true
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
||||||
buffer = 0,
|
|
||||||
callback = function()
|
|
||||||
local last_line = vim.api.nvim_buf_get_lines(0, -2, -1, false)[1]
|
|
||||||
|
|
||||||
if last_line ~= "" then
|
|
||||||
vim.api.nvim_buf_set_lines(0, -1, -1, false, { "" })
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Convert lines into a markdown list.
|
|
||||||
vim.keymap.set("n", "<leader>l", "vip:norm I- <CR>")
|
|
||||||
vim.keymap.set("v", "<leader>l", ":norm I- <CR>")
|
|
|
@ -1,12 +0,0 @@
|
||||||
if !exists('*opdavies#save_and_exec')
|
|
||||||
function! opdavies#save_and_exec() abort
|
|
||||||
if &filetype == 'vim'
|
|
||||||
:silent! write
|
|
||||||
:source %
|
|
||||||
elseif &filetype == 'lua'
|
|
||||||
:silent! write
|
|
||||||
:luafile %
|
|
||||||
endif
|
|
||||||
return
|
|
||||||
endfunction
|
|
||||||
endif
|
|
|
@ -1 +0,0 @@
|
||||||
require "opdavies"
|
|
|
@ -1,13 +0,0 @@
|
||||||
P = function(v)
|
|
||||||
print(vim.inspect(v))
|
|
||||||
return v
|
|
||||||
end
|
|
||||||
|
|
||||||
RELOAD = function(...)
|
|
||||||
return require("plenary.reload").reload_module(...)
|
|
||||||
end
|
|
||||||
|
|
||||||
R = function(name)
|
|
||||||
RELOAD(name)
|
|
||||||
return require(name)
|
|
||||||
end
|
|
|
@ -1,4 +0,0 @@
|
||||||
require "opdavies.globals"
|
|
||||||
require "opdavies.options"
|
|
||||||
require "opdavies.keymaps"
|
|
||||||
require "opdavies.lsp"
|
|
|
@ -1,121 +0,0 @@
|
||||||
local set = vim.keymap.set
|
|
||||||
|
|
||||||
set("n", "<C-f>", "<cmd>silent !tmux new-window tmux-sessionizer<CR>")
|
|
||||||
|
|
||||||
-- Execute Lua in the current file, line or range.
|
|
||||||
set("n", "<leader><leader>x", "<cmd>source %<CR>")
|
|
||||||
set("n", "<leader>x", ":.lua<CR>")
|
|
||||||
set("v", "<leader>x", ":lua<CR>")
|
|
||||||
|
|
||||||
-- Yank from the current column to the end of the line
|
|
||||||
set("n", "Y", "yg$")
|
|
||||||
|
|
||||||
-- Keep things centred
|
|
||||||
set("n", "n", "nzzzv")
|
|
||||||
set("n", "N", "Nzzzv")
|
|
||||||
|
|
||||||
-- Disable up and down arrow keys.
|
|
||||||
set("v", "<down>", "<nop>")
|
|
||||||
set("v", "<up>", "<nop>")
|
|
||||||
|
|
||||||
set("n", "<Left>", "gT")
|
|
||||||
set("n", "<Right>", "gt")
|
|
||||||
|
|
||||||
-- Easily switch back to visual mode.
|
|
||||||
set("i", "jj", "<Esc>")
|
|
||||||
set("i", "jk", "<Esc>")
|
|
||||||
|
|
||||||
-- Easy insertion of a trailing ; or , from insert mode
|
|
||||||
set("i", ",,", "<Esc>A,<Esc>")
|
|
||||||
set("i", ";;", "<Esc>A;<Esc>")
|
|
||||||
|
|
||||||
-- Automatically resize buffers.
|
|
||||||
set("n", "<leader>=", ":wincmd =<cr>", { noremap = true, silent = true })
|
|
||||||
|
|
||||||
-- Move line(s) up and down.
|
|
||||||
local opts = { noremap = true, silent = true }
|
|
||||||
set("i", "<M-j>", "<Esc>:m .+1<CR>==gi", opts)
|
|
||||||
set("i", "<M-k>", "<Esc>:m .-2<CR>==gi", opts)
|
|
||||||
set("n", "<M-j>", ":m .+1<CR>==", opts)
|
|
||||||
set("n", "<M-k>", ":m .-2<CR>==", opts)
|
|
||||||
set("v", "<M-j>", ":m '>+1<CR>gv=gv", opts)
|
|
||||||
set("v", "<M-k>", ":m '<-2<CR>gv=gv", opts)
|
|
||||||
|
|
||||||
-- Re-centre when navigating.
|
|
||||||
set("n", "#", "#zz", opts)
|
|
||||||
set("n", "%", "%zz", opts)
|
|
||||||
set("n", "*", "*zz", opts)
|
|
||||||
set("n", "<C-d>", "<C-d>zz", opts)
|
|
||||||
set("n", "<C-i>", "<C-i>zz", opts)
|
|
||||||
set("n", "<C-o>", "<C-o>zz", opts)
|
|
||||||
set("n", "<C-u>", "<C-u>zz", opts)
|
|
||||||
set("n", "G", "Gzz", opts)
|
|
||||||
set("n", "N", "Nzz", opts)
|
|
||||||
set("n", "gg", "ggzz", opts)
|
|
||||||
set("n", "n", "Nzz", opts)
|
|
||||||
set("n", "{", "{zz", opts)
|
|
||||||
set("n", "}", "}zz", opts)
|
|
||||||
|
|
||||||
-- Clears hlsearch after doing a search, otherwise just does normal <CR> stuff
|
|
||||||
vim.cmd [[ nnoremap <expr> <CR> {-> v:hlsearch ? ":nohl\<CR>" : "\<CR>"}() ]]
|
|
||||||
|
|
||||||
-- Quicker macro playback.
|
|
||||||
set("n", "Q", "@qj")
|
|
||||||
set("x", "Q", ":norm @q<CR>")
|
|
||||||
|
|
||||||
set("v", "Q", "<nop>")
|
|
||||||
|
|
||||||
set("v", "J", ":m '>+1<CR>gvrgv")
|
|
||||||
set("v", "K", ":m '<-2<CR>gv=gv")
|
|
||||||
|
|
||||||
set("n", "J", "mzJ`z")
|
|
||||||
set("n", "<C-d>", "<C-d>zz")
|
|
||||||
set("n", "<C-u>", "<C-u>zz")
|
|
||||||
set("n", "n", "nzzzv")
|
|
||||||
set("n", "N", "Nzzzv")
|
|
||||||
|
|
||||||
set("n", "<leader>ec", ":edit composer.json<CR>")
|
|
||||||
set("n", "<leader>ef", ":edit flake.nix<CR>")
|
|
||||||
set("n", "<leader>ej", ":edit justfile<CR>")
|
|
||||||
set("n", "<leader>en", ":edit notes.txt<CR>")
|
|
||||||
set("n", "<leader>er", ":edit run<CR>")
|
|
||||||
set("n", "<leader>et", function() vim.cmd.tabnew("todo.txt") end)
|
|
||||||
|
|
||||||
set({ "n", "v" }, "<leader>y", [["+y]])
|
|
||||||
set("n", "<leader>Y", [["+Y]])
|
|
||||||
|
|
||||||
-- Re-add functionality to open the URL under the cursor.
|
|
||||||
-- This is overridden by mini.operators to exchange text regions.
|
|
||||||
vim.keymap.set("n", "<leader>gx", function()
|
|
||||||
local url = vim.fn.expand "<cfile>"
|
|
||||||
vim.fn["netrw#BrowseX"](url, 0)
|
|
||||||
end, { desc = "Open URL under cursor" })
|
|
||||||
|
|
||||||
set("n", "<leader>f", vim.lsp.buf.format);
|
|
||||||
|
|
||||||
local notes_directory = os.getenv("NOTES_DIRECTORY")
|
|
||||||
local wiki_directory = os.getenv("XDG_DOCUMENTS_DIR") .. "/wiki"
|
|
||||||
|
|
||||||
set("n", "<leader>gn", function()
|
|
||||||
require("telescope.builtin").live_grep({
|
|
||||||
cwd = notes_directory,
|
|
||||||
})
|
|
||||||
end)
|
|
||||||
|
|
||||||
set("n", "<leader>n", function()
|
|
||||||
local filepath = string.format("%s/%s.txt", notes_directory, os.date("%Y-%m-%d"))
|
|
||||||
|
|
||||||
vim.cmd.tabnew(vim.fn.fnameescape(filepath))
|
|
||||||
end)
|
|
||||||
|
|
||||||
set("n", "<leader>fw", function()
|
|
||||||
require("telescope.builtin").find_files({
|
|
||||||
cwd = wiki_directory,
|
|
||||||
})
|
|
||||||
end)
|
|
||||||
|
|
||||||
set("n", "<leader>gw", function()
|
|
||||||
require("telescope.builtin").live_grep({
|
|
||||||
cwd = wiki_directory,
|
|
||||||
})
|
|
||||||
end)
|
|
|
@ -1,73 +0,0 @@
|
||||||
local M = {}
|
|
||||||
|
|
||||||
local function should_remove_diagnostic(messages_to_filter, message)
|
|
||||||
for _, filter_message in ipairs(messages_to_filter) do
|
|
||||||
if message:match(filter_message) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
M.definition = function()
|
|
||||||
local params = vim.lsp.util.make_position_params()
|
|
||||||
|
|
||||||
vim.lsp.buf_request(0, "textDocument/definition", params, function(err, result, ctx, config)
|
|
||||||
local bufnr = ctx.bufnr
|
|
||||||
local ft = vim.api.nvim_buf_get_option(bufnr, "filetype")
|
|
||||||
|
|
||||||
local new_result = vim.tbl_filter(function(v)
|
|
||||||
-- Remove any definitions within the nix store via the .direnv directory.
|
|
||||||
if string.find(v.targetUri, ".direnv") then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Remove definitions within vendor-bin directory for PHP files.
|
|
||||||
if ft == "php" then
|
|
||||||
if string.find(v.targetUri, "vendor%-bin") then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return true
|
|
||||||
end, result)
|
|
||||||
|
|
||||||
if #new_result > 0 then
|
|
||||||
result = new_result
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/definition"](err, result, ctx, config)
|
|
||||||
vim.cmd [[normal! zz]]
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
M.on_publish_diagnostics = function(_, result, ctx, config)
|
|
||||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
|
||||||
|
|
||||||
if client.name == "cssls" then
|
|
||||||
local filtered_diagnostics = {}
|
|
||||||
|
|
||||||
local messages_to_filter = {
|
|
||||||
"Unknown at rule @apply",
|
|
||||||
"Unknown at rule @plugin",
|
|
||||||
"Unknown at rule @tailwind",
|
|
||||||
"Unknown at rule @theme",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- For each diagnostic, ensure its mesages doesn't match one I want to
|
|
||||||
-- ignore before adding it to the result. If it matches, don't add it to the
|
|
||||||
-- result and it won't be shown.
|
|
||||||
for _, diagnostic in ipairs(result.diagnostics) do
|
|
||||||
if not should_remove_diagnostic(messages_to_filter, diagnostic.message) then
|
|
||||||
table.insert(filtered_diagnostics, diagnostic)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
result.diagnostics = filtered_diagnostics
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics(_, result, ctx, config)
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
|
@ -1,24 +0,0 @@
|
||||||
vim.diagnostic.config {
|
|
||||||
float = { source = true },
|
|
||||||
signs = true,
|
|
||||||
underline = false,
|
|
||||||
update_in_insert = false,
|
|
||||||
virtual_text = { spacing = 2 },
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
|
||||||
callback = function()
|
|
||||||
local builtin = require "telescope.builtin"
|
|
||||||
|
|
||||||
vim.keymap.set("n", "gd", builtin.lsp_definitions, { buffer = 0 })
|
|
||||||
vim.keymap.set("n", "gr", builtin.lsp_references, { buffer = 0 })
|
|
||||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { buffer = 0 })
|
|
||||||
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition, { buffer = 0 })
|
|
||||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = 0 })
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { buffer = 0 })
|
|
||||||
vim.keymap.set("n", "<leader>cr", vim.lsp.buf.rename, { buffer = 0 })
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>dl", vim.diagnostic.setqflist, { buffer = 0 })
|
|
||||||
end,
|
|
||||||
})
|
|
|
@ -1,53 +0,0 @@
|
||||||
vim.g.mapleader = " "
|
|
||||||
vim.g.snippets = "luasnip"
|
|
||||||
|
|
||||||
local settings = {
|
|
||||||
autoindent = true,
|
|
||||||
backup = false,
|
|
||||||
breakindent = true,
|
|
||||||
expandtab = true,
|
|
||||||
exrc = true,
|
|
||||||
foldlevel = 1,
|
|
||||||
foldlevelstart = 99,
|
|
||||||
foldmethod = "indent",
|
|
||||||
formatoptions = "clqjp",
|
|
||||||
hidden = false,
|
|
||||||
hlsearch = false,
|
|
||||||
inccommand = "split",
|
|
||||||
laststatus = 3,
|
|
||||||
linebreak = true,
|
|
||||||
list = true,
|
|
||||||
mouse = "a",
|
|
||||||
number = true,
|
|
||||||
pumblend = 10,
|
|
||||||
pumheight = 10,
|
|
||||||
relativenumber = true,
|
|
||||||
scrolloff = 5,
|
|
||||||
shiftwidth = 2,
|
|
||||||
showmode = false,
|
|
||||||
signcolumn = "yes:1",
|
|
||||||
smartindent = true,
|
|
||||||
softtabstop = 2,
|
|
||||||
spellfile = "/home/opdavies/Code/personal/nixos-config/modules/home-manager/cli/neovim/config/spell/en.utf-8.add",
|
|
||||||
splitbelow = true,
|
|
||||||
splitright = true,
|
|
||||||
swapfile = false,
|
|
||||||
syntax = "on",
|
|
||||||
tabstop = 2,
|
|
||||||
termguicolors = true,
|
|
||||||
textwidth = 0,
|
|
||||||
undodir = os.getenv "XDG_STATE_HOME" .. "/nvim/undodir",
|
|
||||||
undofile = true,
|
|
||||||
updatetime = 1000,
|
|
||||||
wrap = false,
|
|
||||||
}
|
|
||||||
|
|
||||||
for key, value in pairs(settings) do
|
|
||||||
vim.o[key] = value
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.opt.backupdir:remove "." -- keep backups out of the current directory
|
|
||||||
vim.opt.completeopt = { "menu", "menuone", "noinsert", "noselect" }
|
|
||||||
vim.opt.listchars:append {
|
|
||||||
trail = "·",
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
require("luasnip.session.snippet_collection").clear_snippets "javascript"
|
|
||||||
|
|
||||||
local ls = require "luasnip"
|
|
||||||
|
|
||||||
local i = ls.insert_node
|
|
||||||
local s = ls.snippet
|
|
||||||
|
|
||||||
local fmta = require("luasnip.extras.fmt").fmta
|
|
||||||
|
|
||||||
ls.add_snippets("javascript", {
|
|
||||||
s("log", fmta("console.log(<>);", { i(1, "value") })),
|
|
||||||
})
|
|
|
@ -1,23 +0,0 @@
|
||||||
require("luasnip.session.snippet_collection").clear_snippets "lua"
|
|
||||||
|
|
||||||
local ls = require "luasnip"
|
|
||||||
|
|
||||||
local f = ls.function_node
|
|
||||||
local i = ls.insert_node
|
|
||||||
local s = ls.snippet
|
|
||||||
|
|
||||||
local fmt = require("luasnip.extras.fmt").fmt
|
|
||||||
|
|
||||||
ls.add_snippets("lua", {
|
|
||||||
s(
|
|
||||||
"req",
|
|
||||||
fmt([[local {} = require "{}"]], {
|
|
||||||
f(function(import_name)
|
|
||||||
local parts = vim.split(import_name[1][1], ".", true)
|
|
||||||
|
|
||||||
return parts[#parts] or ""
|
|
||||||
end, { 1 }),
|
|
||||||
i(1),
|
|
||||||
})
|
|
||||||
),
|
|
||||||
})
|
|
|
@ -1,120 +0,0 @@
|
||||||
require("luasnip.session.snippet_collection").clear_snippets "nix"
|
|
||||||
|
|
||||||
local ls = require "luasnip"
|
|
||||||
|
|
||||||
local i = ls.insert_node
|
|
||||||
local s = ls.snippet
|
|
||||||
|
|
||||||
local fmta = require("luasnip.extras.fmt").fmta
|
|
||||||
|
|
||||||
ls.add_snippets("nix", {
|
|
||||||
s("home_packages", fmta("home.packages = with pkgs; [ <> ];", i(0))),
|
|
||||||
|
|
||||||
s(
|
|
||||||
"homepage_options",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
homepage.name = mkOption {
|
|
||||||
default = "<name>";
|
|
||||||
type = types.str;
|
|
||||||
};
|
|
||||||
|
|
||||||
homepage.description = mkOption {
|
|
||||||
default = "<description>";
|
|
||||||
type = types.str;
|
|
||||||
};
|
|
||||||
|
|
||||||
homepage.icon = mkOption {
|
|
||||||
default = "<icon>";
|
|
||||||
type = types.str;
|
|
||||||
};
|
|
||||||
|
|
||||||
homepage.category = mkOption {
|
|
||||||
default = "<finish>";
|
|
||||||
type = types.str;
|
|
||||||
};
|
|
||||||
]],
|
|
||||||
{
|
|
||||||
description = i(2),
|
|
||||||
finish = i(0),
|
|
||||||
icon = i(3),
|
|
||||||
name = i(1),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
s(
|
|
||||||
"imports",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
<>
|
|
||||||
];
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
{ i(0) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
s(
|
|
||||||
"new_flake",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
{
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";<inputs>
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs =
|
|
||||||
{ nixpkgs, ... }:
|
|
||||||
let
|
|
||||||
system = "x86_64-linux";
|
|
||||||
pkgs = import nixpkgs { inherit system; };
|
|
||||||
|
|
||||||
inherit (pkgs) mkShell;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
devShells.${system}.default = mkShell {
|
|
||||||
packages = with pkgs; [ <pkgs> ];
|
|
||||||
};<finish>
|
|
||||||
|
|
||||||
formatter.${system} = pkgs.nixfmt-classic;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
{ inputs = i(1), pkgs = i(2), finish = i(0) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
s(
|
|
||||||
"new_module",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
{ config, lib, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
name = "<name>";
|
|
||||||
cfg = config.<namespace>.${name};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.<namespace>.${name} = {
|
|
||||||
enable = lib.mkEnableOption "Enable ${name}";<more_options>
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
<finish>
|
|
||||||
};
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
{
|
|
||||||
finish = i(0),
|
|
||||||
more_options = i(3),
|
|
||||||
name = i(1),
|
|
||||||
namespace = i(2),
|
|
||||||
},
|
|
||||||
{ repeat_duplicates = true }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
s("system_packages", fmta("environment.systemPackages = with pkgs; [<>];", i(0))),
|
|
||||||
})
|
|
|
@ -1,66 +0,0 @@
|
||||||
require("luasnip.session.snippet_collection").clear_snippets "php"
|
|
||||||
|
|
||||||
local ls = require "luasnip"
|
|
||||||
|
|
||||||
local c = ls.choice_node
|
|
||||||
local i = ls.insert_node
|
|
||||||
local s = ls.snippet
|
|
||||||
local t = ls.text_node
|
|
||||||
|
|
||||||
local fmta = require("luasnip.extras.fmt").fmta
|
|
||||||
|
|
||||||
ls.add_snippets("php", {
|
|
||||||
s("func", fmta("function <>(<>)<> {\n <>\n}<>", { i(1), i(2), i(3), i(4), i(0) })),
|
|
||||||
|
|
||||||
s(
|
|
||||||
"met",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
<> function <>(<>)<> {
|
|
||||||
<>
|
|
||||||
}<>
|
|
||||||
]],
|
|
||||||
{ c(1, { t "public", t "protected", t "private" }), i(2), i(3), i(4), i(5), i(0) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
s("pest", fmta("<>('<>', function() {\n <>\n});", { c(1, { t "it", t "test" }), i(2), i(0) })),
|
|
||||||
|
|
||||||
s(
|
|
||||||
"test",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
public function test<>(): void {
|
|
||||||
<>
|
|
||||||
}<>
|
|
||||||
]],
|
|
||||||
{ i(1), i(2), i(0) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
s(
|
|
||||||
"testan",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
/** @test */
|
|
||||||
public function <>(): void {
|
|
||||||
<>
|
|
||||||
}<>
|
|
||||||
]],
|
|
||||||
{ i(1), i(2), i(0) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
s(
|
|
||||||
"testat",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
[#Test]
|
|
||||||
public function <>(): void {
|
|
||||||
<>
|
|
||||||
}<>
|
|
||||||
]],
|
|
||||||
{ i(1), i(2), i(0) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
})
|
|
|
@ -1,63 +0,0 @@
|
||||||
require("luasnip.session.snippet_collection").clear_snippets "rst"
|
|
||||||
|
|
||||||
local ls = require "luasnip"
|
|
||||||
|
|
||||||
local i = ls.insert_node
|
|
||||||
local f = ls.function_node
|
|
||||||
local s = ls.snippet
|
|
||||||
local t = ls.text_node
|
|
||||||
|
|
||||||
local fmta = require("luasnip.extras.fmt").fmta
|
|
||||||
|
|
||||||
local fill_line = function(char)
|
|
||||||
return function()
|
|
||||||
local row = vim.api.nvim_win_get_cursor(0)[1]
|
|
||||||
local lines = vim.api.nvim_buf_get_lines(0, row - 2, row, false)
|
|
||||||
return string.rep(char, #lines[1])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
ls.add_snippets("rst", {
|
|
||||||
s("class", t(".. class:: ", i(1))),
|
|
||||||
|
|
||||||
s("footer", t(".. footer:: ", i(1))),
|
|
||||||
|
|
||||||
s("link", t(".. _", i(1), ":")),
|
|
||||||
|
|
||||||
s("raw", t(".. raw:: ", i(1))),
|
|
||||||
|
|
||||||
-- TODO: add an optional new line and ":width" property.
|
|
||||||
s("image", t(".. image:: ", i(1))),
|
|
||||||
|
|
||||||
s("head", f(fill_line "=", {})),
|
|
||||||
|
|
||||||
s("sub", f(fill_line "-", {})),
|
|
||||||
|
|
||||||
s("subsub", f(fill_line "^", {})),
|
|
||||||
|
|
||||||
-- Add a page break with an optional page template.
|
|
||||||
s(
|
|
||||||
"pb",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
.. raw:: pdf
|
|
||||||
|
|
||||||
PageBreak<>
|
|
||||||
]],
|
|
||||||
{ i(0) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
-- Add a new speaker note.
|
|
||||||
s(
|
|
||||||
"ta",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
.. raw:: pdf
|
|
||||||
|
|
||||||
TextAnnotation "<>"
|
|
||||||
]],
|
|
||||||
{ i(0) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
})
|
|
|
@ -1,12 +0,0 @@
|
||||||
require("luasnip.session.snippet_collection").clear_snippets "scss"
|
|
||||||
|
|
||||||
local ls = require "luasnip"
|
|
||||||
|
|
||||||
local i = ls.insert_node
|
|
||||||
local s = ls.snippet
|
|
||||||
|
|
||||||
local fmta = require("luasnip.extras.fmt").fmta
|
|
||||||
|
|
||||||
ls.add_snippets("scss", {
|
|
||||||
s("bp", fmta("@include breakpoint(<>) {\n <>\n}", { i(1), i(0) })),
|
|
||||||
})
|
|
|
@ -1,28 +0,0 @@
|
||||||
require("luasnip.session.snippet_collection").clear_snippets "twig"
|
|
||||||
|
|
||||||
local ls = require "luasnip"
|
|
||||||
|
|
||||||
local s = ls.snippet
|
|
||||||
local i = ls.insert_node
|
|
||||||
|
|
||||||
local fmta = require("luasnip.extras.fmt").fmta
|
|
||||||
|
|
||||||
ls.add_snippets("twig", {
|
|
||||||
s("do", fmta("{% <> %}<>", { i(1), i(0) })),
|
|
||||||
s("dump", fmta("{{ dump(<>) }}<>", { i(1), i(0) })),
|
|
||||||
s("echo", fmta("{{ <> }}<>", { i(1), i(0) })),
|
|
||||||
|
|
||||||
s(
|
|
||||||
"for",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
{% for <> in <> %}
|
|
||||||
<>
|
|
||||||
{% endfor %}<>
|
|
||||||
]],
|
|
||||||
{ i(1), i(2), i(3), i(0) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
s("if", fmta("{% if <> %}<>{% endif %}<>", { i(1), i(2), i(0) })),
|
|
||||||
})
|
|
|
@ -1,47 +0,0 @@
|
||||||
require("luasnip.session.snippet_collection").clear_snippets "yaml"
|
|
||||||
|
|
||||||
local ls = require "luasnip"
|
|
||||||
|
|
||||||
local c = ls.choice_node
|
|
||||||
local i = ls.insert_node
|
|
||||||
local s = ls.snippet
|
|
||||||
local t = ls.text_node
|
|
||||||
|
|
||||||
local fmta = require("luasnip.extras.fmt").fmta
|
|
||||||
local rep = require("luasnip.extras").rep
|
|
||||||
|
|
||||||
ls.add_snippets("yaml", {
|
|
||||||
s(
|
|
||||||
"drupal_info",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
name: <module_name>
|
|
||||||
description: <description>
|
|
||||||
core_version_requirement: ^10 || ^11
|
|
||||||
type: <type>
|
|
||||||
package: <package>
|
|
||||||
]],
|
|
||||||
{ module_name = i(1), description = i(2), type = c(3, { t "module", t "theme" }), package = i(0) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
|
|
||||||
s(
|
|
||||||
"drupal_route",
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
<module>.<route>:
|
|
||||||
path: /<path>
|
|
||||||
defaults:
|
|
||||||
_controller: Drupal\<module_same>\Controller\<class>
|
|
||||||
# _form:
|
|
||||||
# _title:
|
|
||||||
# _title_callback:
|
|
||||||
methods: [GET]
|
|
||||||
requirements:
|
|
||||||
_permission: access content
|
|
||||||
# _access: TRUE<finish>
|
|
||||||
]],
|
|
||||||
{ module = i(1), route = i(2), path = i(3), module_same = rep(1), class = i(4), finish = i(0) }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
})
|
|
|
@ -1,57 +0,0 @@
|
||||||
local conf = require("telescope.config").values
|
|
||||||
local finders = require "telescope.finders"
|
|
||||||
local make_entry = require "telescope.make_entry"
|
|
||||||
local pickers = require "telescope.pickers"
|
|
||||||
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
local live_multigrep = function(opts)
|
|
||||||
opts = opts or {}
|
|
||||||
opts.cwd = opts.cwd or vim.uv.cwd()
|
|
||||||
|
|
||||||
local finder = finders.new_async_job {
|
|
||||||
command_generator = function(prompt)
|
|
||||||
if not prompt or prompt == "" then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local pieces = vim.split(prompt, " ")
|
|
||||||
local args = { "rg" }
|
|
||||||
|
|
||||||
if pieces[1] then
|
|
||||||
table.insert(args, "-e")
|
|
||||||
table.insert(args, pieces[1])
|
|
||||||
end
|
|
||||||
|
|
||||||
if pieces[2] then
|
|
||||||
table.insert(args, "-g")
|
|
||||||
table.insert(args, pieces[2])
|
|
||||||
end
|
|
||||||
|
|
||||||
---@diagnostic disable-next-line: deprecated
|
|
||||||
return vim.tbl_flatten {
|
|
||||||
args,
|
|
||||||
{ "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" },
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
|
|
||||||
cwd = opts.cwd,
|
|
||||||
entry_maker = make_entry.gen_from_vimgrep(opts),
|
|
||||||
}
|
|
||||||
|
|
||||||
pickers
|
|
||||||
.new(opts, {
|
|
||||||
debounce = 100,
|
|
||||||
finder = finder,
|
|
||||||
previewer = conf.grep_previewer(opts),
|
|
||||||
prompt_title = "Multi Grep",
|
|
||||||
sorter = require("telescope.sorters").empty(),
|
|
||||||
})
|
|
||||||
:find()
|
|
||||||
end
|
|
||||||
|
|
||||||
M.setup = function()
|
|
||||||
vim.keymap.set("n", "<leader>fg", live_multigrep)
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
|
@ -1,7 +0,0 @@
|
||||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
|
||||||
desc = "Highlight when yanking (copying) text",
|
|
||||||
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
|
|
||||||
callback = function()
|
|
||||||
vim.highlight.on_yank()
|
|
||||||
end,
|
|
||||||
})
|
|
|
@ -1,25 +0,0 @@
|
||||||
local status_ok, catppuccin = pcall(require, "catppuccin")
|
|
||||||
if not status_ok then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
catppuccin.setup {
|
|
||||||
flavour = "macchiato",
|
|
||||||
integrations = {
|
|
||||||
cmp = true,
|
|
||||||
gitsigns = true,
|
|
||||||
mini = {
|
|
||||||
enabled = true,
|
|
||||||
indentscope_color = "",
|
|
||||||
},
|
|
||||||
native_lsp = {
|
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
telescope = true,
|
|
||||||
treesitter = true,
|
|
||||||
},
|
|
||||||
term_colors = true,
|
|
||||||
transparent_background = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.cmd.colorscheme "catppuccin"
|
|
|
@ -1,19 +0,0 @@
|
||||||
local status_ok, comment = pcall(require, "Comment")
|
|
||||||
if not status_ok then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
comment.setup {
|
|
||||||
padding = true,
|
|
||||||
|
|
||||||
opleader = {
|
|
||||||
line = "gc",
|
|
||||||
block = "gb",
|
|
||||||
},
|
|
||||||
|
|
||||||
mappings = {
|
|
||||||
basic = true,
|
|
||||||
extra = true,
|
|
||||||
extended = false,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
local cmp = require "cmp"
|
|
||||||
local ls = require "luasnip"
|
|
||||||
|
|
||||||
vim.opt.shortmess:append "c"
|
|
||||||
|
|
||||||
cmp.setup {
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
ls.lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
mapping = cmp.mapping.preset.insert {
|
|
||||||
["<C-e>"] = cmp.mapping.close(),
|
|
||||||
|
|
||||||
["<C-h>"] = cmp.mapping(function()
|
|
||||||
if ls.locally_jumpable(-1) then
|
|
||||||
ls.jump(-1)
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
|
|
||||||
["<C-l>"] = cmp.mapping(function()
|
|
||||||
if ls.expand_or_locally_jumpable() then
|
|
||||||
ls.expand_or_jump()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
|
|
||||||
["<C-y>"] = cmp.mapping.confirm { select = true },
|
|
||||||
["<tab>"] = cmp.config.disable,
|
|
||||||
},
|
|
||||||
|
|
||||||
sources = {
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "nvim_lua" },
|
|
||||||
{ name = "luasnip" },
|
|
||||||
{ name = "buffer" },
|
|
||||||
{ name = "calc" },
|
|
||||||
},
|
|
||||||
|
|
||||||
sorting = {
|
|
||||||
comparators = {
|
|
||||||
cmp.config.compare.offset,
|
|
||||||
cmp.config.compare.exact,
|
|
||||||
cmp.config.compare.score,
|
|
||||||
cmp.config.compare.kind,
|
|
||||||
cmp.config.compare.sort_text,
|
|
||||||
cmp.config.compare.length,
|
|
||||||
cmp.config.compare.order,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
formatting = {
|
|
||||||
format = require("lspkind").cmp_format {
|
|
||||||
with_text = true,
|
|
||||||
menu = {
|
|
||||||
buffer = "[buf]",
|
|
||||||
cmp_tabnine = "[tn]",
|
|
||||||
luasnip = "[snip]",
|
|
||||||
nvim_lsp = "[lsp]",
|
|
||||||
nvim_lua = "[lua]",
|
|
||||||
path = "[path]",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
experimental = {
|
|
||||||
native_menu = false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
cmp.setup.filetype({ "mysql", "sql" }, {
|
|
||||||
sources = {
|
|
||||||
{ name = "vim-dadbod-completion" },
|
|
||||||
{ name = "buffer" },
|
|
||||||
},
|
|
||||||
})
|
|
|
@ -1,5 +0,0 @@
|
||||||
local conform = require "conform"
|
|
||||||
|
|
||||||
conform.setup {
|
|
||||||
formatters_by_ft = {}
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
local dap = require "dap"
|
|
||||||
local ui = require "dapui"
|
|
||||||
|
|
||||||
dap.adapters.php = {
|
|
||||||
type = "executable",
|
|
||||||
command = "node",
|
|
||||||
args = { os.getenv "HOME" .. "/build/vscode-php-debug/out/phpDebug.js" },
|
|
||||||
}
|
|
||||||
|
|
||||||
dap.configurations.php = {
|
|
||||||
{
|
|
||||||
type = "php",
|
|
||||||
request = "launch",
|
|
||||||
name = "Listen for Xdebug",
|
|
||||||
port = 9003,
|
|
||||||
pathMappings = {
|
|
||||||
["/app"] = "${workspaceFolder}",
|
|
||||||
["/var/www/html"] = "${workspaceFolder}",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
dap.listeners.after.event_initialized["ui_config"] = function()
|
|
||||||
ui.open()
|
|
||||||
end
|
|
||||||
|
|
||||||
dap.listeners.before.event_terminated["ui_config"] = function()
|
|
||||||
ui.close()
|
|
||||||
end
|
|
||||||
|
|
||||||
dap.listeners.before.event_exited["ui_config"] = function()
|
|
||||||
ui.close()
|
|
||||||
end
|
|
||||||
|
|
||||||
ui.setup {
|
|
||||||
layouts = {
|
|
||||||
{
|
|
||||||
elements = {
|
|
||||||
{ id = "scopes", size = 0.25 },
|
|
||||||
"breakpoints",
|
|
||||||
"stacks",
|
|
||||||
"watches",
|
|
||||||
},
|
|
||||||
size = 40, -- 40 columns
|
|
||||||
position = "right",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
elements = {
|
|
||||||
"repl",
|
|
||||||
"console",
|
|
||||||
},
|
|
||||||
size = 0.25, -- 25% of total lines
|
|
||||||
position = "bottom",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
require("nvim-dap-virtual-text").setup {
|
|
||||||
commented = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>b", dap.toggle_breakpoint)
|
|
||||||
vim.keymap.set("n", "<leader>gb", dap.run_to_cursor)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<F1>", dap.continue)
|
|
||||||
vim.keymap.set("n", "<F2>", dap.step_into)
|
|
||||||
vim.keymap.set("n", "<F3>", dap.step_over)
|
|
||||||
vim.keymap.set("n", "<F4>", dap.step_out)
|
|
||||||
vim.keymap.set("n", "<F5>", dap.step_back)
|
|
|
@ -1,15 +0,0 @@
|
||||||
vim.filetype.add {
|
|
||||||
extension = {
|
|
||||||
inc = "php",
|
|
||||||
install = "php",
|
|
||||||
module = "php",
|
|
||||||
neon = "yaml",
|
|
||||||
pcss = "scss",
|
|
||||||
theme = "php",
|
|
||||||
},
|
|
||||||
|
|
||||||
filename = {
|
|
||||||
["composer.lock"] = "json",
|
|
||||||
["phpstan.neon.dist"] = "yaml",
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
vim.keymap.set("n", "<leader>gc", "<cmd>Git commit<cr><C-w>K")
|
|
||||||
|
|
||||||
-- Open the ":Git" window in its own buffer, not a split.
|
|
||||||
vim.keymap.set("n", "<leader>gs", "<cmd>0Git<cr>")
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("BufWinEnter", {
|
|
||||||
pattern = "*",
|
|
||||||
|
|
||||||
callback = function()
|
|
||||||
if vim.bo.ft ~= "fugitive" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local bufnr = vim.api.nvim_get_current_buf()
|
|
||||||
local opts = { buffer = bufnr, remap = false }
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>p", function()
|
|
||||||
vim.cmd.Git "push"
|
|
||||||
end, opts)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>P", function()
|
|
||||||
vim.cmd.Git { "pull", "--rebase" }
|
|
||||||
end, opts)
|
|
||||||
end,
|
|
||||||
})
|
|
|
@ -1,30 +0,0 @@
|
||||||
local gitsigns = require "gitsigns"
|
|
||||||
|
|
||||||
gitsigns.setup {
|
|
||||||
linehl = false,
|
|
||||||
numhl = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
local set = vim.keymap.set
|
|
||||||
|
|
||||||
set("n", "[h", "<cmd>Gitsigns prev_hunk<CR>")
|
|
||||||
set("n", "]h", "<cmd>Gitsigns next_hunk<CR>")
|
|
||||||
|
|
||||||
set("n", "<leader>hR", gitsigns.reset_buffer)
|
|
||||||
set("n", "<leader>hS", gitsigns.stage_buffer)
|
|
||||||
set("n", "<leader>hb", gitsigns.blame_line)
|
|
||||||
set("n", "<leader>hp", gitsigns.preview_hunk)
|
|
||||||
set("n", "<leader>hr", gitsigns.reset_hunk)
|
|
||||||
set("n", "<leader>hs", gitsigns.stage_hunk)
|
|
||||||
set("n", "<leader>hu", gitsigns.undo_stage_hunk)
|
|
||||||
|
|
||||||
set("v", "<leader>hr", function()
|
|
||||||
gitsigns.reset_hunk { vim.fn.line ".", vim.fn.line "v" }
|
|
||||||
end)
|
|
||||||
|
|
||||||
set("v", "<leader>hs", function()
|
|
||||||
gitsigns.stage_hunk { vim.fn.line ".", vim.fn.line "v" }
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Text object.
|
|
||||||
set({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
|
|
|
@ -1,34 +0,0 @@
|
||||||
local harpoon = require "harpoon"
|
|
||||||
|
|
||||||
harpoon:setup()
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>a", function()
|
|
||||||
harpoon:list():add()
|
|
||||||
end)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-e>", function()
|
|
||||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
|
||||||
end)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-h>", function()
|
|
||||||
harpoon:list():select(1)
|
|
||||||
end)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-j>", function()
|
|
||||||
harpoon:list():select(2)
|
|
||||||
end)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-k>", function()
|
|
||||||
harpoon:list():select(3)
|
|
||||||
end)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-l>", function()
|
|
||||||
harpoon:list():select(4)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Set <space>1..<space>5 be my shortcuts to moving to the files
|
|
||||||
for _, idx in ipairs { 1, 2, 3, 4, 5 } do
|
|
||||||
vim.keymap.set("n", string.format("<space>%d", idx), function()
|
|
||||||
harpoon:list():select(idx)
|
|
||||||
end)
|
|
||||||
end
|
|
|
@ -1,12 +0,0 @@
|
||||||
local lint = require "lint"
|
|
||||||
|
|
||||||
lint.linters_by_ft = {};
|
|
||||||
|
|
||||||
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
|
||||||
group = lint_augroup,
|
|
||||||
callback = function()
|
|
||||||
lint.try_lint()
|
|
||||||
end,
|
|
||||||
})
|
|
|
@ -1,13 +0,0 @@
|
||||||
require("mini.ai").setup { n_lines = 500 }
|
|
||||||
|
|
||||||
require("mini.align").setup {}
|
|
||||||
|
|
||||||
require("mini.bracketed").setup {}
|
|
||||||
|
|
||||||
require("mini.move").setup {}
|
|
||||||
|
|
||||||
require("mini.operators").setup {}
|
|
||||||
|
|
||||||
require("mini.splitjoin").setup {}
|
|
||||||
|
|
||||||
require("mini.surround").setup {}
|
|
|
@ -1,16 +0,0 @@
|
||||||
require("oil").setup {
|
|
||||||
columns = {},
|
|
||||||
|
|
||||||
keymaps = {
|
|
||||||
["<C-h>"] = false,
|
|
||||||
["<M-h>"] = "actions.select_split",
|
|
||||||
},
|
|
||||||
|
|
||||||
skip_confirm_for_simple_edits = true,
|
|
||||||
|
|
||||||
view_options = {
|
|
||||||
show_hidden = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.keymap.set("n", "-", "<Cmd>Oil<cr>", { desc = "Open parent directory" })
|
|
|
@ -1,2 +0,0 @@
|
||||||
vim.keymap.set("n", "<leader>pm", "<cmd>PhpactorContextMenu<CR>")
|
|
||||||
vim.keymap.set("n", "<leader>pn", "<cmd>PhpactorClassNew<CR>")
|
|
|
@ -1,12 +0,0 @@
|
||||||
local refactoring = require "refactoring"
|
|
||||||
|
|
||||||
-- TODO: add keymaps - https://github.com/ThePrimeagen/refactoring.nvim#configuration-for-refactoring-operations
|
|
||||||
refactoring.setup {}
|
|
||||||
|
|
||||||
local opts = { silent = true }
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<Leader>ri", "<Cmd>lua require 'refactoring'.refactor 'Inline Variable'<Cr>", opts)
|
|
||||||
|
|
||||||
vim.keymap.set("v", "<Leader>re", "<Esc><Cmd>lua require 'refactoring'.refactor 'Extract Function'<Cr>", opts)
|
|
||||||
vim.keymap.set("v", "<Leader>ri", "<Esc><Cmd>lua require 'refactoring'.refactor 'Inline Variable'<Cr>", opts)
|
|
||||||
vim.keymap.set("v", "<Leader>rv", "<Esc><Cmd>lua require 'refactoring'.refactor 'Extract Variable'<Cr>", opts)
|
|
|
@ -1,32 +0,0 @@
|
||||||
local ls = require "luasnip"
|
|
||||||
|
|
||||||
ls.config.set_config {
|
|
||||||
enable_autosnippets = true,
|
|
||||||
history = true,
|
|
||||||
updateevents = "TextChanged,TextChangedI",
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, ft_path in ipairs(vim.api.nvim_get_runtime_file("lua/opdavies/snippets/*.lua", true)) do
|
|
||||||
loadfile(ft_path)()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Expand the current item or just to the next item within the snippet.
|
|
||||||
vim.keymap.set({ "i", "s" }, "<c-k>", function()
|
|
||||||
if ls.expand_or_jumpable() then
|
|
||||||
ls.expand_or_jump()
|
|
||||||
end
|
|
||||||
end, { silent = true })
|
|
||||||
|
|
||||||
-- Jump backwards.
|
|
||||||
vim.keymap.set({ "i", "s" }, "<c-j>", function()
|
|
||||||
if ls.jumpable(-1) then
|
|
||||||
ls.jump(-1)
|
|
||||||
end
|
|
||||||
end, { silent = true })
|
|
||||||
|
|
||||||
-- Select within a list of options.
|
|
||||||
vim.keymap.set("i", "<c-l>", function()
|
|
||||||
if ls.choice_active() then
|
|
||||||
ls.change_choice(1)
|
|
||||||
end
|
|
||||||
end)
|
|
|
@ -1,64 +0,0 @@
|
||||||
local telescope = require "telescope"
|
|
||||||
|
|
||||||
telescope.setup {
|
|
||||||
defaults = {
|
|
||||||
layout_config = { prompt_position = "top" },
|
|
||||||
path_display = { truncate = 1 },
|
|
||||||
prompt_prefix = "$ ",
|
|
||||||
sorting_strategy = "ascending",
|
|
||||||
},
|
|
||||||
|
|
||||||
pickers = {
|
|
||||||
lsp_references = {
|
|
||||||
previewer = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
extensions = {
|
|
||||||
["ui-select"] = {
|
|
||||||
require("telescope.themes").get_dropdown {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
telescope.load_extension "fzf"
|
|
||||||
telescope.load_extension "refactoring"
|
|
||||||
telescope.load_extension "ui-select"
|
|
||||||
|
|
||||||
local builtin = require "telescope.builtin"
|
|
||||||
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
M.grep_bluecheese = function()
|
|
||||||
builtin.live_grep { cwd = "web/sites/default/themes/bluecheese" }
|
|
||||||
end
|
|
||||||
|
|
||||||
M.grep_drupalorg_theme = function()
|
|
||||||
builtin.live_grep { cwd = "web/themes/contrib/drupalorg_theme" }
|
|
||||||
end
|
|
||||||
|
|
||||||
M.search_all_files = function()
|
|
||||||
builtin.find_files {
|
|
||||||
find_command = { "rg", "--no-ignore", "--files" },
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<space>/", builtin.current_buffer_fuzzy_find)
|
|
||||||
vim.keymap.set("n", "<space>fb", builtin.buffers)
|
|
||||||
vim.keymap.set("n", "<space>fd", builtin.find_files)
|
|
||||||
vim.keymap.set("n", "<space>fh", builtin.help_tags)
|
|
||||||
vim.keymap.set("n", "<space>fi", M.search_all_files)
|
|
||||||
vim.keymap.set("n", "<space>fk", builtin.keymaps)
|
|
||||||
vim.keymap.set("n", "<space>fr", builtin.lsp_references)
|
|
||||||
vim.keymap.set("n", "<space>ft", builtin.git_files)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<space>ds", builtin.lsp_document_symbols)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<space>gw", builtin.grep_string)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<space>dgb", M.grep_bluecheese)
|
|
||||||
vim.keymap.set("n", "<space>dgd", M.grep_drupalorg_theme)
|
|
||||||
|
|
||||||
vim.keymap.set({ "n", "v" }, "<space>gw", builtin.grep_string)
|
|
||||||
|
|
||||||
require("opdavies.telescope.multigrep").setup {}
|
|
|
@ -1,133 +0,0 @@
|
||||||
local configs = require "nvim-treesitter.configs"
|
|
||||||
local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move"
|
|
||||||
|
|
||||||
configs.setup {
|
|
||||||
autotag = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
context_commenting = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
indent = {
|
|
||||||
disable = { "yaml" },
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
matchup = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
textobjects = {
|
|
||||||
select = {
|
|
||||||
enable = true,
|
|
||||||
lookahead = true,
|
|
||||||
|
|
||||||
keymaps = {
|
|
||||||
["a="] = { query = "@assignment.outer", desc = "Select outer part of an assignment" },
|
|
||||||
["i="] = { query = "@assignment.inner", desc = "Select inner part of an assignment" },
|
|
||||||
["l="] = { query = "@assignment.lhs", desc = "Select left hand side of an assignment" },
|
|
||||||
["r="] = { query = "@assignment.rhs", desc = "Select right hand side of an assignment" },
|
|
||||||
|
|
||||||
["a:"] = { query = "@property.outer", desc = "Select outer part of an object property" },
|
|
||||||
["i:"] = { query = "@property.inner", desc = "Select inner part of an object property" },
|
|
||||||
["l:"] = { query = "@property.lhs", desc = "Select left part of an object property" },
|
|
||||||
["r:"] = { query = "@property.rhs", desc = "Select right part of an object property" },
|
|
||||||
|
|
||||||
["aa"] = { query = "@parameter.outer", desc = "Select outer part of a parameter/argument" },
|
|
||||||
["ia"] = { query = "@parameter.inner", desc = "Select inner part of a parameter/argument" },
|
|
||||||
|
|
||||||
["ac"] = { query = "@class.outer", desc = "Select outer part of a class" },
|
|
||||||
["ic"] = { query = "@class.inner", desc = "Select inner part of a class" },
|
|
||||||
|
|
||||||
["af"] = { query = "@call.outer", desc = "Select outer part of a function call" },
|
|
||||||
["if"] = { query = "@call.inner", desc = "Select inner part of a function call" },
|
|
||||||
|
|
||||||
["ai"] = { query = "@conditional.outer", desc = "Select outer part of a conditional" },
|
|
||||||
["ii"] = { query = "@conditional.inner", desc = "Select inner part of a conditional" },
|
|
||||||
|
|
||||||
["al"] = { query = "@loop.outer", desc = "Select outer part of a loop" },
|
|
||||||
["il"] = { query = "@loop.inner", desc = "Select inner part of a loop" },
|
|
||||||
|
|
||||||
["am"] = { query = "@function.outer", desc = "Select outer part of a method/function definition" },
|
|
||||||
["im"] = { query = "@function.inner", desc = "Select inner part of a method/function definition" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
swap = {
|
|
||||||
enable = true,
|
|
||||||
|
|
||||||
swap_next = {
|
|
||||||
["<leader>na"] = "@parameter.inner", -- swap parameters/argument with next
|
|
||||||
["<leader>n:"] = "@property.outer", -- swap object property with next
|
|
||||||
["<leader>nm"] = "@function.outer", -- swap function with next
|
|
||||||
},
|
|
||||||
|
|
||||||
swap_previous = {
|
|
||||||
["<leader>pa"] = "@parameter.inner", -- swap parameters/argument with prev
|
|
||||||
["<leader>p:"] = "@property.outer", -- swap object property with prev
|
|
||||||
["<leader>pm"] = "@function.outer", -- swap function with previous
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
move = {
|
|
||||||
enable = true,
|
|
||||||
set_jumps = true, -- whether to set jumps in the jumplist
|
|
||||||
|
|
||||||
goto_next_start = {
|
|
||||||
["]f"] = { query = "@call.outer", desc = "Next function call start" },
|
|
||||||
["]m"] = { query = "@function.outer", desc = "Next method/function def start" },
|
|
||||||
["]c"] = { query = "@class.outer", desc = "Next class start" },
|
|
||||||
["]i"] = { query = "@conditional.outer", desc = "Next conditional start" },
|
|
||||||
["]l"] = { query = "@loop.outer", desc = "Next loop start" },
|
|
||||||
|
|
||||||
["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" },
|
|
||||||
["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" },
|
|
||||||
},
|
|
||||||
|
|
||||||
goto_next_end = {
|
|
||||||
["]F"] = { query = "@call.outer", desc = "Next function call end" },
|
|
||||||
["]M"] = { query = "@function.outer", desc = "Next method/function def end" },
|
|
||||||
["]C"] = { query = "@class.outer", desc = "Next class end" },
|
|
||||||
["]I"] = { query = "@conditional.outer", desc = "Next conditional end" },
|
|
||||||
["]L"] = { query = "@loop.outer", desc = "Next loop end" },
|
|
||||||
},
|
|
||||||
|
|
||||||
goto_previous_start = {
|
|
||||||
["[f"] = { query = "@call.outer", desc = "Prev function call start" },
|
|
||||||
["[m"] = { query = "@function.outer", desc = "Prev method/function def start" },
|
|
||||||
["[c"] = { query = "@class.outer", desc = "Prev class start" },
|
|
||||||
["[i"] = { query = "@conditional.outer", desc = "Prev conditional start" },
|
|
||||||
["[l"] = { query = "@loop.outer", desc = "Prev loop start" },
|
|
||||||
},
|
|
||||||
|
|
||||||
goto_previous_end = {
|
|
||||||
["[F"] = { query = "@call.outer", desc = "Prev function call end" },
|
|
||||||
["[M"] = { query = "@function.outer", desc = "Prev method/function def end" },
|
|
||||||
["[C"] = { query = "@class.outer", desc = "Prev class end" },
|
|
||||||
["[I"] = { query = "@conditional.outer", desc = "Prev conditional end" },
|
|
||||||
["[L"] = { query = "@loop.outer", desc = "Prev loop end" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local set = vim.keymap.set
|
|
||||||
|
|
||||||
set("n", "<leader>th", "<cmd>TSHighlightCapturesUnderCursor<CR>")
|
|
||||||
set("n", "<leader>tp", "<cmd>TSPlaygroundToggle<CR>")
|
|
||||||
|
|
||||||
-- vim way: ; goes to the direction you were moving.
|
|
||||||
set({ "n", "o", "x" }, ";", ts_repeat_move.repeat_last_move)
|
|
||||||
set({ "n", "o", "x" }, ",", ts_repeat_move.repeat_last_move_opposite)
|
|
||||||
|
|
||||||
-- Optionally, make builtin f, F, t, T also repeatable with ; and ,
|
|
||||||
set({ "n", "o", "x" }, "f", ts_repeat_move.builtin_f)
|
|
||||||
set({ "n", "o", "x" }, "F", ts_repeat_move.builtin_F)
|
|
||||||
set({ "n", "o", "x" }, "t", ts_repeat_move.builtin_t)
|
|
||||||
set({ "n", "o", "x" }, "T", ts_repeat_move.builtin_T)
|
|
|
@ -1 +0,0 @@
|
||||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
|
|
@ -1,16 +0,0 @@
|
||||||
local set = vim.keymap.set
|
|
||||||
|
|
||||||
local options = {
|
|
||||||
silent = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
set("n", "<leader>tf", ":TestFile<CR>", options)
|
|
||||||
set("n", "<leader>tg", ":TestVisit<CR>", options)
|
|
||||||
set("n", "<leader>tl", ":TestLast<CR>", options)
|
|
||||||
set("n", "<leader>tn", ":TestNearest<CR>", options)
|
|
||||||
set("n", "<leader>ts", ":TestSuite<CR>", options)
|
|
||||||
|
|
||||||
vim.cmd [[
|
|
||||||
let test#php#phpunit#options = '--colors=always --testdox'
|
|
||||||
let g:test#strategy = 'vimux'
|
|
||||||
]]
|
|
|
@ -1,132 +0,0 @@
|
||||||
ANP
|
|
||||||
AWS
|
|
||||||
Acquia
|
|
||||||
Ansible
|
|
||||||
Appnovation
|
|
||||||
Architected
|
|
||||||
BAU
|
|
||||||
Behat
|
|
||||||
Bitbucket
|
|
||||||
Bluecheese
|
|
||||||
BrumPHP
|
|
||||||
CMSes
|
|
||||||
CTI
|
|
||||||
Cachix
|
|
||||||
Centarro
|
|
||||||
CiviCRM
|
|
||||||
Configs
|
|
||||||
D7
|
|
||||||
DDEV
|
|
||||||
DevOps
|
|
||||||
DigitalOcean
|
|
||||||
Drupal
|
|
||||||
Drupal's
|
|
||||||
DrupalCamp
|
|
||||||
DrupalCon
|
|
||||||
DrupalEasy
|
|
||||||
Drupaler
|
|
||||||
Drush
|
|
||||||
FPM
|
|
||||||
FTSE
|
|
||||||
GitLab
|
|
||||||
Gitea
|
|
||||||
HDN
|
|
||||||
HashiCorp
|
|
||||||
Hetzner
|
|
||||||
Homelab
|
|
||||||
Immich
|
|
||||||
InvalidArgumentException
|
|
||||||
Inviqa
|
|
||||||
JSON
|
|
||||||
Jellyfin
|
|
||||||
Kickstart
|
|
||||||
Lando
|
|
||||||
Laravel
|
|
||||||
Linode
|
|
||||||
Magento
|
|
||||||
MariaDB
|
|
||||||
Microserve
|
|
||||||
Mischa
|
|
||||||
MySQL
|
|
||||||
NGINX
|
|
||||||
Neovim
|
|
||||||
Netlify
|
|
||||||
Nginx
|
|
||||||
NixOS
|
|
||||||
NodeInterface
|
|
||||||
Nomensa
|
|
||||||
OpenID
|
|
||||||
OpenTofu
|
|
||||||
PDOException
|
|
||||||
PHPDoc
|
|
||||||
PHPStan
|
|
||||||
PHPUnit
|
|
||||||
Packagist
|
|
||||||
PhpStorm
|
|
||||||
PostBuilder
|
|
||||||
PostNodeRepository
|
|
||||||
Pulumi
|
|
||||||
S3
|
|
||||||
SHA
|
|
||||||
SQLSTATE
|
|
||||||
SQLite
|
|
||||||
SSO
|
|
||||||
Sculpin
|
|
||||||
Silex
|
|
||||||
SimpleTest
|
|
||||||
Sylius
|
|
||||||
Symfony
|
|
||||||
TODO
|
|
||||||
TermInterface
|
|
||||||
Themers
|
|
||||||
Traefik
|
|
||||||
TypeScript
|
|
||||||
Ubercart
|
|
||||||
VSCode
|
|
||||||
Vaultwarden
|
|
||||||
WCAG
|
|
||||||
WSL
|
|
||||||
Wellbeing
|
|
||||||
ZSH
|
|
||||||
Zellij
|
|
||||||
Zettelkasten
|
|
||||||
architected
|
|
||||||
assertContainsOnlyInstancesOf
|
|
||||||
assertSame
|
|
||||||
bootcamp
|
|
||||||
contrib
|
|
||||||
devenv
|
|
||||||
dotfiles
|
|
||||||
drupal
|
|
||||||
eCommerce
|
|
||||||
foreach
|
|
||||||
getPost
|
|
||||||
ghostty
|
|
||||||
hotfix
|
|
||||||
isNotPublished
|
|
||||||
isPublished
|
|
||||||
localhost
|
|
||||||
macOS
|
|
||||||
mentees
|
|
||||||
nixpkgs
|
|
||||||
nodeStorage
|
|
||||||
opdavies
|
|
||||||
osCommerce
|
|
||||||
param
|
|
||||||
reStructuredText
|
|
||||||
rebase
|
|
||||||
rebasing
|
|
||||||
roadmapping
|
|
||||||
rst2pdf
|
|
||||||
rwxrob
|
|
||||||
src
|
|
||||||
stylesheet
|
|
||||||
stylesheets
|
|
||||||
testbot
|
|
||||||
tmux
|
|
||||||
url
|
|
||||||
vhost
|
|
||||||
wildcard
|
|
||||||
worktree
|
|
||||||
worktrees
|
|
||||||
www
|
|
|
@ -1,8 +0,0 @@
|
||||||
indent_type = "Spaces"
|
|
||||||
indent_width = 2
|
|
||||||
line_endings = "Unix"
|
|
||||||
no_call_parentheses = true
|
|
||||||
quote_style = "AutoPreferDouble"
|
|
||||||
|
|
||||||
[sort_requires]
|
|
||||||
enabled = true
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
inputs,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
|
@ -11,134 +12,60 @@ let
|
||||||
cfg = config.coding.neovim;
|
cfg = config.coding.neovim;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.nixvim.homeManagerModules.nixvim
|
||||||
|
];
|
||||||
|
|
||||||
options.coding.neovim.enable = mkEnableOption "Enable neovim";
|
options.coding.neovim.enable = mkEnableOption "Enable neovim";
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
programs.neovim =
|
programs.nixvim = {
|
||||||
let
|
enable = true;
|
||||||
php = pkgs.php82;
|
|
||||||
in
|
# TODO: re-add DAP.
|
||||||
{
|
# TODO: re-add snippets.
|
||||||
|
# TODO: re-configure spell.
|
||||||
|
|
||||||
|
viAlias = true;
|
||||||
|
vimAlias = true;
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
./keymaps.nix
|
||||||
|
./options.nix
|
||||||
|
./plugins/cmp.nix
|
||||||
|
./plugins/conform.nix
|
||||||
|
./plugins/fidget.nix
|
||||||
|
./plugins/fugitive.nix
|
||||||
|
./plugins/gitsigns.nix
|
||||||
|
./plugins/harpoon.nix
|
||||||
|
./plugins/lint.nix
|
||||||
|
./plugins/lsp.nix
|
||||||
|
./plugins/lualine.nix
|
||||||
|
./plugins/luasnip.nix
|
||||||
|
./plugins/mini.nix
|
||||||
|
./plugins/oil.nix
|
||||||
|
./plugins/phpactor.nix
|
||||||
|
./plugins/refactoring.nix
|
||||||
|
./plugins/telescope.nix
|
||||||
|
./plugins/treesitter.nix
|
||||||
|
./plugins/undotree.nix
|
||||||
|
./plugins/vim-dadbod.nix
|
||||||
|
./plugins/vim-highlightedyank.nix
|
||||||
|
./plugins/vim-test.nix
|
||||||
|
./plugins/web-devicons.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
colorschemes.catppuccin = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
settings.flavour = "mocha";
|
||||||
plugins = with pkgs.vimPlugins; [
|
|
||||||
comment-nvim
|
|
||||||
gitsigns-nvim
|
|
||||||
harpoon2
|
|
||||||
mini-nvim
|
|
||||||
nvim-web-devicons
|
|
||||||
oil-nvim
|
|
||||||
phpactor
|
|
||||||
refactoring-nvim
|
|
||||||
undotree
|
|
||||||
vim-nix
|
|
||||||
|
|
||||||
# Testing
|
|
||||||
vim-test
|
|
||||||
vimux
|
|
||||||
|
|
||||||
# Git
|
|
||||||
vim-fugitive
|
|
||||||
|
|
||||||
# Debugging
|
|
||||||
nvim-dap
|
|
||||||
nvim-dap-ui
|
|
||||||
nvim-dap-virtual-text
|
|
||||||
|
|
||||||
# Treesitter
|
|
||||||
(pkgs.vimPlugins.nvim-treesitter.withPlugins (
|
|
||||||
plugins: with plugins; [
|
|
||||||
bash
|
|
||||||
comment
|
|
||||||
css
|
|
||||||
csv
|
|
||||||
dockerfile
|
|
||||||
gitattributes
|
|
||||||
gitignore
|
|
||||||
go
|
|
||||||
html
|
|
||||||
javascript
|
|
||||||
json
|
|
||||||
kdl
|
|
||||||
lua
|
|
||||||
luadoc
|
|
||||||
make
|
|
||||||
markdown
|
|
||||||
markdown_inline
|
|
||||||
nix
|
|
||||||
php
|
|
||||||
phpdoc
|
|
||||||
query
|
|
||||||
rst
|
|
||||||
scss
|
|
||||||
sql
|
|
||||||
terraform
|
|
||||||
twig
|
|
||||||
typescript
|
|
||||||
vim
|
|
||||||
vimdoc
|
|
||||||
vue
|
|
||||||
xml
|
|
||||||
yaml
|
|
||||||
]
|
|
||||||
))
|
|
||||||
nvim-treesitter-textobjects
|
|
||||||
|
|
||||||
# LSP, linting and formatting
|
|
||||||
conform-nvim
|
|
||||||
lsp-status-nvim
|
|
||||||
nvim-lint
|
|
||||||
nvim-lspconfig
|
|
||||||
|
|
||||||
# Completion
|
|
||||||
cmp-buffer
|
|
||||||
cmp-calc
|
|
||||||
cmp-cmdline
|
|
||||||
cmp-nvim-lsp
|
|
||||||
cmp-path
|
|
||||||
cmp-treesitter
|
|
||||||
cmp_luasnip
|
|
||||||
lspkind-nvim
|
|
||||||
nvim-cmp
|
|
||||||
|
|
||||||
# Snippets
|
|
||||||
luasnip
|
|
||||||
|
|
||||||
# Telescope
|
|
||||||
plenary-nvim
|
|
||||||
popup-nvim
|
|
||||||
telescope-frecency-nvim
|
|
||||||
telescope-fzf-native-nvim
|
|
||||||
telescope-live-grep-args-nvim
|
|
||||||
telescope-nvim
|
|
||||||
telescope-ui-select-nvim
|
|
||||||
|
|
||||||
# Databases
|
|
||||||
vim-dadbod
|
|
||||||
vim-dadbod-ui
|
|
||||||
vim-dadbod-completion
|
|
||||||
|
|
||||||
# Themes
|
|
||||||
catppuccin-nvim
|
|
||||||
];
|
|
||||||
|
|
||||||
extraPackages = with pkgs; [
|
|
||||||
ripgrep
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.configFile.nvim = {
|
extraPackages = with pkgs; [
|
||||||
source = ./config;
|
nixfmt-rfc-style
|
||||||
recursive = true;
|
stylua
|
||||||
|
];
|
||||||
|
|
||||||
|
globals.mapleader = " ";
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".markdownlint.yaml".text = ''
|
|
||||||
default: true
|
|
||||||
|
|
||||||
line-length: false
|
|
||||||
|
|
||||||
no-duplicate-heading:
|
|
||||||
siblings_only: true
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
62
modules/home-manager/coding/neovim/keymaps.nix
Normal file
62
modules/home-manager/coding/neovim/keymaps.nix
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
{
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
action = "<Esc>A,<Esc>";
|
||||||
|
key = ",,";
|
||||||
|
mode = "i";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<Esc>A;<Esc>";
|
||||||
|
key = ";;";
|
||||||
|
mode = "i";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<cmd>lua vim.lsp.buf.format()<CR>";
|
||||||
|
key = "<leader>f";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "\"+y";
|
||||||
|
key = "<leader>y";
|
||||||
|
mode = "x";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "@q";
|
||||||
|
key = "Q";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<cmd>silent !tmux new-window tmux-sessionizer<CR>";
|
||||||
|
key = "<C-f>";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<Esc>:w<CR>";
|
||||||
|
key = "<C-s>";
|
||||||
|
mode = ["i" "n"];
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<cmd>tabnew<CR>";
|
||||||
|
key = "<C-t>";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<cmd>!composer install<CR>";
|
||||||
|
key = "<leader>ci";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<cmd>edit composer.json<CR>";
|
||||||
|
key = "<leader>ec";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<cmd>edit flake.nix<CR>";
|
||||||
|
key = "<leader>ef";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
25
modules/home-manager/coding/neovim/options.nix
Normal file
25
modules/home-manager/coding/neovim/options.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
expandtab = true;
|
||||||
|
exrc = true;
|
||||||
|
foldlevel = 1;
|
||||||
|
foldlevelstart = 99;
|
||||||
|
foldmethod = "indent";
|
||||||
|
inccommand = "split";
|
||||||
|
laststatus = 3;
|
||||||
|
list = true;
|
||||||
|
number = true;
|
||||||
|
relativenumber = true;
|
||||||
|
shiftwidth = 2;
|
||||||
|
smartindent = true;
|
||||||
|
softtabstop = 2;
|
||||||
|
splitbelow = true;
|
||||||
|
splitright = true;
|
||||||
|
swapfile = false;
|
||||||
|
syntax = "on";
|
||||||
|
tabstop = 2;
|
||||||
|
termguicolors = true;
|
||||||
|
updatetime = 1000;
|
||||||
|
wrap = false;
|
||||||
|
};
|
||||||
|
}
|
58
modules/home-manager/coding/neovim/plugins/cmp.nix
Normal file
58
modules/home-manager/coding/neovim/plugins/cmp.nix
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
{
|
||||||
|
plugins.cmp = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
autoEnableSources = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
mapping = {
|
||||||
|
"<C-e>" = "cmp.mapping.close()";
|
||||||
|
|
||||||
|
"<C-h>" = ''
|
||||||
|
cmp.mapping(function()
|
||||||
|
if ls.locally_jumpable(-1) then
|
||||||
|
ls.jump(-1)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
'';
|
||||||
|
|
||||||
|
"<C-l>" = ''
|
||||||
|
cmp.mapping(function()
|
||||||
|
if ls.expand_or_locally_jumpable() then
|
||||||
|
ls.expand_or_jump()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
'';
|
||||||
|
|
||||||
|
"<C-n>" = "cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select })";
|
||||||
|
"<C-p>" = "cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select })";
|
||||||
|
|
||||||
|
"<C-y>" = "cmp.mapping.confirm({ select = true })";
|
||||||
|
|
||||||
|
"<CR>" = "nil";
|
||||||
|
"<S-Tab>" = "nil";
|
||||||
|
"<Tab>" = "nil";
|
||||||
|
};
|
||||||
|
|
||||||
|
snippet.expand = ''
|
||||||
|
function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
{ name = "nvim_lsp"; }
|
||||||
|
{ name = "nvim_lua"; }
|
||||||
|
{
|
||||||
|
name = "luasnip";
|
||||||
|
keyword_length = 2;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "buffer";
|
||||||
|
keyword_length = 3;
|
||||||
|
}
|
||||||
|
{ name = "calc"; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
3
modules/home-manager/coding/neovim/plugins/conform.nix
Normal file
3
modules/home-manager/coding/neovim/plugins/conform.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
plugins.conform-nvim.enable = true;
|
||||||
|
}
|
3
modules/home-manager/coding/neovim/plugins/fidget.nix
Normal file
3
modules/home-manager/coding/neovim/plugins/fidget.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
plugins.fidget.enable = true;
|
||||||
|
}
|
18
modules/home-manager/coding/neovim/plugins/fugitive.nix
Normal file
18
modules/home-manager/coding/neovim/plugins/fugitive.nix
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
plugins.fugitive.enable = true;
|
||||||
|
|
||||||
|
keymaps = lib.mkIf config.plugins.fugitive.enable [
|
||||||
|
{
|
||||||
|
key = "<leader>gc";
|
||||||
|
action = "<cmd>Git commit<CR><C-w>K";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
# Open the ":Git" window in its own buffer, not a split.
|
||||||
|
key = "<leader>gs";
|
||||||
|
action = "<cmd>0Git<CR>";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
45
modules/home-manager/coding/neovim/plugins/gitsigns.nix
Normal file
45
modules/home-manager/coding/neovim/plugins/gitsigns.nix
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
plugins.gitsigns.enable = true;
|
||||||
|
|
||||||
|
keymaps = lib.mkIf config.plugins.gitsigns.enable [
|
||||||
|
{
|
||||||
|
action = "<cmd>Gitsigns prev_hunk<CR>";
|
||||||
|
key = "[h";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<cmd>Gitsigns next_hunk<CR>";
|
||||||
|
key = "]h";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<cmd>Gitsigns reset_hunk<CR>";
|
||||||
|
key = "<leader>hr";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<cmd>Gitsigns reset_buffer<CR>";
|
||||||
|
key = "<leader>hR";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<cmd>Gitsigns stage_hunk<CR>";
|
||||||
|
key = "<leader>hs";
|
||||||
|
mode = ["n" "v"];
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<cmd>Gitsigns stage_buffer<CR>";
|
||||||
|
key = "<leader>hS";
|
||||||
|
mode = "x";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
action = "<cmd>Gitsigns undo_stage_hunk<CR>";
|
||||||
|
key = "<leader>hu";
|
||||||
|
mode = "x";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
47
modules/home-manager/coding/neovim/plugins/harpoon.nix
Normal file
47
modules/home-manager/coding/neovim/plugins/harpoon.nix
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
leaderBinding = key: command: {
|
||||||
|
key = "<leader>${key}";
|
||||||
|
action = "<cmd>${command}<CR>";
|
||||||
|
options.silent = true;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
plugins.harpoon = {
|
||||||
|
enable = true;
|
||||||
|
enableTelescope = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = lib.mkIf config.plugins.harpoon.enable (
|
||||||
|
[
|
||||||
|
{
|
||||||
|
key = "<leader>a";
|
||||||
|
action.__raw = "function() require'harpoon':list():add() end";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
key = "<C-e>";
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require 'harpoon'.ui:toggle_quick_menu(require'harpoon':list())
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]
|
||||||
|
++ (map
|
||||||
|
(num: leaderBinding "${toString num}" "lua require(\"harpoon\"):list():select(${toString num})")
|
||||||
|
[
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
3
modules/home-manager/coding/neovim/plugins/lint.nix
Normal file
3
modules/home-manager/coding/neovim/plugins/lint.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
plugins.lint.enable = true;
|
||||||
|
}
|
3
modules/home-manager/coding/neovim/plugins/lsp.nix
Normal file
3
modules/home-manager/coding/neovim/plugins/lsp.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
plugins.lsp.enable = true;
|
||||||
|
}
|
11
modules/home-manager/coding/neovim/plugins/lualine.nix
Normal file
11
modules/home-manager/coding/neovim/plugins/lualine.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
plugins.lualine = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings.options = {
|
||||||
|
component_separators = "";
|
||||||
|
icons_enabled = false;
|
||||||
|
section_separators = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
3
modules/home-manager/coding/neovim/plugins/luasnip.nix
Normal file
3
modules/home-manager/coding/neovim/plugins/luasnip.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
plugins.luasnip.enable = true;
|
||||||
|
}
|
15
modules/home-manager/coding/neovim/plugins/mini.nix
Normal file
15
modules/home-manager/coding/neovim/plugins/mini.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
plugins.mini = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
modules = {
|
||||||
|
ai = {};
|
||||||
|
align = {};
|
||||||
|
bracketed = {};
|
||||||
|
move = {};
|
||||||
|
operators = {};
|
||||||
|
splitjoin = {};
|
||||||
|
surround = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
20
modules/home-manager/coding/neovim/plugins/oil.nix
Normal file
20
modules/home-manager/coding/neovim/plugins/oil.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
plugins.oil = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
delete_to_trash = true;
|
||||||
|
|
||||||
|
keymaps."-" = "actions.parent";
|
||||||
|
|
||||||
|
skip_confirm_for_simple_edits = true;
|
||||||
|
view_options.show_hidden = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = lib.mkIf config.plugins.oil.enable [
|
||||||
|
{ action = "<cmd>Oil<CR>"; key = "-"; }
|
||||||
|
];
|
||||||
|
}
|
17
modules/home-manager/coding/neovim/plugins/phpactor.nix
Normal file
17
modules/home-manager/coding/neovim/plugins/phpactor.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
extraPlugins = with pkgs.vimPlugins; [ phpactor ];
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
key = "<leader>pm";
|
||||||
|
action = "<cmd>PhpactorContextMenu<CR>";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
key = "<leader>pn";
|
||||||
|
action = "<cmd>PhpactorClassNew<CR>";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
47
modules/home-manager/coding/neovim/plugins/refactoring.nix
Normal file
47
modules/home-manager/coding/neovim/plugins/refactoring.nix
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
plugins.refactoring = {
|
||||||
|
enable = true;
|
||||||
|
enableTelescope = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps =
|
||||||
|
lib.mkIf config.plugins.refactoring.enable ([
|
||||||
|
{
|
||||||
|
key = "<leader>ri";
|
||||||
|
action = "<cmd>Refactor inline_var<CR>";
|
||||||
|
mode = "n";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
key = "<leader>re";
|
||||||
|
action = "<cmd>Refactor extract<CR>";
|
||||||
|
mode = "x";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
key = "<leader>ri";
|
||||||
|
action = "<cmd>Refactor inline_var<CR>";
|
||||||
|
mode = "x";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
key = "<leader>rv";
|
||||||
|
action = "<cmd>Refactor extract_var<CR>";
|
||||||
|
mode = "x";
|
||||||
|
}
|
||||||
|
]
|
||||||
|
++ lib.optionals (config.plugins.refactoring.enable && config.plugins.refactoring.enableTelescope) [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>rR";
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require('telescope').extensions.refactoring.refactors()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
options.silent = true;
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
28
modules/home-manager/coding/neovim/plugins/telescope.nix
Normal file
28
modules/home-manager/coding/neovim/plugins/telescope.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
plugins.telescope = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
extensions = {
|
||||||
|
live-grep-args.enable = true;
|
||||||
|
fzf-native.enable = true;
|
||||||
|
ui-select.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
"<leader>fb" = "buffers";
|
||||||
|
"<leader>fd" = "find_files";
|
||||||
|
"<leader>fg" = "live_grep";
|
||||||
|
|
||||||
|
"<leader>gw" = {
|
||||||
|
action = "grep_string";
|
||||||
|
mode = [
|
||||||
|
"n"
|
||||||
|
"v"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
settings.defaults.layout_config.prompt_position = "top";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
47
modules/home-manager/coding/neovim/plugins/treesitter.nix
Normal file
47
modules/home-manager/coding/neovim/plugins/treesitter.nix
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
plugins = {
|
||||||
|
treesitter = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||||
|
bash
|
||||||
|
comment
|
||||||
|
css
|
||||||
|
csv
|
||||||
|
dockerfile
|
||||||
|
gitattributes
|
||||||
|
gitignore
|
||||||
|
go
|
||||||
|
html
|
||||||
|
javascript
|
||||||
|
json
|
||||||
|
kdl
|
||||||
|
lua
|
||||||
|
luadoc
|
||||||
|
make
|
||||||
|
markdown
|
||||||
|
markdown_inline
|
||||||
|
nix
|
||||||
|
php
|
||||||
|
phpdoc
|
||||||
|
query
|
||||||
|
rst
|
||||||
|
scss
|
||||||
|
sql
|
||||||
|
terraform
|
||||||
|
twig
|
||||||
|
typescript
|
||||||
|
vim
|
||||||
|
vimdoc
|
||||||
|
vue
|
||||||
|
xml
|
||||||
|
yaml
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
treesitter-textobjects.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
9
modules/home-manager/coding/neovim/plugins/undotree.nix
Normal file
9
modules/home-manager/coding/neovim/plugins/undotree.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
plugins.undotree.enable = true;
|
||||||
|
|
||||||
|
keymaps = lib.mkIf config.plugins.undotree.enable [
|
||||||
|
{ action = "<cmd>UndotreeToggle<CR>"; key = "<leader>u"; }
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
plugins = {
|
||||||
|
vim-dadbod.enable = true;
|
||||||
|
vim-dadbod-completion.enable = true;
|
||||||
|
vim-dadbod-ui.enable = true;
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
extraPlugins = with pkgs.vimPlugins; [ vim-highlightedyank ];
|
||||||
|
|
||||||
|
extraConfigVim = ''
|
||||||
|
let g:highlightedyank_highlight_duration = 100
|
||||||
|
'';
|
||||||
|
}
|
11
modules/home-manager/coding/neovim/plugins/vim-test.nix
Normal file
11
modules/home-manager/coding/neovim/plugins/vim-test.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
plugins.vim-test.enable = true;
|
||||||
|
|
||||||
|
keymaps = lib.mkIf config.plugins.vim-test.enable [
|
||||||
|
{ key = "<leader>tf"; action = "<cmd>TestFile<CR>"; }
|
||||||
|
{ key = "<leader>tl"; action = "<cmd>TestLast<CR>"; }
|
||||||
|
{ key = "<leader>tn"; action = "<cmd>TestNearest<CR>"; }
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
plugins.web-devicons.enable = false;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue