From 2ec7420c2b1218c4c59746338eeff5deaa3b9f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20R=C3=B3=C5=BCewski?= Date: Tue, 13 Feb 2024 02:11:21 +0100 Subject: [PATCH] style: Follow the Vim script Style Guide by Google Streamlined the Neovim setup by segregating configuration scripts into logically organized plugin files for easier management and maintenance. Enhanced the autoload functionality for improved startup times and clarified function namespacing. Extended EditorConfig to apply consistent coding styles to Vim script files. Additionally, refined the custom Neovim color theme and corrected a typo in the test functions comment. This restructure facilitates a more intuitive development environment and promotes best practices for future customizations. --- .editorconfig | 2 +- config/nvim/autoload/mdsanima.vim | 8 ++++---- config/nvim/colors/mdsanima.vim | 12 ++++++------ config/nvim/init.vim | 12 ++---------- config/nvim/plugin/autocmds.vim | 8 ++++++++ config/nvim/plugin/commands.vim | 4 ++++ config/nvim/{keymaps.vim => plugin/mappings.vim} | 5 ++--- config/nvim/{settings.vim => plugin/mdsanima.vim} | 7 +++---- 8 files changed, 30 insertions(+), 28 deletions(-) create mode 100644 config/nvim/plugin/autocmds.vim create mode 100644 config/nvim/plugin/commands.vim rename config/nvim/{keymaps.vim => plugin/mappings.vim} (66%) rename config/nvim/{settings.vim => plugin/mdsanima.vim} (93%) diff --git a/.editorconfig b/.editorconfig index 8e47829..4ba9563 100644 --- a/.editorconfig +++ b/.editorconfig @@ -25,7 +25,7 @@ max_line_length = 115 [*.py] profile = black -[*.{sh,bash,zsh}] +[*.{sh,bash,zsh,vim}] indent_size = 2 max_line_length = 80 diff --git a/config/nvim/autoload/mdsanima.vim b/config/nvim/autoload/mdsanima.vim index 4dc734b..42c73bd 100644 --- a/config/nvim/autoload/mdsanima.vim +++ b/config/nvim/autoload/mdsanima.vim @@ -1,11 +1,11 @@ " Copyright (c) 2024 MDSANIMA DEV. All rights reserved. " Licensed under the MIT license. -" This file sets up the mdsanima functions for the Neovim. -" Should be called by a specific function name. +" Autoloaded functions. Autoloading allows functions to be loaded on +" demand, which makes startuptime faster and enforces function namespacing. -" Tesging function +" Testing function mdsanima#hello() - echo "Hello World" + echo 'Hello World' endfunction diff --git a/config/nvim/colors/mdsanima.vim b/config/nvim/colors/mdsanima.vim index f705f10..c5287e5 100644 --- a/config/nvim/colors/mdsanima.vim +++ b/config/nvim/colors/mdsanima.vim @@ -1,17 +1,17 @@ " Copyright (c) 2024 MDSANIMA DEV. All rights reserved. " Licensed under the MIT license. -" This is a color file for custom theme in Neovim. -" Based on the default `pablo` vim color file. +" Custom `mdsanima` color theme. Based on the default `pablo` vim color file. +" Run this command `vim -c 'edit $VIMRUNTIME/colors/pablo.vim'` for help. -" Basic +" Setup hi clear set notermguicolors set background=dark -let g:colors_name = "mdsanima" +let g:colors_name = 'mdsanima' -" Colors +" Default hi Boolean cterm=none ctermfg=202 ctermbg=none hi Comment cterm=none ctermfg=8 ctermbg=none hi Constant cterm=none ctermfg=222 ctermbg=none @@ -31,7 +31,7 @@ hi StatusLine cterm=bold ctermfg=16 ctermbg=12 hi Todo cterm=bold ctermfg=15 ctermbg=3 hi Type cterm=none ctermfg=36 ctermbg=none -" Commits +" Commit hi diffRemoved cterm=none ctermfg=196 ctermbg=none hi diffAdded cterm=none ctermfg=76 ctermbg=none hi diffChanged cterm=none ctermfg=202 ctermbg=none diff --git a/config/nvim/init.vim b/config/nvim/init.vim index 1322969..b8c20cb 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -1,16 +1,8 @@ " Copyright (c) 2024 MDSANIMA DEV. All rights reserved. " Licensed under the MIT license. -" This is a initial configuration script for Neovim. -" Repository: https://github.com/neovim/neovim/ +" Initial configuration for Neovim. Other configs will be loaded automatically. -" Base initial setup +" Load color theme colorscheme mdsanima - -" Load configurations sources -source $HOME/.config/nvim/settings.vim -source $HOME/.config/nvim/keymaps.vim - -" Back to default terminal cursor style -autocmd VimLeave * set guicursor=a:ver1-blinkon1 diff --git a/config/nvim/plugin/autocmds.vim b/config/nvim/plugin/autocmds.vim new file mode 100644 index 0000000..7e8de4d --- /dev/null +++ b/config/nvim/plugin/autocmds.vim @@ -0,0 +1,8 @@ +" Copyright (c) 2024 MDSANIMA DEV. All rights reserved. +" Licensed under the MIT license. + +" General autocommands. + + +" Back to default terminal cursor style +autocmd VimLeave * set guicursor=a:ver1-blinkon1 diff --git a/config/nvim/plugin/commands.vim b/config/nvim/plugin/commands.vim new file mode 100644 index 0000000..42014ed --- /dev/null +++ b/config/nvim/plugin/commands.vim @@ -0,0 +1,4 @@ +" Copyright (c) 2024 MDSANIMA DEV. All rights reserved. +" Licensed under the MIT license. + +" General commands. diff --git a/config/nvim/keymaps.vim b/config/nvim/plugin/mappings.vim similarity index 66% rename from config/nvim/keymaps.vim rename to config/nvim/plugin/mappings.vim index bbf01c7..39c21d6 100644 --- a/config/nvim/keymaps.vim +++ b/config/nvim/plugin/mappings.vim @@ -1,10 +1,9 @@ " Copyright (c) 2024 MDSANIMA DEV. All rights reserved. " Licensed under the MIT license. -" This file sets up the keymaps for Neovim. -" Should be sourced in the `init.vim` file. +" Key mappings. -" Keymaps +" General map :w " CTRL+S to Save file map :q " CTRL+Q to Quit file diff --git a/config/nvim/settings.vim b/config/nvim/plugin/mdsanima.vim similarity index 93% rename from config/nvim/settings.vim rename to config/nvim/plugin/mdsanima.vim index f819e42..c1d8d45 100644 --- a/config/nvim/settings.vim +++ b/config/nvim/plugin/mdsanima.vim @@ -1,11 +1,10 @@ " Copyright (c) 2024 MDSANIMA DEV. All rights reserved. " Licensed under the MIT license. -" This file sets up the settings for Neovim. -" Shuld be sourced in the `init.vim` file. +" Custom `mdsanima` configuration setting options. -" Settings +" Setting set autoindent " Indent from last line set autoread " Read file on change set backup " Make backups files @@ -35,7 +34,7 @@ set tabstop=4 " Ident spaces set undofile " Persistent undo set writebackup " Make backups files -" Directories +" File set backupdir=$HOME/.cache/nvim/backup// set directory=$HOME/.cache/nvim/swap// set undodir=$HOME/.cache/nvim/undo//