Skip to contentSkip to conversation

qemu: add .exrc

PATCH Superseded Michael S. Tsirkin 4 participants 7 messages Jul 19, 2012 – Jul 20, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu: add .exrc

I've been using this to get correct indenting with vim in qemu for a while, but it's a bit easier if we put the settings in the central place.
Note that
1. you still need to enable 'exrc' and 'secure' options in your vimrc for these settings to take effect.
2. you can create a .vimrc file if 'exrc' is on but there's need to bypass this configuration.

---
 .exrc | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 .exrc
.exrc new file +3 -0
new file mode 100644
index 0000000..1853616
@@ -0,0 +1,3 @@
+set expandtab
+set shiftwidth=4
+set smarttab
Signature · 1 line
MST
#1 lore raw
Quoted 8 lines · Michael S. Tsirkin

I've been using this to get correct indenting with vim in qemu for a while, but it's a bit easier if we put the settings in the central place.
Note that
1. you still need to enable 'exrc' and 'secure' options in your vimrc for these settings to take effect.
2. you can create a .vimrc file if 'exrc' is on but there's need to bypass this configuration.

I think editor configs could reasonably go on the wiki somewhere but I'm not sure they belong in our git repo...

-- PMM

#2 lore raw
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Michael S. Tsirkin

I've been using this to get correct indenting with vim in qemu for a while, but it's a bit easier if we put the settings in the central place.
Note that
1. you still need to enable 'exrc' and 'secure' options in your vimrc for these settings to take effect.
2. you can create a .vimrc file if 'exrc' is on but there's need to bypass this configuration.

Quoted 4 lines

I think editor configs could reasonably go on the wiki somewhere but I'm not sure they belong in our git repo...

-- PMM

kvm people need to work on both qemu and kernel which
have different styles, so switching styles manually gets old quickly. The benefit is more people will send patches in the correct style. What's the harm?

Signature · 1 line
MST
#3 lore raw
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Peter Maydell
Quoted 8 lines · Michael S. Tsirkin

I've been using this to get correct indenting with vim in qemu for a while, but it's a bit easier if we put the settings in the central place.
Note that
1. you still need to enable 'exrc' and 'secure' options in your vimrc for these settings to take effect.
2. you can create a .vimrc file if 'exrc' is on but there's need to bypass this configuration.

I think editor configs could reasonably go on the wiki somewhere but I'm not sure they belong in our git repo...

Quoted 8 lines
Quoted 1 line

-- PMM

kvm people need to work on both qemu and kernel which
have different styles, so switching styles manually gets old quickly. The benefit is more people will send patches in the correct style. What's the harm?

From my .vimrc:

au BufNewFile,BufRead */qemu/*.c,*/qemu/*.h,*/qemu/*.hx,*/qemu/*tool setlocal ts=4 sw=4 et

I agree that it's useful to have this, just like .gitignore or .gdbinit. It makes developer's lives easier and encourages consistent coding style.

Stefan

#4 lore raw
Quoted 4 lines · Stefan Hajnoczi

From my .vimrc:

au BufNewFile,BufRead */qemu/*.c,*/qemu/*.h,*/qemu/*.hx,*/qemu/*tool setlocal ts=4 sw=4 et

Basically I think editor preferences are a local matter which can reasonably differ between different developers, so they shouldn't be in the git repo.

(a) haven't you just demonstrated that even vim users have different preferred settings?
(b) where do we stop? emacs? bbedit? there are a lot of editors out there...

In any case, 3 settings clearly don't encompass the whole of QEMU's coding style. The relevant bit of my .emacs tweaks about 20 different settings...

-- PMM

#5 lore raw
Quoted 3 lines

In any case, 3 settings clearly don't encompass the whole of QEMU's coding style. The relevant bit of my .emacs tweaks about 20 different settings...

Just leave the coding style checking to checkpatch.pl, I think?

Regards,
chenwj

Signature · 5 lines
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj
#6 lore raw
In reply to Peter Maydell
Quoted 9 lines · Peter Maydell
Quoted 4 lines · Stefan Hajnoczi

From my .vimrc:

au BufNewFile,BufRead */qemu/*.c,*/qemu/*.h,*/qemu/*.hx,*/qemu/*tool setlocal ts=4 sw=4 et

Basically I think editor preferences are a local matter which can reasonably differ between different developers, so they shouldn't be in the git repo.

This is why I simply set the shiftwidth and set indenting by space. Clearly no "can reasonably differ" applies here.

Quoted 2 lines

(a) haven't you just demonstrated that even vim users have different preferred settings?

No, it's the same with the addition of tabstop=4, which *is* a matter of taste (how many spaces you want shown if you edit a file with tabs, like a makefile).

Quoted 2 lines

(b) where do we stop? emacs? bbedit? there are a lot of editors out there...

If people ask for it we can consider. I doubt it will be a real problem.

Quoted 6 lines

In any case, 3 settings clearly don't encompass the whole of QEMU's coding style.
The relevant bit of my .emacs tweaks about
20 different settings...

-- PMM

If you don't use vim why do you even care about this patch?

Signature · 1 line
MST