initial commit

added a bunch of config to try and get things closer to my doom emacs
setup. still not perfect.
This commit is contained in:
ryan committed 2023-05-25 10:18:01 -07:00
commit 567bfcc06e
13 files changed
+704

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
-- 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
-- autocmd InsertLeave * :normal `^
vim.api.nvim_create_autocmd("InsertLeave", { command = ":normal `^" })
+39
View File
@@ -0,0 +1,39 @@
-- 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
-- telescope picker shortcuts
vim.keymap.set("n", "<C-b>", ":Telescope buffers<cr>")
vim.keymap.set("n", "<C-f>", ":Telescope file_browser path=%:p:h select_buffer=true<cr>")
vim.keymap.set("n", "<leader>fp", ":Telescope find_files cwd=~/.config/nvim<cr>", { desc = "Find file in config" })
-- hjkl modifiers
vim.keymap.set({ "n", "v" }, "L", "E")
vim.keymap.set({ "n", "v" }, "H", "B")
vim.keymap.set({ "n", "v" }, "J", "4j")
vim.keymap.set({ "n", "v" }, "K", "4k")
vim.keymap.set({ "n", "v" }, "<C-k>", "8<C-e>")
vim.keymap.set({ "n", "v" }, "<C-j>", "8<C-y>")
-- join line
vim.keymap.set({ "n", "v" }, "gj", ":join<cr>")
-- jump forward and back
vim.keymap.set({ "n", "v" }, "gf", "<C-i>")
vim.keymap.set({ "n", "v" }, "gb", "<C-o>")
-- file operations
vim.keymap.set({ "n", "v" }, "fs", ":w<cr>", { desc = "Save file" })
-- window operations
vim.keymap.del({ "n" }, "<leader>w|")
vim.keymap.del({ "n" }, "<leader>ww")
vim.keymap.set({ "n", "v" }, "<leader>w\\", "<C-w>v", { desc = "Split window vertical" })
vim.keymap.set({ "n", "v" }, "<leader>w-", "<C-w>s", { desc = "Split window horizontal" })
vim.keymap.set({ "n", "v" }, "<leader>w=", "<C-w>=", { desc = "Balance windows" })
vim.keymap.set({ "n", "v", "i" }, "<C-o>", "<C-w>w")
-- git stuff
vim.keymap.del({ "n" }, "<leader>gg")
vim.keymap.del({ "n" }, "<leader>gG")
vim.keymap.set({ "n" }, "<leader>gg", "<CMD>Neogit<CR>", { desc = "Neogit status" })
+46
View File
@@ -0,0 +1,46 @@
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 any extras modules here
-- { import = "lazyvim.plugins.extras.lang.typescript" },
-- { import = "lazyvim.plugins.extras.lang.json" },
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
-- import/override with your plugins
{ 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",
},
},
},
})
+3
View File
@@ -0,0 +1,3 @@
-- 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
+266
View File
@@ -0,0 +1,266 @@
-- since this is just an example spec, don't actually load anything here and return an empty spec
-- stylua: ignore
if true then return {} end
-- every spec file under config.plugins will be loaded automatically by lazy.nvim
--
-- In your plugin files, you can:
-- * add extra plugins
-- * disable/enabled LazyVim plugins
-- * override the configuration of LazyVim plugins
return {
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
-- change trouble config
{
"folke/trouble.nvim",
-- opts will be merged with the parent spec
opts = { use_diagnostic_signs = true },
},
-- disable trouble
{ "folke/trouble.nvim", enabled = false },
-- add symbols-outline
{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
config = true,
},
-- override nvim-cmp and add cmp-emoji
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local cmp = require("cmp")
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } }))
end,
},
-- change some telescope options and a keymap to browse plugin files
{
"nvim-telescope/telescope.nvim",
keys = {
-- add a keymap to browse plugin files
-- stylua: ignore
{
"<leader>fp",
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
desc = "Find Plugin File",
},
},
-- change some options
opts = {
defaults = {
layout_strategy = "horizontal",
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
},
},
},
-- add telescope-fzf-native
{
"telescope.nvim",
dependencies = {
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
config = function()
require("telescope").load_extension("fzf")
end,
},
},
-- add pyright to lspconfig
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- pyright will be automatically installed with mason and loaded with lspconfig
pyright = {},
},
},
},
-- add tsserver and setup with typescript.nvim instead of lspconfig
{
"neovim/nvim-lspconfig",
dependencies = {
"jose-elias-alvarez/typescript.nvim",
init = function()
require("lazyvim.util").on_attach(function(_, buffer)
-- stylua: ignore
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
end)
end,
},
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- tsserver will be automatically installed with mason and loaded with lspconfig
tsserver = {},
},
-- you can do any additional lsp server setup here
-- return true if you don't want this server to be setup with lspconfig
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
-- example to setup with typescript.nvim
tsserver = function(_, opts)
require("typescript").setup({ server = opts })
return true
end,
-- Specify * to use this function as a fallback for any server
-- ["*"] = function(server, opts) end,
},
},
},
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
{ import = "lazyvim.plugins.extras.lang.typescript" },
-- add more treesitter parsers
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
},
},
},
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
-- would overwrite `ensure_installed` with the new value.
-- If you'd rather extend the default config, use the code below instead:
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- add tsx and treesitter
vim.list_extend(opts.ensure_installed, {
"tsx",
"typescript",
})
end,
},
-- the opts function can also be used to change the default opts:
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
table.insert(opts.sections.lualine_x, "😄")
end,
},
-- or you can return new options to override all the defaults
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function()
return {
--[[add your custom lualine config here]]
}
end,
},
-- use mini.starter instead of alpha
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
-- add jsonls and schemastore ans setup treesitter for json, json5 and jsonc
{ import = "lazyvim.plugins.extras.lang.json" },
-- add any tools you want to have installed below
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"stylua",
"shellcheck",
"shfmt",
"flake8",
},
},
},
-- Use <tab> for completion and snippets (supertab)
-- first: disable default <tab> and <s-tab> behavior in LuaSnip
{
"L3MON4D3/LuaSnip",
keys = function()
return {}
end,
},
-- then: setup supertab in cmp
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-emoji",
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local luasnip = require("luasnip")
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
})
end,
},
}
+178
View File
@@ -0,0 +1,178 @@
return {
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.json" },
{ "UtkarshVerma/molokai.nvim" },
{
"xiyaowong/transparent.nvim",
},
{
"neovim/nvim-lspconfig",
init = function()
local keys = require("lazyvim.plugins.lsp.keymaps").get()
keys[#keys + 1] = { "K", false }
keys[#keys + 1] = { "gm", vim.lsp.buf.hover, desc = "Hover" }
keys[#keys + 1] = { "gM", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" }
end,
},
{
"ggandor/leap.nvim",
keys = function() -- function overwrites keybinds
return {
{
"gl",
function()
require("leap").leap({
target_windows = vim.tbl_filter(function(win)
return vim.api.nvim_win_get_config(win).focusable
end, vim.api.nvim_tabpage_list_wins(0)),
})
end,
mode = { "n", "x", "o" },
desc = "Leap anywhere",
},
}
end,
config = false, -- remove lazyvim config, i only want the above binding
},
{
"ggandor/flit.nvim",
opts = {
labeled_modes = "", -- Disable labels
},
},
{
"echasnovski/mini.surround",
opts = {
mappings = {
add = "s", -- Add surrounding in Normal and Visual modes
delete = "ds", -- Delete surrounding
replace = "cs", -- Replace surroundng
find = "", -- Find surrounding (to the right)
find_left = "", -- Find surrounding (to the left)
highlight = "", -- Highlight surroundng
update_n_lines = "", -- Update `n_lines`
},
},
},
{
"folke/which-key.nvim",
opts = function(_, opts)
opts.defaults["gz"] = nil
end,
},
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-cmdline" },
lazy = false,
config = function(_, opts)
local cmp = require("cmp")
cmp.setup(opts)
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
end,
},
{
"folke/noice.nvim",
-- enabled = false,
opts = {
cmdline = {
view = "cmdline",
},
presets = {
bottom_search = true,
command_palette = true,
long_message_to_split = true,
},
popupmenu = {
enabled = true, -- enables the Noice popupmenu UI
backend = "cmp", -- backend to use to show regular cmdline completions
kind_icons = {}, -- set to `false` to disable icons
},
},
},
{
"echasnovski/mini.indentscope",
opts = {
draw = {
delay = 0,
animation = require("mini.indentscope").gen_animation.none(),
priority = 2,
},
},
config = function(_, opts)
require("mini.indentscope").setup(opts)
end,
},
{
"RRethy/vim-illuminate",
keys = function()
return {}
end,
config = function(_, opts)
require("illuminate").configure(opts)
-- why doesn't this work
-- vim.cmd("hi link IlluminatedWordRead Visual")
end,
},
{
"TimUntersberger/neogit",
dependencies = { "nvim-lua/plenary.nvim" },
-- lazy = false,
event = "VeryLazy",
cmd = "Neogit",
-- keys = {
-- {
-- "<leader>gg",
-- "<CMD>Neogit<CR>",
-- -- function()
-- -- require("neogit").open()
-- -- end,
-- desc = "Neogit status",
-- },
-- },
-- config = function()
-- local neogit = require("neogit")
-- neogit.setup({})
-- end,
},
{
"LazyVim/LazyVim",
opts = {
colorscheme = "molokai",
},
},
{
"akinsho/bufferline.nvim",
enabled = false,
},
}
+79
View File
@@ -0,0 +1,79 @@
return {
{
"nvim-telescope/telescope.nvim",
opts = {
defaults = {
mappings = {
n = {
["<C-g>"] = function(...)
return require("telescope.actions").close(...)
end,
},
i = {
["<C-j>"] = function(...)
return require("telescope.actions").move_selection_next(...)
end,
["<C-k>"] = function(...)
return require("telescope.actions").move_selection_previous(...)
end,
["<C-g>"] = function(...)
return require("telescope.actions").close(...)
end,
},
},
},
},
},
{
"nvim-telescope/telescope-file-browser.nvim",
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" },
config = function()
local fb_actions = require("telescope._extensions.file_browser.actions")
local t_actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
require("telescope").setup({
extensions = {
file_browser = {
-- disables netrw and use telescope-file-browser in its place
hijack_netrw = true,
mappings = {
n = {
["l"] = t_actions.select_default,
["h"] = fb_actions.backspace,
},
i = {
["<C-l>"] = t_actions.select_default,
["<C-h>"] = fb_actions.backspace,
["<C-g>"] = t_actions.close,
},
},
},
},
})
require("telescope").load_extension("file_browser")
end,
},
{
"telescope.nvim",
dependencies = {
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
config = function()
require("telescope").setup({
extensions = {
fzf = {
fuzzy = false, -- false will only do exact matching
-- override_generic_sorter = true, -- override the generic sorter
-- override_file_sorter = true, -- override the file sorter
-- case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
},
},
})
require("telescope").load_extension("fzf")
end,
},
},
}