diff --git a/.helpers/config b/.helpers/config index 6bf2d43..458f55e 100755 --- a/.helpers/config +++ b/.helpers/config @@ -10,7 +10,7 @@ action="$1" function backup { if [ -d "${NEOVIM_CONFIG_DESTINATION_DIR}" ]; then - echo "INFO: backing up existing config..." + echo "[INFO] backing up existing config..." timestamp=$( date +"%Y.%m.%dT%H.%M.%S" ) backup_dir="${ROOT_DIR}/backup" mkdir -p ${backup_dir} @@ -28,13 +28,13 @@ function update { mkdir -p ${NEOVIM_CONFIG_DESTINATION_DIR} # Syncing the neovim configuration files - echo "INFO: syncing ${NEOVIM_CONFIG_SOURCE_DIR} to ${NEOVIM_CONFIG_DESTINATION_DIR}..." + echo "[INFO] Syncing ${NEOVIM_CONFIG_SOURCE_DIR} to ${NEOVIM_CONFIG_DESTINATION_DIR}..." rsync -avh ${NEOVIM_CONFIG_SOURCE_DIR}/ ${NEOVIM_CONFIG_DESTINATION_DIR} chmod a-rwx,u+rwx ${NEOVIM_CONFIG_DESTINATION_DIR} - # Ensuring the data directories are present - mkdir -p ${XDG_DATA_HOME}/nvim/{backup,swap,undo,view,spell} - chmod 0700 ${XDG_DATA_HOME}/nvim/{backup,swap,undo,view,spell} + # Ensuring the state directories are present + mkdir -p ${XDG_STATE_HOME}/nvim/{backup,swap,undo,view} ${XDG_STATE_HOME}/logs/nvim ${XDG_DATA_HOME}/nvim/spell + chmod 0700 ${XDG_STATE_HOME}/nvim/{backup,swap,undo,view} ${XDG_STATE_HOME}/logs/nvim ${XDG_DATA_HOME}/nvim/spell } case ${action} in diff --git a/neovim/lua/options.lua b/neovim/lua/options.lua index 9aee33b..0210047 100644 --- a/neovim/lua/options.lua +++ b/neovim/lua/options.lua @@ -1,19 +1,21 @@ local set = vim.opt local g = vim.g local cmd = vim.cmd +-- TODO: Use vim.fn.stdpath("state") when it is GA. +local state_directory = vim.env.XDG_STATE_HOME .. "/nvim" g.mapleader = "," --- Backups, Undos and Swaps +-- State files set.backup = true set.writebackup = true -set.backupdir = vim.fn.stdpath("data").."/backup" +set.backupdir = state_directory .. "/backup" set.swapfile = true -set.directory = vim.fn.stdpath("data").."/swap" +set.directory = state_directory .. "/swap" set.undofile = true -set.undodir = vim.fn.stdpath("data").."/undo" -set.viewdir = vim.fn.stdpath("data").."/view" -set.spellfile = vim.fn.stdpath("data").."/spell/en.utf-8.add" +set.undodir = state_directory .. "/undo" +set.viewdir = state_directory .. "/view" +set.spellfile = vim.fn.stdpath("data") .. "/spell/en.utf-8.add" -- Searching set.ignorecase = true -- ignore case when searching.