1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 07:50:04 +08:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Eric Wong
e2250a99f7 fix(format): format code in visual mode
close https://github.com/SpaceVim/SpaceVim/issues/4864
2024-07-03 10:48:25 +08:00
Eric Wong
c501057f6f fix(git): fix git lazy command 2024-07-03 10:23:58 +08:00
Eric Wong
13f67638ff docs(bundle-plugins): add neo-tree link 2024-07-03 09:56:05 +08:00
Eric Wong
47082e7d42 perf(neo-tree): use lua notify 2024-07-03 09:33:48 +08:00
Eric Wong
26b7c1e45a perf(plugins): lazy load plugins 2024-07-03 07:38:50 +08:00
Eric Wong
305e4545ec perf(git): add key binding v to view log 2024-07-02 16:52:39 +08:00
8 changed files with 40 additions and 11 deletions

View File

@ -224,7 +224,7 @@ function! SpaceVim#layers#core#plugins() abort
xmap T <Plug>(clever-f-T)
omap T <Plug>(clever-f-T)
endif
call add(plugins, [g:_spacevim_root_dir . 'bundle/nerdcommenter', { 'loadconf' : 1, 'merged' : 0}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/nerdcommenter', { 'loadconf' : 1, 'merged' : 0, 'on_map' : ['<Plug>NERDCommenter', '<Plug>Commenter']}])
if exists('*matchaddpos')
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-matchup', {'merged' : 0, 'on_event' : 'BufReadPost'}])

View File

@ -68,11 +68,11 @@ endfunction
function! SpaceVim#layers#format#config() abort
if s:format_method ==# 'neoformat'
call SpaceVim#mapping#space#def('nnoremap', ['b', 'f'], 'Neoformat', 'format-code', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'f'], ":Neoformat\<Cr>", 'format-code', 0, 1)
elseif s:format_method ==# 'codefmt'
call SpaceVim#mapping#space#def('nnoremap', ['b', 'f'], 'FormatCode', 'format-code', 1)
elseif s:format_method ==# 'format.nvim'
call SpaceVim#mapping#space#def('nnoremap', ['b', 'f'], 'Format', 'format-code', 1)
call SpaceVim#mapping#space#def('nnoremap', ['b', 'f'], ":Format\<Cr>", 'format-code', 0, 1)
endif
augroup spacevim_layer_format
autocmd!

View File

@ -74,7 +74,7 @@ function! SpaceVim#layers#git#plugins() abort
elseif s:git_plugin ==# 'gita'
call add(plugins, ['lambdalisue/vim-gita', { 'on_cmd' : 'Gita'}])
else
call add(plugins, [g:_spacevim_root_dir . 'bundle/git.vim', { 'merged' : 0, 'on_event' : 'Git', 'on_func' : 'git#branch#current'}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/git.vim', { 'merged' : 0, 'on_cmd' : ['Git'], 'on_func' : 'git#branch#current'}])
endif
return plugins
endfunction

View File

@ -39,13 +39,14 @@ function! SpaceVim#layers#github#plugins() abort
\ [g:_spacevim_root_dir . 'bundle/vim-github-dashboard', {
\ 'merged' : 0,
\ 'if' : has('ruby'),
\ 'on_cmd' : ['GHActivity', 'GHDashboard'],
\ }],
\ ['tyru/open-browser-github.vim', {
\ 'depends': 'open-browser.vim',
\ 'on_cmd': ['OpenGithubFile', 'OpenGithubIssue', 'OpenGithubPullReq'],
\ }],
\ [g:_spacevim_root_dir . 'bundle/github.vim', {'merged' : 0}],
\ ['lambdalisue/vim-gista', {'merged' : 0}],
\ ['lambdalisue/vim-gista', {'merged' : 0, 'on_cmd' : ['Gista']}],
\ ]
endfunction

View File

@ -103,6 +103,23 @@ local function delete_branch()
end
end
local function view_log_of_branch()
local remote_line = vim.fn.search('^r:', 'bnW')
if remote_line == 0 then
local line = vim.fn.getline('.')
if vim.startswith(line, ' * ') then
elseif vim.startswith(line, ' ') then
local branch = vim.trim(line)
vim.cmd('tabnew | Git log ' .. branch)
end
else
local line = vim.fn.getline('.')
local branch = vim.trim(line)
local remote = string.sub(vim.fn.getline(remote_line), 3)
vim.cmd('tabnew | Git log ' .. remote .. '/' .. branch)
end
end
function M.open()
if branch_manager_bufnr ~= -1 and vim.api.nvim_buf_is_valid(branch_manager_bufnr) then
vim.api.nvim_buf_delete(branch_manager_bufnr, {
@ -125,6 +142,9 @@ function M.open()
vim.api.nvim_buf_set_keymap(branch_manager_bufnr, 'n', 'dd', '', {
callback = delete_branch,
})
vim.api.nvim_buf_set_keymap(branch_manager_bufnr, 'n', 'v', '', {
callback = view_log_of_branch,
})
end
function M.update()

View File

@ -7,6 +7,9 @@
-- under the terms of the MIT license. See LICENSE for details.
local vim = vim
local _, spacevim_notify = pcall(require, 'spacevim.api.notify')
-- User configuration section
local default_config = {
-- Name of the plugin. Prepended to log messages
@ -47,11 +50,8 @@ local notify = function(message, level_config)
if type(vim.notify) == "table" then
-- probably using nvim-notify
vim.notify(message, level_config.level, { title = "Neo-tree" })
elseif vim.fn.exists("*SpaceVim#api#notify#get") == 1 then
local saved_v = vim.g._spacevim_temp_msg
vim.g._spacevim_temp_msg = message
vim.api.nvim_eval('SpaceVim#api#notify#get().notify(g:_spacevim_temp_msg, "None")')
vim.g._spacevim_temp_msg = saved_v
elseif spacevim_notify then
spacevim_notify.notify(message)
else
local nameupper = level_config.name:upper()
local console_string = string.format("[Neo-tree %s] %s", nameupper, message)

View File

@ -57,7 +57,7 @@ These plugins are changed based on a specific version of origin plugin.
#### `core` layer
- `neo-tree`: based on [neo-tree@e3b4ef0f](https://github.com/nvim-neo-tree/neo-tree.nvim/tree/e3b4ef0fc05b0c99526ffb941abe23ef4fdc8e4e)
- [SpaceVim/neo-tree](https://github.com/SpaceVim/neo-tree.nvim)
- `clever-f.vim`: based on [clever-f.vim@fd370f2](https://github.com/rhysd/clever-f.vim/tree/fd370f27cca93918184a8043220cef1aa440a1fd)
#### `edit` layer

View File

@ -58,6 +58,14 @@ if you want to use `fugitive` instead:
| `SPC g h r` | undo cursor hunk |
| `SPC g h v` | preview cursor hunk |
**Key bindings in Git branch manager:**
| Key Binding | Description |
| ----------- | ------------------ |
| `v` | view log of branch |
| `Enter` | checkout branch |
| `dd` | delete branch |
## Omnifunc of commit message
This layer also provides omnifunc of commit message. The key binding is `ctrl-x_ctrl-o` in insert mode.