mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-28 18:28:35 -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 = {}
|
local M = {}
|
||||||
|
|
||||||
M.colors = {
|
M.colors = {
|
||||||
@ -306,7 +307,7 @@ local function highlight_plugins()
|
|||||||
hi('EftChar' , c.orange, '', 'bold,underline', '')
|
hi('EftChar' , c.orange, '', 'bold,underline', '')
|
||||||
hi('EftSubChar', c.grey3, '', 'bold,underline', '')
|
hi('EftSubChar', c.grey3, '', 'bold,underline', '')
|
||||||
|
|
||||||
-- Dashboard
|
-- dashboard-nvim / alpha-nvim
|
||||||
hi('DashboardHeader' , c.cyan , '', 'bold' , '')
|
hi('DashboardHeader' , c.cyan , '', 'bold' , '')
|
||||||
hi('DashboardCenter' , c.blue , '', 'bold' , '')
|
hi('DashboardCenter' , c.blue , '', 'bold' , '')
|
||||||
hi('DashboardShortcut', c.grey_bright, '', 'bold,italic', '')
|
hi('DashboardShortcut', c.grey_bright, '', 'bold,italic', '')
|
||||||
|
@ -68,7 +68,6 @@ function M.load_autocmds()
|
|||||||
},
|
},
|
||||||
|
|
||||||
ft = {
|
ft = {
|
||||||
{"FileType", "dashboard", "set showtabline=0 | autocmd WinLeave <buffer> set showtabline=2"},
|
|
||||||
{"BufNewFile,BufRead", "*.md,*.mkd", "setfiletype markdown"},
|
{"BufNewFile,BufRead", "*.md,*.mkd", "setfiletype markdown"},
|
||||||
{"BufNewFile,BufRead", "*.toml", "setfiletype toml"},
|
{"BufNewFile,BufRead", "*.toml", "setfiletype toml"},
|
||||||
{"BufNewFile,BufRead", "*.rasi", "setfiletype css"},
|
{"BufNewFile,BufRead", "*.rasi", "setfiletype css"},
|
||||||
|
@ -129,7 +129,7 @@ wk.register({
|
|||||||
d = {':bdelete<CR>', 'Close buffer'},
|
d = {':bdelete<CR>', 'Close buffer'},
|
||||||
j = {':BufferLineCyclePrev<CR>', 'Previous buffer'},
|
j = {':BufferLineCyclePrev<CR>', 'Previous buffer'},
|
||||||
k = {':BufferLineCycleNext<CR>', 'Next buffer'},
|
k = {':BufferLineCycleNext<CR>', 'Next buffer'},
|
||||||
n = {':DashboardNewFile<CR>', 'New file'},
|
n = {':enew <BAR> startinsert <CR>', 'New buffer'},
|
||||||
u = {':UndotreeToggle<CR>', 'Undotree'},
|
u = {':UndotreeToggle<CR>', 'Undotree'},
|
||||||
z = {':ZenMode<CR>', 'Zen mode'}
|
z = {':ZenMode<CR>', 'Zen mode'}
|
||||||
},
|
},
|
||||||
@ -147,6 +147,14 @@ wk.register({
|
|||||||
t = {':lua require("dapui").open()<CR>', 'Toggle UI'}
|
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
|
-- Telescope
|
||||||
f = {
|
f = {
|
||||||
name = 'Telescope',
|
name = 'Telescope',
|
||||||
|
@ -23,6 +23,7 @@ function M.blankline_conf()
|
|||||||
vim.g.indent_blankline_filetype_exclude = {
|
vim.g.indent_blankline_filetype_exclude = {
|
||||||
'startify',
|
'startify',
|
||||||
'dashboard',
|
'dashboard',
|
||||||
|
'alpha',
|
||||||
'dotooagenda',
|
'dotooagenda',
|
||||||
'log',
|
'log',
|
||||||
'fugitive',
|
'fugitive',
|
||||||
|
@ -259,4 +259,11 @@ function M.neoscroll_conf()
|
|||||||
require('neoscroll').setup()
|
require('neoscroll').setup()
|
||||||
end
|
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
|
return M
|
||||||
|
@ -1,35 +1,95 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.dashboard_conf()
|
function M.dashboard_conf()
|
||||||
-- vim.g.dashboard_disable_at_vimenter = 1
|
local dashboard = require('alpha.themes.dashboard')
|
||||||
-- vim.g.dashboard_disable_statusline = 1
|
local button = dashboard.button
|
||||||
vim.g.dashboard_preview_file_height = 12
|
|
||||||
vim.g.dashboard_preview_file_width = 80
|
dashboard.section.header = {
|
||||||
vim.g.dashboard_default_executive = 'telescope'
|
type = 'text',
|
||||||
vim.g.dashboard_session_directory = vim.fn.stdpath('data') .. '/sessions'
|
val = {
|
||||||
vim.g.dashboard_custom_section = {
|
[[<-. (`-')_ (`-') _ (`-') _ <-. (`-') ]],
|
||||||
a = {description = {' Find File SPC f f'}, command = 'DashboardFindFile'},
|
[[ \( OO) ) ( OO).-/ .-> _(OO ) (_) \(OO )_ ]],
|
||||||
b = {description = {' Recents SPC f o'}, command = 'DashboardFindHistory'},
|
[[,--./ ,--/ (,------.(`-')----. ,--.(_/,-.\ ,-(`-'),--./ ,-.)]],
|
||||||
c = {description = {' Find Word SPC f g'}, command = 'DashboardFindWord'},
|
[[| \ | | | .---'( OO).-. '\ \ / (_/ | ( OO)| `.' |]],
|
||||||
d = {description = {'洛 New File SPC b n'}, command = 'DashboardNewFile'},
|
[[| . '| |)(| '--. ( _) | | | \ / / | | )| |'.'| |]],
|
||||||
e = {description = {' Bookmarks SPC f m'}, command = 'DashboardJumpMark'}
|
[[| |\ | | .--' \| |)| |_ \ /_)(| |_/ | | | |]],
|
||||||
|
[[| | \ | | `---. ' '-' '\-'\ / | |'->| | | |]],
|
||||||
|
[[`--' `--' `------' `-----' `-' `--' `--' `--']]
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
position = 'center',
|
||||||
|
-- wrap = 'overflow',
|
||||||
|
hl = 'DashboardHeader'
|
||||||
}
|
}
|
||||||
vim.g.dashboard_custom_header = {
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
"<-. (`-')_ (`-') _ (`-') _ <-. (`-') ",
|
|
||||||
" \\( OO) ) ( OO).-/ .-> _(OO ) (_) \\(OO )_ ",
|
|
||||||
",--./ ,--/ (,------.(`-')----. ,--.(_/,-.\\ ,-(`-'),--./ ,-.)",
|
|
||||||
"| \\ | | | .---'( OO).-. '\\ \\ / (_/ | ( OO)| `.' |",
|
|
||||||
"| . '| |)(| '--. ( _) | | | \\ / / | | )| |'.'| |",
|
|
||||||
"| |\\ | | .--' \\| |)| |_ \\ /_)(| |_/ | | | |",
|
|
||||||
"| | \\ | | `---. ' '-' '\\-'\\ / | |'->| | | |",
|
|
||||||
"`--' `--' `------' `-----' `-' `--' `--' `--'",
|
|
||||||
}
|
}
|
||||||
vim.g.dashboard_custom_footer = {
|
|
||||||
'おかえりなさい'
|
dashboard.section.footer = {
|
||||||
|
type = 'text',
|
||||||
|
val = 'おかえりなさい',
|
||||||
|
opts = {
|
||||||
|
position = 'center',
|
||||||
|
hl = 'DashboardFooter'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
end
|
||||||
|
|
||||||
function M.statusline_conf()
|
function M.statusline_conf()
|
||||||
|
@ -25,18 +25,9 @@ return require('packer').startup(
|
|||||||
--------
|
--------
|
||||||
local ui = require('modules.ui')
|
local ui = require('modules.ui')
|
||||||
use {
|
use {
|
||||||
'glepnir/dashboard-nvim',
|
'goolord/alpha-nvim',
|
||||||
cmd = {
|
event = 'VimEnter',
|
||||||
'Dashboard',
|
config = ui.dashboard_conf
|
||||||
'DashboardNewFile',
|
|
||||||
'DashboardFindFile',
|
|
||||||
'DashboardFindHistory',
|
|
||||||
'DashboardFindWord',
|
|
||||||
'DashboardJumpMark',
|
|
||||||
'SessionLoad',
|
|
||||||
'SessionSave'
|
|
||||||
},
|
|
||||||
setup = ui.dashboard_conf
|
|
||||||
}
|
}
|
||||||
use { -- TODO: consider moving to feline.nvim
|
use { -- TODO: consider moving to feline.nvim
|
||||||
'glepnir/galaxyline.nvim',
|
'glepnir/galaxyline.nvim',
|
||||||
@ -380,10 +371,15 @@ return require('packer').startup(
|
|||||||
run = ':TSInstall http',
|
run = ':TSInstall http',
|
||||||
config = tools.rest_conf
|
config = tools.rest_conf
|
||||||
}
|
}
|
||||||
use {
|
use { -- TODO: move to formater.nvim
|
||||||
'sbdchd/neoformat',
|
'sbdchd/neoformat',
|
||||||
cmd = 'Neoformat'
|
cmd = 'Neoformat'
|
||||||
}
|
}
|
||||||
|
use {
|
||||||
|
'folke/persistence.nvim',
|
||||||
|
event = 'BufReadPre',
|
||||||
|
config = tools.session_conf
|
||||||
|
}
|
||||||
use {'tweekmonster/startuptime.vim', cmd = 'StartupTime'} -- Just for benchmarking
|
use {'tweekmonster/startuptime.vim', cmd = 'StartupTime'} -- Just for benchmarking
|
||||||
|
|
||||||
-- TODO: dial.nvim, rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*, vim-pandoc
|
-- TODO: dial.nvim, rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*, vim-pandoc
|
||||||
|
Loading…
Reference in New Issue
Block a user