Replace nvim config with LazyVim

This commit is contained in:
Kevin Cotugno 2023-10-06 06:13:04 -07:00
parent a9a8844c09
commit 535d81f6af
17 changed files with 192 additions and 3187 deletions

View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2017 Junegunn Choi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

2
.config/nvim/init.lua Normal file
View File

@ -0,0 +1,2 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")

View File

@ -1,354 +0,0 @@
scriptencoding utf-8
" vim-plug---START
call plug#begin('~/.config/nvim/plugged')
" Plugins
Plug 'airblade/vim-gitgutter'
Plug 'cespare/vim-toml'
Plug 'vim-scripts/nginx.vim'
Plug 'elixir-lang/vim-elixir'
Plug 'fatih/vim-go'
Plug 'gabesoft/vim-ags'
Plug 'google/protobuf'
Plug 'hashivim/vim-terraform'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-calc'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-nvim-lua'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/vim-vsnip'
Plug 'junegunn/fzf'
Plug 'kchmck/vim-coffee-script'
Plug 'lifepillar/vim-solarized8'
Plug 'majutsushi/tagbar'
Plug 'neovim/nvim-lspconfig'
Plug 'OmniSharp/omnisharp-vim'
Plug 'posva/vim-vue'
Plug 'sainnhe/gruvbox-material'
Plug 'preservim/nerdcommenter'
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'Shougo/vimproc.vim'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-surround'
call plug#end()
" vim-plug---END
syntax enable
set termguicolors
colorscheme gruvbox-material
set cursorline
set colorcolumn=80,100
function ToggleBackground(current)
if a:current ==# 'dark'
set background=light
" hi Whitespace ctermfg=7 guifg=#eee8d5
else
set background=dark
" hi Whitespace ctermfg=0 guifg=#073642
end
endfunction
call ToggleBackground('light')
nmap <F5> :call ToggleBackground(&background)<CR>
set spell
set number
set nowrap
filetype plugin indent on
set mouse=a
set list
set listchars=tab:――,space,trail
let g:NoClean = ['diff']
augroup indentation
autocmd BufRead,BufNewFile
\ Makefile,
\*.c,
\*.cpp,
\*.go
\ set tabstop=8 shiftwidth=8 noexpandtab
autocmd BufRead,BufNewFile
\ *.cs,
\*.java
\ set tabstop=4 shiftwidth=4 expandtab
autocmd BufRead,BufNewFile
\ *.rb,
\*.css,
\*.js,
\*.jsx,
\*.coffee,
\*.erb,
\*.html,
\*.html.tmpl,
\*.json,
\*.qtpl,
\*.tf,
\*.tfvars,
\*.vue,
\*.yml,
\*.yaml
\ set tabstop=2 shiftwidth=2 expandtab
autocmd FileType crontab set backupcopy=yes
augroup END
" vint: -ProhibitCommandRelyOnUser -ProhibitCommandWithUnintendedSideEffect
function TrimTrailingInvisibles()
let view = winsaveview()
%s/\s\+$//e
call winrestview(view)
endfunction
function TrimTrailingLines()
let view = winsaveview()
%s/\n\+\%$//e
call winrestview(view)
endfunction
" vint: +ProhibitCommandRelyOnUser +ProhibitCommandWithUnintendedSideEffect
function OnWrite()
if Writeable()
call CleanFile()
endif
endfunction
function OnLeave()
if Writeable()
call CleanFile()
write
GitGutter
endif
endfunction
function CleanFile()
call TrimTrailingInvisibles() | call TrimTrailingLines()
endfunction
function Writeable()
return empty(&buftype)
\ && index(g:NoClean, &filetype) == -1
\ && !&readonly
\ && &modifiable
\ && &modified
\ && !empty(expand('%:t'))
endfunction
augroup maximus
autocmd BufWrite * call OnWrite()
autocmd BufLeave * call OnLeave()
augroup END
set statusline=%f
set statusline+=\ %y
set statusline+=[%{&ff}]
set statusline+=%r
set statusline+=%h
set statusline+=%{ModifiedSym()}
set statusline+=%=
set statusline+=%{AddGitGutterToStatusline()}
set statusline+=\ [%c:%l/%L:%p%%]
function ModifiedSym()
if &modified
return "[\u270f]"
else
return ''
end
endfunction
function AddGitGutterToStatusline()
if empty(&buftype) && exists('b:gitgutter_summary')
return join(['[Git:', join(b:gitgutter_summary, ','), ']'], '')
else
return ''
endif
endfunction
" Shortcuts
" Plugins
nnoremap <C-\> :NERDTreeToggle<CR>
nnoremap <leader>. :TagbarToggle<CR>
" Tabs
nnoremap <leader>tt :tabnew<CR>
nnoremap <leader>tn :tabnext<CR>
nnoremap <leader>tp :tabprevious<CR>
nnoremap <leader>tc :tabclose<CR>
nnoremap <leader>tm :tabmove<CR>
" Misc
nnoremap <leader>h :noh<CR>
nnoremap <C-]> :exec "tjump ".expand("<cword>")<CR>
nnoremap <leader><space> :call Fullscreen()<CR>
function Fullscreen()
let view = winsaveview()
let buf = winbufnr(0)
let found = 0
for b in win_findbuf(buf)
let tabwin = win_id2tabwin(b)
if gettabwinvar(tabwin[0], tabwin[1], 'fullscreen_buf') == buf
let found = 1
let existing_tab = tabwin[0]
let existing_win = tabwin[1]
endif
endfor
if found == 1
if existing_tab == tabpagenr()
tabclose
else
exec 'tabnext'.existing_tab
endif
else
exec 'tabnew +buffer'.buf
let w:fullscreen_buf = buf
end
call winrestview(view)
endfunction
" Plugin configuration
" The Silver Searcher
nnoremap <leader>s :Ags<space>
" FZF
nnoremap <C-p> :FZF<CR>
" NERD Commenter
let g:NERDSpaceDelims = 1
" NERD Tree
let g:NERDTreeShowHidden = 1
" Tagbar
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
set completeopt=menu,menuone,noselect
lua <<EOF
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
local opts = { noremap=true, silent=true }
-- See `:help vim.lsp.*` for documentation on any of the below functions
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
end
local cmp = require'cmp'
local sources = {
{ name = 'nvim_lsp' },
{ name = 'nvim_lua' },
{ name = 'vsnip' },
{ name = 'path' },
{ name = 'buffer' },
}
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<CR>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources(sources),
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
require'lspconfig'.gopls.setup{
on_attach = on_attach,
capabilities = capabilities,
}
require'lspconfig'.solargraph.setup{
on_attach = on_attach,
bundlerPath = 'bin/bundle',
useBundler = true,
capabilities = capabilities,
}
require'lspconfig'.rust_analyzer.setup{
on_attach = on_attach,
capabilities = capabilities,
}
require'lspconfig'.clangd.setup{
on_attach = on_attach,
capabilities = capabilities,
}
EOF

