Split up neovim config

This commit is contained in:
Devon Tingley 2022-08-30 10:14:07 -04:00
parent fa76424a93
commit 4551ffc465
19 changed files with 238 additions and 233 deletions

View file

@ -103,16 +103,16 @@ window:
#multiplier: 3
# Font configuration
#font:
font:
# Normal (roman) font face
#normal:
normal:
# Font family
#
# Default:
# - (macOS) Menlo
# - (Linux/BSD) monospace
# - (Windows) Consolas
#family: monospace
family: NotoMono Nerd Font mono
# The `style` can be specified to pick a specific face.
#style: Regular
@ -151,7 +151,7 @@ window:
#style: Bold Italic
# Point size
#size: 11.0
size: 12.0
# Offset is the extra space around each character. `offset.y` can be thought
# of as modifying the line spacing, and `offset.x` as modifying the letter

View file

@ -35,6 +35,6 @@ SETUVAR fish_pager_color_description:B3A06D\x1eyellow
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SETUVAR fish_pager_color_selected_background:\x2dr
SETUVAR fish_user_paths:/home/digyx/\x2elocal/bin\x1e/home/digyx/\x2eyarn/bin\x1e/home/digyx/\x2ecargo/bin
SETUVAR fish_user_paths:/Users/dtingley/go/bin\x1e/Users/dtingley/\x2ecargo/bin\x1e/home/digyx/\x2eyarn/bin\x1e/home/digyx/\x2ecargo/bin
SETUVAR nvm_data:/home/digyx/\x2elocal/share/nvm
SETUVAR nvm_mirror:https\x3a//nodejs\x2eorg/dist

View file

@ -0,0 +1,5 @@
function macos_update
brew upgrade
gup update
cargo install-update --all
end

View file

@ -1,9 +0,0 @@
{
"coc.preferences.formatOnSaveFiletypes": ["go", "rust"],
"Lua.diagnostics.globals": [
"vim"
],
"Lua.telemetry.enable": true,
"sumneko-lua.enableNvimLuaDev": true,
"rust-analyzer.inlayHints.typeHints": false
}

View file

@ -0,0 +1 @@
vim.o.shiftwidth = 2

View file

@ -0,0 +1 @@
vim.o.expandtab = false

View file

@ -0,0 +1 @@
vim.o.shiftwidth = 2

View file

@ -0,0 +1 @@
vim.o.shiftwidth = 2

View file

@ -0,0 +1 @@
vim.o.shiftwidth = 2

View file

@ -0,0 +1,19 @@
require('zen-mode').setup()
require('neorg').setup({
load = {
['core.defaults'] = {},
['core.norg.completion'] = {
config = {
engine = 'nvim-cmp',
}
},
['core.integrations.nvim-cmp'] = {},
['core.norg.concealer'] = {},
['core.export'] = {},
['core.presenter'] = {
config = {
zen_mode = 'zen-mode'
}
},
}
})

View file

@ -0,0 +1 @@
vim.o.shiftwidth = 2

View file

@ -0,0 +1 @@
vim.o.shiftwidth = 2

View file

