Skip to content

Commit

Permalink
style: Follow the Vim script Style Guide by Google
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mdsanima committed Feb 13, 2024
1 parent 64ff255 commit 2ec7420
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions config/nvim/autoload/mdsanima.vim
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions config/nvim/colors/mdsanima.vim
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
12 changes: 2 additions & 10 deletions config/nvim/init.vim
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions config/nvim/plugin/autocmds.vim
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions config/nvim/plugin/commands.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
" Copyright (c) 2024 MDSANIMA DEV. All rights reserved.
" Licensed under the MIT license.

" General commands.
5 changes: 2 additions & 3 deletions config/nvim/keymaps.vim → config/nvim/plugin/mappings.vim
Original file line number Diff line number Diff line change
@@ -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 <C-S> :w<CR> " CTRL+S to Save file
map <C-Q> :q<CR> " CTRL+Q to Quit file
7 changes: 3 additions & 4 deletions config/nvim/settings.vim → config/nvim/plugin/mdsanima.vim
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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//
Expand Down

0 comments on commit 2ec7420

Please sign in to comment.