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 vim
This 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
Plug
line to your Vim configuration file, run the followingPlugInstall
Ex 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
Plugin
line to your Vim configuration file, run the followingPluginInstall
Ex 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-notes
Alternatively plugin documentation maybe reviewed within
doc/date-time.txt
file.
By default the <Leader>R
sequence in Visual select mode will R
eplace 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
G
normal mode we can jump to the end of the bufferyy
to yank the whole linegg
to jump to the top of the bufferP
to put/past before cursor positionv
to enter Visual select mode
-
Visual mode
t,;
selectt
ill comma (,
) and;
to repeat once<Leader>R
- selected
%F,%R
text will be replaced viastrftime
built-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 main
Note, the
-u
option may be used to setfork
as the default remote, eg.git push -u fork main
however, this will also default thefork
remote for pulling from too! Meaning that pulling updates fromorigin
must 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.