More work, LSP is not working yet need to figure that out more
This commit is contained in:
parent
713d128018
commit
764b890c58
32 changed files with 290 additions and 441 deletions
5
init.lua
5
init.lua
|
@ -18,13 +18,14 @@ if not vim.loop.fs_stat(lazypath) then
|
|||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup("user", {
|
||||
require("lazy").setup("plugins", {
|
||||
change_detection = {
|
||||
enabled = false,
|
||||
}
|
||||
})
|
||||
|
||||
vim.cmd 'colorscheme material'
|
||||
|
||||
require "tools"
|
||||
require "autocommands"
|
||||
require "lsp"
|
||||
|
||||
|
|
|
@ -1,32 +1,26 @@
|
|||
{
|
||||
"SchemaStore.nvim": { "branch": "main", "commit": "15f37630d3abfb98607dd8e4625b731a8558b96d" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "1838ae926e8d49fe5330d1498ee8289ae2c340bc" },
|
||||
"LuaSnip": { "branch": "master", "commit": "51ebb4b6637290e1b8e0fb0d6f38b605d3c24940" },
|
||||
"auto-save.nvim": { "branch": "main", "commit": "979b6c82f60cfa80f4cf437d77446d0ded0addf0" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "c18b7ca0b5b50596722f3a1572eb9b8eb520c0f1" },
|
||||
"glow.nvim": { "branch": "advanced_window", "commit": "f1157d4cb7e46e830c72004e7e1adb81a1f9b04c" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6610b15dfd76f7992423916e2b87f031881d7b25" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
|
||||
"glow.nvim": { "branch": "advanced_window", "commit": "bbd0473d72a45094495ee5600b5577823543eefe" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "ae25448d39fb2bdc38a139339233270edec44484" },
|
||||
"lsp-zero.nvim": { "branch": "v2.x", "commit": "8fda9a849d6ab4196ecf129905764ddefdfb64b5" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "c55d18f3947562e699d34d89681edbf9f0e250d3" },
|
||||
"mason-null-ls.nvim": { "branch": "main", "commit": "54d702020bf94e4eefd357f0b738317af30217eb" },
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "c836e511e796d2b6a25ad9f164f5b25d8b9ff705" },
|
||||
"mason.nvim": { "branch": "main", "commit": "08b2fd308e0107eab9f0b59d570b69089fd0b522" },
|
||||
"material.nvim": { "branch": "main", "commit": "0c725897bc3d22c45fbf25a602002ee02f06f619" },
|
||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "20c2f2f5ba083bbb1e37b8bc3d590621434f31e9" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "2daabebac1b0b2ab7abba298c1a8f07a542866a6" },
|
||||
"noice.nvim": { "branch": "main", "commit": "f5178da0097e964b37951a0ebc078fdcc14280f3" },
|
||||
"nui.nvim": { "branch": "main", "commit": "698e75814cd7c56b0dd8af4936bcef2d13807f3c" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "77e53bc3bac34cc273be8ed9eb9ab78bcf67fa48" },
|
||||
"nvim-dap": { "branch": "master", "commit": "56118cee6af15cb9ddba9d080880949d8eeb0c9f" },
|
||||
"nui.nvim": { "branch": "main", "commit": "d5a82aae64426a805e19d8ef5a379292f9dc55d3" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "fc0f694af1a742ada77e5b1c91ff405c746f4a26" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "1c13e529bd5683b54a39b633a560d2f00fcb25af" },
|
||||
"nvim-notify": { "branch": "master", "commit": "f3024b912073774111202f5fa6518b0cd2a74432" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "f2778bd1a28b74adf5b1aa51aa57da85adfa3d16" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "40615e96075c743ef47aaf9de966dc348bec6459" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "0bf8fbc2ca8f8cdb6efbd0a9e32740d7a991e4c3" },
|
||||
"openingh.nvim": { "branch": "main", "commit": "374c081409dc238018cd986410f16190d8f9f680" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" },
|
||||
"rest.nvim": { "branch": "main", "commit": "d8dc204e9f6fd930d9d1d709f0d19138f804431a" },
|
||||
"rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "40c31fdde93bcd85aeb3447bb3e2a3208395a868" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" },
|
||||
"undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" },
|
||||
"vim-autoswap": { "branch": "master", "commit": "e587e4b14a605d8921942ba65a37583813289272" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "e271c28118998c93a14d189af3395812a1aa646c" }
|
||||
}
|
||||
}
|
|
@ -1,53 +1 @@
|
|||
function is_available(plugin)
|
||||
local lazy_config_avail, lazy_config = pcall(require, "lazy.core.config")
|
||||
return lazy_config_avail and lazy_config.plugins[plugin] ~= nil
|
||||
end
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local cmd = vim.api.nvim_create_user_command
|
||||
local namespace = vim.api.nvim_create_namespace
|
||||
|
||||
if is_available "alpha-nvim" then
|
||||
local group_name = augroup("alpha_settings", { clear = true })
|
||||
autocmd({ "User", "BufEnter" }, {
|
||||
desc = "Disable status and tablines for alpha",
|
||||
group = group_name,
|
||||
callback = function(event)
|
||||
if
|
||||
(
|
||||
(event.event == "User" and event.file == "AlphaReady")
|
||||
or (event.event == "BufEnter" and vim.api.nvim_get_option_value("filetype", { buf = event.buf }) == "alpha")
|
||||
) and not vim.g.before_alpha
|
||||
then
|
||||
vim.g.before_alpha = { showtabline = vim.opt.showtabline:get(), laststatus = vim.opt.laststatus:get() }
|
||||
vim.opt.showtabline, vim.opt.laststatus = 0, 0
|
||||
elseif
|
||||
vim.g.before_alpha
|
||||
and event.event == "BufEnter"
|
||||
and vim.api.nvim_get_option_value("buftype", { buf = event.buf }) ~= "nofile"
|
||||
then
|
||||
vim.opt.laststatus, vim.opt.showtabline = vim.g.before_alpha.laststatus, vim.g.before_alpha.showtabline
|
||||
vim.g.before_alpha = nil
|
||||
end
|
||||
end,
|
||||
})
|
||||
autocmd("VimEnter", {
|
||||
desc = "Start Alpha when vim is opened with no arguments",
|
||||
group = group_name,
|
||||
callback = function()
|
||||
local should_skip = false
|
||||
if vim.fn.argc() > 0 or vim.fn.line2byte(vim.fn.line "$") ~= -1 or not vim.o.modifiable then
|
||||
should_skip = true
|
||||
else
|
||||
for _, arg in pairs(vim.v.argv) do
|
||||
if arg == "-b" or arg == "-c" or vim.startswith(arg, "+") or arg == "-S" then
|
||||
should_skip = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not should_skip then require("alpha").start(true, require("alpha").default_config) end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
|
199
lua/keymaps.lua
199
lua/keymaps.lua
|
@ -1,10 +1,5 @@
|
|||
-- Shorten function name
|
||||
local keymap = vim.keymap.set
|
||||
-- Silent keymap option
|
||||
local opts = { silent = true }
|
||||
|
||||
--Remap space as leader key
|
||||
keymap("", "<Space>", "<Nop>", opts)
|
||||
-- Remap space as leader key
|
||||
vim.keymap.set("", "<Space>", "<Nop>", { silent = true })
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Modes
|
||||
|
@ -15,161 +10,53 @@ vim.g.mapleader = " "
|
|||
-- term_mode = "t",
|
||||
-- command_mode = "c",
|
||||
|
||||
local scratch = function(extension)
|
||||
os.execute "mkdir -p ~/dev/scratches/"
|
||||
local date = os.date "%Y-%m-%dT%H:%M:%S"
|
||||
local filepath = "~/dev/scratches/scratch_" .. date .. extension
|
||||
vim.cmd("execute 'edit " .. filepath .. "'")
|
||||
end
|
||||
|
||||
local mappings = {
|
||||
n = {
|
||||
require('util').keymaps({
|
||||
n = {
|
||||
["n"] = { "nzzzv", desc = "Next search result centered" },
|
||||
["N"] = { "Nzzzv", desc = "Previous search result centered" },
|
||||
["<esc>"] = { ":noh<CR><esc>", desc = "Clear search on escape" },
|
||||
["<return>"] = {":noh<CR><return>", desc = "Clear search on return" },
|
||||
["<leader>w"] = { "<cmd>w<cr>", desc = "Save" },
|
||||
["<leader>q"] = { "<cmd>confirm q<cr>", desc = "Quit" },
|
||||
["|"] = { "<cmd>vsplit<cr>", desc = "Vertical Split" },
|
||||
["\\"] = { "<cmd>split<cr>", desc = "Horizontal Split" },
|
||||
["<C-d>"] = { "<C-d>zz", desc = "Vertical half page down and center cursor" },
|
||||
["<C-u>"] = { "<C-u>zz", desc = "Vertical half page up and center cursor" },
|
||||
["y"] = { '"*y', desc = "Copy to system clipboard" },
|
||||
["p"] = { '"*p', desc = "Paste from system clipboard" },
|
||||
-- TODO L-c to close buffer
|
||||
["<C-d>"] = { "<C-d>zz", desc = "Vertical half page down and center cursor" },
|
||||
["<C-u>"] = { "<C-u>zz", desc = "Vertical half page up and center cursor" },
|
||||
["y"] = { '"*y', desc = "Copy to system clipboard" },
|
||||
["p"] = { '"*p', desc = "Paste from system clipboard" },
|
||||
["<leader>Q"] = { ":qa<CR>", desc = "Quit all" },
|
||||
|
||||
["<leader>fs"] = {
|
||||
function()
|
||||
require("telescope.builtin").live_grep {
|
||||
search_dirs = { "~/dev/scratches/" },
|
||||
}
|
||||
end,
|
||||
desc = "Find words in scratches",
|
||||
},
|
||||
["<leader>s"] = { name = " Scratch File" },
|
||||
["<leader>ss"] = { function() scratch ".txt" end, desc = "New text scratch file" },
|
||||
["<leader>sn"] = { function() scratch ".json" end, desc = "New json scratch file" },
|
||||
["<leader>sq"] = { function() scratch ".sql" end, desc = "New sql scratch file" },
|
||||
["<leader>st"] = { function() scratch ".ts" end, desc = "New ts scratch file" },
|
||||
["<leader>sb"] = { function() scratch ".sh" end, desc = "New shell scratch file" },
|
||||
["<leader>sj"] = { function() scratch ".js" end, desc = "New js scratch file" },
|
||||
|
||||
|
||||
["<leader>Q"] = { ":qa<CR>", desc = "Quit all" },
|
||||
["<leader>,"] = { name = " Misc Tools" },
|
||||
["<leader>,c"] = { name = " Casing" },
|
||||
["<leader>,cs"] = { ":Snek<CR>", desc = "To Snek Case" },
|
||||
["<leader>,cc"] = { ":Camel<CR>", desc = "To Camel Case" },
|
||||
["<leader>,cp"] = { ":CamelB<CR>", desc = "To Pascal Case" },
|
||||
["<leader>,ck"] = { ":Kebab<CR>", desc = "To Kebab Case" },
|
||||
["<leader>,ce"] = { ":Screm<CR>", desc = "To Screm Case" },
|
||||
["<leader>,j"] = { name = " Jest Tests" },
|
||||
["<leader>,jr"] = { function() require("jester").run() end, desc = "Run test under cursor" },
|
||||
["<leader>,jf"] = { function() require("jester").run_file() end, desc = "Run tests for file" },
|
||||
["<leader>,jl"] = { function() require("jester").run_last() end, desc = "Run last ran test" },
|
||||
["<leader>lz"] = { ":LspRestart<CR>", desc = "Restart LSP Server" },
|
||||
},
|
||||
v = {
|
||||
["<leader>gf"] = { ":OpenInGHFile <CR>", desc = "Open in github" },
|
||||
["y"] = { '"*y', desc = "Copy to system clipboard" },
|
||||
["p"] = { '"*p', desc = "Paste from system clipboard" },
|
||||
["∆"] = {
|
||||
cmd = ":m '>+1<CR>gv=gv",
|
||||
desc = "Move the selected text up",
|
||||
},
|
||||
["˚"] = {
|
||||
cmd = ":m '<-2<CR>gv=gv",
|
||||
desc = "Move the selected text down",
|
||||
},
|
||||
["<leader>,"] = { name = " Misc Tools" },
|
||||
["<leader>,c"] = { name = " Casing" },
|
||||
["<leader>,cs"] = { ":Snek<CR>", desc = "To Snek Case" },
|
||||
["<leader>,cc"] = { ":Camel<CR>", desc = "To Camel Case" },
|
||||
["<leader>,cp"] = { ":CamelB<CR>", desc = "To Pascal Case" },
|
||||
["<leader>,ck"] = { ":Kebab<CR>", desc = "To Kebab Case" },
|
||||
["<leader>,ce"] = { ":Screm<CR>", desc = "To Screm Case" },
|
||||
},
|
||||
-- ["<leader>,j"] = { name = " Jest Tests" },
|
||||
-- ["<leader>,jr"] = { function() require("jester").run() end, desc = "Run test under cursor" },
|
||||
-- ["<leader>,jf"] = { function() require("jester").run_file() end, desc = "Run tests for file" },
|
||||
-- ["<leader>,jl"] = { function() require("jester").run_last() end, desc = "Run last ran test" },
|
||||
-- ["<leader>lz"] = { ":LspRestart<CR>", desc = "Restart LSP Server" },
|
||||
},
|
||||
v = {
|
||||
["y"] = { '"*y', desc = "Copy to system clipboard" },
|
||||
["p"] = { '"*p', desc = "Paste from system clipboard" },
|
||||
["J"] = { ":m '>+1<CR>gv=gv", desc = "Visually move block down"},
|
||||
["K"] = { ":m '<-2<CR>gv=gv", desc = "Visually move block up"},
|
||||
},
|
||||
i = {
|
||||
["<C-k>"] = { "<Up>", desc = "Up" },
|
||||
["<C-j>"] = { "<Down>", desc = "Down" },
|
||||
["<C-h>"] = { "<Left>", desc = "Left" },
|
||||
["<C-l>"] = { "<Right>", desc = "Right" },
|
||||
["<C-4>"] = { "<End>", desc = "End" },
|
||||
["<C-6>"] = { "<Home>", desc = "Home" },
|
||||
},
|
||||
c = {
|
||||
["<C-h>"] = { "<Left>", desc = "Left" },
|
||||
["<C-j>"] = { "<Down>", desc = "Down" },
|
||||
["<C-k>"] = { "<Up>", desc = "Up" },
|
||||
["<C-l>"] = { "<Right>", desc = "Right" },
|
||||
["<C-4>"] = { "<End>", desc = "End" },
|
||||
["<C-6>"] = { "<Home>", desc = "Home" },
|
||||
},
|
||||
x = {
|
||||
["∆"] = {
|
||||
cmd = ":m '>+1<CR>gv=gv",
|
||||
desc = "Move the selected text up",
|
||||
},
|
||||
["˚"] = {
|
||||
desc = "Move the selected text down",
|
||||
cmd = ":m '<-2<CR>gv=gv",
|
||||
},
|
||||
["<leader>p"] = { '"_dP', desc = "Paste w/o copying replaced content" },
|
||||
},
|
||||
i = {
|
||||
["<C-k>"] = { "<Up>", desc = "Up" },
|
||||
["<C-j>"] = { "<Down>", desc = "Down" },
|
||||
["<C-h>"] = { "<Left>", desc = "Left" },
|
||||
["<C-l>"] = { "<Right>", desc = "Right" },
|
||||
},
|
||||
c = {
|
||||
["<C-h>"] = { "<Left>", desc = "Left" },
|
||||
["<C-j>"] = { "<Down>", desc = "Down" },
|
||||
["<C-k>"] = { "<Up>", desc = "Up" },
|
||||
["<C-l>"] = { "<Right>", desc = "Right" },
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
for _, file in ipairs(vim.fn.readdir(vim.fn.stdpath('config')..'/lua/user', [[v:val =~ '\.lua$']])) do
|
||||
local uplugin = require('user.'..file:gsub('%.lua$', ''))
|
||||
-- if (uplugin[1] ~= nil) then
|
||||
if (uplugin.mappings ~= nil) then
|
||||
for mode, keymaps in pairs(uplugin.mappings) do
|
||||
-- Add new mode if not already existing
|
||||
if (mappings[mode] == nil) then
|
||||
mappings[mode] = {}
|
||||
end
|
||||
|
||||
for key, value in pairs(keymaps) do
|
||||
mappings[mode][key] = value;
|
||||
end
|
||||
end
|
||||
end
|
||||
-- end
|
||||
end
|
||||
|
||||
local M = {}
|
||||
local which_key_queue = nil
|
||||
function M.which_key_register()
|
||||
if which_key_queue then
|
||||
local wk_avail, wk = pcall(require, "which-key")
|
||||
if wk_avail then
|
||||
for mode, registration in pairs(which_key_queue) do
|
||||
wk.register(registration, { mode = mode })
|
||||
end
|
||||
which_key_queue = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function set_mappings(map_table, base)
|
||||
-- iterate over the first keys for each mode
|
||||
base = base or {}
|
||||
for mode, maps in pairs(map_table) do
|
||||
-- iterate over each keybinding set in the current mode
|
||||
for keymap, options in pairs(maps) do
|
||||
-- build the options for the command accordingly
|
||||
if options then
|
||||
local cmd = options
|
||||
local keymap_opts = base
|
||||
if type(options) == "table" then
|
||||
cmd = options[1]
|
||||
keymap_opts = vim.tbl_deep_extend("force", keymap_opts, options)
|
||||
keymap_opts[1] = nil
|
||||
end
|
||||
if not cmd or keymap_opts.name then -- if which-key mapping, queue it
|
||||
if not which_key_queue then which_key_queue = {} end
|
||||
if not which_key_queue[mode] then which_key_queue[mode] = {} end
|
||||
which_key_queue[mode][keymap] = keymap_opts
|
||||
else -- if not which-key mapping, set it
|
||||
vim.keymap.set(mode, keymap, cmd, keymap_opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if package.loaded["which-key"] then M.which_key_register() end -- if which-key is loaded already, register
|
||||
end
|
||||
|
||||
set_mappings(mappings);
|
||||
|
||||
return M
|
||||
|
||||
|
|
21
lua/lsp.lua
Normal file
21
lua/lsp.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
local lsp = require('lsp-zero').preset({})
|
||||
|
||||
lsp.on_attach(function(client, bufnr)
|
||||
lsp.default_keymaps({buffer = bufnr})
|
||||
end)
|
||||
|
||||
lsp.ensure_installed({
|
||||
"tsserver",
|
||||
"eslint",
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
"cssls",
|
||||
"cssmodules_ls",
|
||||
"pyright",
|
||||
})
|
||||
|
||||
-- (Optional) Configure lua language server for neovim
|
||||
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
|
||||
|
||||
lsp.setup()
|
||||
|
|
@ -1,20 +1,42 @@
|
|||
-- allow use of system keyboard
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
|
||||
-- allow use of mouse
|
||||
vim.opt.mouse = 'a'
|
||||
|
||||
-- line numbering, relative
|
||||
vim.opt.number = true
|
||||
vim.wo.number = true
|
||||
vim.wo.relativenumber = true
|
||||
|
||||
-- Highlights the results of previous search, which is annoying when we are done searching
|
||||
vim.opt.hlsearch = false
|
||||
|
||||
-- Wrap lines in files
|
||||
vim.opt.wrap = true
|
||||
|
||||
-- preseve indentation of virtual wrapped lines
|
||||
vim.opt.breakindent = true
|
||||
|
||||
-- be smart with indents
|
||||
vim.opt.smartindent = true
|
||||
|
||||
-- set tab length
|
||||
vim.opt.tabstop = 2;
|
||||
vim.opt.softtabstop = 2;
|
||||
vim.opt.shiftwidth = 2;
|
||||
vim.opt.expandtab = true
|
||||
|
||||
-- Dont use swap files, use undotree
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = os.getenv('HOME') .. '/.vim/undodir'
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- Search settings
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.incsearch = true
|
||||
|
||||
-- split to the right or below always
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.splitright = true
|
||||
|
|
15
lua/plugins/README.md
Normal file
15
lua/plugins/README.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Plugins to look into
|
||||
- https://github.com/andythigpen/nvim-coverage
|
||||
- https://github.com/lukas-reineke/indent-blankline.nvim
|
||||
- https://github.com/johmsalas/text-case.nvim
|
||||
- gitsigns?
|
||||
- casing plugins?
|
||||
["<leader>,"] = { name = " Misc Tools" },
|
||||
["<leader>,c"] = { name = " Casing" },
|
||||
["<leader>,cs"] = { ":Snek<CR>", desc = "To Snek Case" },
|
||||
["<leader>,cc"] = { ":Camel<CR>", desc = "To Camel Case" },
|
||||
["<leader>,cp"] = { ":CamelB<CR>", desc = "To Pascal Case" },
|
||||
["<leader>,ck"] = { ":Kebab<CR>", desc = "To Kebab Case" },
|
||||
["<leader>,ce"] = { ":Screm<CR>", desc = "To Screm Case" },
|
||||
- https://github.com/tpope/vim-fugitive
|
||||
|
|
@ -3,9 +3,7 @@ return {
|
|||
commit = "d8dc204e9f6fd930d9d1d709f0d19138f804431a",
|
||||
event = "BufEnter *.http",
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
mappings = {
|
||||
n = {
|
||||
["<leader>r"] = { function() require("rest-nvim").run() end, desc = "Send http request" },
|
||||
}
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>r", function() require("rest-nvim").run() end, desc = "Send http request" }
|
||||
}
|
||||
}
|
41
lua/plugins/layout-side-bar_neo-tree.lua
Normal file
41
lua/plugins/layout-side-bar_neo-tree.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
commit = "e5594d53986b34e584e8afe2ea6ad99d6f6d2105",
|
||||
dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" },
|
||||
cmd = "Neotree",
|
||||
init = function() vim.g.neo_tree_remove_legacy_commands = true end,
|
||||
pin = true,
|
||||
tag = '2.56',
|
||||
opts = {
|
||||
auto_clean_after_session_restore = true,
|
||||
close_if_last_window = true,
|
||||
sources = { "filesystem" },
|
||||
filesystem = {
|
||||
follow_current_file = true,
|
||||
group_empty_dirs = true,
|
||||
filtered_items = {
|
||||
visible = true,
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = false,
|
||||
hide_by_name = {
|
||||
".DS_Store",
|
||||
},
|
||||
},
|
||||
},
|
||||
nesting_rules = {
|
||||
["ts"] = { ".cjs", ".cjs.map", ".d.ts", ".d.ts.map", ".js", ".js.map", ".mjs", ".mjs.map", ".test.ts" },
|
||||
["tsx"] = { ".d.ts", ".d.ts.map", ".js;", ".js.map;", ".jsx;", ".jsx.map;", ".module.scss;", ".svg" },
|
||||
["scss"] = { ".css", ".css.map" },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>e", "<cmd>Neotree toggle<CR>", desc = "Toggle Explorer" },
|
||||
{ "<leader>o",function()
|
||||
if vim.bo.filetype == "neo-tree" then
|
||||
vim.cmd.wincmd "p"
|
||||
else
|
||||
vim.cmd.Neotree "focus"
|
||||
end
|
||||
end , desc = "Toggle Explorer Focus" },
|
||||
},
|
||||
}
|
20
lua/plugins/lsp-zero.lua
Normal file
20
lua/plugins/lsp-zero.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
return {
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = 'v2.x',
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{'neovim/nvim-lspconfig'}, -- Required
|
||||
{ -- Optional
|
||||
'williamboman/mason.nvim',
|
||||
build = function()
|
||||
pcall(vim.cmd, 'MasonUpdate')
|
||||
end,
|
||||
},
|
||||
{'williamboman/mason-lspconfig.nvim'}, -- Optional
|
||||
|
||||
-- Autocompletion
|
||||
{'hrsh7th/nvim-cmp'}, -- Required
|
||||
{'hrsh7th/cmp-nvim-lsp'}, -- Required
|
||||
{'L3MON4D3/LuaSnip'}, -- Required
|
||||
},
|
||||
}
|
|
@ -6,10 +6,8 @@ return {
|
|||
default_type = "keep",
|
||||
},
|
||||
cmd = "Glow",
|
||||
mappings = {
|
||||
n = {
|
||||
["<leader>m"] = { "<Nop>", name = " Markdown" },
|
||||
["<leader>mp"] = { ":Glow <CR>", desc = "Markdown preview" },
|
||||
}
|
||||
}
|
||||
keys = {
|
||||
{ "<leader>m","<Nop>", desc = " Markdown" },
|
||||
{ "<leader>mp",":Glow <CR>", desc = "Markdown preview" },
|
||||
},
|
||||
}
|
8
lua/plugins/open-github.lua
Normal file
8
lua/plugins/open-github.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
"Almo7aya/openingh.nvim",
|
||||
commit = "374c081409dc238018cd986410f16190d8f9f680",
|
||||
event = "BufEnter",
|
||||
keys = {
|
||||
{ "<leader>gf", ":OpenInGHFile <CR>", desc = "Open in git" }
|
||||
},
|
||||
}
|
18
lua/plugins/telescope.lua
Normal file
18
lua/plugins/telescope.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = '0.1.1',
|
||||
dependencies = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable "make" == 1, build = "make" },
|
||||
},
|
||||
cmd = "Telescope",
|
||||
keys = {
|
||||
{ "<leader>f", "<Nop>", desc = "Find ..." },
|
||||
{ "<leader>ff", function() require('telescope.builtin').find_files() end, desc = "Find Files" },
|
||||
{ "<leader>fg", function() require('telescope.builtin').git_files() end, desc = "Find Git only Files" },
|
||||
{ "<leader>fw", function() require('telescope.builtin').live_grep() end, desc = "Find Words" },
|
||||
{ "<leader>fc", function() require('telescope.builtin').commands() end, desc = "Find Commands" },
|
||||
{ "<leader>fk", function() require('telescope.builtin').keymaps() end, desc = "Find Commands" },
|
||||
},
|
||||
opts = {},
|
||||
}
|
|
@ -60,7 +60,7 @@ return {
|
|||
"vue",
|
||||
"yaml",
|
||||
},
|
||||
-- auto_install = true,
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end,
|
9
lua/plugins/undotree.lua
Normal file
9
lua/plugins/undotree.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"mbbill/undotree",
|
||||
commit = "485f01efde4e22cb1ce547b9e8c9238f36566f21",
|
||||
event = "BufEnter",
|
||||
keys = {
|
||||
{ "<leader>u", vim.cmd.UndotreeToggle, desc = "Undo Tree Toggle" },
|
||||
},
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
-- Disabled this because of undotree, turniung off swap files entirely, adding in undo tree history instead
|
||||
|
||||
return {
|
||||
"gioele/vim-autoswap",
|
||||
commit = "e587e4b14a605d8921942ba65a37583813289272",
|
|
@ -70,24 +70,8 @@ return {
|
|||
"MasonUninstall",
|
||||
"MasonUninstallAll",
|
||||
"MasonLog",
|
||||
"MasonUpdate", -- AstroNvim extension here as well
|
||||
"MasonUpdateAll", -- AstroNvim specific
|
||||
},
|
||||
opts = {
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_uninstalled = "✗",
|
||||
package_pending = "⟳",
|
||||
},
|
||||
},
|
||||
},
|
||||
--config = function(_, opts)
|
||||
--require('mason').setup(opts)
|
||||
--for _, plugin in ipairs { "mason-lspconfig", "mason-null-ls", "mason-nvim-dap" } do
|
||||
-- pcall(require, plugin)
|
||||
--end
|
||||
--end
|
||||
opts = {}
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
8
lua/tools/init.lua
Normal file
8
lua/tools/init.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
-- Autoload all files in this tools dir, minus this init again
|
||||
for _, file in ipairs(vim.fn.readdir(vim.fn.stdpath('config')..'/lua/tools', [[v:val =~ '\.lua$']])) do
|
||||
if file ~= "init.lua" then
|
||||
local tool = string.sub(file, 0, -5)
|
||||
require('tools.' .. tool)
|
||||
end
|
||||
end
|
||||
|
36
lua/tools/scratch-files.lua
Normal file
36
lua/tools/scratch-files.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
-- Scratch files
|
||||
local scratch = function(extension)
|
||||
os.execute "mkdir -p ~/dev/scratches/"
|
||||
local date = os.date "%Y-%m-%dT%H:%M:%S"
|
||||
local filepath = "~/dev/scratches/scratch_" .. date .. extension
|
||||
vim.cmd("execute 'edit " .. filepath .. "'")
|
||||
end
|
||||
|
||||
require('util').keymaps({
|
||||
n = {
|
||||
["<leader>fsw"] = {
|
||||
function()
|
||||
require("telescope.builtin").live_grep {
|
||||
search_dirs = { "~/dev/scratches/" },
|
||||
}
|
||||
end,
|
||||
desc = "Find Words in Scratches",
|
||||
},
|
||||
["<leader>fsf"] = {
|
||||
function()
|
||||
require("telescope.builtin").find_files{
|
||||
search_dirs = { "~/dev/scratches/" },
|
||||
}
|
||||
end,
|
||||
desc = "Find Scratches",
|
||||
},
|
||||
["<leader>s"] = { "<Nop>", desc = " Scratch File" },
|
||||
["<leader>ss"] = { function() scratch ".txt" end, desc = "New text scratch file" },
|
||||
["<leader>sn"] = { function() scratch ".json" end, desc = "New json scratch file" },
|
||||
["<leader>sq"] = { function() scratch ".sql" end, desc = "New sql scratch file" },
|
||||
["<leader>st"] = { function() scratch ".ts" end, desc = "New ts scratch file" },
|
||||
["<leader>sb"] = { function() scratch ".sh" end, desc = "New shell scratch file" },
|
||||
["<leader>sj"] = { function() scratch ".js" end, desc = "New js scratch file" },
|
||||
}
|
||||
})
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# Plugins to look into
|
||||
- https://github.com/andythigpen/nvim-coverage
|
||||
- https://github.com/lukas-reineke/indent-blankline.nvim
|
||||
- https://github.com/johmsalas/text-case.nvim
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
commit = "c18b7ca0b5b50596722f3a1572eb9b8eb520c0f1",
|
||||
event = "User AstroGitFile",
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = "▎" },
|
||||
change = { text = "▎" },
|
||||
delete = { text = "▎" },
|
||||
topdelete = { text = "" },
|
||||
changedelete = { text = "▎" },
|
||||
untracked = { text = "▎" },
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
commit = "e5594d53986b34e584e8afe2ea6ad99d6f6d2105",
|
||||
dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" },
|
||||
cmd = "Neotree",
|
||||
init = function() vim.g.neo_tree_remove_legacy_commands = true end,
|
||||
pin = true,
|
||||
tag = '2.56',
|
||||
opts = {
|
||||
auto_clean_after_session_restore = true,
|
||||
close_if_last_window = true,
|
||||
sources = { "filesystem" },
|
||||
filesystem = {
|
||||
follow_current_file = true,
|
||||
group_empty_dirs = true,
|
||||
filtered_items = {
|
||||
visible = true,
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = false,
|
||||
hide_by_name = {
|
||||
".DS_Store",
|
||||
},
|
||||
},
|
||||
},
|
||||
nesting_rules = {
|
||||
["ts"] = { ".cjs", ".cjs.map", ".d.ts", ".d.ts.map", ".js", ".js.map", ".mjs", ".mjs.map", ".test.ts" },
|
||||
["tsx"] = { ".d.ts", ".d.ts.map", ".js;", ".js.map;", ".jsx;", ".jsx.map;", ".module.scss;", ".svg" },
|
||||
["scss"] = { ".css", ".css.map" },
|
||||
},
|
||||
},
|
||||
mappings = {
|
||||
n = {
|
||||
["<leader>e"] = { "<cmd>Neotree toggle<cr>", desc = "Toggle Explorer" },
|
||||
["<leader>o"] = {
|
||||
function()
|
||||
if vim.bo.filetype == "neo-tree" then
|
||||
vim.cmd.wincmd "p"
|
||||
else
|
||||
vim.cmd.Neotree "focus"
|
||||
end
|
||||
end,
|
||||
desc = "Toggle Explorer Focus",
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
commit = "40c31fdde93bcd85aeb3447bb3e2a3208395a868",
|
||||
dependencies = {
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable "make" == 1, build = "make" },
|
||||
},
|
||||
cmd = "Telescope",
|
||||
opts = function()
|
||||
local actions = require "telescope.actions"
|
||||
local get_icon = require("astronvim.utils").get_icon
|
||||
return {
|
||||
defaults = {
|
||||
prompt_prefix = string.format("%s ", get_icon "Search"),
|
||||
selection_caret = string.format("%s ", get_icon "Selected"),
|
||||
path_display = { "truncate" },
|
||||
sorting_strategy = "ascending",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top",
|
||||
preview_width = 0.55,
|
||||
},
|
||||
vertical = {
|
||||
mirror = false,
|
||||
},
|
||||
width = 0.87,
|
||||
height = 0.80,
|
||||
preview_cutoff = 120,
|
||||
},
|
||||
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-n>"] = actions.cycle_history_next,
|
||||
["<C-p>"] = actions.cycle_history_prev,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
},
|
||||
n = { ["q"] = actions.close },
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
return {
|
||||
"Almo7aya/openingh.nvim",
|
||||
commit = "374c081409dc238018cd986410f16190d8f9f680",
|
||||
event = "User AstroFile",
|
||||
mappings = {
|
||||
n = {
|
||||
["<leader>gf"] = { ":OpenInGHFile <CR>", desc = "Open in github" },
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
return {
|
||||
"goolord/alpha-nvim",
|
||||
commit = "1838ae926e8d49fe5330d1498ee8289ae2c340bc", -- May 22, 2023
|
||||
cmd = "Alpha",
|
||||
opts = function()
|
||||
local dashboard = require "alpha.themes.dashboard"
|
||||
dashboard.section.header.val = {
|
||||
" ▒▒▒▒▒▒ ",
|
||||
" ▒▒▓▓▓▓▒▒▒▒▒▒▒▒ ",
|
||||
" ▓▓▒▒▒▒▒▒▒▒░░ ▓▓ ",
|
||||
" ▒▒▓▓▓▓▓▓▓▓▓▓▓▓░░░░ ▒▒▒▒▓▓▒▒▒▒ ",
|
||||
" ▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░ ▒▒▓▓▓▓▓▓▒▒▒▒▒▒ ",
|
||||
" ▓▓▓▓▓▓▓▓▓▓ ██▓▓▓▓▓▓▓▓ ▒▒▒▒ ██ ",
|
||||
" ██▓▓▓▓ ▓▓████▓▓▓▓ ▒▒▒▒▒▒▒▒▓▓██▓▓ ▒▒▒▒▒▒ ",
|
||||
" ██ ██ ▒▒▒▒▒▒░░░░ ▒▒▒▒▒▒ ▓▓▓▓▓▓ ▒▒▒▒▓▓▓▓██▓▓▒▒▒▒██▒▒▒▒▒▒▒▒▒▒ ",
|
||||
" ▒▒▒▒▓▓ ▒▒▒▒▓▓▓▓▓▓▓▓▓▓▒▒░░ ░░▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒ ▒▒▓▓▓▓▓▓▒▒▒▒▒▒▒▒ ██▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒ ▓▓ ▒▒ ",
|
||||
" ▒▒▓▓▓▓██▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░ ▒▒▓▓▓▓▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ░░██▓▓ ██▓▓ ▒▒ ▒▒▒▒▓▓▒▒▒▒▓▓ ▒▒ ▒▒ ",
|
||||
" ▒▒▓▓▓▓▓▓██▓▓▓▓▓▓████▓▓▓▓▓▓▓▓▓▓ ▒▒ ▒▒▒▒▒▒▒▒▒▒ ▓▓▓▓▓▓▓▓▓▓██▓▓▓▓██▓▓▓▓▓▓▓▓ ████▓▓▓▓▓▓▒▒ ██▒▒██▒▒▓▓▓▓▒▒▓▓▓▓▒▒▓▓▓▓██▓▓ ",
|
||||
" ▓▓▓▓▓▓▓▓██▓▓██ ████ ▓▓▓▓▓▓▓▓ ▒▒▒▒▒▒▒▒▒▒ ▒▒▓▓▒▒ ▒▒▒▒▒▒ ░░██ ▓▓▓▓▓▓▓▓██▓▓ ▓▓██▓▓ ▓▓ ▒▒▒▒▒▒▒▒▒▒▒▒ ██▓▓ ██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▒▒▓▓▓▓▒▒▓▓",
|
||||
" ░░▓▓▓▓░░░░████████░░ ░░▓▓▓▓░░ ░░▒▒▒▒▒▒▒▒░░▒▒▓▓▒▒░░▒▒▒▒░░ ░░██ ▓▓░░▓▓░░░░▓▓ ▓▓░░▓▓▒▒▓▓ ▒▒▓▓▓▓▓▓▓▓▒▒▒▒░░▒▒▓▓░░ ██▓▓▓▓▓▓██▓▓██░░██▓▓▓▓▓▓▒▒▓▓",
|
||||
" ░░░░ ░░██▓▓░░ ░░░░ ░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░ ░░██ ▓▓ ▓▓ ▓▓ ░░ ▓▓▓▓░░░░ ░░░░░░░░░░▓▓▓▓▒▒██░░ ░░░░░░ ▒▒░░▓▓▓▓▓▓██░░██▒▒░░▓▓██▓▓▓▓░░",
|
||||
" ██▓▓ ▒▒ ▒▒▒▒▒▒▒▒ ▓▓▓▓▒▒▒▒▒▒▒▒ ░░ ▓▓ ▓▓ ██ ▓▓▓▓▓▓ ▓▓ ▓▓██▓▓▓▓ ▒▒▒▒▒▒▒▒▒▒ ██░░██ ██▓▓████ ░░ ",
|
||||
" ██▓▓ ░░ ▒▒░░▓▓░░ ▓▓▒▒░░▒▒░░▒▒ ▓▓ ██ ░░ ▒▒▓▓░░▓▓ ▓▓ ░░░░████▒▒▓▓▓▓▓▓▒▒▒▒░░ ░░ ░░ ██▓▓░░░░ ",
|
||||
" ██▓▓ ▒▒▒▒▒▒ ▓▓ ██▓▓ ██ ██ ████▓▓██ ▓▓ ▓▓▒▒ ████ ",
|
||||
" ▓▓▓▓██▓▓▓▓▓▓ ▓▓▒▒ ▓▓▓▓ ██▓▓ ▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓ ",
|
||||
" ████▓▓██████▓▓▓▓████ ▓▓▓▓▓▓▓▓▓▓▒▒▓▓▓▓██▓▓ ████████▓▓▓▓████████ ██████▓▓████ ██▒▒▓▓▓▓██████▓▓▓▓▒▒██ ",
|
||||
" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▓▓▓▓▓▓▓▓ ▓▓▒▒▓▓██████▓▓▓▓▓▓▓▓▒▒██ ▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓ ▓▓▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒██ ",
|
||||
" ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒ ▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒ ██▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ",
|
||||
" ▓▓▓▓▓▓▓▓▒▒▓▓▓▓▓▓▓▓▒▒▒▒▓▓ ▓▓▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▓▓ ██▓▓▒▒▒▒▓▓▒▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒██ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒██ ",
|
||||
" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▒▒▒▒░░░░░░░░░░░░░░░░▓▓ ░░██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██ ▓▓▓▓▓▓▒▒▒▒▒▒▓▓▒▒▒▒▓▓ ░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ",
|
||||
" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ░░████████████████████░░ ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░ ░░ ████▓▓▓▓▓▓▓▓▓▓████░░",
|
||||
"",
|
||||
" ██╗ ██████╗ ███████╗██╗ ██╗",
|
||||
" ██║██╔═══██╗██╔════╝██║ ██║",
|
||||
" ██║██║ ██║███████╗███████║",
|
||||
" ██ ██║██║ ██║╚════██║██╔══██║",
|
||||
" ╚█████╔╝╚██████╔╝███████║██║ ██║",
|
||||
" ╚════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝",
|
||||
}
|
||||
dashboard.section.header.opts.hl = "DashboardHeader"
|
||||
|
||||
dashboard.section.buttons.val = {
|
||||
}
|
||||
|
||||
dashboard.config.layout[1].val = vim.fn.max { 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) }
|
||||
dashboard.config.layout[3].val = 5
|
||||
dashboard.config.opts.noautocmd = true
|
||||
|
||||
return dashboard
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("alpha").setup(opts.config)
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyVimStarted",
|
||||
desc = "Add Alpha dashboard footer",
|
||||
once = true,
|
||||
callback = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = math.floor(stats.startuptime * 100 + 0.5) / 100
|
||||
opts.section.footer.val =
|
||||
{ " ", " ", " ", "Loaded " .. stats.count .. " plugins in " .. ms .. "ms" }
|
||||
pcall(vim.cmd.AlphaRedraw)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
24
lua/util.lua
Normal file
24
lua/util.lua
Normal file
|
@ -0,0 +1,24 @@
|
|||
local M = {};
|
||||
|
||||
function M.keymaps(mappings)
|
||||
for mode, maps in pairs(mappings) do
|
||||
for keymap, options in pairs(maps) do
|
||||
if options then
|
||||
local cmd = options
|
||||
local keymap_opts = {}
|
||||
if type(options) == "table" then
|
||||
cmd = options[1]
|
||||
keymap_opts = vim.tbl_deep_extend("force", keymap_opts, options)
|
||||
keymap_opts[1] = nil
|
||||
end
|
||||
|
||||
if mode and keymap and cmd and keymap_opts then
|
||||
vim.keymap.set(mode, keymap, cmd, keymap_opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue