Add user42 and mail42 support thanks to @xbeheydt
This commit is contained in:
27
README.md
27
README.md
@@ -31,8 +31,8 @@ USER="marvin" ./set_header.sh
|
|||||||
|
|
||||||
If you want to setup the same email and username for all your git:
|
If you want to setup the same email and username for all your git:
|
||||||
```
|
```
|
||||||
git config --global user.name gbaconni
|
git config --global user.name marvin
|
||||||
git config --global user.email gbaconni@student.42lausanne.ch
|
git config --global user.email marvin@student.42lausanne.ch
|
||||||
```
|
```
|
||||||
|
|
||||||
Otherwise setup it on a case-by-case basic:
|
Otherwise setup it on a case-by-case basic:
|
||||||
@@ -43,6 +43,14 @@ git config user.name "marvin"
|
|||||||
git config user.email "marvin@student.42lausanne.ch"
|
git config user.email "marvin@student.42lausanne.ch"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For non git-based folder, set user and mail values directly in your vimrc
|
||||||
|
```vim
|
||||||
|
vim ~/.vimrc
|
||||||
|
let g:user42 = 'marvin'
|
||||||
|
let g:mail42 = 'marvin@student.42lausanne.ch'
|
||||||
|
```
|
||||||
|
<kbd>ESC</kbd> `:wq`
|
||||||
|
|
||||||
### **Manual Setup**
|
### **Manual Setup**
|
||||||
|
|
||||||
Below replace "marvin" with your 42 Network login.
|
Below replace "marvin" with your 42 Network login.
|
||||||
@@ -55,8 +63,8 @@ cp -va vim/stdheader.vim ~/.vim/plugin
|
|||||||
|
|
||||||
If you want to setup the same email and username for all your git:
|
If you want to setup the same email and username for all your git:
|
||||||
```
|
```
|
||||||
git config --global user.name gbaconni
|
git config --global user.name marvin
|
||||||
git config --global user.email gbaconni@student.42lausanne.ch
|
git config --global user.email marvin@student.42lausanne.ch
|
||||||
```
|
```
|
||||||
|
|
||||||
Otherwise setup it on a case-by-case basic:
|
Otherwise setup it on a case-by-case basic:
|
||||||
@@ -87,7 +95,7 @@ source ~/.bashrc
|
|||||||
|
|
||||||
- Your git username and email will always have the priority over $USER and $MAIL variables.
|
- Your git username and email will always have the priority over $USER and $MAIL variables.
|
||||||
- If you are outside a git repo tree, it will use the $USER and $MAIL environement variables.
|
- If you are outside a git repo tree, it will use the $USER and $MAIL environement variables.
|
||||||
- I none of the above, it will default to marvin@student.42lausanne.ch and marvin as username.
|
- If none of the above, it will default to marvin@student.42lausanne.ch and marvin as username.
|
||||||
- Usually you don't want to overwrite $USER as is the logged user and is already defined.
|
- Usually you don't want to overwrite $USER as is the logged user and is already defined.
|
||||||
|
|
||||||
Troubleshooting:
|
Troubleshooting:
|
||||||
@@ -112,9 +120,18 @@ The location of the official stdheader.vim in 42lausanne's clusters:
|
|||||||
|
|
||||||
- [@42Paris](https://github.com/42Paris)
|
- [@42Paris](https://github.com/42Paris)
|
||||||
- [@zazard](https://github.com/zazard)
|
- [@zazard](https://github.com/zazard)
|
||||||
|
- [@xbeheydt](https://github.com/xbeheydt)
|
||||||
|
|
||||||
### **Bonus**
|
### **Bonus**
|
||||||
|
|
||||||
|
- 42 Vim Headerguard [42-vim-headerguard](https://github.com/xbeheydt/42-vim-headerguard)
|
||||||
|
```
|
||||||
|
test -d ~/.vim/plugin || mkdir -p ~/.vim/plugin
|
||||||
|
git clone https://github.com/xbeheydt/42-vim-headerguard.git 42-vim-headerguard
|
||||||
|
cd 42-vim-headerguard
|
||||||
|
cp -va plugin/* ~/.vim/plugin/
|
||||||
|
```
|
||||||
|
|
||||||
- Swissair is gone? Have a look to [Airline](https://github.com/vim-airline/vim-airline) for a nice status for vim.
|
- Swissair is gone? Have a look to [Airline](https://github.com/vim-airline/vim-airline) for a nice status for vim.
|
||||||
```
|
```
|
||||||
test -d ~/.vim/plugin || mkdir -p ~/.vim/plugin
|
test -d ~/.vim/plugin || mkdir -p ~/.vim/plugin
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
" By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ "
|
" By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ "
|
||||||
" +#+#+#+#+#+ +#+ "
|
" +#+#+#+#+#+ +#+ "
|
||||||
" Created: 2013/06/15 12:45:56 by zaz #+# #+# "
|
" Created: 2013/06/15 12:45:56 by zaz #+# #+# "
|
||||||
" Updated: 2021/10/28 13:12:49 by gbaconni ### lausanne.ch "
|
" Updated: 2021/11/06 14:55:57 by gbaconni ### lausanne.ch "
|
||||||
" "
|
" "
|
||||||
" **************************************************************************** "
|
" **************************************************************************** "
|
||||||
|
|
||||||
@@ -64,6 +64,8 @@ function s:trimlogin ()
|
|||||||
let l:login = systemlist('git config user.name')
|
let l:login = systemlist('git config user.name')
|
||||||
if v:shell_error == 0 && len(l:login) > 0
|
if v:shell_error == 0 && len(l:login) > 0
|
||||||
let l:trimlogin = strpart(l:login[0], 0, 9)
|
let l:trimlogin = strpart(l:login[0], 0, 9)
|
||||||
|
elseif exists('g:user42')
|
||||||
|
let l:trimlogin = strpart(g:user42, 0, 9)
|
||||||
elseif exists("$USER")
|
elseif exists("$USER")
|
||||||
let l:trimlogin = strpart($USER, 0, 9)
|
let l:trimlogin = strpart($USER, 0, 9)
|
||||||
else
|
else
|
||||||
@@ -76,6 +78,8 @@ function s:trimemail ()
|
|||||||
let l:email = systemlist('git config user.email')
|
let l:email = systemlist('git config user.email')
|
||||||
if v:shell_error == 0 && len(l:email) > 0
|
if v:shell_error == 0 && len(l:email) > 0
|
||||||
let l:trimemail = strpart(l:email[0], 0, s:contentlen - 5)
|
let l:trimemail = strpart(l:email[0], 0, s:contentlen - 5)
|
||||||
|
elseif exists('g:mail42')
|
||||||
|
let l:trimemail = strpart(g:mail42, 0, s:contentlen - 5)
|
||||||
elseif exists("$MAIL")
|
elseif exists("$MAIL")
|
||||||
let l:trimemail = strpart($MAIL, 0, s:contentlen - 5)
|
let l:trimemail = strpart($MAIL, 0, s:contentlen - 5)
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user