Skip to content

Commit

Permalink
Clean banner. Add session mgmt autocmd.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sqvid committed Jul 31, 2023
1 parent 6667e19 commit 18d97d8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
12 changes: 6 additions & 6 deletions neovim/.config/nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
--
-- ███╗░░██╗███████╗█████╗██╗░░░██╗██╗███╗░░░███╗
-- ████╗██║██╔════╝██╔══██╗██║░░░██║██║████╗████║
-- ██╔██╗██║█████╗░░██║░░██║╚██╗██╔╝██║██╔████╔██║
-- ██║╚████║██╔══╝░░██║░░██║╚████╔╝██║██║╚██╔╝██║
-- ██║╚███║███████╗╚█████╔╝░░╚██╔╝░░██║██║╚═╝██║
-- ╚═╝░░╚══╝╚══════╝╚════╝░░░░╚═╝░░░╚═╝╚═╝░░░░░╚═╝
-- ███╗ ██╗███████╗ █████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔══██╗██║ ██║██║████╗ ████║
-- ██╔██╗██║█████╗ ██║ ██║╚██╗ ██╔╝██║██╔████╔██║
-- ██║╚████║██╔══╝ ██║ ██║ ╚████╔╝ ██║██║╚██╔╝██║
-- ██║ ╚███║███████╗╚█████╔╝ ╚██╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚══╝╚══════╝ ╚════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
--

--------------------------------------------------------------------------------
Expand Down
38 changes: 38 additions & 0 deletions neovim/.config/nvim/lua/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,44 @@ autocmd("TextYankPost", {
command = [[silent! lua vim.highlight.on_yank({higroup = "IncSearch", timeout = 100})]]
})

-- Load session file if one exists in the current directory.
augroup("autoSession", {clear = true})
autocmd("VimEnter", {
group = "autoSession",
callback =
function ()
local cwd = func.getcwd()
local session = cwd .. "/Session.vim"

if func.filereadable(session) ~=0 then
vim.ui.input(
{
prompt = "Detected session file. Restore it? (y/n): "
},

function(input)
if input == "y" then
cmd("so ".. session)
vim.g.LoadedFromSession = true
end
end
)
end
end
})
autocmd("VimLeave", {
group = "autoSession",
callback =
function ()
local cwd = func.getcwd()
local session = cwd .. "/Session.vim"

if vim.g.LoadedFromSession and func.filewritable(session) ~=0 then
cmd("mksession!")
end
end
})

-- Track daily thesis progress.
augroup("thesisProgress", {clear = true})
local progressScript = "~/Documents/CourseWork/Cambridge/MPhilThesis/paper/progress.sh"
Expand Down
3 changes: 1 addition & 2 deletions neovim/.config/nvim/lua/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ opt.showmode = false
opt.laststatus = 3
opt.spelllang = "en_gb"
opt.hidden = true

opt.mouse = "nv"
-- Add OCaml indent tool to runtimepath
opt.runtimepath:prepend("~/.opam/cs3110-2023sp/share/ocp-indent/vim")

cmd("colorscheme tokyonight")

cmd("filetype plugin on")

0 comments on commit 18d97d8

Please sign in to comment.