<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> IS_COMMAND</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">() (</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">get_mods</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">() </span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">==</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> MOD_MASK_CTRL)</span></span></code></pre></div><h2id="customizing-caps-word"tabindex="-1">Customizing Caps Word <aclass="header-anchor"href="#customizing-caps-word"aria-label="Permalink to "Customizing Caps Word {#customizing-caps-word}""></a></h2><h3id="invert-on-shift"tabindex="-1">Invert on shift <aclass="header-anchor"href="#invert-on-shift"aria-label="Permalink to "Invert on shift {#invert-on-shift}""></a></h3><p>By default, Caps Word turns off when Shift keys are pressed, considering them as word-breaking. Alternatively with the <code>CAPS_WORD_INVERT_ON_SHIFT</code> option, pressing the Shift key continues Caps Word and inverts the shift state. This is convenient for uncapitalizing one or a few letters within a word, for example with Caps Word on, typing "D, B, Shift+A, Shift+A, S" produces "DBaaS", or typing "P, D, F, Shift+S" produces "PDFs".</p><p>Enable it by adding in config.h</p><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> CAPS_WORD_INVERT_ON_SHIFT</span></span></code></pre></div><p>This option works with regular Shift keys <code>KC_LSFT</code> and <code>KC_RSFT</code>, mod-tap Shift keys, and one-shot Shift keys. Note that while Caps Word is on, one-shot Shift keys behave like regular Shift keys, and have effect only while they are held.</p><h3id="idle-timeout"tabindex="-1">Idle timeout <aclass="header-anchor"href="#idle-timeout"aria-label="Permalink to "Idle timeout {#idle-timeout}""></a></h3><p>Caps Word turns off automatically if no keys are pressed for <code>CAPS_WORD_IDLE_TIMEOUT</code> milliseconds. The default is 5000 (5 seconds). Configure the timeout duration in config.h, for instance</p><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> CAPS_WORD_IDLE_TIMEOUT</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 3000</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // 3 seconds.</span></span></code></pre></div><p>Setting <code>CAPS_WORD_IDLE_TIMEOUT</code> to 0 configures Caps Word to never time out. Caps Word then remains active indefinitely until a word breaking key is pressed.</p><h3id="functions"tabindex="-1">Functions <aclass="header-anchor"href="#functions"aria-label="Permalink to "Functions {#functions}""></a></h3><p>Functions to manipulate Caps Word:</p><table><thead><tr><th>Function</th><th>Description</th></tr></thead><tbody><tr><td><code>caps_word_on()</code></td><td>Turns Caps Word on.</td></tr><tr><td><code>caps_word_off()</code></td><td>Turns Caps Word off.</td></tr><tr><td><code>caps_word_toggle()</code></td><td>Toggles Caps Word.</td></tr><tr><td><code>is_caps_word_on()</code></td><td>Returns true if Caps Word is currently on.</td></tr></tbody></table><h3id="configure-which-keys-are-word-breaking"tabindex="-1">Configure which keys are "word breaking"<aclass="header-anchor"href="#configure-which-keys-are-word-breaking"aria-label="Permalinkto"Configurewhichke
<spanclass="line"><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> add_weak_mods</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">MOD_BIT</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(KC_LSFT));</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Apply shift to next key.</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h3id="representing-caps-word-state"tabindex="-1">Representing Caps Word state <aclass="header-anchor"href="#representing-caps-word-state"aria-label="Permalink to "Representing Caps Word state {#representing-caps-word-state}""></a></h3><p>Define <code>caps_word_set_user(bool active)</code> to get callbacks when Caps Word turns on or off. This is useful to represent the current Caps Word state, e.g. by setting an LED or playing a sound. In your keymap, define</p><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">void</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> caps_word_set_user</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">bool</span><spanstyle="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> active</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div></div></div></main><footerclass="VPDocFooter"data-v-39a288b8data-v-09de1c0f><!--[--><!--]--><divclass="edit-info"data-v-09de1c0f><divclass="edit-link"data-v-09de1c0f><aclass="VPLink link vp-external-link-icon no-icon edit-link-button"href="https://github.com/qmk/qmk_firmware/edit/master/docs/features/caps_word.md"target="_blank"rel="noreferrer"data-v-09de1c0f><!--[--><spanclass="vpi-square-pen edit-link-icon"data-v-09de1c0f></span> Edit this page<!--]--></a></div><!----></div><navclass="prev-next"data-v-09de1c0f><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link prev"href="/features/autocorrect"data-v-09de1c0f><!--[--><spanclass="desc"data-v-09de1c0f>Previous page</span><spanclass="title"data-v-09de1c0f>Autocorrect</span><!--]--></a></div><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link next"href="/features/combo"data-v-09de1c0f><!--[--><spanclass="desc"data-v-09de1c0f>Next page</span><spanclass="title"data-v-09de1c0f>Combos</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>