Skip to content

Commit

Permalink
Yet Another Vim Overhaul
Browse files Browse the repository at this point in the history
Well, it's that time again. This is a very large cleanup of my neovim configs
and a migration to using lazy.nvim for my plugin manager. This has meant that
all neovim plugin configuration has been moved from their own -config files into
their respective .lua files under `./lua/plugin`.

Other things in this commit:
- Cleaning up any unused vim files in the `./config` directory
- Fixing my LSP setup so that it works with Mason properly
- Removing an filetype plugins in favor of using an LSP or Mason
  • Loading branch information
mr-mustash committed Dec 14, 2023
1 parent ee3eee4 commit 4afbfd3
Show file tree
Hide file tree
Showing 59 changed files with 770 additions and 3,451 deletions.
2,812 changes: 0 additions & 2,812 deletions tilde/.config/nvim/autoload/plug.vim

This file was deleted.

2 changes: 2 additions & 0 deletions tilde/.config/nvim/ftdetect/text.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
" Text
autocmd customaugroup BufNewFile,BufRead *.{txt,text,tex} set filetype=text
3 changes: 3 additions & 0 deletions tilde/.config/nvim/ftplugin/git.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
autocmd customaugroup Filetype git,gitsendemail,*commit*,*COMMIT* call pencil#init({'wrap': 'hard', 'textwidth': 80})
\ | setl expandtab noswapfile noautoindent
\ | call ProseSetup()
5 changes: 4 additions & 1 deletion tilde/.config/nvim/ftplugin/go.vim
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
set nolist
"vint: -ProhibitUnnecessaryDoubleQuote
let &listchars="tab: ,trail:\uB7,nbsp:~"
"vint: +ProhibitUnnecessaryDoubleQuote
"
autocmd customaugroup BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4
1 change: 0 additions & 1 deletion tilde/.config/nvim/ftplugin/markdown.vim

This file was deleted.

2 changes: 2 additions & 0 deletions tilde/.config/nvim/ftplugin/markdown.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
autocmd customaugroup FileType markdown,mkd,md call pencil#init()
\ | call ProseSetup()
12 changes: 0 additions & 12 deletions tilde/.config/nvim/ftplugin/prose.vim

This file was deleted.

5 changes: 5 additions & 0 deletions tilde/.config/nvim/ftplugin/sh.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"vint: -ProhibitUnnecessaryDoubleQuote
let &listchars="tab: ,trail:\uB7,nbsp:~"
"vint: +ProhibitUnnecessaryDoubleQuote

autocmd customaugroup BufNewFile,BufRead *.sh setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4
1 change: 0 additions & 1 deletion tilde/.config/nvim/ftplugin/text.vim

This file was deleted.

2 changes: 2 additions & 0 deletions tilde/.config/nvim/ftplugin/text.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
autocmd customaugroup FileType text,tex,txt call pencil#init({'wrap': 'hard'})
\ | call ProseSetup()
39 changes: 39 additions & 0 deletions tilde/.config/nvim/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-- Load my old init.vim file first
local vimrc = vim.fn.stdpath("config") .. "/vimrc.vim"
vim.cmd.source(vimrc)

-- Faster loading: Used to be https://github.com/lewis6991/impatient.nvim
vim.loader.enable()

-- Only current line diagnostics
vim.diagnostic.config({ virtual_lines = { only_current_line = true } })

