update lvim config

This commit is contained in:
Daylin Morgan 2022-06-20 11:22:38 -05:00
parent 627d00c94a
commit ddbcf98ee3
9 changed files with 215 additions and 224 deletions

View file

@ -1,47 +1,5 @@
require("plugins")
require("keybindings")
-- general
lvim.log.level = "warn"
lvim.format_on_save = false
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
lvim.builtin.notify.active = true
lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.show_icons.git = 0
-- if you don't want all the parsers change this to a table of the ones you want
lvim.builtin.treesitter.ensure_installed = {
"bash",
"haskell",
"javascript",
"json",
"lua",
"python",
-- "typescript",
"css",
-- "rust",
"yaml",
"go"
}
lvim.builtin.treesitter.highlight.enabled = true
-- colorscheme
lvim.builtin.lualine.options.theme = "catppuccin"
lvim.colorscheme = "catppuccin"
-- settings
local opt = vim.opt
opt.timeoutlen = 200
opt.cmdheight = 1
lvim.autocommands.custom_groups = {
-- On entering insert mode in any file, scroll the window so the cursor line is centered
{"InsertEnter", "*", ":normal zz"},
-- Auto disbale spell checking on buffer open
{"BufNewFile,BufReadPost,FilterReadPost,FileReadPost","*",":set nospell"},
}
require('settings')
require('plugins')
require('keybindings')
require('autocommands')

View file

@ -1,19 +0,0 @@
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

@ -1,5 +1,8 @@
local _, util = pcall(require, "zk.util")
-- Add the key mappings only for Markdown files in a zk notebook.
if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then
if 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.

View file

@ -0,0 +1,8 @@
-- Is this necessary?
vim.api.nvim_create_autocmd("FileType", {
pattern = "zsh",
callback = function()
-- let treesitter use bash highlight for zsh files as well
require("nvim-treesitter.highlight").attach(0, "bash")
end,
})

View file

@ -0,0 +1,78 @@
-- local _, zk = pcall(require, "zk")
-- local _, commands = pcall(require, "zk.commands")
-- TODO: figure out what's wrong with these ....
-- local function dump(o)
-- if type(o) == 'table' then
-- local s = '{ '
-- for k, v in pairs(o) do
-- if type(k) ~= 'number' then k = '"' .. k .. '"' end
-- s = s .. '[' .. k .. '] = ' .. dump(v) .. ','
-- end
-- return s .. '} '
-- else
-- return tostring(o)
-- end
-- end
-- commands.add("ZkLinkTo", function(options)
-- zk.pick_notes(options, { title = "ZkLinkTo" }, function(notes)
-- local note = notes[1]
-- local title = ''
-- print(dump(note))
-- if note.title then
-- title = note.title
-- else
-- title = "Untitled"
-- end
-- local link = "[" .. title .. "](" .. note.absPath .. ")"
-- print(link)
-- -- notes = { notes }
-- for i, note in ipairs(notes) do
-- print(i)
-- print(note.title)
-- if note.title then
-- print("[" .. note.title .. "](" .. note.absPath .. ")")
-- link = "[" .. note.title .. "](" .. note.absPath .. ")"
-- else
-- print('no title brah')
-- link = 'other lin'
-- print(link)
-- end
-- print(link)
-- print(note.absPath)
-- -- -- vim.cmd("e " .. note.absPath)
-- end
-- end)
-- end)
-- commands.add("ZkListLin", function(options)
-- zk.pick_notes(options, { title = "ZkLinkTo" }, function(notes)
-- local note = notes[1]
-- local title = ''
-- print(dump(note))
-- if note.title then
-- title = note.title
-- else
-- title = "Untitled"
-- end
-- local link = "[" .. title .. "](" .. note.absPath .. ")"
-- print(link)
-- -- notes = { notes }
-- for i, note in ipairs(notes) do
-- print(i)
-- print(note.title)
-- if note.title then
-- print("[" .. note.title .. "](" .. note.absPath .. ")")
-- link = "[" .. note.title .. "](" .. note.absPath .. ")"
-- else
-- print('no title brah')
-- link = 'other lin'
-- print(link)
-- end
-- print(link)
-- print(note.absPath)
-- -- -- vim.cmd("e " .. note.absPath)
-- end
-- end)
-- end)

View file

@ -1,73 +0,0 @@
-- 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

@ -1,25 +1,21 @@
-- Map a key with optional options
local function map(mode, keys, action, options)
if options == nil then
options = {noremap=true}
options = { noremap = true }
end
vim.api.nvim_set_keymap(mode,keys,action,options)
vim.api.nvim_set_keymap(mode, keys, action, options)
end
vim.g.mapleader = " "
map('i','jk','<Esc>',{noremap=true})
map('v','jk','<Esc>',{noremap=true})
map('n', "H", "^",{noremap=true})
map('n', "L", "$",{noremap=true})
map('n','j',"v:count ? 'j' : 'gj'",{expr=true,noremap=true})
map('n','k',"v:count ? 'k' : 'gk'",{expr=true,noremap=true})
map('i', 'jk', '<Esc>', { noremap = true })
map('v', 'jk', '<Esc>', { noremap = true })
map('n', "H", "^", { noremap = true })
map('n', "L", "$", { noremap = true })
map('n', 'j', "v:count ? 'j' : 'gj'", { expr = true, noremap = true })
map('n', 'k', "v:count ? 'k' : 'gk'", { expr = true, noremap = true })
-- zettelkasten keybindings
-- Create a new note after asking for its title.
-- map("n", "<leader>zn", "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>")
@ -31,23 +27,37 @@ map('n','k',"v:count ? 'k' : 'gk'",{expr=true,noremap=true})
-- -- Search for the notes matching a given query.
-- map("n", "<leader>zf", "<Cmd>ZkNotes { sort = { 'modified' }, match = vim.fn.input('Search: ') }<CR>")
-- -- Search for the notes matching the current visual selection.
map("v", "<leader>zf", ":'<,'>ZkMatch<CR>")
local mappings = lvim.builtin.which_key.mappings
mappings["z"] = {
name = "zk",
n = { "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", "New"},
o = { "<Cmd>ZkNotes { sort = { 'modified' } }<CR>", "Open" },
t = { "<Cmd>ZkTags<CR>", "Tags"},
f = { "<Cmd>ZkNotes { sort = { 'modified' }, match = vim.fn.input('Search: ') }<CR>", "Fuzzy Search" },
name = "zk",
n = { "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", "New" },
o = { "<Cmd>ZkNotes { sort = { 'modified' } }<CR>", "Open" },
t = { "<Cmd>ZkTags<CR>", "Tags" },
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"}
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]
-- lvim.leader = "space"
-- add your own keymapping
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
-- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode.
-- we use protected-mode (pcall) just in case the plugin wasn't loaded yet.
local _, actions = pcall(require, "telescope.actions")
lvim.builtin.telescope.defaults.mappings = {
-- for input mode
i = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev,
},
-- for normal mode
n = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
},
}

View file

