mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-28 10:18:25 -05:00
neovim: add translate-shell + orgmode
This commit is contained in:
parent
8b3da5fff0
commit
7a4a5bdeb1
@ -123,6 +123,8 @@ wk.register({
|
||||
name = 'Buffer',
|
||||
c = {':ColorizerToggle<CR>', 'Colorizer'},
|
||||
d = {':bdelete<CR>', 'Close buffer'},
|
||||
j = {':BufferLineCyclePrev<CR>', 'Previous buffer'},
|
||||
k = {':BufferLineCycleNext<CR>', 'Previous buffer'},
|
||||
n = {':DashboardNewFile<CR>', 'New file'},
|
||||
z = {':ZenMode<CR>', 'Zen mode'}
|
||||
},
|
||||
@ -173,6 +175,15 @@ wk.register({
|
||||
}
|
||||
},
|
||||
|
||||
-- translate-shell.vim
|
||||
j = {
|
||||
name = 'Translate',
|
||||
t = {':Trans<CR>', 'Translate'},
|
||||
d = {':TransSelectDirection<CR>', 'Translate with direction'},
|
||||
r = {'cw<C-R>=system(\'trans -brief -no-ansi\', getreg(""))[:-2]<CR>', 'Translate and replace'},
|
||||
c = {'cw<C-R>=system(\'trans -brief -no-ansi :\', getreg(""))[:-2]<S-Left><S-Left><Right>', 'Translate and replace with direction'}
|
||||
},
|
||||
|
||||
l = {
|
||||
name = 'LSP',
|
||||
a = 'Add workspace folder',
|
||||
@ -207,13 +218,20 @@ wk.register({
|
||||
|
||||
n = {':NnnPicker %:p:h<CR>', 'File picker'},
|
||||
|
||||
-- orgmode.nvim
|
||||
o = {
|
||||
name = 'Org',
|
||||
a = 'Agenda',
|
||||
c = 'Capture'
|
||||
},
|
||||
|
||||
-- Tab related
|
||||
t = {
|
||||
name = 'Tab',
|
||||
c = {'<Cmd>tabclose<CR>', 'Close tab'},
|
||||
n = {'<Cmd>tabnext<CR>', 'Next tab'},
|
||||
p = {'<Cmd>tabprev<CR>', 'Previous tab'},
|
||||
t = {'<Cmd>tabnew<CR>', 'New tab'}
|
||||
j = {'<Cmd>tabprev<CR>', 'Previous tab'},
|
||||
k = {'<Cmd>tabnext<CR>', 'Next tab'},
|
||||
n = {'<Cmd>tabnew<CR>', 'New tab'}
|
||||
}
|
||||
}, {prefix = '<leader>'})
|
||||
|
||||
@ -226,5 +244,75 @@ wk.register({
|
||||
name = 'Git',
|
||||
r = 'Reset hunk',
|
||||
s = 'Stage hunk'
|
||||
},
|
||||
|
||||
-- translate-shell.vim
|
||||
j = {
|
||||
name = 'Translate',
|
||||
t = {':Trans<CR>', 'Translate'},
|
||||
d = {':TransSelectDirection<CR>', 'Translate with direction'},
|
||||
r = {'c<C-R>=system(\'trans -brief -no-ansi\', getreg(""))[:-2]<CR>', 'Translate and replace'},
|
||||
c = {'c<C-R>=system(\'trans -brief -no-ansi :\', getreg(""))[:-2]<S-Left><S-Left><Right>', 'Translate and replace with direction'}
|
||||
}
|
||||
}, {mode = 'v', prefix = '<leader>'})
|
||||
|
||||
------------------------
|
||||
-- Filetype specified --
|
||||
------------------------
|
||||
vim.cmd(([[
|
||||
autocmd FileType org lua whichkeyOrg()
|
||||
autocmd FileType markdown lua whichkeyMarkdown()
|
||||
autocmd FileType html lua whichkeyHtml()
|
||||
]]))
|
||||
|
||||
_G.whichkeyOrg = function()
|
||||
wk.register({
|
||||
['<leader>o'] = {
|
||||
A = 'Toggle ARCHIVE',
|
||||
e = 'Export',
|
||||
i = {
|
||||
name = 'Insert',
|
||||
h = 'Add headline',
|
||||
t = 'Add TODO heading and content',
|
||||
T = 'Add TODO heading',
|
||||
},
|
||||
J = 'Move subtree down',
|
||||
K = 'Move subtree up',
|
||||
o = 'Open at point',
|
||||
r = 'Refile',
|
||||
t = 'Set tags',
|
||||
['$'] = 'Archive current headline'
|
||||
},
|
||||
['<leader><CR>'] = 'Org meta return',
|
||||
['<C-a>'] = 'Org increase date',
|
||||
['<C-x>'] = 'Org decrease date',
|
||||
['cid'] = 'Org change date',
|
||||
['cit'] = 'Org TODO',
|
||||
['ciT'] = 'Org TODO prev',
|
||||
['<C-Space>'] = 'Org toggle checkbox',
|
||||
['<TAB>'] = 'Org cycle folding',
|
||||
['<S-TAB>'] = 'Org cycle global folding',
|
||||
['<<'] = 'Org promote headline',
|
||||
['>>'] = 'Org demote headline',
|
||||
['<s'] = 'Org prmote subtree',
|
||||
['>s'] = 'Org demote subtree',
|
||||
['}'] = 'Org next visible heading',
|
||||
['{'] = 'Org previous visible heading',
|
||||
[']]'] = 'Org forward heading',
|
||||
['[['] = 'Org backward heading',
|
||||
['g{'] = 'Org parent heading',
|
||||
['?'] = 'Org help'
|
||||
})
|
||||
end
|
||||
|
||||
_G.whichkeyMarkdown = function()
|
||||
wk.register({
|
||||
['<leader>bp'] = {':MarkdownPreviewToggle<CR>', 'Preview markdown'}
|
||||
})
|
||||
end
|
||||
|
||||
_G.whichkeyHtml = function()
|
||||
wk.register({
|
||||
['<leader>bp'] = {':Bracey<CR>', 'Preview html'}
|
||||
})
|
||||
end
|
||||
|
@ -5,6 +5,7 @@ require('compe').setup {
|
||||
min_length = 1,
|
||||
preselect = 'always',
|
||||
source = {
|
||||
orgmode = true,
|
||||
path = true,
|
||||
buffer = true,
|
||||
calc = false,
|
||||
|
39
home/.config/nvim/lua/modules/org.lua
Normal file
39
home/.config/nvim/lua/modules/org.lua
Normal file
@ -0,0 +1,39 @@
|
||||
local c = require('colors.' .. vim.g.global_theme).colors
|
||||
|
||||
return require('orgmode').setup({
|
||||
-- General settings
|
||||
org_agenda_files = {
|
||||
'~/Documents/Org/agenda/agenda.org',
|
||||
'~/Documents/Org/agenda/archive.org'
|
||||
},
|
||||
org_default_notes_file = '~/Documents/Org/notes.org',
|
||||
org_todo_keywords = {
|
||||
'TODO', 'PROJ', 'LOOP', 'STRT', 'WAIT', 'HOLD', 'IDEA', 'DONE', 'KILL',
|
||||
'[ ]', '[-]', '[X]' , '|', 'OKAY', 'YES', 'NO'
|
||||
},
|
||||
org_todo_keyword_faces = {
|
||||
TODO = ':foreground ' .. c.green .. ' :weight bold',
|
||||
PROJ = ':foreground ' .. c.grey_bright .. ' :weight bold :slant italic',
|
||||
LOOP = ':foreground ' .. c.green .. ' :weight bold :underline on',
|
||||
STRT = ':foreground ' .. c.blue .. ' :weight bold',
|
||||
WAIT = ':foreground ' .. c.yellow .. ' :weight bold',
|
||||
HOLD = ':foreground ' .. c.yellow .. ' :weight bold :slant italic',
|
||||
IDEA = ':foreground ' .. c.green .. ' :weight bold :slant italic',
|
||||
DONE = ':foreground ' .. c.grey2 .. ' :weight bold',
|
||||
KILL = ':foreground ' .. c.red .. ' :weight bold',
|
||||
OKAY = ':foreground ' .. c.grey1 .. ' :weight bold :slant italic',
|
||||
YES = ':foreground ' .. c.grey1 .. ' :weight bold :underline on',
|
||||
NO = ':foreground ' .. c.red .. ' :weight bold :underline on'
|
||||
},
|
||||
org_hide_leading_stars = true,
|
||||
org_highlight_latex_and_related = 'entities',
|
||||
|
||||
-- Agenda settings
|
||||
org_deadline_warning_days = 7,
|
||||
org_agenda_span = 'week',
|
||||
org_agenda_start_on_weekday = 7, -- Start a week in Sunday
|
||||
org_agenda_min_height = 15,
|
||||
|
||||
-- Tags settings
|
||||
org_use_tag_inheritance = false
|
||||
})
|
18
home/.config/nvim/lua/modules/translate-shell.lua
Normal file
18
home/.config/nvim/lua/modules/translate-shell.lua
Normal file
@ -0,0 +1,18 @@
|
||||
local function translate_options()
|
||||
vim.g.trans_join_lines = 1
|
||||
vim.g.trans_win_height = 15
|
||||
vim.g.trans_default_direction = ':ja'
|
||||
vim.g.trans_directions_list = {
|
||||
{'', 'en'},
|
||||
{'', 'ja'},
|
||||
{'', 'de'},
|
||||
{'', 'ru'},
|
||||
{'', 'fr'},
|
||||
{'', 'nl'},
|
||||
{'', 'es'},
|
||||
{'', 'zh-CN'},
|
||||
{'', 'zh-TW'}
|
||||
}
|
||||
end
|
||||
|
||||
translate_options()
|
@ -321,6 +321,19 @@ return require('packer').startup(
|
||||
require('modules.zen')
|
||||
end
|
||||
}
|
||||
use {
|
||||
'kristijanhusak/orgmode.nvim', -- shouldn't be lazy-loaded (otherwise keybindings don't work)
|
||||
config = function()
|
||||
require('modules.org')
|
||||
end
|
||||
}
|
||||
use {
|
||||
'echuraev/translate-shell.vim',
|
||||
cmd = {'Trans', 'TransSelectDirection'},
|
||||
config = function()
|
||||
require('modules.translate-shell')
|
||||
end
|
||||
}
|
||||
use {
|
||||
'akinsho/nvim-toggleterm.lua',
|
||||
cmd = 'ToggleTerm',
|
||||
@ -339,7 +352,7 @@ return require('packer').startup(
|
||||
end
|
||||
}
|
||||
|
||||
-- TODO: lspsaga, orgmode.nvim, nvim-lint, format(ter).nvim, rest.nvim, sqls.nvim,
|
||||
-- TODO: lspsaga, nvim-lint, format(ter).nvim, rest.nvim, sqls.nvim,
|
||||
-- nvim-spectre, nvim-dap, dial.nvim, asynctasks.nvim
|
||||
end
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user