Commands for injecting date and/or time into current buffer
This repository requires the [Vim][vim_home] text editor to be installed the source code is available on GitHub -- vim/vim, and most GNU Linux package managers are able to install Vim directly, eg...
- Arch based Operating Systems
sudo packman -Syy
sudo packman -S vim- Debian derived Distributions
sudo apt-get update
sudo apt-get install vimThis repository is a Vim plugin and can be installed via a number of methods.
-
mkdir -p ~/git/hub/vim-utilities cd ~/git/hub/vim-utilities/date-time git clone [email protected]:vim-utilities/date-time.git make install
-
~/.vimrc(snip)call plug#begin('~/.vim/plugged') " ... Plug 'vim-utilities/date-time' " ... call plug#end()
After adding above
Plugline to your Vim configuration file, run the followingPlugInstallEx mode command within a Vim session:PlugInstall date-time -
~/.vimrc(snip)call vundle#begin('~/.vim/plugged') " ... Plugin 'vim-utilities/date-time' " ... call vundle#end()
After adding above
Pluginline to your Vim configuration file, run the followingPluginInstallEx mode command within a Vim session:PluginInstall
After installation use help to review configuration, and usage, details, eg.
:help date-time.txt
" Jump to specific sections
:help date-time-ex-commands
:help date-time-normal-map
:help date-time-visual-map
:help date-time-configuration
:help date-time-notesAlternatively plugin documentation maybe reviewed within
doc/date-time.txt file.
By default the <Leader>R sequence in Visual select mode will Replace any
date/time format strings.
Consider the following template time-sheet CSV;
date,start,stop,description
%F,%R,%R,DESCRIPTION
... which can be quickly modified via the following sequence of steps;
-
Normal mode
Gnormal mode we can jump to the end of the bufferyyto yank the whole lineggto jump to the top of the bufferPto put/past before cursor positionvto enter Visual select mode
-
Visual mode
t,;selecttill comma (,) and;to repeat once<Leader>R- selected
%F,%Rtext will be replaced viastrftimebuilt-in function
Note; mode will automatically switch to Normal
Example result
date,start,stop,description
2023-03-18,14:04,%R,DESCRIPTION
%F,%R,%R,DESCRIPTION
By default Normal mode <Leader>t (or T), and <Leader>d (or D), motions
will append or insert the current time or date respectively.
Tip; this can be useful in combination with Ctrl^o from Insert mode to avoid breaking one's flow of thought.
Consider the following text;
I will see you later today (
... which may have current date appended via the following sequence of steps;
-
Insert mode
- Ctrl^o
-
(insert)/Normal mode
<Leader>d
-
Insert mode
) to discuss something
Example result
I will see you later today (2023-03-18) to discuss something
This repository may not be feature complete and/or fully functional, Pull Requests that add features or fix bugs are certainly welcomed.
Options for contributing to date-time and vim-utilities
Start making a Fork of this repository to an account that you have write permissions for.
- Add remote for fork URL. The URL syntax is
[email protected]:<NAME>/<REPO>.git...
cd ~/git/hub/vim-utilities/date-time
git remote add fork [email protected]:<NAME>/date-time.git- Commit your changes and push to your fork, eg. to fix an issue...
cd ~/git/hub/vim-utilities/date-time
git commit -F- <<'EOF'
:bug: Fixes #42 Issue
**Edits**
- `<SCRIPT-NAME>` script, fixes some bug reported in issue
EOF
git push fork mainNote, the
-uoption may be used to setforkas the default remote, eg.git push -u fork mainhowever, this will also default theforkremote for pulling from too! Meaning that pulling updates fromoriginmust be done explicitly, eg.git pull origin main
- Then on GitHub submit a Pull Request through the Web-UI, the URL syntax is
https://github.com/<NAME>/<REPO>/pull/new/<BRANCH>
Note; to decrease the chances of your Pull Request needing modifications before being accepted, please check the dot-github repository for detailed contributing guidelines.
Thanks for even considering it!
Via Liberapay you may [![sponsor__shields_io__liberapay]][sponsor__link__liberapay] on a repeating basis.
Regardless of if you're able to financially support projects such as date-time that vim-utilities maintains, please consider sharing projects that are useful with others, because one of the goals of maintaining Open Source repositories is to provide value to the community.
Commands for injecting date and/or time into current buffer
Copyright (C) 2023 S0AndS0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For further details review full length version of AGPL-3.0 License.