@ -1,16 +1,14 @@
require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use 'dstein64/vim-startuptime'
use 'williamboman/mason.nvim'
use 'williamboman/mason-lspconfig.nvim'
use 'neovim/nvim-lspconfig'
use 'nvim-lualine/lualine.nvim'
use 'morhetz/gruvbox'
use 'vim-test/vim-test'
use 'lewis6991/gitsigns.nvim'
use 'windwp/nvim-autopairs'
use 'numToStr/Comment.nvim'
use 'echasnovski/mini.nvim'
-- Treesitter
use 'nvim-treesitter/nvim-treesitter'
@ -34,200 +32,29 @@ require('packer').startup(function(use)
}
use {
"nvim-neorg/neorg",
requires = "nvim-lua/plenary.nvim"
}
use "folke/zen-mode.nvim"
end)
-- Caddyfile Grammar
vim.filetype.add({
filename = {
['Caddyfile'] = 'caddyfile',
}
})
require('nvim-treesitter.configs').setup({
highlight = {
enable = true
}
})
local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
parser_config.caddyfile = {
install_info = {
url = '~/Code/tree-sitter-caddyfile',
files = { 'src/parser.c' },
branch = 'main',
},
filetype = 'caddyfile',
}
-- Automatic LSP Setup
local lspconf = {
sumneko_lua = {
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
'nvim-neorg/neorg',
tag = '0.0.12',
requires = {
'nvim-lua/plenary.nvim',
'folke/zen-mode.nvim'
}
}
}
local lspconfig = require('lspconfig')
require('mason').setup()
require('mason-lspconfig').setup_handlers({
function(server_name)
local opts = lspconf[server_name]
if opts == nil then
opts = {}
end
lspconfig[server_name].setup(opts)
end
})
-- Format on save
local function format_on_save()
vim.lsp.buf.formatting_sync()
end
vim.api.nvim_create_autocmd(
"BufWritePre",
{
pattern = { "<buffer>" },
callback = format_on_save,
use {
'lewis6991/gitsigns.nvim',
config = function()
require('gitsigns').setup()
end,
event = 'BufWinEnter'
}
)
end)
-- Autocomplete Setup
local cmp = require('cmp')
cmp.setup {
mapping = {
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
},
require('opts')
require('mappings')
["<Up>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
["<Down>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
},
sources = {
{ name = "neorg" },
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
{ name = "buffer" },
},
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end
},
}
require('lsp')
require('completion')
require('mini')
-- Misc Plugin Setup
require('lualine').setup()
require('nvim-autopairs').setup()
require('gitsigns').setup()
require('Comment').setup()
require('zen-mode').setup()
require('neorg').setup({
load = {
["core.defaults"] = {},
["core.norg.completion"] = {
config = {
engine = "nvim-cmp",
}
},
["core.integrations.nvim-cmp"] = {},
["core.presenter"] = {
config = {
zen_mode = "zen-mode"
}
},
}
})
-- General Options
vim.cmd [[colorscheme gruvbox]]
vim.o.number = true
vim.o.relativenumber = true
vim.o.splitright = true
vim.o.splitbelow = true
vim.o.scrolloff = 10
-- Tab Settings
vim.o.tabstop = 4
vim.o.softtabstop = 0
vim.o.expandtab = true
vim.o.shiftwidth = 4
vim.o.smarttab = true
vim.api.nvim_create_autocmd(
"FileType",
{
pattern = {
"html",
"css",
"javascript",
"typescript",
"vue",
"lua",
},
command = "setlocal shiftwidth=2",
}
)
vim.api.nvim_create_autocmd(
"FileType",
{
pattern = {
"go",
},
command = "setlocal noexpandtab"
}
)
-- General Keymaps
vim.keymap.set('t', '<ESC>', '<C-\\><C-n>')
vim.keymap.set('n', '<leader>t', ':TestNearest<CR>')
vim.keymap.set('n', '<leader>T', ':TestFile<CR>')
local telescope = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', telescope.find_files)
vim.keymap.set('n', '<leader>fg', telescope.live_grep)
vim.keymap.set('n', '<leader>fh', telescope.help_tags)
-- LSP Keymaps
vim.keymap.set('n', '<leader>h', vim.lsp.buf.hover)
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename)
vim.keymap.set('n', '<leader><space>', vim.lsp.buf.code_action)
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition)
vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation)
vim.keymap.set('n', 'gr', vim.lsp.buf.references)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)

View file

@ -0,0 +1,40 @@
local cmp = require('cmp')
cmp.setup {
mapping = {
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
},
['<Up>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
['<Down>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
},
sources = {
{ name = 'neorg' },
{ name = 'nvim_lua' },
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'path' },
{ name = 'buffer' },
},
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end
},
}

36
dotfiles/nvim/lua/lsp.lua Normal file
View file

@ -0,0 +1,36 @@
require('mason').setup()
require('mason-lspconfig').setup({
automatic_installation = true,
})
-- Format on save
local function format_on_save()
vim.lsp.buf.formatting_sync()
end
vim.api.nvim_create_autocmd(
'BufWritePre',
{
pattern = { '<buffer>' },
callback = format_on_save,
}
)
-- Language Servers
require('lspconfig')['gopls'].setup({})
require('lspconfig')['pyright'].setup({})
require('lspconfig')['rust_analyzer'].setup({})
require('lspconfig')['html'].setup({})
require('lspconfig')['cssls'].setup({})
require('lspconfig')['tsserver'].setup({})
require('lspconfig')['sumneko_lua'].setup({
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
}
})

View file

@ -0,0 +1,21 @@
-- General Keymaps
vim.keymap.set('t', '<ESC>', '<C-\\><C-n>')
vim.keymap.set('n', 'gb', ':Gitsigns blame_line<CR>')
local telescope = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', telescope.find_files)
vim.keymap.set('n', '<leader>fg', telescope.live_grep)
vim.keymap.set('n', '<leader>fh', telescope.help_tags)
-- LSP Keymaps
vim.keymap.set('n', '<leader>h', vim.lsp.buf.hover)
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename)
vim.keymap.set('n', '<leader><space>', vim.lsp.buf.code_action)
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition)
vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation)
vim.keymap.set('n', 'gr', vim.lsp.buf.references)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)

