Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[VIM] identation suivant un certain "coding style"
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
angela
Apprentice
Apprentice


Joined: 16 Feb 2005
Posts: 150

PostPosted: Wed Mar 26, 2008 6:52 pm    Post subject: [VIM] identation suivant un certain "coding style" Reply with quote

Salut,

je travaille dans une boite qui a son propre coding style. J'utilise vim pour coder, seulement j'ai des soucis pour automatiser ces taches.

Par exemple, vim m'indente comme ça:
Code:

 39    __asm__ __volatile__("pushq %[cluclu];"
 40            "mov %%rsp, %[savedReg];"
 41             "ret;"
 42             "l0:"
 43             "nop;"
 44             : [savedReg] "=a" (savedReg)
 45             : [cluclu] "r" (cluclu));



et j'aimerais qu'il m'aligne tout au niveau tu pushq:

Code:

 39    __asm__ __volatile__("pushq %[cluclu];"
 40                         "mov %%rsp, %[savedReg];"
 41                         "ret;"
 42                         "l0:"
 43                         "nop;"
 44                         : [savedReg] "=a" (savedReg)
 45                         : [cluclu] "r" (cluclu));





Un autre exemple, est la déclaration de fonctions:

Code:
void salut(void)
{...
}


mais il faut que je fasse
Code:
void
salut(void)
{...
}


Seulement vim me fait:
Code:
   void
salut(void)
{...
}


(il me rajoute 3 espaces avant le void).

Enfin voilà, j'ai pleins de petits détails comme ça. Dans l'ensemble, l'auto-ident est bien, mais j'aimerais juste un peu le modifier de manière propre.

Merci
Back to top
View user's profile Send private message
sno35
Guru
Guru


Joined: 15 May 2004
Posts: 334
Location: Paris, France

PostPosted: Wed Mar 26, 2008 7:16 pm    Post subject: Reply with quote

Salut
Code:
:set cindent
:set cino+=(0

ça devrait le faire pour l'alignement avec la parenthèse ouvrante
Code:
:he cino

pour la suite.
Èqça.
Back to top
View user's profile Send private message
Untux
Apprentice
Apprentice


Joined: 10 Apr 2006
Posts: 285

PostPosted: Wed Mar 26, 2008 7:38 pm    Post subject: Reply with quote

En complément à sno35, voir aussi dev-util/indent. C'est pas de l'auto-indent Vim mais... une option de plus c'est toujours bon à prendre :]
Back to top
View user's profile Send private message
angela
Apprentice
Apprentice


Joined: 16 Feb 2005
Posts: 150

PostPosted: Thu Mar 27, 2008 2:52 pm    Post subject: Reply with quote

merci pour vos réponses !

C'est un peu plus big deal pour l'indentation du type de la fonction par contre.

Je ne connaissais pas indent, ça rox !

thx
Back to top
View user's profile Send private message
sno35
Guru
Guru


Joined: 15 May 2004
Posts: 334
Location: Paris, France

PostPosted: Thu Mar 27, 2008 7:38 pm    Post subject: Reply with quote

Bonsoir
Dans le genre de indent, il y a aussi dev-util/astyle
Èqça.
Back to top
View user's profile Send private message
RaX
Apprentice
Apprentice


Joined: 16 Aug 2007
Posts: 166

PostPosted: Thu Mar 27, 2008 7:59 pm    Post subject: Reply with quote

Ha monsieur fait de l'asm 64bit :), y a un registre que j'aime bien en assembler x64, l'accumulateur :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum