]> git.lizzy.rs Git - bspwm.git/blob - doc/CONTRIBUTING.md
Merge pull request #305 from Vrakfall/master
[bspwm.git] / doc / CONTRIBUTING.md
1 ## Requirements
2
3 You must be comfortable with [C][1], [XCB][2] and [Git][3].
4
5 ## Coding Style
6
7 I follow the [Linux Coding Style][4] with the following variations:
8 - [Ident with tabs, align with spaces][5].
9 - Always use braces with if/else.
10
11 ## Browsing the Code
12
13 If you use `vim`:
14 - Hitting *K* will lead you to the manual page of the function under the cursor (works with most `xcb_*` functions), sometimes you'll have to explicitly specify the section of the manual you're interested in with *3K* (e.g.: `open`).
15 - Install `ctags` and run `ctags *.{c,h}` in the directory holding the source. Then, hitting *Ctrl-]* will lead you to the definition of the function/variable/structure under the cursor (to go back: *Ctrl-T*).
16 - You can run `make` from `vim` with `:make` and then navigate to the next and the previous error with `:cn` and `:cp`.
17
18 ## Debugging
19
20 To install debug executables:
21 ```
22 make clean debug && make install
23 ```
24
25 You can attach to a running *bspwm* process with:
26 ```
27 gdb bspwm $(pgrep -x bspwm)
28 c
29 ```
30
31 Or if you just want to generate a backtrace (saved in `gdb.txt`):
32 ```
33 ulimit -c unlimited
34 startx
35 sudo systemd-coredumpctl gdb bspwm
36 set logging on
37 bt full
38 q
39 ```
40
41 [1]: http://cm.bell-labs.com/cm/cs/cbook/
42 [2]: http://www.x.org/releases/X11R7.5/doc/libxcb/tutorial/
43 [3]: http://git-scm.com/documentation
44 [4]: http://www.kernel.org/doc/Documentation/CodingStyle
45 [5]: http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/