modifs de l'installation automatique et ajouts configs files autofill cpp
This commit is contained in:
48
tutos/git.txt
Normal file
48
tutos/git.txt
Normal file
@@ -0,0 +1,48 @@
|
||||
**git init** creates a new git repository"
|
||||
**git status** inspects the contents of the working directory and staging area
|
||||
**git add** adds files from the working directory to the staging area
|
||||
**git add -a** . the -a ensures even file deletions are included
|
||||
**git reset <filename>** to remove a file or files from the staging area
|
||||
**git diff** shows the difference between the working directory and the staging area
|
||||
**git commit** permanently stores file changes from the staging area in the repository
|
||||
**git remote add origin https://github.com/nomutilisateur/monprojet** origin indicate a new place where files will be stored, remote describe origin and indicate that origin is distant, not local but online
|
||||
**git push -u remote_name branch_name** (git push -u origin master) pushes a local branch to a remote, the -u tells git to remember the parameters, so that next time we can simply run git push
|
||||
**git push** pushes the modifications to the distant repository github (remote)
|
||||
**git remote -v** lists all distant origins, remotes, your local git project knows (in other words it lists a git project's remotes)
|
||||
**git remote show origin** show the state of the remote and its branches
|
||||
**git remote rm remote_name** delete a remote
|
||||
**git remote set-url remote_name new_name** change remote name
|
||||
**git pull** pull any changes from the remote
|
||||
**git clone** creates a local copy of a remote
|
||||
**git branch** lists all a git project's branches
|
||||
**git branch branch_name** creates a new branch
|
||||
**git checkout branch_name** to switch from one branch to another
|
||||
**git log** shows a list of all previous commits
|
||||
**git log --summary** show more informations
|
||||
**git merge branch_name** join file changes from branch_name into current branch
|
||||
**git branch -d branch_name** deletes the branch specified
|
||||
**git checkout commit_name** detach head from branch into commit, to move in commits
|
||||
**git checkout branch_name^** move head one commit upwards
|
||||
**git checkout branch_name~4** move 4 commits upwards
|
||||
**git checkout HEAD^** if head is not on a branch_name but on a commit
|
||||
**git branch -f master HEAD~3** moves the master branch to 3 parents behind head do not amend a public commit, it will reset the commit the others are working on
|
||||
**git commit --amend** do a commit replacing the last one, even if there was nothing to commit
|
||||
**git commit --amend --no-edit** do a new commit with new things replacing the last one and keepping the last message
|
||||
**git commit --amend -m 'message'** do a new commit that replace the last one with the same content but a new message
|
||||
**git stash** saves the uncommited changes besides for later use
|
||||
**git stash pop** reapply the stashed changes and removes them from the stash area
|
||||
**git stash apply** reaply the stashed changes and keep them in the stash area
|
||||
**git config --global credential.helper store** store the passwords in .git-credentials in the HOME directory (thanks to global, as opposed to the project directory) so you don't have tot type it each time
|
||||
**git cherry-pick NAME_OF_BRANCH** ti merge a branch into the actual one, but only with the last commit
|
||||
**relier dossier sur serveur en local avec git**
|
||||
**acceder au serveur via ssh :**
|
||||
`ssh hugugtzx@world-370.fr.planethoster.net -p 5022`
|
||||
**initier git dans le repo remote :**
|
||||
`git init` in the repo
|
||||
**dans le dossier local, cloner le repo :**
|
||||
git clone ssh://hugugtzx@world-370.fr.planethoster.net:5022/home/hugugtzx/wordpress.hugulumu.fr
|
||||
**avec :**
|
||||
git clone ssh://username@hostname/path/to/project
|
||||
avec `unsername@hostname` == la commande ssh
|
||||
et `/path/to/project` == la sortie de `pwd` dans le dossier remote
|
||||
|
||||
265
tutos/node.txt
Normal file
265
tutos/node.txt
Normal file
@@ -0,0 +1,265 @@
|
||||
**take node_login**
|
||||
[]
|
||||
**npm init -y**
|
||||
[package.json]
|
||||
**npm i express backpack-core mongoose volleyball dotenv babel-preset-stage-3**
|
||||
[node_modules]
|
||||
[package.json]
|
||||
[package-lock.json]
|
||||
**(express)** simplifie le code de node
|
||||
**(backpack)** recharge le serveur en live (npm start)
|
||||
**(babel)** comprend l'es6 (marche avec backpack)
|
||||
**(mongoose)** permet d'uiliser la base de donnée Mongodb
|
||||
**(volleyball)** informe en direct sur ce que tu fais
|
||||
**(dotenv)** cacher les variable environnement
|
||||
|
||||
**----------------------**
|
||||
|
||||
**node_login/package.json**
|
||||
remplacer "test": "echo \"Error: no test specified\" && exit 1"
|
||||
par "start": "backpack"
|
||||
|
||||
**node_login**
|
||||
take src
|
||||
touch index.js
|
||||
|
||||
**node_login**
|
||||
npm start //demare backpack et genere build/
|
||||
|
||||
**node_login**
|
||||
touch .env .babelrc
|
||||
|
||||
**node_login/.babelrc**
|
||||
{
|
||||
"presets": [
|
||||
"backpack-core/babel",
|
||||
"stage-3"
|
||||
]
|
||||
}
|
||||
|
||||
**node_login**
|
||||
mongod
|
||||
(il va peut-être falloir creer le fichier db dans le dossier data a la racine "sudo mkdir -p /data/db" -p pour creer un fichier dans un dossier et aussi donner tous les droits a db "sudo chmod 777 /data/db")
|
||||
|
||||
**node_login/.env**
|
||||
SERVER_PORT=3000
|
||||
DBUrl = "mongodb://localhost/users_db"
|
||||
|
||||
**node_login/src/index.js**
|
||||
import "dotenv/config";
|
||||
import express from "express";
|
||||
import volleyball from "volleyball";
|
||||
import mongoose from "mongoose";
|
||||
import passport from "passport";
|
||||
import bcrypt from "bcrypt";
|
||||
|
||||
const app = express();
|
||||
const {SERVER_PORT, DBUrl} = process.env;
|
||||
const url = DBUrl;
|
||||
const options = {promiseLibrary:Promise}
|
||||
|
||||
mongoose.connect(url, options);
|
||||
mongoose.connection.on("connected", () => {
|
||||
console.log("the mongo is working 27017")
|
||||
})
|
||||
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({extended:true}));
|
||||
app.use(volleyball);
|
||||
|
||||
app.listen(SERVER_PORT, () => {
|
||||
console.log(`server is listening port... ${SERVER_PORT}`)
|
||||
});
|
||||
|
||||
app.get('/', (req,res)=>{
|
||||
res.send('life is good with Hajar')
|
||||
})
|
||||
|
||||
**node_login**
|
||||
mkdir public src/models src/routes src/views
|
||||
|
||||
**node_login/src/models/user.js**
|
||||
import mongoose from "mongoose";
|
||||
const Schema = mongoose.Schema;
|
||||
const userSchema = new Schema({
|
||||
name: {type:String, required:true},
|
||||
email: {type:String, required:true},
|
||||
username: {type:String, required:true},
|
||||
password: {type:String, required:true},
|
||||
})
|
||||
|
||||
const User = mongoose.model("User", userSchema);
|
||||
export {User};
|
||||
|
||||
**node_login/src/routes/routes.js**
|
||||
import express from "express";
|
||||
import {User} from "../models/user";
|
||||
|
||||
const userRouter = express.Router();
|
||||
|
||||
userRouter.post("/new_user", (req,res)=>{
|
||||
let newUser = new User(req.body)
|
||||
newUser.save((err,user)=>{
|
||||
if(err) res.send(err)
|
||||
res.json(user)
|
||||
})
|
||||
})
|
||||
|
||||
export {userRouter};
|
||||
|
||||
**node_login/src/index.js**
|
||||
ajouter :
|
||||
import {userRouter} from "./routes/routes";
|
||||
et
|
||||
app.use("/users", userRouter) //utiliser userRouter pour les url /users
|
||||
|
||||
**node_login/src/views**
|
||||
touch layout.pug user_add.pug
|
||||
|
||||
**node_login/src/views/layout.pug**
|
||||
doctype html
|
||||
html
|
||||
head
|
||||
title
|
||||
link(href="/css/")
|
||||
|
||||
body
|
||||
h1 formulaire
|
||||
block content
|
||||
|
||||
**node_login/src/views/user_add.pug**
|
||||
extends layout
|
||||
block content
|
||||
h2 sign in
|
||||
|
||||
form(action="/users/new_user", method="post")
|
||||
div
|
||||
h5 name
|
||||
input(type="text", name="name", placeholder="enter name")
|
||||
input(type="text", name="email", placeholder="enter email")
|
||||
input(type="text", name="username", placeholder="enter username")
|
||||
input(type="password", name="password", placeholder="enter password")
|
||||
input(type="password", name="confirm", placeholder="confirm password")
|
||||
div
|
||||
h5 validate
|
||||
input(type="submit", value="enter")
|
||||
|
||||
**node_login/src/routes/routes.js**
|
||||
ajouter
|
||||
userRouter.get("/new_user", (req, res)=>{
|
||||
res.render("user_add")
|
||||
})
|
||||
|
||||
**node_login/src/index.js**
|
||||
ajouter
|
||||
import path from "path";
|
||||
et
|
||||
app.use(express.static(path.join(__dirname+"/public")))
|
||||
app.set("views", path.join(__dirname + "/views"))
|
||||
app.set("view engine", "pug")
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
|
||||
**express generator** creer le contenu de base automatiquement
|
||||
**bodyparser** envois les informations d'un formulaire à mongoose
|
||||
|
||||
|
||||
**ngrok https://nrgok.com** pour heberger le site en ligne pendant quelques heures pour le tester
|
||||
|
||||
|
||||
|
||||
--------------------------------
|
||||
|
||||
|
||||
**base .env**
|
||||
PORT=3000
|
||||
|
||||
**base src index.js**
|
||||
import express from "express"
|
||||
import "dotenv/config"
|
||||
const app = express();
|
||||
|
||||
const { PORT } = process.env
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`ca marche : ${ PORT }`)
|
||||
})
|
||||
|
||||
app.get("/coucou", (req, res) => {
|
||||
res.json("coucou les amis")
|
||||
})
|
||||
|
||||
**base src routes basic.js**
|
||||
import express from "express"
|
||||
|
||||
const basicRouter = express.Router();
|
||||
|
||||
basicRouter.get("/:name", (req, res) => { //jsute un test (:name recupere
|
||||
res.json(`je suis ${req.params.name}`) //des parametres depuis l'url
|
||||
})
|
||||
|
||||
export {basicRouter}
|
||||
|
||||
**--> base src index.js**
|
||||
import { basicRouter } from "./routes/basic"
|
||||
|
||||
app.use("/", basicRouter)
|
||||
|
||||
**base src routes books.js**
|
||||
import express from "express"
|
||||
|
||||
const booksRouter = express.Router();
|
||||
|
||||
booksRouter.get("/add_book", (req, res) => {
|
||||
res.json("ca marche")
|
||||
})
|
||||
|
||||
export {booksRouter}
|
||||
|
||||
**------------------------------**
|
||||
|
||||
**create-react-app nom** creer react dans un dossier "nom"
|
||||
**npm start** lance react
|
||||
**take server**
|
||||
**npm init -y** creer node dans server (server a la racine)
|
||||
**/server npm i express backpack-core mongoose volleyball dotenv babel-preset-stage-3**
|
||||
**vim /server/.babelrc** compilateur es6 pour js
|
||||
{
|
||||
"presets": [
|
||||
"backpack-core/babel",
|
||||
"stage-3"
|
||||
]
|
||||
}
|
||||
**vim /server/.env**
|
||||
PORT=3001 **(3000 est deja utilise par react)**
|
||||
DBUrl= "mongodb://localhost/blog_db"
|
||||
**take /server/src**
|
||||
**vim /server/src/index.js**
|
||||
import "dotenv/config"
|
||||
import express from "express"
|
||||
const app = express();
|
||||
import mongoose from "mongoose"
|
||||
import volleyball from "volleyball"
|
||||
app.use(volleyball);
|
||||
const { PORT, DBUrl } = process.env;
|
||||
**vim /server/package.json**
|
||||
("test"...) supression
|
||||
"start": "backapck"
|
||||
**npm start** (blog/server/) lance node
|
||||
**vim /server/src/index.js**
|
||||
app.listen(PORT, () => {
|
||||
console.log(`server is listening port... ${PORT}`)
|
||||
})
|
||||
**vim /server/.env**
|
||||
DBUrl= "mongodb://localhost**:27017**/blog_db"
|
||||
**vim /server/src/index.js**
|
||||
const options = {promiseLibrary:Promise, useNewUrlParser:true}
|
||||
|
||||
mongoose.connect((DBUrl), options)
|
||||
mongoose.connection.on("connected", () => {
|
||||
console.log("the mongo is working 27017")
|
||||
})
|
||||
**mongod** (/server)
|
||||
8
tutos/php.txt
Normal file
8
tutos/php.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
**lancer serveur apache**
|
||||
/etc/init.d/apache2 start
|
||||
|
||||
**navigateur**
|
||||
http://localhost/
|
||||
|
||||
**emplacement des fichiers**
|
||||
/var/www/html/
|
||||
3
tutos/react.txt
Normal file
3
tutos/react.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
**first time** npm install -g create-react-app
|
||||
**otherwise** create-react-app name_folder
|
||||
**then** npm start
|
||||
34
tutos/screen.txt
Normal file
34
tutos/screen.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
**screen** sudo apt-get install screen pour avoir plusieurs terminals
|
||||
**ctrl-a |** split vertically
|
||||
**ctrl-a S** split horizontally
|
||||
**ctrl-a Q** unsplit all
|
||||
**ctrl-a X** close current pane
|
||||
**ctrl-a K** kill current pane
|
||||
**ctrl-a \** kill all sessions (if it doesn't work see below)
|
||||
**ctrl-a d** get out of screen
|
||||
**screen -ls** see list of sessions
|
||||
**screen -XS 42353 quit** -X execute command, -S session PID to execute on, five digit number specific at the session
|
||||
**ctrl-a d** get out of screen without killing it then run: screen -r to recover session
|
||||
**ctrl-a tab** switch from one splited window to another
|
||||
**ctrl-a n** or **p** move to the next or previous windows
|
||||
**ctrl-a c** start new terminal (in the new window)
|
||||
**screen** prompt command "screen" to open a new window in the same directory
|
||||
**ctrl-a space** next terminal
|
||||
**ctrl-a backspace** previous terminal
|
||||
**ctrl-a ctrl a** flip flop between to terminal
|
||||
**ctrl-a "** switch between terminal with a list
|
||||
**,** move windows number down
|
||||
**.** move windows number up
|
||||
**ctrl-a A** rename
|
||||
**ctrl-a l** resize
|
||||
**ctrl-a w** show windows name
|
||||
**ctrl-a esc** go in scroll mode (press esc again to axit)
|
||||
**ctrl-a :** enter command line
|
||||
** scrollback 10000** set number of line in the buffer
|
||||
|
||||
to configure actions when launch :
|
||||
**vim ~/.screenrc ** go to or create file screenrc, then write inside:
|
||||
**startup_message off** avoid message at start
|
||||
**chdir -directorie-** change the working directorie
|
||||
**screen -t -name- -action-** start a windows with a name and execute action (for example: screen -t shell vim /Bureau/fiche/chell.txt)
|
||||
**focus** focus on next screen
|
||||
46
tutos/shell.txt
Normal file
46
tutos/shell.txt
Normal file
@@ -0,0 +1,46 @@
|
||||
**screen size** pour 2*2: 137*38 / pour 1*1: 68*19 (37 et 18 si barre des menus cachee)
|
||||
**ctrl c** termine l'action en cours du terminal
|
||||
**ctrl s** bloque l'affichage du terminal
|
||||
**ctrl q** rétablit la communication avec le terminal
|
||||
**ctrl z** stop le travail en cours et le met sur pause
|
||||
**fg** relance le dernier travail mis sur pause
|
||||
**mkdir file{1..10}** creer 10 dossiers nommés de file1 à file10
|
||||
**pwd** print working directory
|
||||
**xdg-open .** open working directory
|
||||
|
||||
**ssh username@ssh.server.com -p 0000** se connecter a un serveur via ssh en precisant un port
|
||||
|
||||
**pdftotext** transforme un pdf en un fichier texte
|
||||
**^** designe le debut d'une ligne
|
||||
* n'importe quel caractere autant de fois que possible
|
||||
**ls** ** montre tous les dossiers et sous-dossiers recursivement
|
||||
**chmod 755 fichier** chmod change les droits des fichiers, organisés en : rwxrwxrwx avec pour valeur r=4 w=2 x=1 donc r-w == r + w == 4 + 1 == 5
|
||||
|
||||
**zsh**
|
||||
**sudo apt-get install zsh**
|
||||
**which zsh** donne le chemin d'acces de zsh (/usr/bin/zsh)
|
||||
**chsh -s /usr/bin/zsh** change shell (chsh) pour zsh
|
||||
(reboot le systeme pour que les changements prennent effet)
|
||||
**echo $SHELL** pour voir quel shell est utilisé
|
||||
(uncomment **line --DISABLE_AUTO_TITLE="true"--** in ~/.zshrc file pour empecher screen de donner un nom automatique aux sessions)
|
||||
|
||||
**sass name.scss name.css** create a css file from a scss file
|
||||
**sass --watch name.scss:name.css** make the transformations of scss in css file
|
||||
|
||||
**'tree' like :**
|
||||
find | sort | grep -ve "node_modules/" -e ".git/" | sed 's#[^/]*/#|__ #g;s#__ |# |#g;s#| # #g;s#\(node_modules\|.git[ignore]*\)#\1 ...#;$a\ '
|
||||
|
||||
**format usb**
|
||||
**sudo fdisk -l** list all disks - find yours (something like /dev/sdx)
|
||||
**sudo fdisk /dev/sdx** enter in fdisk program
|
||||
**p** print the partions
|
||||
**o** create an empty dos table
|
||||
**n** add a new partition
|
||||
**p** primary
|
||||
**1** partition number 1
|
||||
**enter** default first selector
|
||||
**+1G** for 1Gb size or *enter* for default
|
||||
**a** toogle the flag *bootable*
|
||||
**n** again if you want more partitions
|
||||
**w** write and quit
|
||||
|
||||
34
tutos/sites.txt
Normal file
34
tutos/sites.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
**create a live usb with partition** https://theartofmachinery.com/2016/04/21/partitioned_live_usb.html
|
||||
**tools** www.preparetocode.io
|
||||
**design** http://www.dailyui.co/
|
||||
**js** https://github.com/myjinxin2015/Katas-list-of-Training-JS-series
|
||||
**js** https://www.javascript.com/
|
||||
**js** https://github.com/mrdavidlaing/javascript-koans
|
||||
**js** http://exercism.io/
|
||||
**jquery** http://try.jquery.com/
|
||||
**secu** https://www.root-me.org/?/lang=en
|
||||
**secu** https://www.hackerone.com/ (si tu resouds des bugs tu es payé)
|
||||
**secu** https://bountyfactory.io/en/index.html (payé pour resoudre des bugs)
|
||||
**script** https://codecombat.com/
|
||||
**script** https://screeps.com/
|
||||
**script** https://repl.it/repls/PuzzlingSugaryWrenchbird
|
||||
**script** http://gamejam.toxicode.fr/
|
||||
**script** http://www.toxicode.fr/learn
|
||||
**shell** https://explainshell.com/
|
||||
**shell** http://overthewire.org/wargames/bandit/bandit7.html
|
||||
**shell** https://cmdchallenge.com/
|
||||
**git** https://try.github.io/levels/1/challenges/1
|
||||
**git** https://learngitbranching.js.org/?demo
|
||||
**git** https://github.com/jlord/git-it-electron
|
||||
**css** https://flukeout.github.io/
|
||||
**css** http://flexboxfroggy.com/#fr
|
||||
**css** http://www.flexboxdefense.com/
|
||||
**css** http://cssgridgarden.com/#fr
|
||||
|
||||
npm init
|
||||
backpack-core
|
||||
express
|
||||
mongoose
|
||||
volleyball
|
||||
babel-preset-stage-3
|
||||
dotenv
|
||||
147
tutos/vim.txt
Normal file
147
tutos/vim.txt
Normal file
@@ -0,0 +1,147 @@
|
||||
/MODE INSERTION/
|
||||
**i** mode insertion avant le curseur
|
||||
**I** mode insertion au debut de la ligne
|
||||
**a** mode insertion apres le curseur
|
||||
**A** mode insertion a la fin de la ligne
|
||||
**o** mode insertion a la ligne
|
||||
**O** mode insertion a la ligne du dessus
|
||||
**3iTEXT** ecrira trois fois TEXT
|
||||
**ctrl r** * colle depuis le clipboard en mode insertion
|
||||
|
||||
/COMMANDES/
|
||||
**:w** enregistrer
|
||||
**:q** quitter
|
||||
**:wq** ou **ZZ** enregister et quitter
|
||||
**:q!** force a quitter
|
||||
**:** mode commande
|
||||
**work with multiple files :**
|
||||
**:e** open a new file in new buffer
|
||||
**:b <tab>** roll between opened files
|
||||
**:set hidden** add that to be able to cancel changes
|
||||
**:ls** list buffer oppened
|
||||
**:bp** go to previous buffer
|
||||
**:bn** go to next buffer
|
||||
**:bd** delete buffer
|
||||
**:b#** switch to last edited buffer
|
||||
**:%y+** copie toutes les lignes DANS LE CLIPBOARD
|
||||
**:set paste** copier sans les effets des tabulations
|
||||
**: up** affiche les dernieres commandes
|
||||
**:set number** ecrit les numeros de lignes
|
||||
**:set syntax=ON** active la coloration du texte
|
||||
**:set tabstop=4** montre les tabulations (meme existantes) de longueur 4
|
||||
**:set colorcolumn=80** ajoute une ligne verticale a la colone 80
|
||||
**transformer des espaces en tab :**
|
||||
**:set ts=2** ts pour tabstop, 2 si 2 espaces
|
||||
**:set noet** noet pour noexpandtab == use tabs no spaces
|
||||
**:%retab!** retabule tous le fichier
|
||||
**:set autoindent** copie l'indentation de la ligne precedente
|
||||
**:source ~/.vimrc** actualise le fichier vimrc sans redémarrer vim
|
||||
**:sav newname** save as with a new name
|
||||
**:!rm oldname** or **:!rm <ctr r>#** to delete the old copy
|
||||
**:sp** split windows (**<ctr w arrow>** to navigate)
|
||||
**:vsp** split verivally
|
||||
**:sp filename** open a new or already existing filename in split mode
|
||||
**:sp %:h/filename** open new file in the same directory
|
||||
**%** refers to the current directory
|
||||
**:h** current directory minus file name and slash
|
||||
**:colo** active un systeme de coloration a choisir parmis :
|
||||
-- darkblue -- blue -- default -- delek -- desert --
|
||||
-- elflord -- evening -- koehler -- morning --
|
||||
-- murphy -- pablo -- peachpuff -- ron -- shine --
|
||||
-- slate -- torte -- zellner --
|
||||
(pour le modifier de manniere permanente :
|
||||
- pour l'utilisateur courant:
|
||||
ouvrir ou creer le fichier ~.vimrc
|
||||
et ajouter dedans: colo "nom du jeu de couleur";
|
||||
- pour tous les utilisateurs:
|
||||
ouvrir le fichier /etc/vim/vimrc
|
||||
et y ajouter: colo "nom du jeu de couleur")
|
||||
|
||||
/MODE VISUEL/
|
||||
**v** mode visuel, selectionne avec le deplacement du curseur
|
||||
**v** **:s/o/n** remplace la premiere occurence par ligne en mode visuelle
|
||||
**v :s/o/n/g** remplace toutes les selections de chaque ligne
|
||||
**v :s/o/n/gc** demande confirmation (y:yes, n:no, a:all remaining, q:quit, l:last)
|
||||
|
||||
/MODE REMPLACEMENT/
|
||||
**R** mode remplacement (esc pour sortir)
|
||||
|
||||
/MODE VISUAL BLOCK/
|
||||
**ctrl v** passe en mode remplacement
|
||||
1-mettre le curseur au debut d'un ligne a commenter
|
||||
2-passer en visual block mode
|
||||
3-avec les fleches descendre jusqu'a la derniere ligne
|
||||
4-appuyer sur shift+i pour passer en mode insertion
|
||||
5-inserer le.s signe.s de commentaire (par exemple: //)
|
||||
6-appuyer sur esc (ttes les lignes vont se commenter)
|
||||
|
||||
/MODE INTERACTIF/
|
||||
**esc** quitte le mode insertion pour rentrer en mode interactif
|
||||
**x** supprime une lettre
|
||||
**r** remplace une lettre (rs remplace la lettre par s)
|
||||
**u** annuler
|
||||
**0** et **$** debut et fin de ligne
|
||||
**gg** et **G** aller a la premiere et derniere ligne
|
||||
**w** avancer le curseur au debut du mot suivant
|
||||
**b** reculer le curseur au debut du mot actuel
|
||||
**e** avancer le curseur a la fin du mot actuel
|
||||
**5G** aller a la ligne 5
|
||||
**5g up/down** va 5 lignes up ou down
|
||||
**g,** va a la position du curseur avant la derniere modification
|
||||
**f** va au prochain signe demandé, par exemple "fa" va au prochain a
|
||||
**ctrl r** refaire
|
||||
**ctrl r 0** colle la derniere selection copiee avec y
|
||||
**ctrl n** auto-completion
|
||||
**dd** coupe une ligne
|
||||
**dw** coupe du curseur a la fin du mot
|
||||
**diw** coupe le "inner" mot
|
||||
**bde** pareil (begining delete end)
|
||||
**bdw** pareil mais en mangeant en plus l'espace en trop avec le mot suivant
|
||||
**d0** coupe du curseur jusqu'au debut de ligne
|
||||
**d$** coupe du curseur jusqu'a la fin de ligne
|
||||
**yy** copie la ligne
|
||||
**p** colle une ligne
|
||||
**.** repete la derniere commande
|
||||
**"ayy** copie la ligne dans le buffer a
|
||||
**"ap** colle la ligne du buffer a
|
||||
**g up/down** go a la ligne du dessous meme quand c la meme ligne en wrap
|
||||
**gUU** passe la ligne en uppercase
|
||||
**guu** passe la ligne en lowercase
|
||||
**bgUw** change le mot en uppercase
|
||||
**~** change casse du caractere sous le cursor
|
||||
* va a la prochaine occurence du mot sous le curseur
|
||||
**q:** affiche les dernieres commandes
|
||||
**==** rétablit la bonne indentation pour la ligne
|
||||
**=G** rétablit la bonne indentation pour toute la page
|
||||
|
||||
/REMPLACER/
|
||||
**:s/old/new** remplace la 1ere occurence de ancien par nouveau
|
||||
**:%s/old/new** remplace toutes les occurences
|
||||
**:s/o/n/gi** i veut dire case insensitive
|
||||
**:s/A\zsB\zeC/X** remplace ABC par AXC
|
||||
**:s/A\zs[0-9]** * **\zeC/#\0@** remplace A865C par A#865@C, ou A123C par A#123@C
|
||||
replacement : **/old** va a la premiere prochaine occurence de 'old'
|
||||
**n** va a la prochaine occurence
|
||||
**:s//new** remplace 'old' par 'new'
|
||||
**N** va a la precedente occurence
|
||||
**&** repete la substitution
|
||||
**u** annule la deniere substitution
|
||||
etc...
|
||||
replacement2: **vim old %** va a la toute premiere occurence de 'old'
|
||||
**:s/old/new** remplace 'old' par 'new'
|
||||
**:cn** va a la prochaine occurence
|
||||
**&** repete la substitution
|
||||
**:p** va a la precedente occurence
|
||||
**u** annule la derniere sunstitution
|
||||
etc...
|
||||
|
||||
**command! Name %s//** a écrire dans le fichier ~/.vimrc, créer une fonction
|
||||
**Name** (tjrs avec une majuscule) qui s'execute quand on
|
||||
l'appel. => **:command! Name %s/a/b <bar> %s/A/B** <=> grace à
|
||||
<bar> on peut écrire plusieurs fonctions a la suite
|
||||
**function! Test()** dans ~/.vimrc définit une fonction qui execute plusieurs
|
||||
commandes. Il faut les appeler avec :exec Test(), le ! est
|
||||
tres important pour que la fonction se réecrive a chaque
|
||||
fois, sinon conflit
|
||||
|
||||
|
||||
Reference in New Issue
Block a user