Are you ready for <F2> or :FT in vim?
This commit is contained in:
96
README.md
96
README.md
@@ -8,36 +8,96 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### **UNIX Setup**
|
|
||||||
|
|
||||||
Add in `~/.zshrc` your:
|
|
||||||
|
|
||||||
+ `USER`
|
|
||||||
+ `MAIL`
|
|
||||||
|
|
||||||
Copy `stdheader.vim` in your `~/.vim/plugin`.
|
|
||||||
|
|
||||||
### **Usage**
|
### **Usage**
|
||||||
|
|
||||||
In **NORMAL** mode you can use `:FT` or simply press the shortcut <kbd>F2</kbd>.
|
In **NORMAL** mode you can use `:FT` (<ESC> :FT) or simply press the shortcut <kbd>F2</kbd> (or <FN> <F2>).
|
||||||
|
|
||||||
Under **Linux** you eventually need to disable the **help** shortcut of your **terminal** :
|
```
|
||||||
|
vim 42.c
|
||||||
|
<ESC> <F2>
|
||||||
|
<ESC> :wq
|
||||||
|
|
||||||
|
vim Makefile
|
||||||
|
<ESC> :FT
|
||||||
|
<ESC> :wq
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Quick Setup**
|
||||||
|
|
||||||
|
Below replace "marvin" with your 42 Network login.
|
||||||
|
|
||||||
|
```
|
||||||
|
export USER="marvin"
|
||||||
|
export MAIL="marvin@student.42lausanne.ch"
|
||||||
|
|
||||||
|
./set_header.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
In all your git repositories:
|
||||||
|
```
|
||||||
|
git clone git@... project
|
||||||
|
cd project
|
||||||
|
git config user.name "marvin"
|
||||||
|
git config user.email "marvin@student.42lausanne.ch"
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Manual Setup**
|
||||||
|
|
||||||
|
Below replace "marvin" with your 42 Network login.
|
||||||
|
|
||||||
|
Copy `stdheader.vim` in your `~/.vim/plugin`.
|
||||||
|
```
|
||||||
|
test -d ~/.vim/plugin || mkdir -p ~/.vim/plugin
|
||||||
|
cp -va vim/stdheader.vim ~/.vim/plugin
|
||||||
|
```
|
||||||
|
|
||||||
|
In all your git repositories:
|
||||||
|
```
|
||||||
|
git clone git@... project
|
||||||
|
cd project
|
||||||
|
git config user.name "marvin"
|
||||||
|
git config user.email "marvin@student.42lausanne.ch"
|
||||||
|
```
|
||||||
|
|
||||||
|
UNIX/BSD Distro (MacOS X, FreeBSD, OpenBSD, etc.)
|
||||||
|
Add in `~/.zshrc` your:
|
||||||
|
```
|
||||||
|
vim ~/.zshrc
|
||||||
|
export USER="marvin"
|
||||||
|
export MAIL="marvin@student.42lausanne.ch"
|
||||||
|
<ESC> :wq
|
||||||
|
source ~/.zshrc
|
||||||
|
```
|
||||||
|
|
||||||
|
Linux/GNU Distro (Debian/Ubuntu, RedHat/SuSE, Arch, Gentoo, etc.)
|
||||||
|
Add in `~/.bashrc` your:
|
||||||
|
```
|
||||||
|
vim ~/.bashrc
|
||||||
|
export USER="marvin"
|
||||||
|
export MAIL="marvin@student.42lausanne.ch"
|
||||||
|
<ESC> :wq
|
||||||
|
. ~/.bashrc
|
||||||
|
```
|
||||||
|
|
||||||
### **Note**
|
### **Note**
|
||||||
|
|
||||||
Inside the **42 clusters** you can easily run:
|
Your git username and email will always have the priority to $USER and $MAIL variable
|
||||||
|
if you are outside a git tree and $USER and $MAIL are not defined it will use the
|
||||||
|
default marvin@student.42lausanne.ch as email and marvin as login for your header.
|
||||||
|
|
||||||
`$ ./set_header.sh`
|
The location of this alternative version of stdheader.vim:
|
||||||
|
- ~/.vim/plugin/stdheader.vim
|
||||||
|
- $HOME/.vim/plugin/stdheader.vim
|
||||||
|
|
||||||
The location of stdheader.vim in 42lausanne's clusters:
|
The location of the official stdheader.vim in 42lausanne's clusters:
|
||||||
- /usr/share/vim/vim82/plugin/stdheader.vim
|
|
||||||
- /usr/share/vim/vim81/plugin/stdheader.vim
|
|
||||||
- /usr/share/vim/vim80/plugin/stdheader.vim
|
- /usr/share/vim/vim80/plugin/stdheader.vim
|
||||||
|
- /usr/share/vim/vim81/plugin/stdheader.vim (at the time of writing)
|
||||||
|
- /usr/share/vim/vim82/plugin/stdheader.vim
|
||||||
|
|
||||||
### **Credits**
|
### **Credits**
|
||||||
|
|
||||||
[@42Paris](https://github.com/42Paris)
|
- [@42Paris](https://github.com/42Paris)
|
||||||
[@zazard](https://github.com/zazard)
|
- [@zazard](https://github.com/zazard)
|
||||||
|
|
||||||
### **License**
|
### **License**
|
||||||
|
|
||||||
|
|||||||
BIN
img/42header.png
BIN
img/42header.png
Binary file not shown.
|
Before Width: | Height: | Size: 876 KiB After Width: | Height: | Size: 1.4 MiB |
@@ -5,12 +5,7 @@
|
|||||||
|
|
||||||
if [ ! -z "$USER" ]
|
if [ ! -z "$USER" ]
|
||||||
then
|
then
|
||||||
echo 'export USER=`/usr/bin/whoami`' >> ~/.zshrc
|
echo 'export USER=`whoami`' >> ~/.zshrc
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z "$GROUP" ]
|
|
||||||
then
|
|
||||||
echo 'export GROUP=`/usr/bin/id -gn ${USER}`' >> ~/.zshrc
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$MAIL" ]
|
if [ ! -z "$MAIL" ]
|
||||||
|
|||||||
Reference in New Issue
Block a user