-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autocmd User AiderOpen #10
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bafb0ff
emit on openAiderBuffer
tsukimizake cedbd36
refactor: hide internal functions in buffer.ts
tsukimizake 7499f14
emit on sendPrompt
tsukimizake b1bbb03
add autocmd key setting on README.md
tsukimizake 3b07135
remove default keymap for closing floating window
tsukimizake 2fd59ec
add lua settings to README.md
tsukimizake 9b71324
same keymap as the vimscript version on lua
tsukimizake File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ Minimal helper plugin for aider with neovim. | |
|
||
## Settings | ||
|
||
### vimscript | ||
Please add the following settings to your vimrc or init.vim. | ||
|
||
```vim | ||
|
@@ -32,6 +33,49 @@ nnoremap <silent> <leader>ai :AiderAddIgnoreCurrentFile<CR> | |
nnoremap <silent> <leader>aI :AiderOpenIgnore<CR> | ||
nnoremap <silent> <leader>ah :AiderHide<CR> | ||
vmap <leader>av :AiderVisualTextWithPrompt<CR> | ||
augroup AiderOpenGroup | ||
autocmd! | ||
autocmd User AiderOpen call s:AiderOpenHandler() | ||
augroup END | ||
|
||
function! s:AiderOpenHandler() abort | ||
" Set key mappings for the buffer | ||
execute 'tnoremap <buffer=' . a:args.buf . '> <Esc> <C-\><C-n>' | ||
execute 'nnoremap <buffer=' . a:args.buf . '> <Esc> :AiderHide<CR>' | ||
endfunction | ||
``` | ||
|
||
### lua (lazy.nvim) | ||
Please add the following settings to your lazy settings. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 追記ありがとうございます ( ;´ワ `;)つ☆ |
||
|
||
```lua | ||
{ "nekowasabi/aider.vim" | ||
, dependencies = "vim-denops/denops.vim" | ||
, config = function() | ||
vim.g.aider_command = 'aider --no-auto-commits' | ||
vim.g.aider_buffer_open_type = 'floating' | ||
vim.g.aider_floatwin_width = 100 | ||
vim.g.aider_floatwin_height = 20 | ||
|
||
vim.api.nvim_create_autocmd('User', | ||
{ | ||
pattern = 'AiderOpen', | ||
callback = | ||
function(args) | ||
vim.keymap.set('t', '<Esc>', '<C-\\><C-n>', { buffer = args.buf }) | ||
vim.keymap.set('n', '<Esc>', '<cmd>AiderHide<CR>', { buffer = args.buf }) | ||
end | ||
}) | ||
vim.api.nvim_set_keymap('n', '<leader>ar', ':AiderRun<CR>', { noremap = true, silent = true }) | ||
vim.api.nvim_set_keymap('n', '<leader>aa', ':AiderAddCurrentFile<CR>', { noremap = true, silent = true }) | ||
vim.api.nvim_set_keymap('n', '<leader>aw', ':AiderAddWeb<CR>', { noremap = true, silent = true }) | ||
vim.api.nvim_set_keymap('n', '<leader>ax', ':AiderExit<CR>', { noremap = true, silent = true }) | ||
vim.api.nvim_set_keymap('n', '<leader>ai', ':AiderAddIgnoreCurrentFile<CR>', { noremap = true, silent = true }) | ||
vim.api.nvim_set_keymap('n', '<leader>aI', ':AiderOpenIgnore<CR>', { noremap = true, silent = true }) | ||
vim.api.nvim_set_keymap('n', '<leader>ah', ':AiderHide<CR>', { noremap = true, silent = true }) | ||
vim.api.nvim_set_keymap('v', '<leader>av', ':AiderVisualTextWithPrompt<CR>', { noremap = true, silent = true }) | ||
end | ||
} | ||
``` | ||
|
||
## Usage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vimscriptの設定は自分のlua設定をaiderくんに翻訳してもらっただけなのでできればマージ前に試しておいてほしい(他力本願)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a:args.bufのところが動かないので(あとフォークされたリポジトリに切り替える方法がよくわからなかった)、マージしてから直します。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なんかgit remote addとかする必要があるかもしれねえ ( ;´。 `;)