Last active
March 31, 2022 16:00
-
-
Save DerrikMilligan/18f2bc9f599c27c15dd8aeb4ac6dc55f to your computer and use it in GitHub Desktop.
Astro Vim Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local config = { | |
-- Set colorscheme | |
colorscheme = "duskfox", | |
-- Default theme configuration | |
default_theme = { | |
diagnostics_style = "none", | |
-- Modify the color table | |
colors = { | |
fg = "#abb2bf", | |
}, | |
-- Modify the highlight groups | |
highlights = function(highlights) | |
local C = require "default_theme.colors" | |
highlights.Normal = { fg = C.fg, bg = C.bg } | |
return highlights | |
end | |
}, | |
-- Disable default plugins | |
enabled = { | |
bufferline = true, | |
neo_tree = true, | |
lualine = true, | |
gitsigns = true, | |
colorizer = true, | |
toggle_term = true, | |
comment = true, | |
symbols_outline = true, | |
indent_blankline = true, | |
dashboard = true, | |
which_key = true, | |
neoscroll = true, | |
ts_rainbow = true, | |
ts_autotag = true, | |
}, | |
-- Configure plugins | |
plugins = { | |
init = { | |
-- Themes | |
{ "lifepillar/vim-gruvbox8" }, | |
{ | |
"EdenEast/nightfox.nvim", | |
config = function() | |
require('nightfox').setup({ | |
options = { | |
styles = { | |
comments = "italic", | |
keywords = "bold", | |
types = "italic,bold", | |
}, | |
}, | |
}) | |
end | |
}, | |
-- { "andweeb/presence.nvim" }, | |
{ | |
"ray-x/lsp_signature.nvim", | |
event = "BufRead", | |
config = function() | |
require("lsp_signature").setup() | |
end, | |
}, | |
-- Load .editorconfig files | |
{ "gpanders/editorconfig.nvim" }, | |
-- The multi cursor stuff | |
{ "mg979/vim-visual-multi" }, | |
-- -- Easy align stuff | |
{ "kg8m/vim-simple-align" }, | |
-- Documentation stuff | |
-- No idea how to get rid of the doge_dir error but it's harmless | |
{ | |
"kkoomen/vim-doge", | |
config = function() | |
vim.g.doge_filetype_aliases = { | |
javascript = { | |
"javascript.jsx", | |
"javascriptreact", | |
"javascript.tsx", | |
"typescriptreact", | |
"typescript", | |
"typescript.tsx", | |
}, | |
php = { | |
"php" | |
} | |
} | |
-- vim.cmd(":call doge#install()") | |
end, | |
}, | |
}, | |
-- All other entries override the setup() call for default plugins | |
treesitter = { | |
ensure_installed = { "lua" }, | |
highlight = { | |
enable = true, | |
-- This is to try and have php autoindent work correctly | |
-- read more about it here https://github.com/nvim-treesitter/nvim-treesitter#highlight | |
additional_vim_regex_highlighting = true, | |
} | |
}, | |
packer = { | |
compile_path = vim.fn.stdpath "config" .. "/lua/packer_compiled.lua", | |
}, | |
}, | |
-- Add paths for including more VS Code style snippets in luasnip | |
luasnip = { | |
vscode_snippet_paths = {}, | |
}, | |
-- Modify which-key registration | |
["which-key"] = { | |
-- Add bindings to the normal mode <leader> mappings | |
register_n_leader = { | |
-- We need to overwrite d as the builtin d is just the startup page this will generate | |
-- documentation for the given function | |
["d"] = { ":call doge#generate(0)<CR>", "Generate Documentation" }, | |
}, | |
}, | |
-- Extend LSP configuration | |
lsp = { | |
-- add to the server on_attach function | |
-- on_attach = function(client, bufnr) | |
-- end, | |
-- override the lsp installer server-registration function | |
-- server_registration = function(server, opts) | |
-- server:setup(opts) | |
-- end | |
-- Add overrides for LSP server settings, the keys are the name of the server | |
["server-settings"] = { | |
-- example for addings schemas to yamlls | |
-- yamlls = { | |
-- settings = { | |
-- yaml = { | |
-- schemas = { | |
-- ["http://json.schemastore.org/github-workflow"] = ".github/workflows/*.{yml,yaml}", | |
-- ["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}", | |
-- ["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}", | |
-- }, | |
-- }, | |
-- }, | |
-- }, | |
}, | |
}, | |
-- Diagnostics configuration (for vim.diagnostics.config({})) | |
diagnostics = { | |
virtual_text = true, | |
underline = true, | |
}, | |
-- null-ls configuration | |
["null-ls"] = function() | |
-- Formatting and linting | |
-- https://github.com/jose-elias-alvarez/null-ls.nvim | |
local status_ok, null_ls = pcall(require, "null-ls") | |
if not status_ok then | |
return | |
end | |
-- Check supported formatters | |
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting | |
local formatting = null_ls.builtins.formatting | |
-- Check supported linters | |
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics | |
local diagnostics = null_ls.builtins.diagnostics | |
null_ls.setup { | |
debug = false, | |
sources = { | |
-- Set a formatter | |
formatting.rufo, | |
-- Set a linter | |
diagnostics.rubocop, | |
}, | |
-- NOTE: You can remove this on attach function to disable format on save | |
on_attach = function(client) | |
if client.resolved_capabilities.document_formatting then | |
vim.cmd "autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()" | |
end | |
end, | |
} | |
end, | |
-- This function is run last | |
-- good place to configure mappings and vim options | |
polish = function() | |
local opts = { noremap = true, silent = true } | |
local map = vim.api.nvim_set_keymap | |
local set = vim.opt | |
-- Set options | |
set.relativenumber = true | |
-- Set key bindings | |
map('n', '<C-s>', ':w!<CR>', opts) | |
-- Add some bindings for the barbar so we can hop between buffers | |
map('n', '<Shift>h', ':BufferLineCyclePrev<CR>', opts) | |
map('n', '<Shift>l', ':BufferLineCycleNext<CR>', opts) | |
-- Make it so that when we paste in visual mode that we copy the pasted | |
-- text back into the buffer so you can paste it again | |
map('v', 'p', 'pgvy', opts) | |
-- Set autocommands | |
-- This one has us source the VIMRC file and call PackerSync when we save | |
-- the init.lua file | |
vim.cmd [[ | |
augroup packer_conf | |
autocmd! | |
autocmd bufwritepost init.lua source <afile> | source $MYVIMRC | |
autocmd bufwritepost init.lua source <afile> | PackerInstall | |
augroup end | |
]] | |
end, | |
} | |
return config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment