<commit_before>local status_ok, p = pcall(require, "toggleterm")
if not status_ok then
	return
end

p.setup({
	open_mapping = [[<c-\>]],
	direction = "float",
	float_opts = {
		border = "curved",
	},
	close_on_exit = true,
})

local keymap = vim.keymap.set
function _G.set_terminal_keymaps()
	local opts = { buffer = 0 }
	keymap("t", "<esc>", [[<C-\><C-n>]], opts)
	keymap("t", "<C-h>", [[<Cmd>wincmd h<CR>]], opts)
	keymap("t", "<C-j>", [[<Cmd>wincmd j<CR>]], opts)
	keymap("t", "<C-k>", [[<Cmd>wincmd k<CR>]], opts)
	keymap("t", "<C-l>", [[<Cmd>wincmd l<CR>]], opts)
end

-- if you only want these mappings for toggle term use term://*toggleterm#* instead
vim.api.nvim_create_autocmd({ "TermOpen" }, {
	group = "_",
	pattern = "term://*",
	command = "lua set_terminal_keymaps()",
})

local opts = { noremap = true, silent = true }
keymap("n", ",,f", function()
	vim.cmd(vim.v.count1 .. "ToggleTerm direction=float")
end, opts)
keymap("n", ",,j", function()
	vim.cmd(vim.v.count1 .. "ToggleTerm direction=horizontal")
end, opts)
<commit_msg>[nvim] Fix ToggleTerm key bindings<commit_after>local status_ok, p = pcall(require, "toggleterm")
if not status_ok then
	return
end

p.setup({
	open_mapping = [[<c-\>]],
	direction = "float",
	float_opts = {
		border = "curved",
	},
	close_on_exit = true,
})

local keymap = vim.keymap.set
function _G.set_terminal_keymaps()
	local opts = { buffer = 0 }
	keymap("t", "<esc>", [[<C-\><C-n>]], opts)
	keymap("t", "<C-j>", [[<Cmd>wincmd j<CR>]], opts)
	keymap("t", "<C-k>", [[<Cmd>wincmd k<CR>]], opts)
end

-- if you only want these mappings for toggle term use term://*toggleterm#* instead
vim.api.nvim_create_autocmd({ "TermOpen" }, {
	group = "_",
	pattern = "term://*",
	command = "lua set_terminal_keymaps()",
})

local opts = { noremap = true, silent = true }
keymap("n", ",,f", function()
	vim.cmd(vim.v.count1 .. "ToggleTerm direction=float")
end, opts)
keymap("n", ",,j", function()
	vim.cmd(vim.v.count1 .. "ToggleTerm direction=horizontal")
end, opts)

{'fraction_non_alphanumeric': 0.22066899650524213, 'fraction_numerical': 0.0029955067398901645, 'mean_word_length': 4.7094017094017095, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4317057', 'n_tokens_mistral': 833, 'n_tokens_neox': 810, 'n_words': 188}