[[ðArticles]] > [[ð2024 Articles]]
![[2024-07-17.webp|cover-picture]]
[[AutoHotkey]]ã§[[Neovim]]ã®é
åãäžå±€åŒãåºããé«ã¿ãç®æã3ã€ã®æ¹æ³ã玹ä»ããŸãã
> [!info]
> ãã®èšäºã¯ [[Vimé§
äŒ]] #2024/07/17 ã® åå èšäºã§ãã
## ã¯ããã«
ç§ã¯[[Windows]]ã®[[WSL]]ã«ã€ã³ã¹ããŒã«ãã[[Ubuntu]]ã§[[Neovim]]ãå©çšããŠãããã¿ãŒããã«ã¯[[Windows Terminal]]ã䜿ã£ãŠããŸããä»ã§ããã»ãŒäžèªç±ãªãå¿«é©ã«äœ¿ããŠããŸãããåœåã¯ããã€ãã®äžæºãæ±ããŠããŸããã
- `^`ã`
ã`"`ãªã©ã®èšå·ãæã€ã®ã倧å€
- æäžæ®µã®æ°åããŒããã¹ãªãã¹ã ãŒãºã«ã¿ã€ãã§ããªã (ç¹ã«2æ¡ä»¥äžã®å Žå)
- `Shift+Space`ã`Ctrl+Enter`ãªã©ãäžéšã®çµã¿åããããŒãå²ãåœãŠã§ããªã
ç¹ã«1ã€ç®ãš2ã€ç®ã¯ã[[Neovim]]ã[[Vim]]ã䜿ãããŠããæ¹ããããã¯[[VSCode]]ãªã©ä»ã®[[IDE]]ã§VimããŒãã€ã³ãã䜿ãããŠããæ¹ã§ããã°ãäžåºŠã¯æããããšãããã®ã§ã¯ãªãã§ããããã
æ¬èšäºã§ã¯ããããã®åé¡ã[[AutoHotkey]]ã䜿ã£ãŠã©ã®ããã«ä¹ãè¶ãããã玹ä»ããŠãããŸãã
> [!hint] Windows以å€ã®OSãã䜿ãã®æ¹ãž
> ä»åã®å
容ã¯[[AutoHotkey]]ã§ã¯ãªããŠãããŒãããç³»ã®ããŒã«ã§ããã°å¯Ÿå¿ã§ããå
容ãå€ããšæããŸããå[[OS]]ã®ããŒãããç³»ããŒã«ã«çœ®ãæããŠãèªã¿ãã ããã
### ç¹ã«èªãã§ã»ããèªè
- ã[[Vim]]? [[Neovim]]? [[AutoHotkey]]ãããã°ãããªãã ãïŒããšæã£ãŠãã[[AutoHotkey]]䜿ãã®æ¹
- ã[[AutoHotkey]]? [[Vim]]ã[[Neovim]]ã䜿ããªãããã«ã€ãªã...ããšæã£ãŠãã[[Vimmer]]ã®æ¹
- [[Vim]]ã[[Neovim]]ã䜿ã£ãç·šéã®é床ãæ£ç¢ºæ§ãè¿œæ±ãããæ¹
- [[Vimmer]]ã«ãªã£ãŠããè
±éçã«æ©ãŸãããŠããæ¹
## AutoHotkeyãšã¯
[[AutoHotkey]]ã¯[[Windows]]ã§åãæ匷ã®ããŒããã¯ããŒã«ã§ããããŒããŒããããŠã¹ã®ããã€ã¹å
¥åãããªã¬ãŒã«ãå¥ã®ããŒæäœãå²ãåœãŠãããããã°ã©ã ã§ä»»æã®åŠçãå®è¡ããããšãã§ããŸãã
<div class="link-card">
<div class="link-card-header">
<img src="https://autohotkey.com/favicon.ico" class="link-card-site-icon"/>
<span class="link-card-site-name">www.autohotkey.com</span>
</div>
<div class="link-card-body">
<div class="link-card-content">
<p class="link-card-title">AutoHotkey</p>
<p class="link-card-description">
Free keyboard macro program. Supports hotkeys for keyboard, mouse, and joystick. Can expand abbreviations as you type them (AutoText).
</p>
</div>
</div>
<a href="https://www.autohotkey.com/"></a>
</div>
æ¬èšäºã§ã¯ã[[AutoHotkey]]ã®ãµã³ãã«ã³ãŒããããããŠæ²èŒããŸãããææ³ãªã©ã®èª¬æã¯ã¹ã³ãŒã察象å€ãšããŸãããŸãããµã³ãã«ã³ãŒãã®æ²èŒå
ã¯ä»¥äžã®ãªããžããªãšãªããŸãã
<div class="link-card">
<div class="link-card-header">
<img src="https://github.githubassets.com/favicons/favicon.svg" class="link-card-site-icon"/>
<span class="link-card-site-name">GitHub</span>
</div>
<div class="link-card-body">
<div class="link-card-content">
<p class="link-card-title">GitHub - tadashi-aikawa/spinal-reflex-bindings-template</p>
<p class="link-card-description">This repository is the Autohotkey KeyCustomized Project which is applicable to only mine. - ta ... </p>
</div>
<img src="https://opengraph.githubassets.com/05a70e75eb7c90d0002708a6a17051bf5f9c62eeac2b583937d123ebba296aa0/tadashi-aikawa/spinal-reflex-bindings-template" class="link-card-image" />
</div>
<a href="https://github.com/tadashi-aikawa/spinal-reflex-bindings-template"></a>
</div>
## AutoHotkeyã䜿ã£ãŠæäœã楜ã«ãã
ããã§ã¯ã3ã€ã®ãŠãŒã¹ã±ãŒã¹ã«å¯Ÿãããœãªã¥ãŒã·ã§ã³ã[[AutoHotkey]]ã®ã³ãŒãäŸã亀ããŠçŽ¹ä»ããŠãããŸãã
> [!caution]
> æ¬èšäºã®ãœãŒã¹ã³ãŒãã¯[[AutoHotkey]]ã®v1ã«å¯Ÿå¿ããŠããŸããææ°ããŒãžã§ã³ã®v2ã§ã¯ãããŸããã
### èšå·ã®å
¥åã楜ã«ãã
#### 課é¡
[[Neovim]]ã§ã¯é »ç¹ã«èšå·ããŒã䜿ããŸããããããèšå·ããŒã¯ä¿®é£ŸããŒãšã®åææŒããå¿
èŠã§ãã£ãããæ°å€ããŒã®ããæäžæ®µããŒã«é
眮ãããŠãããªã©ãæã®è² è·ã倧ããééããããå Žæã«äœçœ®ããŠããŸãã
ããšãã°ã以äžã®æäœãæ³å®ããŠã¿ãŸãããã
1. åé ã®ã³ã¡ã³ãã¢ãŠããåé€ãã
2. ããã«ã¯ã©ãŒããŒã·ã§ã³ã®äžã倧æåã«ãã
![[2024-07-16_case1.webm]]
å®éã«æŒããããŒã¯ `^dawgUi"$3h.` ã§ããèšå·ãããã€ããããéåžžã®ããŒããŒãã§ã¯ä»¥äžã®åãã«ãªããŸãã
![[keyboard_case1_before.png]]
å·Šæãæ²é³Žãäžããããªæ§æã§ããã
#### ãœãªã¥ãŒã·ã§ã³
以äžã®ãããªæ¡ä»¶ãæºããèšå·ã®å
¥åã«ã¯[[2ããŒãã€ã³ã]]ãèšå®ããŸããæ¡ä»¶ãšåºŠåãã«ãã£ãŠã¯ãã¹ãŠæºãããã®ãããã°ã1ã€ã ãããæºãããªããã®ããããŸãã
- ShiftãšåææŒããçºçãã
- å·Šæã®ã¿ã§å
¥åãã
- å©çšé »åºŠãããããé«ã
[[PrefixããŒ]]ã«ã¯`;`ã䜿ã£ãŠããŸãã
| èšå· | ããŒãã€ã³ãèšå® |
| ---- | ---------------- |
| `^` | `;` -> `a` |
| `
| `;` -> `f` |
| `#` | `;` -> `d` |
| `!` | `;` -> `z` |
| `&` | `;` -> `g` |
| `~` | `;` -> `h` |
| `_` | `;` -> `l` |
| `"` | `;` -> `m` |
| `'` | `;` -> `v` |
| `%` | `;` -> `p` |
ãããã¯[[Neovim]]ã®[[LeaderããŒ]]ã§èšå®ããã®ã§ã¯ãªãã[[AutoHotkey]]ã§èšå®ããŸãããªããªãã**[[AutoHotkey]]ã§èšå®ããã°ã[[Neovim]]ã®èšå®ã[[Vim]]ãä»ã®[[VimããŒãã€ã³ã]]ãçšãããšãã£ã¿ã®èšå®ãå€æŽãããããããå Žæã§ãã®ããŒãã€ã³ãã䜿çšã§ãããã**ã§ãã
> [!question]- [[PrefixããŒ]]ã«ã»ãã³ãã³ã䜿ãçç±ã¯?
> 以äž2ã€ã®æ¡ä»¶ãæºãããŠããããã§ãã
>
> - ããŒã ããžã·ã§ã³ã§çŽ æ©ãå
¥åã§ãã
> - åæŒãã§äœ¿ããªããã°ãããªãæ©äŒãå€ããªã
> - ã³ãŒãã£ã³ã°ã®å Žåã¯[[ãã©ãŒããã¿ãŒ]]è£å®ã«é Œããããšãå€ã ([[Rust]]é€ã)
> - [[Neovim]]ã® `f` ã `t` ã®ãªããŒãã¯[[flash.nvim]]ã䜿ãã°ä»£çšã§ãã
> - ææªCtrlãšã®åææŒããªããããŸã§èŠã§ããªã
> - ã»ãã³ãã³ã®åŸã«é£ç¶ããŠããŒãå
¥åããããšã¯ã»ãšãã©ãªã
ãã®èšå®ãããããã§å
ã»ã©ã®ãŠãŒã¹ã±ãŒã¹ãèããŠã¿ãŸãããã
å®éã«æŒããããŒã¯ `;adawgUi;m;f3h.` ã«ãªããŸãããããŒã®æ°ãå¢ããŠãªãã...?ããšæããããããŸãã...ããã®ååžãã芧ãã ããã
![[keyboard_case1_after.png]]
ãã©ã€ã³ãã¿ããé£æ床ã®é«ãæäžæ®µããŒããå·Šæã®ã¿ã®ShiftããŒåææŒãåæ°ãåææŒãåæ°ã®ããããæžå°ããŠããŸãã
| é
ç®æ° | æ¬å¯Ÿå¿å | æ¬å¯Ÿå¿åŸ |
| ------------------ | -------- | -------- |
| æäžæ®µã㌠| 4 | 1 |
| å·Šæã®ã¿ã®åææŒã | 2 | 0 |
| åææŒã | 3 | 1 |
| ã㌠| 12 | 15 |
å°å³ãªéãã§ãããé·ãæé[[Neovim]]ã䜿ã£ãŠãããšãæäœã®æ£ç¢ºæ§ãæã®ç²ãã«çŽçµããŠããŸãã®ã§äŸ®ããŸãããå·Šæ åè¬äžæã®è
±éçãªã¹ã¯ãæ¿æžãããšæããŸãã
#### AutoHotkeyã®ã³ãŒãäŸ
[[PrefixããŒ]]ã`;`ã§ãããã®å€å®ã¯ `2K` é¢æ°ãäœã£ãŠå€å®ããŠããŸãã
```autohotkey
;ãæŠèŠã2ããŒãã€ã³ãã®ããŒãã©ãããå€å®ããŸã
;ãåŒæ°ãPrefixããŒ
;ãæ»å€ãboolean
2K(prefix) {
return (A_PriorHotKey = "quot; . prefix)
}
```
ããšã¯ãããŒãã€ã³ãèšå®ã§æ¡ä»¶åå²ãæžãã°OKã
```autohotkey
$a::
if (2K(";")) {
send {^}
} else {
send a
}
return
```
### è¡åäœã®æäœã楜ã«ãã
#### 課é¡
[[Neovim]]ã䜿ã£ãŠãããšãã¡ã€ã«ã®äžã移åããŸãã£ãŠé«éã§ç·šéããããšããããšæããŸããããšãã°ä»¥äžã®ãã¡ã€ã«ãæŽåœ¢ããã·ãŒã³ãèããŠã¿ãŠãã ããã
![[Pasted image 20240716201413.png]]
ã第1ç« ããšã第2ç« ãã®ã»ã¯ã·ã§ã³ãé転ããŠããŸã£ãŠããããããå
¥ãæ¿ããã±ãŒã¹ãèããŸãã解ã¯ç¡éã«ååšãããšæããŸãããããã§ã¯[[flash.nvim]]ãš`}`ã䜿ãæŠç¥ãæ³å®ããŠã¿ãŸãã(ã©ã¡ããçæ¹ã§ãããã®ã§ããããã£ãããªã®ã§...)
![[2024-07-16_case2.webm]]
é®®ãããªæäœã«æãããããããŸãããããã®ãããªæäœã¯å°ãåå°ç¥çµãšé ã®ãªãœãŒã¹ã奪ãããŸãããªããªãã[[flash.nvim]]ã®åè£ã«å¯ŸããŠã¢ã«ãã¡ããããEnterã§ç§»åã§ããç®æã衚瀺ãããã®ã¯ã**[[flash.nvim]]ã«èšå®ããã[[LeaderããŒ]]ãæŒããããš**ã ããã§ãã
![[Pasted image 20240716203724.png|frame]]
*ãã®è¡šç€ºãåºãã®ã¯ `s#` ãæŒããããš*
æäœã®ãã£ãŒãããã¯ãèŠãªããŠãæäœãããã®ã§ããã°ããã£ãšç¢ºåºŠã®é«ã移åæ段ã䜿ãã¹ãã§ããåžžã«èŠããŠãããæäœåããææ¡ã§ãããžã£ã³ãå
ãäžæã«ãªãæ¹æ³... ãšèšãã°è¡çªå·æå®ãžã£ã³ãã§ãããã
![[2024-07-16_case2-2.webm]]
ç®ã«èŠãã¬é人ã®ææ¥... éããçž«ãæ£ç¢ºããšç¬é移åã«çããå§åçã¹ããŒãã¯ãè¡åäœã®ç·šéã§ããã°æµãªãã ãšæããŸãããããããã®æ¹æ³ã«ã1ã€åŒ±ç¹ããããŸãã**ããŒãçŽ æ©ãæŒãã®ãé£ãã**ã®ã§ãã
å
ã»ã©å
¥åããããŒã¯ `43G2dap36Gp` ã§ãããããããŒããŒãã®ååžã§ç¢ºèªããŠã¿ãŸãããã
![[Pasted image 20240716205004.png]]
å·Šæã ãã®åææŒãã¯å¿
ãçºçããŸãããåœç¶ã§ããå
¥åããããŒã¯ã»ãšãã©æäžæ®µã§ãããã¹ãããããæãç²ããŸããå
ã»ã©ã®åç»ã§ãèŠããããããªã¹ããŒããå®å®ããŠåºãã®ã¯é£æ床ãé«ããšæããŸããä»ã¯ãŸã 2æ¡ãªã®ã§ããã§ãããè¡æ°ã3æ¡ã«ãªããšãã¯ãè¡çªå·ãæã€ã ãã§äžèŠåŽã ãšæããŸãã
> [!note]
> `vim.wo.relativenumber = true` ãªãã·ã§ã³ã§çŸåšè¡ããã®çžå¯Ÿè¡ã衚瀺ããæ¹æ³ããããŸãããè€æ°è¡äžäžãžã®ç§»åãå°ã楜ã«ãªãã ãã§æ¬è³ªçãªãœãªã¥ãŒã·ã§ã³ã§ã¯ãªããšæã£ãŠããŸãããŸãã移åãããŸã§ããã®æŽã«æ¬¡ã«ç§»åãããè¡çªå·ãåãããªãã®ã§[[flash.nvim]]ãšåæ§ã®èª²é¡ããããŸãã
#### ãœãªã¥ãŒã·ã§ã³
æŒãã«ãããã°æŒããããããã°ãããåé¡ãšãªã£ãŠãã2çš®é¡ã®ããŒã«ã€ããŠä»¥äžã®ãããªãœãªã¥ãŒã·ã§ã³ã§ã¢ãããŒãããŸãã
- æ°å€ããŒ
- ããŒã ããžã·ã§ã³ã®å³åŽã«**ä»®æ³ãã³ããŒ**ãäœæãã
- `Shift + G`
- ä»®æ³ãã³ããŒæå¹æã«`G`ãæŒããã`Shift + G`ãšãã
ä»®æ³ãã³ããŒã¯ä»¥äžã®ãããªé
眮ãšãªã£ãŠããŸããç§ã®ç°å¢ã§ã¯ `ç¡å€æ` -> `R` ãšããé ã§2ã€ã®ããŒãå
¥åãããä»®æ³ãã³ããŒãæå¹ã«ãªãããã«ããŠããŸãã
![[Pasted image 20240716210413.png]]
ãã®èšå®ã§å
ã»ã©ã®ãŠãŒã¹ã±ãŒã¹ãèããŠã¿ãŸãããã
å®éã«æŒããããŒã¯ `ç¡å€ærj.g2dapç¡å€ær.lgp` ã«ãªããŸããäŸã«ãã£ãŠããŒæ°ã¯å¢ããŠããŸãããæ¹ããŠååžãã芧ãã ããã
![[Pasted image 20240716211018.png]]
ã»ãŒãã¹ãŠãããŒã ããžã·ã§ã³ã«åãŸããåææŒãããŒã¯0ã§ãããããªãå
ã»ã©ã®æäœã§ãçŽ æ©ããã¹ãªãç¶ããããšãã§ããŸãã
| é
ç®æ° | æ¬å¯Ÿå¿å | æ¬å¯Ÿå¿åŸ |
| --------- | ---- | ---- |
| æäžæ®µã㌠| 5 | 1 |
| å·Šæã®ã¿ã®åææŒã | 2 | 0 |
| åææŒã | 2 | 0 |
| ã㌠| 11 | 15 |
> [!note]
> ä»®æ³ãã³ããŒã¢ãŒãã§`G`ãæŒããšãä»®æ³ãã³ããŒã¢ãŒãããè±åŽããŸããããã¯è¡ãžã£ã³ãçŽåŸã«ç¶ããŠããäžåºŠè¡ãžã£ã³ããç¹°ãè¿ãã±ãŒã¹ã¯ã»ãŒãªãããã§ãã
#### AutoHotkeyã®ã³ãŒãäŸ
詳现ãèŒãããšæ¬çããéžããŠããŸãã®ã§ãé°å²æ°ã ããäŒãããŸãã[[ðŠSpinal reflex bindings template]]ã§ã¯[[Neovim]]ãšåæ§ã«ã¢ãŒããšããæŠå¿µãåãå
¥ããŠããã5ã€ã®ã¢ãŒããååšããŸãã
| çç¥è¡šèš | ã¢ãŒãå | æŠèŠ |
| -------- | ------------- | -------------------------------- |
| N | NORMALã¢ãŒã | Windowsã®æ®éã®ç¶æ
|
| E | EDITã¢ãŒã | Vimã®[[ããŒãã«ã¢ãŒã]]çžåœ |
| R | RANGEã¢ãŒã | Vimã®[[ããžã¥ã¢ã«ã¢ãŒã]]çžåœ |
| M | MOUSEã¢ãŒã | ããŠã¹ã«ãŒãœã«æäœã«ç¹åç¶æ
|
| S | SPECIALã¢ãŒã | ãŠã£ã³ããŠç§»åã»ãã³ããŒã»ãã®ä» |
以äžã¯ã³ãŒãã®æçãå¯ãéããã¹ããããã§ããå
ã»ã©ã®æäœã§ã¯â â¡ã§ä»®æ³ãã³ããŒãæå¹ã«ããâ¢ã®ããã«æ°åãå
¥åãâ£ã§è¡ãžã£ã³ãããŠããŸãã
```autohotkey
;----- ã¢ãŒãåæ¿ -----
; ç¡å€æããŒ
$vk1C::
if (mode(_MODE.NORMAL)) {
; â NORMALã¢ãŒãæã«ç¡å€æããŒãæŒãããããEDITã¢ãŒããžç§»è¡
setMode(_MODE.EDIT)
} else {
setMode(_MODE.NORMAL)
setIME(false)
}
return
;[N] rããŒ
;[EMR] SPECIALã¢ãŒãã«åãæ¿ã
;[S] EDITã¢ãŒãã«åãæ¿ã
$r::
if (modes("N")) {
send r
} else if (modes("EMR")) {
; â¡ EDITã¢ãŒãæã«rããŒãæŒãããããSPECIALã¢ãŒããžç§»è¡
setMode(_MODE.SPECIAL)
} else if (modes("S")) {
setMode(_MODE.EDIT)
}
return
;[N] mã㌠(; -> ")
;[ER] æ¥æ¬èªå
¥åOFF + ã¢ãŒããNORMALã«å€æŽ
;[S] 1ããŒ
$m::
if (modes("N")) {
if (2K(";")) {
send "
} else {
send m
}
} else if (modes("ER")) {
setIME(false)
setMode(_MODE.NORMAL)
} else if (modes("S")) {
; ⢠SPECIALã¢ãŒãæã«mããŒãæŒããããã1ãå
¥å
if (isTerminal() || isUbuntu()) {
send 1
} else {
send {Numpad1}
}
}
return
;[N] gã㌠(; -> &)(Obsidian: C-j -> å
šææ€çŽ¢)
;[EM] RANGEã¢ãŒãã«åãæ¿ã
;[R] EDITã¢ãŒãã«åãæ¿ã
;[S] G+NORMALã¢ãŒãã«åãæ¿ã(Vimãžã£ã³ãçš)
$g::
if (modes("N")) {
if (2K(";")) {
send &
} else if (AP("Obsidian") && 2K("^j")) {
send ^g
} else {
send g
}
} else if (modes("EM")) {
setMode(_MODE.RANGE)
} else if (modes("R")) {
setMode(_MODE.EDIT)
} else if (modes("S")) {
; ⣠SPECIALã¢ãŒãæã«gããŒãæŒãããããShift+Gå
¥ååŸã«NORMALã¢ãŒããž
send G
setMode(_MODE.NORMAL)
}
return
```
ã¢ãŒãã®ååŸãå€æŽã«é¢ããã³ãŒã㯠[ModeController.ahk](https://github.com/tadashi-aikawa/spinal-reflex-bindings-template/blob/master/ModeController.ahk) ãã芧ãã ããã
#### AutoHotkeyã®èšå®ãããçè
ã®æäœåç»
ãã£ãããªã®ã§ãªã¢ã«ã«ã©ããããã®ã¹ããŒããåºãã®ãæ®åœ±ããŠã¿ãŸããã
![[2024-07-16_21h30_26.webm]]
å³äžã« `Special` ãšããã©ãã«ã衚瀺ãããŠãããšããSPECIALã¢ãŒãã®ãšãã§ããå
ã»ã©ã®åç»ã¯[[VHS (CLI)|VHS]]ãšããã¿ãŒããã«èªåæäœ&é²ç»ããŒã«ã䜿ã£ããã®ã§ãããã»ãŒåãé床ãåºããŠããã®ã§ã¯ãªãã§ããããã
### å²ãåœãŠã§ããªãçµã¿åããããŒãå²ãåœãŠã
#### 課é¡
[[Neovim]]ã®å¶éã[[Neovimãã©ã°ã€ã³]]ã®èšå®å¶éã[[OS]]ã[[ã¿ãŒããã«]]ã®ç°å¢ã«ãã£ãŠãäžéšã®ããŒãã€ã³ããèšå®ã§ããªãããšããããŸããå°ãªããšãç§ã®ç°å¢/ç¥èã§ã¯ä»¥äž2ã€ã®ããŒãèšå®ã§ããŸããã§ããã
- `Ctrl+Enter`
- `Shift+Space`
ãã®2çš®é¡ã®ããŒã¯[[IDE]]ã§é »ç¹ã«äœ¿ãããŒã§ããåè
ã¯æ°ããã¿ãããŠã£ã³ããŠãéãçšéã§... åŸè
ã¯[[Hippie completion]]ã§å©çšããŠããããããããã®ããŒãã€ã³ãã䜿ããªãã®ã¯èŽåœçã§ããã
#### ãœãªã¥ãŒã·ã§ã³
[[AutoHotkey]]ã§**ã¿ãŒããã«ãæäœäžã«éãã**`Ctrl+Enter`ãš`Shift+Space`ãå¥ã®ããŒã«å²ãåœãŠãŸãã
| ã㌠| å²ãåœãŠãå¥ã㌠|
| ------------- | ---------------- |
| `Ctrl+Enter` | `F12` |
| `Shift+Space` | `Shift+F6` |
ãã®äžã§[[Neovim]]ã«ããŒãã€ã³ããèšå®ããŸããç§ã[[Neovim]]ã䜿ã£ãŠãããšãã¯å¿
ã[[ã¿ãŒããã«]]ã䜿ã£ãŠããã®ã§åžžã«ãã®ããŒãã€ã³ããæå¹ã«ãªããŸãã
```lua
{
"stevearc/oil.nvim",
keys = {
{ "<Space>o", ":Oil<CR>", silent = true },
},
opts = {
skip_confirm_for_simple_edits = true,
keymaps = {
["<C-s>"] = "actions.select_split",
-- Ctrl+Enterã§åçŽåå²ã§éžæ
["<F12>"] = "actions.select_vsplit",
},
view_options = {
show_hidden = true,
},
},
}
```
```lua
local u = require("utils")
-- Hippie completion
if u.is_windows then
vim.keymap.set("i", "<S-F6>", "<C-x><C-p>")
else
-- Ubuntu(WSL)ã§ã¯S-F6ãF18ãšãªããã
vim.keymap.set("i", "<F18>", "<C-x><C-p>")
end
```
> [!attention]
> å²ãåœãŠãããŒã¯[[Neovim]]èµ·åäžã«çµ¶å¯Ÿå©çšããªãããŒã«ããŸãããã
#### AutoHotkeyã®ã³ãŒãäŸ
ã¿ãŒããã«(â[[Neovim]])ãã©ããã®å€å®ã¯ `isTerminal` é¢æ°ãã€ãã£ãŠå€å®ããŠããŸãã
```autohotkey
;ãæŠèŠãæå®ãããããã»ã¹ãã¢ã¯ãã£ãã§ããã
;ãåŒæ°ãname: ããã»ã¹å
;ãæ»å€ãtrue / false
isActiveProcess(name) {
; â pNameã«ã¯ WindowsTerminal.exe ãªã©ãå
¥ã
pName := getSettingsValue("ProcessName", name)
WinGet, ahk_process, ProcessName, A
return pName == ahk_process
}
;ãæŠèŠãæå®ããããŠã£ã³ããŠãã¿ãŒããã«ã (ãããå€å®..minttyã¯git bashããª...)
;ãæ»å€ãtrue / false
isTerminal() {
return isActive("mintty") || isActiveProcess("terminal") || isActiveProcess("wezterm")
}
```
ããšã¯éåžžã®ããŒãããã§ãã¿ãŒããã«(â[[Neovim]])èµ·åäžã¯æå®ã®ãããã³ã°ãããã ãã§ãã
```autohotkey
;[N] Ctrl+Enterã㌠(ã¿ãŒããã«ã®å Žåã¯Ctrl+Enterã䜿ããªãã®ã§F12ã§ä»£çš)
$^Enter::
if (modes("N")) {
if (isTerminal()) {
; â¡ ã¿ãŒããã«(âNeovim)èµ·åäžãªãF12
send {F12}
} else {
send ^{Enter}
}
}
return
;Shift+Spaceã㌠(ã¿ãŒããã«ã®å Žåã¯Shift+Spaceã䜿ããªãã®ã§Shift+F6 or F18(WSL)ã§ä»£çš)
$+Space::
if (isTerminal()) {
; ⢠ã¿ãŒããã«(âNeovim)èµ·åäžãªãShift+F6
; WSLã ãšF18ã«ãªã
send +{F6}
} else {
send +{Space}
}
return
```
## ãŸãšã
[[Neovim]]ã䜿ã£ãŠãããšçŽé¢ãã課é¡ã«å¯ŸããŠã[[AutoHotkey]]ã䜿ã£ã3ã€ã®ãœãªã¥ãŒã·ã§ã³ã玹ä»ããŸãããç¹ã«ã1ã€ç®ãš2ã€ç®ã®ãœãªã¥ãŒã·ã§ã³ã¯[[Neovim]]以å€ã®[[VimããŒãã€ã³ã]]ããŒã«ã§ã掻çšã§ããŸãã(äŸ: [[VSCode]]ã[[IntelliJ IDEA]]ã[[Obsidian]])
[[Neovim]]ã®ç·šéå¹çã¯ãèšå·ããŒãæ°åããŒã䜿ãããªãããšã§å€§ããäžããã±ãŒã¹ããããªãã«ãããŸãããããããããã®ããŒãæŒãã¥ããããããå®éã¯`hjkl`ããŒãæŒãã£ã±ãªãã«ããŠç§»åãããã`wb`ããŒã®è€æ°åæŒãã§åŠ¥å?ããã·ãŒã³ãå°ãªãããèŠãããŸããç·šéã¹ããŒããšããç¹ã§ã¯ããã§ååãªã®ãããããŸãããã§ããããã£ãã[[Neovim]]ãšããçŽ æŽããããšãã£ã¿ã䜿ã£ãŠããã®ã§ããããäžè²ã®ç·šéæäœã楜ããã ããæŽãªãå¹çã®é«ã¿ãç®æãã®ããŸãäžèã§ã¯ãªãã§ããããã
ãã[[macOS]]ãªã®ã§[[AutoHotkey]]ã¯äœ¿ããªãã§ãã£ãŠïŒ ãåŸãããããããã§ð