update toggleterm

This commit is contained in:
Lee Tang
2022-04-19 10:14:10 +08:00
parent 76e08244e7
commit 2bb3018a4d
16 changed files with 262 additions and 42 deletions

View File

@@ -1,46 +1,15 @@
local g = vim.g local g = vim.g
local map = require('utils').map local map = require('utils').map
local Terminal = require('toggleterm.terminal').Terminal map('t', '<C-]>', [[<C-\><C-n>]], { noremap = true })
local lazygit = Terminal:new({
cmd = 'lazygit', require('toggleterm').setup({
dir = 'git_dir', open_mapping = [[<C-t>]],
close_on_exit = true, size = function(term)
direction = 'float', if term.direction == 'horizontal' then
float_opts = { return 15
border = 'double', else
}, return vim.o.columns * 0.3
hidden = true, end
-- function to run on opening the terminal end,
--on_open = function(term)
--vim.cmd("startinsert!")
--vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", {noremap = true, silent = true})
--end,
-- function to run on closing the terminal
--on_close = function(term)
--vim.cmd("Closing terminal")
--end,
}) })
function _lazygit_toggle()
lazygit:toggle()
end
function _G.set_terminal_keymaps()
local opts = { noremap = true }
vim.api.nvim_buf_set_keymap(0, 't', '<C-b>', [[<C-\><C-n><C-w>]], opts)
--vim.api.nvim_buf_set_keymap(0, 't', 'jk', [[<C-\><C-n>]], opts)
--vim.api.nvim_buf_set_keymap(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
--vim.api.nvim_buf_set_keymap(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
--vim.api.nvim_buf_set_keymap(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
--vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
end
vim.api.nvim_set_keymap('n', '<leader>g', '<cmd>lua _lazygit_toggle()<CR>', { noremap = true, silent = true })
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
map('n', '<leader>tm', ':ToggleTerm size=15 direction=horizontal<CR>')
require('toggleterm').setup({})

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,135 @@
{
"$schema": "https://www.raycast.com/schemas/extension.json",
"name": "music",
"title": "Music",
"description": "Control the Apple Music app with your keyboard.",
"icon": "icon.png",
"author": "fedevitaledev",
"license": "MIT",
"keywords": [
"music",
"player",
"media"
],
"commands": [
{
"name": "toggle-play-pause",
"title": "Toggle Play/Pause",
"subtitle": "Apple Music",
"description": "Toggle play or pause of current track in Music.",
"mode": "no-view"
},
{
"name": "play",
"title": "Play",
"subtitle": "Apple Music",
"description": "Play current track in Music.",
"mode": "no-view"
},
{
"name": "pause",
"title": "Pause",
"subtitle": "Apple Music",
"description": "Pause current track in Music.",
"mode": "no-view"
},
{
"name": "next-track",
"title": "Next Track",
"subtitle": "Apple Music",
"description": "Skip to the next track in Music.",
"mode": "no-view"
},
{
"name": "previous-track",
"title": "Previous Track",
"subtitle": "Apple Music",
"description": "Skip to the previous track in Music.",
"mode": "no-view"
},
{
"name": "currently-playing",
"title": "Currently Playing Track",
"subtitle": "Apple Music",
"description": "Get info about currently playing track.",
"mode": "no-view"
},
{
"name": "love",
"title": "Love Track",
"subtitle": "Apple Music",
"description": "Love currently playing track.",
"mode": "no-view"
},
{
"name": "dislike",
"title": "Dislike Track",
"subtitle": "Apple Music",
"description": "Dislike currently playing track.",
"mode": "no-view"
},
{
"name": "add-to-library",
"title": "Add to Library",
"subtitle": "Apple Music",
"description": "Add currently playing track to your library.",
"mode": "no-view"
},
{
"name": "love-and-add-to-library",
"title": "Love and Add to Library",
"subtitle": "Apple Music",
"description": "Love and add currently playing track to your library.",
"mode": "no-view"
},
{
"name": "start-playlist",
"title": "Start Playlist",
"subtitle": "Apple Music",
"description": "Start any of your playlists.",
"keywords": [
"playlist"
],
"mode": "view"
},
{
"name": "play-library-track",
"title": "Search & Play Library Track",
"subtitle": "Apple Music",
"description": "Search and start a track from your library.",
"keywords": [
"track"
],
"mode": "view"
},
{
"name": "play-library-album",
"title": "Search & Play Library Album",
"subtitle": "Apple Music",
"description": "Search and start an album from your library.",
"keywords": [
"album"
],
"mode": "view"
}
],
"dependencies": {
"@raycast/api": "^1.25.4",
"fp-ts": "^2.11.5",
"run-applescript": "^6.0.0"
},
"devDependencies": {
"@types/node": "~16.10.0",
"@types/react": "^17.0.28",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"react-devtools": "^4.19.2",
"typescript": "^4.4.3"
},
"scripts": {
"build": "ray build -e dist",
"dev": "ray develop"
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long