Tidy neovim configuration
* Remove some unused plugins and packages. * e.g. floaterm, projectionist, vim-wiki, vim-easy-align, vim-surround, visual-star-search, vim-rhubarb * Replace none-ls with conform.nvim and nvim-lint. * Replace lualine.nvim with mini-statusline. * Add neodev. * Simplify cmp completion sources.
This commit is contained in:
parent
94581a9c7f
commit
3afe1bd12b
1
.luacheckrc
Normal file
1
.luacheckrc
Normal file
|
@ -0,0 +1 @@
|
|||
globals = { "vim" }
|
53
CHANGELOG.md
53
CHANGELOG.md
|
@ -1,5 +1,58 @@
|
|||
# Changelog
|
||||
|
||||
## 24th February 2024
|
||||
|
||||
### Added
|
||||
|
||||
* Add `neodev`.
|
||||
|
||||
### Removed
|
||||
|
||||
* Remove some unused plugins and packages.
|
||||
* e.g. floaterm, projectionist, vim-wiki, vim-easy-align,
|
||||
vim-surround, visual-star-search, vim-rhubarb
|
||||
|
||||
### Changed
|
||||
|
||||
* Tidy neovim configuration
|
||||
* Replace none-ls with conform.nvim and nvim-lint.
|
||||
* Replace lualine.nvim with mini-statusline.
|
||||
* Simplify cmp completion sources.
|
||||
|
||||
## 21st February 2024
|
||||
|
||||
### Added
|
||||
|
||||
* Re-add `vim-just` and `fidget.nvim`.
|
||||
|
||||
## 13th February 2024
|
||||
|
||||
### Changed
|
||||
|
||||
* Use `alejandra` to format Nix files.
|
||||
|
||||
## 5th February 2024
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fix PHPUnit command in `vim-test`.
|
||||
|
||||
## 27th January 2024
|
||||
|
||||
### Added
|
||||
|
||||
* Add vim-floaterm.
|
||||
|
||||
### Removed
|
||||
|
||||
* Remove Astro plugin and language server.
|
||||
|
||||
## 26th January 2024
|
||||
|
||||
### Added
|
||||
|
||||
* Add vim-wiki.
|
||||
|
||||
## 25th January 2024
|
||||
|
||||
### Added
|
||||
|
|
|
@ -8,6 +8,10 @@ catppuccin.setup {
|
|||
integrations = {
|
||||
cmp = true,
|
||||
gitsigns = true,
|
||||
mini = {
|
||||
enabled = true,
|
||||
indentscope_color = "",
|
||||
},
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
},
|
||||
|
|
|
@ -26,13 +26,9 @@ cmp.setup {
|
|||
},
|
||||
|
||||
sources = {
|
||||
{ name = "nvim_lsp_signature_help" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "cmp_tabnine" },
|
||||
{ name = "path" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer", keyword_length = 5, max_item_count = 5 },
|
||||
},
|
||||
|
||||
sorting = {
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
-- Based on https://github.com/ALT-F4-LLC/thealtf4stream.nvim/blob/main/lua/TheAltF4Stream/floaterm.lua.
|
||||
|
||||
local nmap = require "opdavies.keymap".nmap
|
||||
|
||||
nmap { "<leader>ld", "<cmd>FloatermNew --autoclose=2 --height=0.9 --width=0.9 lazydocker<cr>" }
|
||||
nmap { "<leader>lg", "<cmd>FloatermNew --autoclose=2 --height=0.9 --width=0.9 lazygit<cr>" }
|
||||
nmap { "<leader>nn", "<cmd>FloatermNew --autoclose=2 --height=0.75 --width=0.75 nnn -Hde<cr>" }
|
||||
nmap { "<leader>tt", "<cmd>FloatermNew --autoclose=2 --height=0.9 --width=0.9 zsh<cr>" }
|
|
@ -1,9 +0,0 @@
|
|||
require("lualine").setup {
|
||||
options = {
|
||||
component_separators = { left = "", right = "" },
|
||||
extensions = { "fzf", "quickfix" },
|
||||
icons_enabled = false,
|
||||
section_separators = { left = "", right = "" },
|
||||
theme = "catppuccin",
|
||||
},
|
||||
}
|
22
after/plugin/mini.lua
Normal file
22
after/plugin/mini.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
require("mini.ai").setup {}
|
||||
|
||||
require("mini.align").setup {}
|
||||
|
||||
require("mini.bracketed").setup {}
|
||||
|
||||
require("mini.hipatterns").setup {
|
||||
highlighters = {
|
||||
note = { pattern = "%f[%w]()NOTE()%f[%W]", group = "MiniHipatternsNote" },
|
||||
todo = { pattern = "%f[%w]()TODO()%f[%W]", group = "MiniHipatternsTodo" },
|
||||
},
|
||||
}
|
||||
|
||||
require("mini.move").setup {}
|
||||
|
||||
require("mini.operators").setup {}
|
||||
|
||||
require("mini.splitjoin").setup {}
|
||||
|
||||
require("mini.statusline").setup {}
|
||||
|
||||
require("mini.surround").setup {}
|
|
@ -1,58 +0,0 @@
|
|||
local heuristics = {
|
||||
["composer.json"] = {
|
||||
["src/*.php"] = {
|
||||
type = "source",
|
||||
alternate = "tests/{}Test.php",
|
||||
},
|
||||
|
||||
["src/Controller/*.php"] = {
|
||||
type = "controller",
|
||||
},
|
||||
|
||||
["src/Model/*.php"] = {
|
||||
type = "model",
|
||||
},
|
||||
|
||||
["src/Service/*.php"] = {
|
||||
type = "service",
|
||||
},
|
||||
|
||||
["tests/*Test.php"] = {
|
||||
type = "test",
|
||||
alternate = "src/{}.php",
|
||||
},
|
||||
},
|
||||
|
||||
["fractal.config.js"] = {
|
||||
["*.config.yml"] = {
|
||||
alternate = "{dirname}/{basename}.twig",
|
||||
},
|
||||
|
||||
["*.twig"] = {
|
||||
alternate = "{dirname}/{basename}.config.yml",
|
||||
},
|
||||
},
|
||||
|
||||
["package.json"] = {
|
||||
["src/*.ts"] = {
|
||||
type = "source",
|
||||
alternate = "tests/{}.test.ts",
|
||||
},
|
||||
|
||||
["src/*.service.ts"] = {
|
||||
type = "source",
|
||||
alternate = "tests/{}.test.ts",
|
||||
},
|
||||
|
||||
["tests/*.test.ts"] = {
|
||||
type = "test",
|
||||
alternate = "src/{}.ts",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.g.projectionist_heuristics = heuristics
|
||||
|
||||
local nmap = require("opdavies.keymap").nmap
|
||||
|
||||
nmap { "<leader>aa", "<cmd>A<cr>" }
|
|
@ -1,7 +0,0 @@
|
|||
vim.g.vimwiki_list = {
|
||||
{
|
||||
ext = 'md',
|
||||
path = '~/Documents/Google Drive/vim-wiki',
|
||||
syntax = 'markdown',
|
||||
}
|
||||
}
|
25
flake.lock
25
flake.lock
|
@ -19,11 +19,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1708118438,
|
||||
"narHash": "sha256-kk9/0nuVgA220FcqH/D2xaN6uGyHp/zoxPNUmPCMmEE=",
|
||||
"lastModified": 1708655239,
|
||||
"narHash": "sha256-ZrP/yACUvDB+zbqYJsln4iwotbH6CTZiTkANJ0AgDv4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5863c27340ba4de8f83e7e3c023b9599c3cb3c80",
|
||||
"rev": "cbc4211f0afffe6dfd2478a62615dd5175a13f9a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -33,6 +33,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-2305": {
|
||||
"locked": {
|
||||
"lastModified": 1704290814,
|
||||
"narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
|
@ -54,7 +70,8 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-2305": "nixpkgs-2305"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
{
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-2305.url = "github:NixOS/nixpkgs/nixos-23.05";
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
|
|
8
justfile
Normal file
8
justfile
Normal file
|
@ -0,0 +1,8 @@
|
|||
_default:
|
||||
just --list
|
||||
|
||||
build profile:
|
||||
nix build --json --no-link --print-build-logs ".#{{ profile }}"
|
||||
|
||||
check:
|
||||
nix flake check
|
|
@ -4,6 +4,7 @@ in rec {
|
|||
mkVimPlugin = {system}: let
|
||||
inherit (pkgs) vimUtils;
|
||||
inherit (vimUtils) buildVimPlugin;
|
||||
|
||||
pkgs = legacyPackages.${system};
|
||||
in
|
||||
buildVimPlugin {
|
||||
|
@ -11,9 +12,11 @@ in rec {
|
|||
postInstall = ''
|
||||
rm -rf $out/.envrc
|
||||
rm -rf $out/.gitignore
|
||||
rm -rf $out/.luacheckrc
|
||||
rm -rf $out/CHANGELOG.md
|
||||
rm -rf $out/flake.lock
|
||||
rm -rf $out/flake.nix
|
||||
rm -rf $out/justfile
|
||||
rm -rf $out/lib
|
||||
rm -rf $out/run
|
||||
rm -rf $out/stylua.toml
|
||||
|
@ -22,7 +25,7 @@ in rec {
|
|||
};
|
||||
|
||||
mkNeovimPlugins = {system}: let
|
||||
inherit (pkgs) vimPlugins;
|
||||
inherit (pkgs) php82Packages vimPlugins;
|
||||
|
||||
pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
|
@ -30,6 +33,8 @@ in rec {
|
|||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
pkgs2305 = inputs.nixpkgs-2305.legacyPackages.${system};
|
||||
|
||||
customVim = {
|
||||
tabline-vim = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "tabline-vim";
|
||||
|
@ -41,16 +46,6 @@ in rec {
|
|||
};
|
||||
};
|
||||
|
||||
toggle-checkbox-nvim = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "toggle-checkbox-nvim";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "opdavies";
|
||||
repo = "toggle-checkbox.nvim";
|
||||
rev = "main";
|
||||
sha256 = "4YSEagQnLK5MBl2z53e6sOBlCDm220GYVlc6A+HNywg=";
|
||||
};
|
||||
};
|
||||
|
||||
vim-caser = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "vim-caser";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
|
@ -100,43 +95,31 @@ in rec {
|
|||
customVim.vim-textobj-xmlattr
|
||||
customVim.vim-zoom
|
||||
|
||||
# {
|
||||
# plugin = customVim.toggle-checkbox-nvim;
|
||||
# type = "lua";
|
||||
# config = ''
|
||||
# vim.keymap.set("n", "<leader>t", ":lua require('toggle-checkbox').toggle()<CR>")
|
||||
# '';
|
||||
# }
|
||||
|
||||
vimPlugins.fidget-nvim
|
||||
vimPlugins.harpoon
|
||||
vimPlugins.refactoring-nvim
|
||||
vimPlugins.comment-nvim
|
||||
vimPlugins.dial-nvim
|
||||
vimPlugins.fidget-nvim
|
||||
vimPlugins.gitsigns-nvim
|
||||
vimPlugins.harpoon
|
||||
vimPlugins.impatient-nvim
|
||||
vimPlugins.mini-nvim
|
||||
vimPlugins.neodev-nvim
|
||||
vimPlugins.nvim-web-devicons
|
||||
vimPlugins.refactoring-nvim
|
||||
vimPlugins.rest-nvim
|
||||
vimPlugins.undotree
|
||||
vimPlugins.vim-easy-align
|
||||
vimPlugins.vim-eunuch
|
||||
vimPlugins.vim-highlightedyank
|
||||
vimPlugins.vim-nix
|
||||
vimPlugins.vim-just
|
||||
vimPlugins.vim-nix
|
||||
vimPlugins.vim-obsession
|
||||
vimPlugins.vim-pasta
|
||||
vimPlugins.vim-polyglot
|
||||
vimPlugins.vim-projectionist
|
||||
vimPlugins.vim-repeat
|
||||
vimPlugins.vim-sleuth
|
||||
vimPlugins.vim-surround
|
||||
vimPlugins.vim-terraform
|
||||
vimPlugins.vim-textobj-user
|
||||
vimPlugins.vim-tmux-navigator
|
||||
vimPlugins.vim-unimpaired
|
||||
vimPlugins.vim-visual-star-search
|
||||
|
||||
vimPlugins.lualine-nvim
|
||||
|
||||
# {
|
||||
# plugin = vimPlugins.vim-sort-motion;
|
||||
|
@ -160,7 +143,6 @@ in rec {
|
|||
|
||||
# Git
|
||||
vimPlugins.vim-fugitive
|
||||
vimPlugins.vim-rhubarb
|
||||
|
||||
# Debugging
|
||||
vimPlugins.nvim-dap
|
||||
|
@ -175,22 +157,19 @@ in rec {
|
|||
# LSP, linting and formatting
|
||||
vimPlugins.conform-nvim
|
||||
vimPlugins.lsp-status-nvim
|
||||
vimPlugins.none-ls-nvim
|
||||
vimPlugins.nvim-lint
|
||||
vimPlugins.nvim-lspconfig
|
||||
|
||||
# Completion
|
||||
pkgs2305.vimPlugins.phpactor
|
||||
vimPlugins.cmp-buffer
|
||||
vimPlugins.cmp-cmdline
|
||||
vimPlugins.cmp-nvim-lsp
|
||||
vimPlugins.cmp-nvim-lsp-signature-help
|
||||
vimPlugins.cmp-path
|
||||
vimPlugins.cmp-tabnine
|
||||
vimPlugins.cmp-treesitter
|
||||
vimPlugins.cmp-vsnip
|
||||
vimPlugins.cmp_luasnip
|
||||
vimPlugins.lspkind-nvim
|
||||
vimPlugins.nvim-cmp
|
||||
vimPlugins.phpactor
|
||||
|
||||
# Snippets
|
||||
vimPlugins.friendly-snippets
|
||||
|
@ -211,8 +190,6 @@ in rec {
|
|||
vimPlugins.vim-dadbod-ui
|
||||
vimPlugins.vim-dadbod-completion
|
||||
|
||||
vimPlugins.vim-floaterm
|
||||
|
||||
# # Markdown
|
||||
# {
|
||||
# plugin = vimPlugins.markdown-preview-nvim;
|
||||
|
@ -225,15 +202,12 @@ in rec {
|
|||
# Themes
|
||||
vimPlugins.catppuccin-nvim
|
||||
|
||||
# Wiki
|
||||
vimPlugins.vimwiki
|
||||
|
||||
# Configuration.
|
||||
opdavies-nvim
|
||||
];
|
||||
|
||||
mkExtraPackages = {system}: let
|
||||
inherit (pkgs) nodePackages;
|
||||
inherit (pkgs) nodePackages lua54Packages php82Packages;
|
||||
|
||||
pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
|
@ -246,6 +220,7 @@ in rec {
|
|||
pkgs.php81
|
||||
|
||||
# Language servers
|
||||
lua54Packages.luacheck
|
||||
nodePackages."@tailwindcss/language-server"
|
||||
nodePackages.bash-language-server
|
||||
nodePackages.dockerfile-language-server-nodejs
|
||||
|
@ -272,11 +247,11 @@ in rec {
|
|||
pkgs.stylua
|
||||
|
||||
# Tools
|
||||
nodePackages.markdownlint-cli
|
||||
php82Packages.phpcbf
|
||||
php82Packages.phpcs
|
||||
php82Packages.phpstan
|
||||
pkgs.html-tidy
|
||||
pkgs.lazygit
|
||||
pkgs.lazydocker
|
||||
pkgs.nnn
|
||||
pkgs.nodePackages.markdownlint-cli
|
||||
pkgs.proselint
|
||||
pkgs.shellcheck
|
||||
];
|
||||
|
|
|
@ -33,7 +33,7 @@ local custom_attach = function(client)
|
|||
|
||||
nvim_status.on_attach(client)
|
||||
|
||||
buf_inoremap { "<C-s>", vim.lsp.buf.signature_help }
|
||||
buf_inoremap { "<C-k>", vim.lsp.buf.signature_help }
|
||||
buf_nnoremap { "<leader>ca", vim.lsp.buf.code_action }
|
||||
buf_nnoremap { "<leader>d", vim.diagnostic.open_float }
|
||||
buf_nnoremap { "<leader>rn", vim.lsp.buf.rename }
|
||||
|
@ -66,6 +66,8 @@ local custom_attach = function(client)
|
|||
-- filetype_attach[filetype](client)
|
||||
end
|
||||
|
||||
require("neodev").setup {}
|
||||
|
||||
local servers = {
|
||||
ansiblels = true,
|
||||
bashls = true,
|
||||
|
@ -85,9 +87,21 @@ local servers = {
|
|||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
},
|
||||
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -146,9 +160,42 @@ vim.diagnostic.config {
|
|||
virtual_text = { spacing = 2 },
|
||||
}
|
||||
|
||||
local conform = require "conform"
|
||||
|
||||
conform.setup {
|
||||
formatters_by_ft = {
|
||||
bash = { "shellcheck" },
|
||||
javascript = { { "prettierd", "prettier" } },
|
||||
just = { "just" },
|
||||
lua = { "stylua" },
|
||||
nix = { { "alejandra", "nixfmt" } },
|
||||
php = { { "php_cs_fixer", "phpcbf" } },
|
||||
terraform = { "terraform_fmt" },
|
||||
yaml = { "yamlfmt" },
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<leader>f", function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
conform.format { lsp_fallback = true, async = false, timeout_ms = 500 }
|
||||
end)
|
||||
|
||||
require "opdavies.lsp.none-ls"
|
||||
require "opdavies.lsp.signature"
|
||||
local lint = require "lint"
|
||||
|
||||
lint.linters_by_ft = {
|
||||
dockerfile = { "hadolint" },
|
||||
javascript = { "eslint_d" },
|
||||
json = { "jsonlint" },
|
||||
lua = { "luacheck" },
|
||||
markdown = { "markdownlint" },
|
||||
nix = { "nix" },
|
||||
php = { "php", "phpcs", "phpstan" },
|
||||
}
|
||||
|
||||
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,47 +0,0 @@
|
|||
local status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local code_actions = null_ls.builtins.code_actions
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
local formatting = null_ls.builtins.formatting
|
||||
|
||||
null_ls.setup {
|
||||
sources = {
|
||||
code_actions.gitsigns,
|
||||
|
||||
formatting.alejandra,
|
||||
formatting.black,
|
||||
formatting.markdownlint,
|
||||
formatting.phpcbf.with {
|
||||
command = "./vendor/bin/phpcbf",
|
||||
condition = function(utils)
|
||||
return utils.root_has_file { "phpcs.xml.dist" }
|
||||
end,
|
||||
},
|
||||
formatting.prettier,
|
||||
formatting.rustywind,
|
||||
formatting.stylua,
|
||||
|
||||
diagnostics.eslint.with {
|
||||
condition = function(utils)
|
||||
return utils.root_has_file { ".eslintrc.js" }
|
||||
end,
|
||||
},
|
||||
diagnostics.markdownlint.with {
|
||||
extra_args = { "--config", "~/.markdownlint.yaml" },
|
||||
},
|
||||
diagnostics.php,
|
||||
diagnostics.phpcs.with {
|
||||
command = "./vendor/bin/phpcs",
|
||||
condition = function(utils)
|
||||
return utils.root_has_file { "phpcs.xml.dist" }
|
||||
end,
|
||||
},
|
||||
diagnostics.phpstan,
|
||||
diagnostics.shellcheck,
|
||||
},
|
||||
|
||||
temp_dir = "/tmp",
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
local status_ok, lsp_signature = pcall(require, "lsp_signature")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
lsp_signature.setup {}
|
Reference in a new issue