Skip to content

Commit 10c6812

Browse files
committed
improved and more keybindings
1 parent 0b3dfec commit 10c6812

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ _To uninstall the tool from your system execute the following command, depending
172172

173173
## Integrating with vscode
174174

175-
Create custom keybindings for vscode to use this script more conveniently in vscode, you can copy my keybindings from [vscode-keybindings](https://github.com/proffapt/code-runner/blob/main/keybindings/vscode-keybindings) into your keybindings.json
175+
Create custom keybindings for `vscode` to use this script more conveniently in vscode, you can copy my keybindings from [vscode-keybindings](https://github.com/proffapt/code-runner/blob/main/keybindings/vscode-keybindings) into your keybindings.json
176176

177177
* `alt+space`
178178

@@ -198,7 +198,10 @@ https://user-images.githubusercontent.com/86282911/204466533-977280fc-a1a7-492f-
198198

199199
## Integrating with vim
200200

201-
I made a custom keybinding to work with my code-runner on vim, add the lines from [vim-keybindings](https://github.com/proffapt/code-runner/blob/main/keybindings/vim-keybindings) to your vim configuration file
201+
Create custom keybindings for `{Neo}vim` to use this script more conveniently in `{Neo}vim`, you can copy my keybindings from the following files to your vim configuration file.
202+
203+
- [For .{n}vimrc type configs](https://github.com/proffapt/code-runner/blob/main/keybindings/vim-keybindings-rc)
204+
- [For lua type configs](https://github.com/proffapt/code-runner/blob/main/keybindings/vim-keybindings-lua)
202205

203206
* `rr`
204207

keybindings/vim-keybindings-lua

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-- README
2+
-- Install the nvterm(NvChad/nvterm) plugin
3+
-- Add the following mappings to your mappings.lua file
4+
--
5+
6+
-- Keybinding code-runner by https://github.com/proffapt
7+
["rr"] = {
8+
function()
9+
if vim.bo.modified then
10+
vim.api.nvim_command(":w")
11+
end
12+
local filename = vim.fn.expand('%')
13+
require("nvterm.terminal").send(" run " .. filename, "horizontal")
14+
vim.defer_fn(function()
15+
vim.cmd("wincmd j")
16+
end, 50)
17+
end,
18+
"spawn code-runner"
19+
},
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
" Keybinding for my code-runner
1+
" README
2+
" Install the floaterm(voldikss/vim-floaterm) plugin from your plugin manager
3+
" Add the following mappings to your .{n}vimrc config file
4+
"
5+
6+
" Keybinding code-runner by https://github.com/proffapt
27
nnoremap rr :w<cr> :FloatermNew --title=code-runner --height=0.6 --width=0.7 --autoclose=0 run % <cr>
38
nnoremap <expr> ff expand('%:t') ==? 'fish' ? ":FloatermToggle <cr>" : execute(':ls! hR') ==? "" ? ":FloatermNew --title=code-runner --height=0.6 --width=0.7 <cr> <C-\><C-n>:FloatermToggle <cr>:w <cr>:FloatermSend --title=code-runner run % <cr>:FloatermToggle <cr>" : ":w <cr>:FloatermSend --title=code-runner run % <cr>:FloatermToggle <cr>"
49
tnoremap ff <C-\><C-n>:FloatermToggle <cr>
5-
6-
7-
" INSTALL THE FLOATERM PLUGIN
8-
call plug#begin('~/.vim/plugged')
9-
10-
" Floating Terminal
11-
Plug 'voldikss/vim-floaterm'
12-
13-
call plug#end()

keybindings/vscode-keybindings

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
// Replace only the key argument with your choice of key-combination
1+
// README
2+
// Replace only the "key" argument with your choice of key-combination
3+
// Add the following key-combination to your vscode key-combination preference file
4+
//
25

36
// Switch focus between terminal and editor
4-
// Start
57
{
68
"key": "alt+space",
79
"command": "workbench.action.terminal.newWithCwd",
@@ -20,10 +22,8 @@
2022
"command": "workbench.action.focusActiveEditorGroup",
2123
"when": "terminalIsOpen && terminalFocus"
2224
},
23-
// End
2425

25-
// My Code runner
26-
// Start
26+
// code-runner by https://github.com/proffapt/
2727
{
2828
"key": "cmd+contextmenu",
2929
"command": "terminal.focus",
@@ -35,4 +35,3 @@
3535
"args": {"text": "run '${fileBasename}'\u000D"},
3636
"when": "terminalIsOpen && terminalFocus"
3737
}
38-
// End

0 commit comments

Comments
 (0)