Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (33 sloc) 1.09 KB
# emacs like keybind
window class_not: ['tilix', 'emacs'] do
remap 'C-b', to: 'Left'
remap 'C-f', to: 'Right'
remap 'C-p', to: 'Up'
remap 'C-n', to: 'Down'
remap 'C-a', to: 'Home'
remap 'C-e', to: 'End'
remap 'C-k', to: ['Shift-End', 'Ctrl-x']
remap 'C-d', to: 'Delete'
remap 'M-d', to: 'Ctrl-Delete'
remap 'M-w', to: 'Ctrl-c'
remap 'C-y', to: 'Ctrl-v'
remap 'C-w', to: 'Ctrl-x'
remap 'C-v', to: 'Page_Down'
remap 'M-v', to: 'Page_Up'
remap 'C-s', to: 'Ctrl-f'
# actually these are vim insert mode bindings, but compatible with shell
remap 'C-u', to: ['Shift-Home', 'Ctrl-x']
remap 'C-w', to: ['Ctrl-Shift-Left', 'Ctrl-x']
end
window class_only: 'google-chrome' do
%w[a z x c v w t f l].each do |key|
remap "Alt-#{key}", to: "C-#{key}"
end
end
define :activate do |wm_class, command|
execute("wmctrl -x -a #{wm_class.shellescape} || #{command.shellescape}")
end
# Check WM_CLASS by wmctrl -x -l
remap 'C-M-c', to: activate('google-chrome.Google-chrome', 'chrome')
remap 'C-M-t', to: activate('tilix.Tilix', 'tilix')
remap 'C-M-e', to: activate('emacs.Emacs', 'emacs')