View file

@ -0,0 +1,13 @@
require('mini.comment').setup()
require('mini.indentscope').setup({
draw = {
delay = 0,
animation = require('mini.indentscope').gen_animation('none')
}
})
require('mini.pairs').setup()
require('mini.sessions').setup()
require('mini.starter').setup()
require('mini.surround').setup()
require('mini.tabline').setup()
require('mini.trailspace').setup()

View file

@ -0,0 +1,16 @@
vim.cmd [[colorscheme gruvbox]]
vim.o.number = true
vim.o.relativenumber = true
vim.o.splitright = true
vim.o.splitbelow = true
vim.o.scrolloff = 10
vim.o.foldenable = false
-- Tab Settings
vim.o.tabstop = 4
vim.o.softtabstop = 0
vim.o.expandtab = true
vim.o.shiftwidth = 4
vim.o.smarttab = true

View file

@ -44,8 +44,8 @@ local function save_profiles(threshold)
end
time([[Luarocks path setup]], true)
local package_path_str = "/home/digyx/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/digyx/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/digyx/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/digyx/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/digyx/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
local package_path_str = "/Users/dtingley/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/dtingley/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/dtingley/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/dtingley/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/Users/dtingley/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
@ -71,102 +71,132 @@ time([[Defining packer_plugins]], true)
_G.packer_plugins = {
LuaSnip = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/LuaSnip",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/LuaSnip",
url = "https://github.com/L3MON4D3/LuaSnip"
},
["cmp-buffer"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp-buffer",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/cmp-buffer",
url = "https://github.com/hrsh7th/cmp-buffer"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
},
["cmp-nvim-lua"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
url = "https://github.com/hrsh7th/cmp-nvim-lua"
},
["cmp-path"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp-path",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/cmp-path",
url = "https://github.com/hrsh7th/cmp-path"
},
cmp_luasnip = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
url = "https://github.com/saadparwaiz1/cmp_luasnip"
},
["gitsigns.nvim"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
config = { "\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0" },
loaded = false,
needs_bufread = false,
only_cond = false,
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/opt/gitsigns.nvim",
url = "https://github.com/lewis6991/gitsigns.nvim"
},
gruvbox = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/gruvbox",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/gruvbox",
url = "https://github.com/morhetz/gruvbox"
},
["lualine.nvim"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/lualine.nvim",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/lualine.nvim",
url = "https://github.com/nvim-lualine/lualine.nvim"
},
["mason-lspconfig.nvim"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
url = "https://github.com/williamboman/mason-lspconfig.nvim"
},
["mason.nvim"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/mason.nvim",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/mason.nvim",
url = "https://github.com/williamboman/mason.nvim"
},
["nvim-autopairs"] = {
["mini.nvim"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
url = "https://github.com/windwp/nvim-autopairs"
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/mini.nvim",
url = "https://github.com/echasnovski/mini.nvim"
},
neorg = {
loaded = true,
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/neorg",
url = "https://github.com/nvim-neorg/neorg"
},
["nvim-cmp"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/nvim-cmp",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-treesitter"] = {
loaded = true,
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["nvim-web-devicons"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
url = "https://github.com/kyazdani42/nvim-web-devicons"
},
["packer.nvim"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/packer.nvim",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
playground = {
loaded = true,
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/playground",
url = "https://github.com/nvim-treesitter/playground"
},
["plenary.nvim"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/plenary.nvim",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["telescope.nvim"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/telescope.nvim",
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
},
["vim-test"] = {
["vim-startuptime"] = {
loaded = true,
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/vim-test",
url = "https://github.com/vim-test/vim-test"
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/vim-startuptime",
url = "https://github.com/dstein64/vim-startuptime"
},
["zen-mode.nvim"] = {
loaded = true,
path = "/Users/dtingley/.local/share/nvim/site/pack/packer/start/zen-mode.nvim",
url = "https://github.com/folke/zen-mode.nvim"
}
}
time([[Defining packer_plugins]], false)
vim.cmd [[augroup packer_load_aucmds]]
vim.cmd [[au!]]
-- Event lazy-loads
time([[Defining lazy-load event autocommands]], true)
vim.cmd [[au BufWinEnter * ++once lua require("packer.load")({'gitsigns.nvim'}, { event = "BufWinEnter *" }, _G.packer_plugins)]]
time([[Defining lazy-load event autocommands]], false)
vim.cmd("augroup END")
if should_profile then save_profiles() end
end)