add zk and alpha lvim configs

This commit is contained in:
Daylin Morgan 2022-02-08 13:42:16 -06:00
parent a431531199
commit 59509ae476
6 changed files with 129 additions and 3 deletions

View file

@ -6,7 +6,6 @@ lvim.log.level = "warn"
lvim.format_on_save = true lvim.format_on_save = true
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
lvim.builtin.dashboard.active = true
lvim.builtin.notify.active = true lvim.builtin.notify.active = true
lvim.builtin.terminal.active = true lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.setup.view.side = "left" lvim.builtin.nvimtree.setup.view.side = "left"

View file

@ -0,0 +1,19 @@
local wk = require("which-key")
-- local opts = lvim.builtin.which_key.opts
local opts = {
mode = "n", -- NORMAL mode
prefix = "<leader>",
buffer = 0, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = false, -- use `nowait` when creating keymaps
}
local mappings = {
C = "Edit Configuration"
}
wk.register(mappings,opts)

View file

@ -0,0 +1,26 @@
-- Add the key mappings only for Markdown files in a zk notebook.
if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then
local function map(...) vim.api.nvim_buf_set_keymap(0, ...) end
local opts = { noremap=true, silent=false }
-- Open the link under the caret.
map("n", "<CR>", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
-- Create a new note after asking for its title.
-- This overrides the global `<leader>zn` mapping to create the note in the same directory as the current buffer.
map("n", "<leader>zn", "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
-- Create a new note in the same directory as the current buffer, using the current selection for title.
map("v", "<leader>znt", ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }<CR>", opts)
-- Create a new note in the same directory as the current buffer, using the current selection for note content and asking for its title.
map("v", "<leader>znc", ":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
-- Open notes linking to the current buffer.
map("n", "<leader>zb", "<Cmd>ZkBacklinks<CR>", opts)
-- Alternative for backlinks using pure LSP and showing the source context.
--map('n', '<leader>zb', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
-- Open notes linked by the current buffer.
map("n", "<leader>zl", "<Cmd>ZkLinks<CR>", opts)
-- Preview a linked note.
map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
-- Open the code actions for a visual selection.
map("v", "<leader>za", ":'<,'>lua vim.lsp.buf.range_code_action()<CR>", opts)
end

View file

@ -0,0 +1,73 @@
-- ref: https://github.com/dtr2300/nvim/blob/main/lua/config/plugins/alpha.lua
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
math.randomseed(os.time())
local function button(sc, txt, keybind, keybind_opts)
local b = dashboard.button(sc, txt, keybind, keybind_opts)
b.opts.hl = "Function"
b.opts.hl_shortcut = "Type"
return b
end
local function pick_color()
local colors = { "String", "Identifier", "Keyword", "Number", "Constant" }
return colors[math.random(#colors)]
end
local function footer()
local plugins = #vim.tbl_keys(packer_plugins)
local v = vim.version()
local datetime = os.date " %d-%m-%Y  %H:%M:%S"
return string.format(" %s  v%s.%s.%s %s", plugins, v.major, v.minor, v.patch, datetime)
end
dashboard.section.header.val = {
[[ _______________________________________ ]],
[[ |,---"-----------------------------"---,| ]],
[[ ||___ 16 bit.................... || ]],
[[ ||====\ :HHHHHHHHHHHHHHHHHHHHHHHHHHH || ]],
[[ ||=====):H c> lvim H || ]],
[[ ||====/ :H ╦ ╦ ╦╔╗╔╔═╗╦═╗╦ ╦╦╔╦╗ H || ]],
[[ || :H ║ ║ ║║║║╠═╣╠╦╝╚╗╔╝║║║║ H || ]],
[[ ||PORTFO:H ╩═╝╚═╝╝╚╝╩ ╩╩╚═ ╚╝ ╩╩ ╩ H || ]],
[[ || :HHHHHHHHHHHHHHHHHHHHHHHHHHH || ]],
[[ ||_____,_________________________,_____|| ]],
[[ |)_____)-----.| /I\ATARI |.------(_____(| ]],
[[ //"""""""|_____|=----------=|______|"""""""\ ]],
[[ // _| _| _| _| _| _| _| _| _| _| _| _| _| _| \ ]],
[[ // ___| _| _| _| _| _| _| _| _| _| _| _| | | \ ]],
[[ |/ ___| _| _| _| _| _| _| _| _| _| _| _| ______| \ ]],
[[ / __| _| _| _| _| _| _| _| _| _| _| _| _| _| ___| \ ]],
[[ / _| _| _| _| ________________________| _| _| _| _| \ ]],
[[|------"--------------------------------------"-------|]],
[[`-----------------------------------------------------']],
}
dashboard.section.header.opts.hl = pick_color()
dashboard.section.buttons.val = {
button( "n", " New file" , ":ene <BAR> startinsert <CR>"),
button( "SPC f"," Find File", "<Cmd>Telescope find_files<CR>"),
button( "SPC s p"," Recent Projects", "<Cmd>Telescope projects<CR>" ),
button( "SPC s r"," Recently Used Files", "<Cmd>Telescope oldfiles<CR>"),
button( "SPC s w", " Find Word","<Cmd>Telescope live_grep<CR>"),
button( "SPC C"," Configuration",":e ~/.config/lvim/config.lua<CR>" ),
button( "q", " Quit NVIM" , ":qa<CR>"),
}
dashboard.section.footer.val = footer()
dashboard.section.footer.opts.hl = dashboard.section.header.opts.hl
-- hide tabline and statusline on startup
vim.cmd [[
augroup alpha_tabline
au!
au FileType alpha set showtabline=0 laststatus=0 noruler | au BufUnload <buffer> set showtabline=2 ruler laststatus=2
augroup END
]]
alpha.setup(dashboard.opts)

View file

@ -30,13 +30,18 @@ map('n', "L", "$",{noremap=true})
-- -- Search for the notes matching the current visual selection. -- -- Search for the notes matching the current visual selection.
map("v", "<leader>zf", ":'<,'>ZkMatch<CR>") map("v", "<leader>zf", ":'<,'>ZkMatch<CR>")
lvim.builtin.which_key.mappings["z"] = { local mappings = lvim.builtin.which_key.mappings
mappings["z"] = {
name = "zk", name = "zk",
n = { "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", "New"}, n = { "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", "New"},
o = { "<Cmd>ZkNotes { sort = { 'modified' } }<CR>", "Open" }, o = { "<Cmd>ZkNotes { sort = { 'modified' } }<CR>", "Open" },
t = { "<Cmd>ZkTags<CR>", "Tags"}, t = { "<Cmd>ZkTags<CR>", "Tags"},
f = { "<Cmd>ZkNotes { sort = { 'modified' }, match = vim.fn.input('Search: ') }<CR>", "Fuzzy Search" }, f = { "<Cmd>ZkNotes { sort = { 'modified' }, match = vim.fn.input('Search: ') }<CR>", "Fuzzy Search" },
} }
mappings["s"]["p"] = {"<cmd>Telescope projects<CR>","Recent Projects"}
mappings["s"]["w"] = {"<cmd>Telescope live_grep<CR>","Find Word"}
mappings[';'] = { "<cmd>Alpha<CR>", "Dashboard"}
-- keymappings [view all the defaults by pressing <leader>Lk] -- keymappings [view all the defaults by pressing <leader>Lk]

View file

@ -1,7 +1,12 @@
local p = function(name) return string.format("require'config.%s'", name) end
-- extra plugins -- extra plugins
lvim.plugins = { lvim.plugins = {
{ 'Mofiqul/dracula.nvim' }, { 'Mofiqul/dracula.nvim' },
{ 'ggandor/lightspeed.nvim' }, { 'ggandor/lightspeed.nvim' },
{ 'goolord/alpha-nvim',
config = p"alpha"
},
{ {
'mickael-menu/zk-nvim', 'mickael-menu/zk-nvim',
config = function () config = function ()
@ -35,7 +40,6 @@ lvim.plugins = {
lvim.builtin.telescope.pickers = { find_files = { hidden = true }} lvim.builtin.telescope.pickers = { find_files = { hidden = true }}
lvim.builtin.nvimtree.setup.git.ignore = false lvim.builtin.nvimtree.setup.git.ignore = false
lvim.builtin.dashboard.custom_header = { lvim.builtin.dashboard.custom_header = {
[[ _______________________________________ ]], [[ _______________________________________ ]],
[[ |,---"-----------------------------"---,| ]], [[ |,---"-----------------------------"---,| ]],