Start nvim config rewrite
Following TJ Devries' advent of neovim
This commit is contained in:
parent
d223857265
commit
ab2c05ee4d
10 changed files with 0 additions and 373 deletions
|
@ -1,2 +0,0 @@
|
|||
inoremap <buffer> <C-CR> <CMD>x<CR>
|
||||
startinsert
|
|
@ -1,18 +0,0 @@
|
|||
require("options")
|
||||
require("keymaps")
|
||||
require("filetypes")
|
||||
|
||||
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",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup("plugins")
|
|
@ -1,43 +0,0 @@
|
|||
vim.filetype.add({
|
||||
filename = {
|
||||
["user-dirs.dirs"] = "conf",
|
||||
|
||||
["gruvbox.conf"] = "kitty",
|
||||
["keys.conf"] = "kitty",
|
||||
["kitty.conf"] = "kitty",
|
||||
["ssh.conf"] = "kitty",
|
||||
|
||||
["dot-zshenv"] = "zsh",
|
||||
["dot-zshrc"] = "zsh"
|
||||
},
|
||||
|
||||
pattern = {
|
||||
[".*/git/config"] = "gitconfig"
|
||||
}
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("Filetype", {
|
||||
group = vim.api.nvim_create_augroup("setIndent", {}),
|
||||
pattern = { "lua" },
|
||||
command = "setlocal tabstop=2 softtabstop=2 shiftwidth=2"
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("Filetype", {
|
||||
group = vim.api.nvim_create_augroup("webDev", {}),
|
||||
pattern = { "html", "css", "javascript", "svelte", "javascriptreact", "json" },
|
||||
callback = function()
|
||||
vim.cmd [[setlocal tabstop=2 softtabstop=2 shiftwidth=2]]
|
||||
vim.bo.formatprg = "prettier --stdin-filepath " .. vim.fn.expand("%:p")
|
||||
require("minimal-format").enable_autocmd(0)
|
||||
end
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("Filetype", {
|
||||
group = vim.api.nvim_create_augroup("zola", {}),
|
||||
pattern = { "htmldjango" },
|
||||
callback = function()
|
||||
vim.cmd [[setlocal tabstop=2 softtabstop=2 shiftwidth=2]]
|
||||
vim.bo.formatprg = "djhtml -; echo"
|
||||
require("minimal-format").enable_autocmd(0)
|
||||
end
|
||||
})
|
|
@ -1,90 +0,0 @@
|
|||
------------------------------------------------------------------------------
|
||||
-- Misc --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
vim.keymap.set("i", "jk", "<ESC>")
|
||||
vim.keymap.set("i", "kj", "<ESC>")
|
||||
|
||||
vim.keymap.set("", "<leader>q", "<CMD>confirm quit<CR>")
|
||||
vim.keymap.set("", "<leader>x", "<CMD>exit<CR>")
|
||||
vim.keymap.set("", "<leader>ww", "<CMD>write<CR>")
|
||||
vim.keymap.set("", "<leader><leader>x", "<CMD>write<BAR>source %<CR>")
|
||||
|
||||
vim.keymap.set("", "n", "nzz")
|
||||
vim.keymap.set("", "N", "Nzz")
|
||||
vim.keymap.set("", "<C-N>", "<CMD>nohls<CR>")
|
||||
|
||||
vim.keymap.set("", "<C-U>", "<C-U>zz")
|
||||
vim.keymap.set("", "<C-D>", "<C-D>zz")
|
||||
|
||||
|
||||
local function swap(a, b)
|
||||
vim.keymap.set("", a, b)
|
||||
vim.keymap.set("", b, a)
|
||||
end
|
||||
|
||||
swap(";", ":")
|
||||
swap("'", "`")
|
||||
|
||||
|
||||
vim.keymap.set("", "<leader>w", "<C-W>")
|
||||
local function window_map(key, mapping)
|
||||
local k = '<M-'..key..'>'
|
||||
local m = '<CMD>wincmd ' .. (mapping or key) .. '<CR>'
|
||||
|
||||
vim.keymap.set({"", "i", "t"}, k, m)
|
||||
end
|
||||
|
||||
window_map("h")
|
||||
window_map("j")
|
||||
window_map("k")
|
||||
window_map("l")
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- Plugin Maps --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.telescope()
|
||||
local telescope = require("telescope")
|
||||
local builtin = require("telescope.builtin")
|
||||
|
||||
vim.keymap.set("", "<leader>ff", builtin.find_files)
|
||||
vim.keymap.set("", "<leader>fh", builtin.help_tags)
|
||||
vim.keymap.set("", "<leader>ft", builtin.builtin)
|
||||
vim.keymap.set("", "<leader>fm", builtin.man_pages)
|
||||
vim.keymap.set("", "<leader>fb", telescope.extensions.file_browser.file_browser)
|
||||
|
||||
vim.keymap.set("", "<leader>fd", function() builtin.find_files({
|
||||
cwd = "$DOTS",
|
||||
prompt_title = "< Dotfiles >"
|
||||
}) end)
|
||||
end
|
||||
|
||||
function M.harpoon()
|
||||
vim.keymap.set("", "<leader>ha", require("harpoon.mark").add_file)
|
||||
vim.keymap.set("", "<leader>ho", require("harpoon.ui").toggle_quick_menu)
|
||||
|
||||
vim.keymap.set("", "<leader>hf", function() require("harpoon.ui").nav_file(1) end)
|
||||
vim.keymap.set("", "<leader>hd", function() require("harpoon.ui").nav_file(2) end)
|
||||
vim.keymap.set("", "<leader>hs", function() require("harpoon.ui").nav_file(2) end)
|
||||
end
|
||||
|
||||
function M.lsp(env)
|
||||
local opts = { buffer = env.buffer }
|
||||
|
||||
vim.keymap.set("", "<leader>dn", vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set("", "<leader>dp", vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set("", "<leader>de", vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set("", "<leader>df", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set("", "<leader>gD", vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set("", "<leader>gd", vim.lsp.buf.definition, opts)
|
||||
end
|
||||
|
||||
function M.fugitive()
|
||||
vim.keymap.set("", "<leader>gs", "<cmd>Git<cr>")
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,37 +0,0 @@
|
|||
vim.g.mapleader = " "
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.smartindent = true
|
||||
|
||||
vim.opt.hidden = true
|
||||
vim.opt.backup = false
|
||||
vim.opt.swapfile = false
|
||||
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.colorcolumn = '80'
|
||||
vim.opt.signcolumn = 'yes'
|
||||
vim.opt.laststatus = 3
|
||||
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.incsearch = true
|
||||
vim.opt.inccommand = 'nosplit'
|
||||
|
||||
vim.opt.scrolloff = 5
|
||||
vim.opt.wrap = false
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.timeoutlen = 400
|
||||
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = "eol:↲,tab:» ,trail:.,"
|
||||
|
||||
vim.opt.exrc = true
|
|
@ -1,68 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
config = function()
|
||||
vim.cmd.colorscheme("gruvbox")
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"ggandor/leap.nvim",
|
||||
config = function()
|
||||
require("leap").add_default_mappings()
|
||||
vim.api.nvim_set_hl(0, 'LeapBackdrop', { link = 'Comment' })
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"ThePrimeagen/harpoon",
|
||||
config = function()
|
||||
require("keymaps").harpoon()
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = "all",
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
}
|
||||
},
|
||||
main = "nvim-treesitter.configs",
|
||||
build = ":TSUpdate"
|
||||
},
|
||||
|
||||
{
|
||||
"abecodes/tabout.nvim",
|
||||
config = {
|
||||
ignore_beginning = false
|
||||
}
|
||||
},
|
||||
|
||||
{ "numToStr/Comment.nvim", config = true },
|
||||
{ "nvim-lualine/lualine.nvim", config = true },
|
||||
{ "windwp/nvim-autopairs", config = true },
|
||||
|
||||
{"tpope/vim-fugitive", config = require("keymaps").fugitive},
|
||||
"tpope/vim-repeat",
|
||||
"tpope/vim-surround",
|
||||
"tpope/vim-unimpaired",
|
||||
|
||||
"fladson/vim-kitty",
|
||||
"cljoly/minimal-format.nvim",
|
||||
|
||||
{
|
||||
'mikesmithgh/kitty-scrollback.nvim',
|
||||
lazy = true,
|
||||
cmd = { 'KittyScrollbackGenerateKittens', 'KittyScrollbackCheckHealth' },
|
||||
event = { 'User KittyScrollbackLaunch' },
|
||||
config = function()
|
||||
require('kitty-scrollback').setup()
|
||||
end,
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"L3MON4D3/LuaSnip"
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
vim.opt.completeopt = {"menu", "menuone", "noinsert"}
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
["<C-Y>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.confirm { select=true }
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" }
|
||||
},
|
||||
experimental = {
|
||||
native_menu = false,
|
||||
ghost_text = { hl_group = "Comment" }
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim"
|
||||
},
|
||||
config = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
local snippet_capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
snippet_capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
lspconfig.emmet_ls.setup {
|
||||
capabilities = snippet_capabilities
|
||||
}
|
||||
|
||||
lspconfig.tailwindcss.setup {
|
||||
capabilities = snippet_capabilities
|
||||
}
|
||||
|
||||
lspconfig.cssls.setup {
|
||||
capabilities = snippet_capabilities
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = require("keymaps").lsp
|
||||
})
|
||||
end
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }
|
||||
},
|
||||
config = function()
|
||||
local telescope = require("telescope")
|
||||
|
||||
telescope.setup({
|
||||
pickers = {
|
||||
man_pages = {
|
||||
sections = {"ALL"}
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
file_browser = {
|
||||
grouped = true,
|
||||
hidden = true,
|
||||
respect_gitignore = false,
|
||||
sorting_strategy = "ascending",
|
||||
layout_config = {
|
||||
prompt_position = "top"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
telescope.load_extension("file_browser")
|
||||
telescope.load_extension("fzf")
|
||||
|
||||
require("keymaps").telescope()
|
||||
|
||||
end
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
return {
|
||||
"akinsho/toggleterm.nvim",
|
||||
opts = {
|
||||
open_mapping = "<C-t>",
|
||||
direction = "float"
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue