mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-24 16:28:22 -05:00
neovim: replace dashboard-nvim with alpha-nvim + persistence.nvim
This commit is contained in:
parent
e9cdccb8a8
commit
b9d674767b
@ -1,3 +1,4 @@
|
||||
-- TODO: add other highlight groups from nord.vim
|
||||
local M = {}
|
||||
|
||||
M.colors = {
|
||||
@ -306,7 +307,7 @@ local function highlight_plugins()
|
||||
hi('EftChar' , c.orange, '', 'bold,underline', '')
|
||||
hi('EftSubChar', c.grey3, '', 'bold,underline', '')
|
||||
|
||||
-- Dashboard
|
||||
-- dashboard-nvim / alpha-nvim
|
||||
hi('DashboardHeader' , c.cyan , '', 'bold' , '')
|
||||
hi('DashboardCenter' , c.blue , '', 'bold' , '')
|
||||
hi('DashboardShortcut', c.grey_bright, '', 'bold,italic', '')
|
||||
|
@ -68,7 +68,6 @@ function M.load_autocmds()
|
||||
},
|
||||
|
||||
ft = {
|
||||
{"FileType", "dashboard", "set showtabline=0 | autocmd WinLeave <buffer> set showtabline=2"},
|
||||
{"BufNewFile,BufRead", "*.md,*.mkd", "setfiletype markdown"},
|
||||
{"BufNewFile,BufRead", "*.toml", "setfiletype toml"},
|
||||
{"BufNewFile,BufRead", "*.rasi", "setfiletype css"},
|
||||
|
@ -129,7 +129,7 @@ wk.register({
|
||||
d = {':bdelete<CR>', 'Close buffer'},
|
||||
j = {':BufferLineCyclePrev<CR>', 'Previous buffer'},
|
||||
k = {':BufferLineCycleNext<CR>', 'Next buffer'},
|
||||
n = {':DashboardNewFile<CR>', 'New file'},
|
||||
n = {':enew <BAR> startinsert <CR>', 'New buffer'},
|
||||
u = {':UndotreeToggle<CR>', 'Undotree'},
|
||||
z = {':ZenMode<CR>', 'Zen mode'}
|
||||
},
|
||||
@ -147,6 +147,14 @@ wk.register({
|
||||
t = {':lua require("dapui").open()<CR>', 'Toggle UI'}
|
||||
},
|
||||
|
||||
e = {
|
||||
name = 'Session',
|
||||
s = {':lua require("persistence").save()<CR>', 'Save session for current directory'},
|
||||
d = {':lua require("persistence").stop()<CR>', 'Stop automatically saving'},
|
||||
l = {':lua require("persistence").load({last = true})<CR>', 'Load last session'},
|
||||
r = {':lua require("persistence").load()<CR>', 'Load session for current directory'}
|
||||
},
|
||||
|
||||
-- Telescope
|
||||
f = {
|
||||
name = 'Telescope',
|
||||
|
@ -23,6 +23,7 @@ function M.blankline_conf()
|
||||
vim.g.indent_blankline_filetype_exclude = {
|
||||
'startify',
|
||||
'dashboard',
|
||||
'alpha',
|
||||
'dotooagenda',
|
||||
'log',
|
||||
'fugitive',
|
||||
|
@ -259,4 +259,11 @@ function M.neoscroll_conf()
|
||||
require('neoscroll').setup()
|
||||
end
|
||||
|
||||
function M.session_conf()
|
||||
require('persistence').setup {
|
||||
dir = vim.fn.expand(vim.fn.stdpath('data') .. '/sessions/'),
|
||||
options = {'buffers', 'curdir', 'tabpages', 'winsize'}
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -1,35 +1,95 @@
|
||||
local M = {}
|
||||
|
||||
function M.dashboard_conf()
|
||||
-- vim.g.dashboard_disable_at_vimenter = 1
|
||||
-- vim.g.dashboard_disable_statusline = 1
|
||||
vim.g.dashboard_preview_file_height = 12
|
||||
vim.g.dashboard_preview_file_width = 80
|
||||
vim.g.dashboard_default_executive = 'telescope'
|
||||
vim.g.dashboard_session_directory = vim.fn.stdpath('data') .. '/sessions'
|
||||
vim.g.dashboard_custom_section = {
|
||||
a = {description = {' Find File SPC f f'}, command = 'DashboardFindFile'},
|
||||
b = {description = {' Recents SPC f o'}, command = 'DashboardFindHistory'},
|
||||
c = {description = {' Find Word SPC f g'}, command = 'DashboardFindWord'},
|
||||
d = {description = {'洛 New File SPC b n'}, command = 'DashboardNewFile'},
|
||||
e = {description = {' Bookmarks SPC f m'}, command = 'DashboardJumpMark'}
|
||||
local dashboard = require('alpha.themes.dashboard')
|
||||
local button = dashboard.button
|
||||
|
||||
dashboard.section.header = {
|
||||
type = 'text',
|
||||
val = {
|
||||
[[<-. (`-')_ (`-') _ (`-') _ <-. (`-') ]],
|
||||
[[ \( OO) ) ( OO).-/ .-> _(OO ) (_) \(OO )_ ]],
|
||||
[[,--./ ,--/ (,------.(`-')----. ,--.(_/,-.\ ,-(`-'),--./ ,-.)]],
|
||||
[[| \ | | | .---'( OO).-. '\ \ / (_/ | ( OO)| `.' |]],
|
||||
[[| . '| |)(| '--. ( _) | | | \ / / | | )| |'.'| |]],
|
||||
[[| |\ | | .--' \| |)| |_ \ /_)(| |_/ | | | |]],
|
||||
[[| | \ | | `---. ' '-' '\-'\ / | |'->| | | |]],
|
||||
[[`--' `--' `------' `-----' `-' `--' `--' `--']]
|
||||
},
|
||||
opts = {
|
||||
position = 'center',
|
||||
-- wrap = 'overflow',
|
||||
hl = 'DashboardHeader'
|
||||
}
|
||||
}
|
||||
vim.g.dashboard_custom_header = {
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"<-. (`-')_ (`-') _ (`-') _ <-. (`-') ",
|
||||
" \\( OO) ) ( OO).-/ .-> _(OO ) (_) \\(OO )_ ",
|
||||
",--./ ,--/ (,------.(`-')----. ,--.(_/,-.\\ ,-(`-'),--./ ,-.)",
|
||||
"| \\ | | | .---'( OO).-. '\\ \\ / (_/ | ( OO)| `.' |",
|
||||
"| . '| |)(| '--. ( _) | | | \\ / / | | )| |'.'| |",
|
||||
"| |\\ | | .--' \\| |)| |_ \\ /_)(| |_/ | | | |",
|
||||
"| | \\ | | `---. ' '-' '\\-'\\ / | |'->| | | |",
|
||||
"`--' `--' `------' `-----' `-' `--' `--' `--'",
|
||||
|
||||
dashboard.section.footer = {
|
||||
type = 'text',
|
||||
val = 'おかえりなさい',
|
||||
opts = {
|
||||
position = 'center',
|
||||
hl = 'DashboardFooter'
|
||||
}
|
||||
}
|
||||
vim.g.dashboard_custom_footer = {
|
||||
'おかえりなさい'
|
||||
|
||||
button = function(sc, txt, keybind, keybind_opts)
|
||||
local sc_ = sc:gsub('%s', ''):gsub('SPC', '<leader>')
|
||||
|
||||
local opts = {
|
||||
position = 'center',
|
||||
shortcut = sc,
|
||||
cursor = 5,
|
||||
width = 50,
|
||||
align_shortcut = 'right',
|
||||
hl = 'DashboardCenter',
|
||||
hl_shortcut = 'DashboardShortcut',
|
||||
}
|
||||
if keybind then
|
||||
keybind_opts = vim.F.if_nil(keybind_opts, {noremap = true, silent = true, nowait = true})
|
||||
opts.keymap = {'n', sc_, keybind, keybind_opts}
|
||||
end
|
||||
|
||||
local function on_press()
|
||||
local key = vim.api.nvim_replace_termcodes(sc_ .. '<Ignore>', true, false, true)
|
||||
vim.api.nvim_feedkeys(key, 'normal', false)
|
||||
end
|
||||
|
||||
return {
|
||||
type = 'button',
|
||||
val = txt,
|
||||
on_press = on_press,
|
||||
opts = opts,
|
||||
}
|
||||
end
|
||||
|
||||
dashboard.section.buttons = {
|
||||
type = 'group',
|
||||
val = {
|
||||
button('SPC b n', ' New file'),
|
||||
button('SPC f f', ' Find file'),
|
||||
button('SPC f o', ' Recent files'),
|
||||
button('SPC f g', ' Find word'),
|
||||
button('SPC f m', ' Bookmarks'),
|
||||
button('SPC e l', ' Load last session')
|
||||
},
|
||||
opts = {spacing = 1}
|
||||
}
|
||||
|
||||
require('alpha').setup {
|
||||
layout = {
|
||||
{type = 'padding', val = 4},
|
||||
dashboard.section.header,
|
||||
{type = 'padding', val = 2},
|
||||
dashboard.section.buttons,
|
||||
dashboard.section.footer
|
||||
},
|
||||
opts = {margin = 5}
|
||||
}
|
||||
|
||||
-- Hide tabline in dashboard buffer
|
||||
vim.api.nvim_command [[
|
||||
autocmd FileType alpha set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
|
||||
]]
|
||||
end
|
||||
|
||||
function M.statusline_conf()
|
||||
|
@ -25,18 +25,9 @@ return require('packer').startup(
|
||||
--------
|
||||
local ui = require('modules.ui')
|
||||
use {
|
||||
'glepnir/dashboard-nvim',
|
||||
cmd = {
|
||||
'Dashboard',
|
||||
'DashboardNewFile',
|
||||
'DashboardFindFile',
|
||||
'DashboardFindHistory',
|
||||
'DashboardFindWord',
|
||||
'DashboardJumpMark',
|
||||
'SessionLoad',
|
||||
'SessionSave'
|
||||
},
|
||||
setup = ui.dashboard_conf
|
||||
'goolord/alpha-nvim',
|
||||
event = 'VimEnter',
|
||||
config = ui.dashboard_conf
|
||||
}
|
||||
use { -- TODO: consider moving to feline.nvim
|
||||
'glepnir/galaxyline.nvim',
|
||||
@ -380,10 +371,15 @@ return require('packer').startup(
|
||||
run = ':TSInstall http',
|
||||
config = tools.rest_conf
|
||||
}
|
||||
use {
|
||||
use { -- TODO: move to formater.nvim
|
||||
'sbdchd/neoformat',
|
||||
cmd = 'Neoformat'
|
||||
}
|
||||
use {
|
||||
'folke/persistence.nvim',
|
||||
event = 'BufReadPre',
|
||||
config = tools.session_conf
|
||||
}
|
||||
use {'tweekmonster/startuptime.vim', cmd = 'StartupTime'} -- Just for benchmarking
|
||||
|
||||
-- TODO: dial.nvim, rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*, vim-pandoc
|
||||
|
Loading…
Reference in New Issue
Block a user