@ -2,79 +2,78 @@ local p = function(name) return string.format("require'config.%s'", name) end
-- extra plugins
lvim.plugins = {
{ 'chrisbra/Colorizer' },
{
'catppuccin/nvim',
as = 'catppuccin'
},
{ 'NoahTheDuke/vim-just' },
{ 'Mofiqul/dracula.nvim' },
{ 'ggandor/lightspeed.nvim' },
{ 'elkowar/yuck.vim' },
{ 'goolord/alpha-nvim',
config = p"alpha"
},
{
'mickael-menu/zk-nvim',
config = function ()
require("zk").setup({
-- can be "telescope", "fzf" or "select" (`vim.ui.select`)
-- it's recommended to use "telescope" or "fzf"
picker = "telescope",
lsp = {
-- `config` is passed to `vim.lsp.start_client(config)`
config = {
cmd = { "zk", "lsp" },
name = "zk",
-- on_attach = ...
-- etc, see `:h vim.lsp.start_client()`
},
-- automatically attach buffers in a zk notebook that match the given filetypes
auto_attach = {
enabled = true,
filetypes = { "markdown" },
},
{ 'chrisbra/Colorizer' },
{
'catppuccin/nvim',
as = 'catppuccin'
},
-- { 'axelf4/vim-strip-trailing-whitespace' },
{ 'NoahTheDuke/vim-just' },
{ 'ggandor/lightspeed.nvim' },
{ 'elkowar/yuck.vim' },
{
'mickael-menu/zk-nvim',
config = function()
require("zk").setup({
-- can be "telescope", "fzf" or "select" (`vim.ui.select`)
-- it's recommended to use "telescope" or "fzf"
picker = "telescope",
lsp = {
-- `config` is passed to `vim.lsp.start_client(config)`
config = {
cmd = { "zk", "lsp" },
name = "zk",
-- on_attach = ...
-- etc, see `:h vim.lsp.start_client()`
},
})
end,
}
-- automatically attach buffers in a zk notebook that match the given filetypes
auto_attach = {
enabled = true,
filetypes = { "markdown" },
},
},
})
end,
},
}
-- default plugins settings
-- lvim.builtin.nvimtree.setup.git.ignore = false
-- make telescope respect that hidden files exist
-- lvim.builtin.telescope.pickers = { find_files = { hidden = true }}
lvim.builtin.nvimtree.setup.git.ignore = false
lvim.builtin.notify.active = true
lvim.builtin.terminal.active = true
lvim.builtin.alpha.dashboard.section.header.val = {
[[ _______________________________________ ]],
[[ |,---"-----------------------------"---,| ]],
[[ ||___ 16 bit.................... || ]],
[[ ||====\ :HHHHHHHHHHHHHHHHHHHHHHHHHHH || ]],
[[ ||=====):H c> lvim H || ]],
[[ ||====/ :H ╦ ╦ ╦╔╗╔╔═╗╦═╗╦ ╦╦╔╦╗ H || ]],
[[ || :H ║ ║ ║║║║╠═╣╠╦╝╚╗╔╝║║║║ H || ]],
[[ ||PORTFO:H ╩═╝╚═╝╝╚╝╩ ╩╩╚═ ╚╝ ╩╩ ╩ H || ]],
[[ || :HHHHHHHHHHHHHHHHHHHHHHHHHHH || ]],
[[ ||_____,_________________________,_____|| ]],
[[ |)_____)-----.| /I\ATARI |.------(_____(| ]],
[[ //"""""""|_____|=----------=|______|"""""""\ ]],
[[ // _| _| _| _| _| _| _| _| _| _| _| _| _| _| \ ]],
[[ // ___| _| _| _| _| _| _| _| _| _| _| _| | | \ ]],
[[ |/ ___| _| _| _| _| _| _| _| _| _| _| _| ______| \ ]],
[[ / __| _| _| _| _| _| _| _| _| _| _| _| _| _| ___| \ ]],
[[ / _| _| _| _| ________________________| _| _| _| _| \ ]],
[[|------"--------------------------------------"-------|]],
[[`-----------------------------------------------------']],
}
lvim.builtin.dashboard.custom_header = {
[[ _______________________________________ ]],
[[ |,---"-----------------------------"---,| ]],
[[ ||___ 16 bit.................... || ]],
[[ ||====\ :HHHHHHHHHHHHHHHHHHHHHHHHHHH || ]],
[[ ||=====):H c> lvim H || ]],
[[ ||====/ :H ╦ ╦ ╦╔╗╔╔═╗╦═╗╦ ╦╦╔╦╗ H || ]],
[[ || :H ║ ║ ║║║║╠═╣╠╦╝╚╗╔╝║║║║ H || ]],
[[ ||PORTFO:H ╩═╝╚═╝╝╚╝╩ ╩╩╚═ ╚╝ ╩╩ ╩ H || ]],
[[ || :HHHHHHHHHHHHHHHHHHHHHHHHHHH || ]],
[[ ||_____,_________________________,_____|| ]],
[[ |)_____)-----.| /I\ATARI |.------(_____(| ]],
[[ //"""""""|_____|=----------=|______|"""""""\ ]],
[[ // _| _| _| _| _| _| _| _| _| _| _| _| _| _| \ ]],
[[ // ___| _| _| _| _| _| _| _| _| _| _| _| | | \ ]],
[[ |/ ___| _| _| _| _| _| _| _| _| _| _| _| ______| \ ]],
[[ / __| _| _| _| _| _| _| _| _| _| _| _| _| _| ___| \ ]],
[[ / _| _| _| _| ________________________| _| _| _| _| \ ]],
[[|------"--------------------------------------"-------|]],
[[`-----------------------------------------------------']],
}
-- simpler header
--[[
]]--
]] --
--[[
_______________________________________

View file

@ -0,0 +1,27 @@
-- settings
local opt = vim.opt
opt.timeoutlen = 200
opt.cmdheight = 0
-- lvim specific settings
-- general
lvim.log.level = "warn"
lvim.format_on_save = false
lvim.colorscheme = "catppuccin"
-- if you don't want all the parsers change this to a table of the ones you want
lvim.builtin.treesitter.ensure_installed = {
"bash",
"javascript",
"json",
"lua",
"python",
"typescript",
"tsx",
"css",
"rust",
"yaml",
"toml"
}
lvim.builtin.treesitter.highlight.enabled = true