This commit is contained in:
Christian Nieves
2023-03-20 15:47:17 -05:00
parent fcbb91f25e
commit 5a14fe163c
5 changed files with 78 additions and 13 deletions

View File

@ -41,8 +41,8 @@ end
local map = require("utils").map local map = require("utils").map
-- here are some mappings you might want: -- here are some mappings you might want:
map('n', '[c', [[<Cmd>GoogleCommentsGotoNextComment<CR>]]) map('n', ']c', [[<Cmd>GoogleCommentsGotoNextComment<CR>]])
map('n', ']c', [[<Cmd>GoogleCommentsGotoPrevComment<CR>]]) map('n', '[c', [[<Cmd>GoogleCommentsGotoPrevComment<CR>]])
map('n', '<Leader>nc', [[<Cmd>GoogleCommentsGotoNextComment<CR>]]) map('n', '<Leader>nc', [[<Cmd>GoogleCommentsGotoNextComment<CR>]])
map('n', '<Leader>pc', [[<Cmd>GoogleCommentsGotoPrevComment<CR>]]) map('n', '<Leader>pc', [[<Cmd>GoogleCommentsGotoPrevComment<CR>]])

View File

@ -1,3 +1,3 @@
local map = require("utils").map vim.keymap.set('n', '<leader>y', require('osc52').copy_operator, {expr = true})
map("n", "<Leader>y", ":OSCYank<CR>", opts) vim.keymap.set('n', '<leader>yy', '<leader>c_', {remap = true})
map("v", "<Leader>y", ":OSCYank<CR>", opts) vim.keymap.set('v', '<leader>y', require('osc52').copy_visual)

View File

@ -1,4 +1,8 @@
local map = require("utils").map local map = require("utils").map
vim.g.signify_vcs_cmds = {
hg = 'hg cat %f -r p4base',
}
map('n', ']d', '<plug>(signify-next-hunk)') map('n', ']d', '<plug>(signify-next-hunk)')
map('n', '[d', '<plug>(signify-prev-hunk)') map('n', '[d', '<plug>(signify-prev-hunk)')

View File

@ -220,12 +220,13 @@ require('packer').startup(function(use)
config = [[require('config.gitsigns')]], config = [[require('config.gitsigns')]],
event = 'User ActuallyEditing', event = 'User ActuallyEditing',
}, },
{ 'TimUntersberger/neogit', cmd = 'Neogit', config = [[require('config.neogit')]] }, -- { 'TimUntersberger/neogit', cmd = 'Neogit', config = [[require('config.neogit')]] },
{ {
'akinsho/git-conflict.nvim', 'akinsho/git-conflict.nvim',
tag = '*', tag = '*',
config = [[require('git-conflict').setup()]] config = [[require('git-conflict').setup()]]
} },
{ 'rhysd/conflict-marker.vim' }
} }
-- use { "catppuccin/nvim", as = "catppuccin" } -- use { "catppuccin/nvim", as = "catppuccin" }
@ -237,10 +238,11 @@ require('packer').startup(function(use)
'christoomey/vim-tmux-navigator', 'christoomey/vim-tmux-navigator',
'whatyouhide/vim-tmux-syntax', 'whatyouhide/vim-tmux-syntax',
'tmux-plugins/vim-tmux-focus-events', 'tmux-plugins/vim-tmux-focus-events',
'jabirali/vim-tmux-yank',
'skywind3000/asyncrun.vim', 'skywind3000/asyncrun.vim',
} }
use { use {
'ojroques/vim-oscyank', 'ojroques/nvim-osc52',
config = [[ require("config.oscyank") ]] config = [[ require("config.oscyank") ]]
} }
@ -278,7 +280,8 @@ require('packer').startup(function(use)
use 'tpope/vim-surround' use 'tpope/vim-surround'
use 'scrooloose/nerdcommenter' use 'scrooloose/nerdcommenter'
use 'mhinz/vim-signify' { use {
'mhinz/vim-signify',
config= [[require('config.signify')]] config= [[require('config.signify')]]
} }

View File

@ -15,8 +15,8 @@ inoremap <Nul> <C-n>
cnoremap %% <C-R>=fnameescape(expand("%:p:h")."/")<CR> cnoremap %% <C-R>=fnameescape(expand("%:p:h")."/")<CR>
" move vertically by visual line " move vertically by visual line
nnoremap j gj " nnoremap j gj
nnoremap k gk " nnoremap k gk
" no shift for colon cmds " no shift for colon cmds
nnoremap ; : nnoremap ; :
@ -43,9 +43,67 @@ nnoremap ]e :<c-u>execute 'move +'. v:count1<cr>
nnoremap <silent> vv <C-w>v nnoremap <silent> vv <C-w>v
nnoremap <silent> ss <C-w>s nnoremap <silent> ss <C-w>s
nnoremap <C-t> <Cmd>CocCommand explorer<CR>
" always use very magic mode when searching " always use very magic mode when searching
"nnoremap / /\v "nnoremap / /\v
"vnoremap / /\v "vnoremap / /\v
nnoremap <silent> <leader>ww :call WindowSwap#EasyWindowSwap()<CR> nnoremap <silent> <leader>ww :call WindowSwap#EasyWindowSwap()<CR>
function! s:createHabitsMappings(keys, message) abort
for key in a:keys
call nvim_set_keymap('n', key, ':call BreakHabitsWindow(' . string(a:message). ')<CR>', {'silent': v:true, 'nowait': v:true, 'noremap': v:true})
endfor
endfunction
function! BreakHabitsWindow(message) abort
" Define the size of the floating window
let width = 50
let height = 10
" Create the scratch buffer displayed in the floating window
let buf = nvim_create_buf(v:false, v:true)
" create the lines to draw a box
let horizontal_border = '+' . repeat('-', width - 2) . '+'
let empty_line = '|' . repeat(' ', width - 2) . '|'
let lines = flatten([horizontal_border, map(range(height-2), 'empty_line'), horizontal_border])
" set the box in the buffer
call nvim_buf_set_lines(buf, 0, -1, v:false, lines)
" Create the lines for the centered message and put them in the buffer
let offset = 0
for line in a:message
let start_col = (width - len(line))/2
let end_col = start_col + len(line)
let current_row = height/2-len(a:message)/2 + offset
let offset = offset + 1
call nvim_buf_set_text(buf, current_row, start_col, current_row, end_col, [line])
endfor
" Set mappings in the buffer to close the window easily
let closingKeys = ['<Esc>', '<CR>', '<Leader>']
for closingKey in closingKeys
call nvim_buf_set_keymap(buf, 'n', closingKey, ':close<CR>', {'silent': v:true, 'nowait': v:true, 'noremap': v:true})
endfor
" Create the floating window
let ui = nvim_list_uis()[0]
let opts = {'relative': 'editor',
\ 'width': width,
\ 'height': height,
\ 'col': (ui.width/2) - (width/2),
\ 'row': (ui.height/2) - (height/2),
\ 'anchor': 'NW',
\ 'style': 'minimal',
\ }
let win = nvim_open_win(buf, 1, opts)
" Change highlighting
" call nvim_win_set_option(win, 'winhl', 'Normal:ErrorFloat')
highlight CustomFloatingWindow ctermbg=11 guibg=black ctermfg=10 guifg=red
call nvim_win_set_option(win, 'winhl', 'Normal:CustomFloatingWindow')
endfunction
" let windowHabitsKeys = [",tm"]
" let windowHabitsMessage = ["USE < ,fw > INSTEAD", "BREAK BAD HABITS"]
" call s:createHabitsMappings(windowHabitsKeys, windowHabitsMessage)