-- Lazy package manager
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup("plugin", {
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},

})
32 changes: 32 additions & 0 deletions tilde/.config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"committia.vim": { "branch": "master", "commit": "a187b8633694027ab5ef8a834527d33093282f95" },
"copilot.lua": { "branch": "master", "commit": "38a41d0d78f8823cc144c99784528b9a68bdd608" },
"fzf-lua": { "branch": "main", "commit": "209e9405d2df949cbffe5b7b9329756b83bf2339" },
"gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lsp-zero.nvim": { "branch": "v3.x", "commit": "ffebf6f7b0649f1eb81b37c37b75552f8ff96337" },
"lsp_lines.nvim": { "branch": "main", "commit": "cf2306dd332e34a3e91075b40bdd4f6db824b2ee" },
"lsp_signature.nvim": { "branch": "master", "commit": "fed2c8389c148ff1dfdcdca63c2b48d08a50dea0" },
"lualine-lsp-progress": { "branch": "master", "commit": "d76634e491076e45f465b31849d6ec320b436abb" },
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "9453e3d6cd2ca45d96e20f343e8f1b927364b630" },
"mason-null-ls.nvim": { "branch": "main", "commit": "d1f7258f80867f718d643d88eee66959671a4bef" },
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
"mini.nvim": { "branch": "main", "commit": "b5645ac6eefce8e7af9d7dd4e5e296a81cba8a10" },
"none-ls.nvim": { "branch": "main", "commit": "45d0e8fa9094dcc3fabad9065a5822af9cf099c7" },
"nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" },
"nvim-lspconfig": { "branch": "master", "commit": "f451052bd6804e9e5ccd0ac874d7df8d3d4c55b9" },
"nvim-navbuddy": { "branch": "master", "commit": "f137a3466a6cd1965cdcc5398daff54e66eebbe5" },
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
"nvim-solarized-lua": { "branch": "master", "commit": "7bd46fa036bde6b4483fb7403b0a7b0754faeeaa" },
"nvim-treesitter": { "branch": "master", "commit": "42381aae7c1f785e4658cdb34a750be9851ba9af" },
"nvim-web-devicons": { "branch": "master", "commit": "a1425903ab52a0a0460622519e827f224e5b4fee" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"vim-dirtytalk": { "branch": "master", "commit": "f5b0d51a7d822177814e7edc116ca484f852665f" },
"vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" },
"vim-mundo": { "branch": "master", "commit": "b53d35fb5ca9923302b9ef29e618ab2db4cc675e" },
"vim-pencil": { "branch": "master", "commit": "6d70438a8886eaf933c38a7a43a61adb0a7815ed" },
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
"vim-spellsync": { "branch": "master", "commit": "210ca6a81243ec4a38404d599f5eb288ca71b700" },
"yanky.nvim": { "branch": "main", "commit": "6bb9ffd3cad4c9876bda54e19d0659de28a4f84f" }
}
9 changes: 9 additions & 0 deletions tilde/.config/nvim/lazyvim.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extras": [

],
"news": {
"NEWS.md": "2123"
},
"version": 2
}
119 changes: 119 additions & 0 deletions tilde/.config/nvim/lua/plugin/config/lsp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
local lsp = {}

local function null_ls_init()
-- Config
local null_ls = require("null-ls")
null_ls.setup({
sources = {
require("null-ls").builtins.code_actions.shellcheck,
require("null-ls").builtins.diagnostics.fish,
require("null-ls").builtins.diagnostics.gitlint,
require("null-ls").builtins.diagnostics.hadolint,
require("null-ls").builtins.diagnostics.luacheck,
require("null-ls").builtins.diagnostics.tfsec,
require("null-ls").builtins.diagnostics.vint,
require("null-ls").builtins.diagnostics.write_good,
require("null-ls").builtins.diagnostics.yamllint,
require("null-ls").builtins.formatting.fish_indent,
require("null-ls").builtins.formatting.markdownlint,
require("null-ls").builtins.formatting.prettierd,
require("null-ls").builtins.formatting.shfmt,
require("null-ls").builtins.formatting.yamllint,
},
diagnostic_config = {
virtual_text = false,
},
})
end

local function mason_null_ls_init()
require("mason-null-ls").setup({
ensure_installed = nil,
automatic_installation = true,
})
end

local function mason_init()
require('mason.settings').set({
ui = {
border = 'rounded'
}
})
require("mason").setup()
end

local function lsp_zero_mason_lspconfig_navic_init()
local mason_lspconfig = require("mason-lspconfig")
local lsp_zero = require('lsp-zero').preset('lsp-only')
local navic = require("nvim-navic")
local navbuddy = require("nvim-navbuddy")

lsp_zero.set_sign_icons({
error = '',
warn = '',
info = '',
hint = ''
})

lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings to learn the available actions
lsp_zero.default_keymaps({buffer = bufnr})

-- Navic and navbuddy require documentSymbolProvider
if client.server_capabilities.documentSymbolProvider then
navic.attach(client, bufnr)
navbuddy.attach(client, bufnr)
end
end)

lsp_zero.setup()

mason_lspconfig.setup({
automatic_installation = true,
handlers = {
lsp_zero.default_setup,
},
})

navic.setup {
highlight = true,
separator = " > ",
depth_limit_indicator = "...",
lazy_update_context = false,
click = false,
}

end

local function lsp_signature_init()
require "lsp_signature".setup({
auto_close_after = 5,
bind = true, -- This is mandatory, otherwise border config won't get registered.
floating_window = true,
floating_window_off_x = 10, -- Right 10 columns
handler_opts = { border = "rounded"},
hint_enable = false,
transparency = 10,
})
end