View File

@ -0,0 +1,51 @@
{
"LazyVim": { "branch": "main", "commit": "cce46cd6401239f04c6ce98113a3410677c1a82f" },
"LuaSnip": { "branch": "master", "commit": "2c3a3a3e4fb503bf39efb61290ecfa8aae95f5eb" },
"alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" },
"bufferline.nvim": { "branch": "main", "commit": "357cc8f8eeb64702e6fcf2995e3b9becee99a5d3" },
"catppuccin": { "branch": "main", "commit": "fc537040147f0374a22b88142a20eb6781141f0b" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"dressing.nvim": { "branch": "master", "commit": "8f4d62b7817455896a3c73cab642002072c114bc" },
"flash.nvim": { "branch": "main", "commit": "6d76c5dee65181ab55cbdfb0760260e800d643f4" },
"friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" },
"gitsigns.nvim": { "branch": "main", "commit": "ff01d34daaed72f271a8ffa088a7e839a60c640f" },
"gruvbox.nvim": { "branch": "main", "commit": "fb03688892b2282cfa1b4181178b7ad4d9da6198" },
"indent-blankline.nvim": { "branch": "master", "commit": "877c1db2bf957300097dd5348a665666a4d900cb" },
"lazy.nvim": { "branch": "main", "commit": "6b6f0a451200bb6abde85978c577c73ea1577758" },
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "e2705063f395b44f676cd26596a11007a2cbd3bd" },
"mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
"mini.ai": { "branch": "main", "commit": "7ae226f331885e6f30e9a8229e113debc59308ae" },
"mini.bufremove": { "branch": "main", "commit": "7821606e35c1ac931b56d8e3155f45ffe76ee7e5" },
"mini.comment": { "branch": "main", "commit": "877acea5b2a32ff55f808fc0ebe9aa898648318c" },
"mini.indentscope": { "branch": "main", "commit": "f60e9b51a6214c73a170ffc5445ce91560981031" },
"mini.pairs": { "branch": "main", "commit": "dfa9f6e2576bb8853be277d96b735af59d9be7c2" },
"mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "71f1841ba6c652908678cece623f52c1fea8a6cd" },
"neoconf.nvim": { "branch": "main", "commit": "64a4f814f598717ed1e56da4e175b2513bd7c3fd" },
"neodev.nvim": { "branch": "main", "commit": "ee960afffdb95472f719a72a1edb494ffea09c92" },
"noice.nvim": { "branch": "main", "commit": "7cf858c30841c9c41601ce58e5bc2023228037ef" },
"none-ls.nvim": { "branch": "main", "commit": "f39f627bbdfb33cc4ae4a95b4708e7dba7b9aafc" },
"nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" },
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
"nvim-lspconfig": { "branch": "master", "commit": "71b39616b14c152da34fcc787fa27f09bf280e72" },
"nvim-navic": { "branch": "master", "commit": "0ffa7ffe6588f3417e680439872f5049e38a24db" },
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
"nvim-spectre": { "branch": "master", "commit": "97cfd1b0f5a6ab35979ce1bee6c17f54745fd1e5" },
"nvim-treesitter": { "branch": "master", "commit": "6276cd9d41a56758bc48b433c99b8f9e345a3f2d" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "4724694bc03ce1148860a46d9d77c3664d8188ab" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "7241635869b7a8115893ffa67bab3907756caf4f" },
"nvim-web-devicons": { "branch": "master", "commit": "45d0237c427baba8cd05e0ab26d30e2ee58c2c82" },
"persistence.nvim": { "branch": "main", "commit": "4b8051c01f696d8849a5cb8afa9767be8db16e40" },
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
"telescope.nvim": { "branch": "master", "commit": "205f469244916716c49cc2b9026566749425c5ba" },
"todo-comments.nvim": { "branch": "main", "commit": "3094ead8edfa9040de2421deddec55d3762f64d1" },
"tokyonight.nvim": { "branch": "main", "commit": "4412dafadf920deb9e08d4b9c1c11b2cf65ca1ca" },
"trouble.nvim": { "branch": "main", "commit": "3f85d8ed30e97ceeddbbcf80224245d347053711" },
"vim-illuminate": { "branch": "master", "commit": "1b5d70332a51a1de05f281069851865a2bb1e6d7" },
"vim-startuptime": { "branch": "master", "commit": "454b3de856b7bd298700de33d79774ca9b9e3875" },
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }
}

