From 10266e1e64942e1360168abfc29788c9f080f8e2 Mon Sep 17 00:00:00 2001 From: Dan Anglin Date: Sat, 29 Jun 2024 09:44:04 +0100 Subject: [PATCH] docs: update documentation --- .helpers/config | 38 ++++++++++++++++----------- Makefile | 6 ++--- README.asciidoc | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 3 --- 4 files changed, 94 insertions(+), 21 deletions(-) create mode 100644 README.asciidoc delete mode 100644 README.md diff --git a/.helpers/config b/.helpers/config index 89a4cbb..72afd2c 100755 --- a/.helpers/config +++ b/.helpers/config @@ -1,10 +1,18 @@ #!/usr/bin/env bash -set -euo pipefail +set -o errexit +set -o nounset +set -o pipefail + +CONFIG_ROOT="${XDG_CONFIG_HOME:-null}" + +if [[ "${CONFIG_ROOT}" == "null" ]]; then + CONFIG_ROOT="${HOME}/.config" +fi ROOT_DIR="$( cd "$( dirname $0 )/.." && pwd )" NEOVIM_CONFIG_SOURCE_DIR="${ROOT_DIR}/nvim" -NEOVIM_CONFIG_DESTINATION_DIR="${XDG_CONFIG_HOME}/nvim" +NEOVIM_CONFIG_DESTINATION_DIR="${CONFIG_ROOT}/nvim" VERSION="$( git describe --tags | tr -d '\n' )" PROJECT_NAME="nvim.d" CODEFLOW_GROUP="linux-home" @@ -14,26 +22,26 @@ action="$1" function backup { if [ -d "${NEOVIM_CONFIG_DESTINATION_DIR}" ]; then echo "[INFO] backing up existing config..." - timestamp=$( date +"%Y.%m.%dT%H.%M.%S" ) - backup_dir="${ROOT_DIR}/backup" - mkdir -p ${backup_dir} - cd ${NEOVIM_CONFIG_DESTINATION_DIR} - tar czf "${backup_dir}/neovim-config-${timestamp}.tar.gz" . + TIMESTAMP=$( date +"%Y.%m.%dT%H.%M.%S" ) + BACKUP_DIR="${ROOT_DIR}/backup" + mkdir -p "${BACKUP_DIR}" + cd "${NEOVIM_CONFIG_DESTINATION_DIR}" + tar czf "${BACKUP_DIR}/neovim-config-${TIMESTAMP}.tar.gz" . fi } function clean { - rm -f ${NEOVIM_CONFIG_DESTINATION_DIR}/init.lua - find ${NEOVIM_CONFIG_DESTINATION_DIR} -maxdepth 1 -mindepth 1 -type d -not -iwholename "*/plugin" | xargs rm -rf + rm -f "${NEOVIM_CONFIG_DESTINATION_DIR}/init.lua" + find "${NEOVIM_CONFIG_DESTINATION_DIR}" -maxdepth 1 -mindepth 1 -type d -not -iwholename "*/plugin" | xargs rm -rf } -function update { - mkdir -p ${NEOVIM_CONFIG_DESTINATION_DIR} +function install { + mkdir -p "${NEOVIM_CONFIG_DESTINATION_DIR}" # Syncing the neovim configuration files 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} + rsync -avh "${NEOVIM_CONFIG_SOURCE_DIR}/" "${NEOVIM_CONFIG_DESTINATION_DIR}" + chmod a-rwx,u+rwx "${NEOVIM_CONFIG_DESTINATION_DIR}" # 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 @@ -64,8 +72,8 @@ case ${action} in clean) clean ;; - update) - update + install) + install ;; package) package diff --git a/Makefile b/Makefile index eaaa24b..4a07174 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ -.PHONY: backup clean update install_lazy package publish +.PHONY: backup clean install install_lazy package publish backup: @bash ./.helpers/config backup -update: - @bash ./.helpers/config update +install: + @bash ./.helpers/config install clean: backup @bash ./.helpers/config clean diff --git a/README.asciidoc b/README.asciidoc new file mode 100644 index 0000000..8d0d79e --- /dev/null +++ b/README.asciidoc @@ -0,0 +1,68 @@ += nvim.d + +My neovim configuration for neovim version 0.10.0+. + +== Dependencies + +== Installation + +1. Clone the repository or download the latest package from the release page. + +2. If you have existing neovim configuration you can take a backup of it. + Run the command below to create a timestamped tar archive of your existing config. + + make backup + +3. Install the config to your `XDG_CONIFIG_HOME` directory (default is ~/.config). + + make install + +4. Install the lazy package manager. + + make install_lazy + +5. Launch neovim. + At first launch the lazy package manager will proceed to install all the specified plugins. + +== Plugins + +[%header,cols=3*] +|=== +|Name +|Purpose +|Link to source + +|folke/lazy.nvim +|Manages all other neovim plugins. +|https://github.com/folke/lazy.nvim + +|folke/tokyonight.nvim +|Sets the Tokyonight colour scheme for neovim. +|https://github.com/folke/tokyonight.nvim + +|neovim/nvim-lspconfig +|Makes configuring LSP settings in neovim much easier. +|https://github.com/neovim/nvim-lspconfig + +|nvim-treesitter/nvim-treesitter +|An interface for treesitter to provide better highlighting among other functionalities. +|https://github.com/nvim-treesitter/nvim-treesitter + +|akinsho/bufferline.nvim +|For visualising buffers and easy navigation between them. +|https://github.com/akinsho/bufferline.nvim + +|nvim-tree/nvim-web-devicons +|Provides icons that are used in other plugins. +|https://github.com/nvim-tree/nvim-web-devicons + +|is0n/tui-nvim +|Allows you to open terminal programs in neovim. Currently used to integration the LF file manager within neovim. +|https://github.com/is0n/tui-nvim + +|mfussenegger/nvim-lint +|An asynchronous linter plugin complementary to the LSP client. Used for external linters such as golangci-lint and pyls. +|https://github.com/mfussenegger/nvim-lint +|=== + +== Key mappings diff --git a/README.md b/README.md deleted file mode 100644 index 4097efa..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# neovim-config - -Neovim configuration for neovim version 0.8.2+.