function lsp.init()
require("lspconfig")
null_ls_init()
mason_init()
lsp_zero_mason_lspconfig_navic_init()
mason_null_ls_init()
lsp_signature_init()

-- This is necessary to make sure virtual text is only shown on the current
-- line
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics,
{
virtual_text = false,
virtual_lines = { only_current_line = true }
}
)
end

return lsp
69 changes: 69 additions & 0 deletions tilde/.config/nvim/lua/plugin/copilot.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
--return { { "github/copilot.vim", build = ":Copilot auth", cmd = "Copilot",
--event = "InsertEnter", config = function () vim.cmd([[ imap
--<silent><script><expr> <C-k> copilot#Accept("\<CR>") let
--g:copilot_no_tab_map = v:true
--
-- " Copilot suggestions
-- inoremap <C-p> <Esc>:Copilot<CR>i " List all sugestions
-- imap <silent><script><expr> <C-l> <Plug>(copilot-next)
-- imap <silent><script><expr> <C-h> <Plug>(copilot-previous)
--
-- " Disable copilot when working on text files
-- let g:copilot_filetypes = {
-- \ 'markdown': v:false,
-- \ 'mkd': v:false,
-- \ 'md': v:false,
-- \ 'tex': v:false,
-- \ 'text': v:false,
-- \ 'git': v:false,
-- \ 'gitsendemail': v:false,
-- \ 'gitcommit': v:false,
-- \ '*commit*': v:false,
-- \ '*COMMIT*': v:false,
-- \ }
--
-- let g:copilot_enabled = 1
-- ]])
-- end,
-- }
--}

return {
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
config = function ()
require('copilot').setup({
panel = {
enabled = false,
},
suggestion = {
enabled = true,
auto_trigger = true,
debounce = 75,
keymap = {
accept = "<C-k>",
},
},
filetypes = {
commit = false,
cvs = false,
git = false,
gitcommit = false,
gitrebase = false,
gitsendmail = false,
help = false,
hgcommit = false,
markdown = false,
md = false,
mkd = false,
svn = false,
tex = false,
text = false,
yaml = false,
},
})
end
}
}
Binary file removed tilde/.config/nvim/lua/plugin/default.profraw
Binary file not shown.
15 changes: 15 additions & 0 deletions tilde/.config/nvim/lua/plugin/fzf.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
return {
{
"ibhagwan/fzf-lua",
keys = {
{ "<leader>p", ":FzfLua files<cr>", desc = "FZF Files" },
{ "<leader>ff", ":FzfLua files<cr>", desc = "FZF Files" },
{ "<leader>fh", ":FzfLua help_tags<cr>", desc = "FZF Helptags" },
{ "<leader>fh", ":FzfLua help_tags<cr>", desc = "FZF Helptags" },
{ "<leader>rg", ":FzfLua live_grep<cr>", desc = "FZF Grep" },
},
config = function()
require("fzf-lua").setup({})
end
}
}
36 changes: 36 additions & 0 deletions tilde/.config/nvim/lua/plugin/git.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
return {
{
"rhysd/committia.vim",
ft = { "gitcommit", "gitsendemail", "*commit*", "*COMMIT*" },
dependencies = { "tpope/vim-fugitive" },
config = function()
vim.cmd([[
let g:committia_open_only_vim_starting = 1
let g:committia_hooks = {}
function! g:committia_hooks.edit_open(info)
" Additional settings
setlocal spell
" If no commit message, start with insert mode
if a:info.vcs ==# 'git' && getline(1) ==# ''
startinsert
endif
" Scroll the diff window from insert mode
" Map <C-n> and <C-p>
imap <buffer><C-n> <Plug>(committia-scroll-diff-down-half)
imap <buffer><C-p> <Plug>(committia-scroll-diff-up-half)
endfunction
]])
end,
},
{
"tpope/vim-fugitive",
cmd = { "Git", "Gdiffsplit", "Gread", "Gwrite", "Ggrep", "GMove", "GDelete", "GBrowse" },
dependencies = { "tpope/vim-rhubarb" },
keys = {
{ "<leader>gb", ":GBrowse<cr>", mode = {"n", "v"}, desc = "Git Browse" },
},
}
}
25 changes: 0 additions & 25 deletions tilde/.config/nvim/lua/plugin/gitsigns-config.lua

This file was deleted.

Loading

0 comments on commit 4afbfd3

Please sign in to comment.