View File

@ -0,0 +1,3 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here

View File

@ -0,0 +1,3 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here

View File

@ -0,0 +1,43 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
-- bootstrap lazy.nvim
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.lang.go" },
{ import = "lazyvim.plugins.extras.lang.ruby" },
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = { "tokyonight", "habamax" } },
checker = { enabled = true }, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View File

@ -0,0 +1,13 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
local opt = vim.opt
opt.colorcolumn = "80,100"
opt.cursorline = true
opt.list = true
opt.listchars = "tab:――,space:·,trail:·"
opt.mouse = "a"
opt.spell = true
opt.termguicolors = true
opt.wrap = false

View File

@ -0,0 +1,9 @@
return {
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
go = { "goimports" },
},
},
}

View File

@ -0,0 +1,12 @@
return {
{
"ellisonleao/gruvbox.nvim",
priority = 1000,
},
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
}

View File

@ -0,0 +1,8 @@
return {
"williamboman/mason.nvim",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"solargraph",
})
end,
}

View File

@ -0,0 +1,14 @@
return {
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
if type(opts.sources) == "table" then
local nls = require("null-ls")
vim.list_extend(opts.sources, {
nls.builtins.code_actions.gomodifytags,
nls.builtins.code_actions.impl,
nls.builtins.formatting.goimports,
})
end
end,
}

View File

@ -0,0 +1,8 @@
return {
"neovim/nvim-lspconfig",
opts = {
servers = {
solargraph = {},
},
},
}

View File

@ -0,0 +1,15 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"go",
"gomod",
"gowork",
"gosum",
"ruby",
"rust",
})
end,
},
}

View File

@ -0,0 +1,8 @@
local Util = require("lazyvim.util")
return {
"nvim-telescope/telescope.nvim",
keys = {
{ "<c-p>", Util.telescope("files"), desc = "Find Files (root dir)" },
},
}

3
.config/nvim/stylua.toml Normal file
View File

@ -0,0 +1,3 @@
indent_type = "Spaces"
indent_width = 2
column_width = 120