2024-03-01 16:28:35 -05:00
"============================================================="
" "
" Darkcloud Neovim Config: keyboard settings "
" "
" By: Kevin MacMartin (prurigro@gmail.com) "
" Website: https://github.com/prurigro/darkcloud-nvimconfig "
" "
" License: MIT "
" "
"============================================================="
2014-02-20 23:24:20 -05:00
"
2018-03-14 11:38:51 -04:00
"Mappings:
2014-03-28 22:12:13 -04:00
" (mouse)
2022-06-08 14:12:50 -04:00
" <Ctrl-ScrollUp> | (A) -> scroll left
" <Alt-ScrollUp> | (A) -> scroll left
" <Shift-ScrollUp> | (A) -> scroll left
" <Ctrl-ScrollDown> | (A) -> scroll right
" <Alt-ScrollDown> | (A) -> scroll right
" <Shift-ScrollDown> | (A) -> scroll right
2014-04-14 08:08:26 -04:00
"
2014-06-12 19:18:16 -04:00
" <MiddleClick> | (A) -> selects from the cursor
" <Ctrl-LeftClick> | (A) -> selects from the cursor
" <Alt-LeftClick> | (A) -> select the line being clicked
" <Ctrl-Alt-LeftClick> | (A) -> select the paragraph being clicked
2014-04-11 11:45:29 -04:00
"
2014-10-29 07:15:02 -04:00
" <Ctrl-RightClick> | (A) -> copy selection or character under cursor
" <Ctrl-MiddleClick> | (A) -> copy selection or character under cursor
2014-06-12 19:18:16 -04:00
"
2014-10-29 07:15:02 -04:00
" <Alt-RightClick> | (A) -> cut selection or character under cursor
" <Alt-MiddleClick> | (A) -> cut selection or character under cursor
2014-06-12 19:18:16 -04:00
"
2014-06-09 17:15:05 -04:00
" <Ctrl-Alt-RightClick> | (A) -> paste at the cursor (not mouse)
" <Ctrl-Alt-MiddleClick> | (A) -> paste at the cursor (not mouse)
2014-03-28 22:12:13 -04:00
"
2024-03-01 21:59:23 -05:00
" (terminal)
" <Esc> | (T) -> leave edit mode
"
2014-03-28 22:12:13 -04:00
" (tabs)
2024-03-05 21:57:59 -05:00
" <Ctrl-n> | (N) -> go to the next open tab
" <Ctrl-p> | (N) -> go to the previous open tab
" <Ctrl-t> | (N) -> open a new tab
2014-03-28 22:12:13 -04:00
"
2014-10-31 01:22:22 -04:00
" (split)
" <Ctrl-w>] | (N) -> split vertically
" <Ctrl-w>[ | (N) -> split horizontally
2024-03-28 17:44:30 -04:00
"
" (rotate)
" <Ctrl-w>{ | (N) -> rotate counter-clockwise
" <Ctrl-w>} | (N) -> rotate clockwise
2014-10-31 01:22:22 -04:00
"
2014-10-22 03:41:50 -04:00
" (display)
2014-10-27 07:52:44 -04:00
" <Backspace> | (N) -> reset window and clear search
2014-10-22 03:41:50 -04:00
" // | (N) -> reset window and clear search
2014-10-29 07:15:02 -04:00
" n | (N) -> center vertically on next search term
" N | (N) -> center vertically on last search term
" * | (N) -> center vertically on nth next search term
" # | (N) -> center vertically on nth last search term
2014-10-22 03:41:50 -04:00
"
2014-06-13 00:58:13 -04:00
" (toggles and features)
2024-03-05 18:14:53 -05:00
" <Leader>d | (N) -> VCS vimdiff in a new tab with signify
"
2014-11-06 13:17:57 -05:00
" ik | (N) -> add cursor character as a keyword
" iK | (N) -> remove cursor character as a keyword
"
2024-03-28 17:44:30 -04:00
" ` | (N) -> toggle the gutter
" ~ | (N) -> toggle folds
2014-06-13 00:58:13 -04:00
"
2014-07-20 21:17:26 -04:00
" <F1> | (A) -> toggle line wrapping
" <F2> | (A) -> toggle spell check
" <F3> | (A) -> toggle external-paste mode
" <F4> | (A) -> toggle syntax checking
2022-04-15 01:04:33 -04:00
"
2024-03-01 16:28:35 -05:00
" <F11> | (N) -> toggle git commit history
" <Leader>[ | (N) -> toggle git commit history
2024-03-06 02:08:39 -05:00
" <F12> | (N) -> toggle the vista sidebar
" <Leader>] | (N) -> toggle the vista sidebar
2022-04-15 01:04:33 -04:00
" <Leader><Leader> | (N) -> toggle the location list
2014-06-25 02:47:29 -04:00
"
" (spellcheck)
" ?+ | (N) -> add the selected word to the local dictionary
" ?? | (N) -> show spelling suggestions for selected word
" ?N | (N) -> go to the next spelling mistake
" ?P | (N) -> go to the previous spelling mistake
2014-03-28 22:12:13 -04:00
"
2014-07-31 01:53:33 -04:00
" (copy/paste and undo/redo)
" <Leader>p | (N) -> view the paste buffers and register contents
" P | (V) -> save selection to the buffer and paste over
" p | (V) -> preserve the buffer pasting over selected text
"
2024-03-01 16:28:35 -05:00
" (delete/cut operations that don't replace the paste buffer)
" <Leader>x | (N) -> delete the char(s) under and the cursor
" <Leader>x | (V) -> delete the currently selected text
" <Leader>X | (N) -> delete the char(s) before the cursor
" <Leader>X | (V) -> delete the currently selected lines
" <Leader>D | (N) -> delete from the cursor to EOL
" <Leader>D | (V) -> delete the currently selected lines
" <Leader>dw | (N) -> delete from the cursor to end of the word
" <Leader>dd | (N) -> delete current line
" <Leader>d | (V) -> delete selected text
2014-07-31 01:53:33 -04:00
"
2018-03-13 11:32:04 -04:00
" (fixing-and-formatting)
2014-12-10 23:26:38 -05:00
" <Leader>J | (N) -> split document into lines of tw or 80
" <Leader>J | (V) -> split selection into lines of tw or 80
2014-06-25 02:47:29 -04:00
" <Leader>f | (N) -> format document and return to cursor
" <Leader>f | (V) -> format the selection and return to cursor
2018-03-13 11:32:04 -04:00
" <Leader>F | (N) -> run available ale fixers on the document
2014-06-25 02:47:29 -04:00
" <Leader>t | (N) -> convert tabs into spaces
2014-10-22 03:41:50 -04:00
" <Leader>T | (N) -> convert spaces into tabs
" <Leader>w | (N) -> remove whitespace
2014-06-09 17:15:05 -04:00
" <Tab> | (V) -> indent all the lines currently selected
" <Tab> | (N) -> indent the current line
2024-03-19 21:25:30 -04:00
" <Shift-Tab> | (V) -> unindent all the lines currently selected
" <Shift-Tab> | (N) -> unindent the current line
2024-03-05 21:34:28 -05:00
" [<Space> | (N) -> insert a blank line above the current one
" ]<Space> | (N) -> insert a blank line below the current one
2014-02-20 23:24:20 -05:00
"
2021-09-17 15:24:17 -04:00
" (macros)
" ' | (N) -> run a macro
"
2014-03-28 22:12:13 -04:00
" (movement)
2014-07-28 06:08:10 -04:00
" = | (N) -> go to the first char on the next line
" _ | (N) -> go to the first char on the previous line
2016-03-24 16:07:11 -04:00
"
2016-03-24 16:24:21 -04:00
" <Ctrl-Up> | (N) -> move four lines up
" <Ctrl-Down> | (N) -> move four lines down
2024-10-16 22:02:17 -04:00
" <Ctrl-k> | (N) -> move four lines up
" <Ctrl-j> | (N) -> move four lines down
2024-10-16 21:42:08 -04:00
"
2016-03-24 16:24:21 -04:00
" <Ctrl-Right> | (N) -> move one word right
" <Ctrl-Left> | (N) -> move one word left
2024-10-16 22:02:17 -04:00
" <Ctrl-l> | (N) -> move one word right
" <Ctrl-h> | (N) -> move one word left
2016-03-24 16:24:21 -04:00
"
2024-10-16 21:57:16 -04:00
" <Alt-k> | (A) -> move the screen up
" <Alt-j> | (A) -> move the screen down
" <Alt-l> | (A) -> move the screen to the right
" <Alt-h> | (A) -> move the screen to the left
2016-03-24 16:07:11 -04:00
"
2014-06-26 07:35:39 -04:00
" <Shift-Up> | (N) -> move to the beginning of the document
" <Shift-Down> | (N) -> move to the end of the document
" <Shift-Right> | (N) -> move to the end of the line
" <Shift-Left> | (N) -> move to the beginning of the non-whitespace
2014-06-09 17:15:05 -04:00
"
2024-03-05 15:53:12 -05:00
" ]g | (N) -> next difference (vimdiff/signify)
" [g | (N) -> previous difference (vimdiff/signify)
2014-06-09 17:15:05 -04:00
" >> | (N) -> next difference (vimdiff/signify)
" << | (N) -> previous difference (vimdiff/signify)
2014-04-07 10:04:48 -04:00
"
2024-03-13 18:14:17 -04:00
" [[ | (N) -> jump to previous issue in the location list (qf.nvim)
" ]] | (N) -> jump to the next issue in the location list (qf.nvim)
"
2014-03-28 22:12:13 -04:00
" (selection)
2014-06-09 17:15:05 -04:00
" <Ctrl-a> | (N) -> select all text
" <Ctrl-a> | (V) -> select all text
2014-04-03 06:17:16 -04:00
"
2014-06-26 07:35:39 -04:00
" <Shift-Up> | (V) -> select all text above
" <Shift-Down> | (V) -> select all text below
" <Shift-Right> | (V) -> select all text to the right
" <Shift-Left> | (V) -> select all text to the left up to the indent
2014-04-03 06:17:16 -04:00
"
2014-06-26 07:35:39 -04:00
" <Ctrl-Up> | (V) -> select four lines up
" <Ctrl-Down> | (V) -> select four lines down
" <Ctrl-Right> | (V) -> select one word right
" <Ctrl-Left> | (V) -> select one word left
2014-02-20 23:24:20 -05:00
"
2024-03-19 21:25:30 -04:00
"File type Specific Mappings:
2014-04-05 03:20:53 -04:00
" (help)
2014-06-09 17:15:05 -04:00
" q | (A) -> close the dialog
Tons of changes all in one commit because I'd broken a commit a while
back and opted to simply reverse them all- Lots of colour changes, the
update script now removes decommissioned bundles, gentags script can now
have additional paths added to it when generating a tags file, README is
much improved, fixed a few issues that required remapping some toggles,
fixed a bunch of issues with the colourscheme between the terminal and
gvim. You can now setup a custom config file to have loaded after the
darkcloud-vimconfig ones, and there's a custom location for pathogen
modules too, to make things tidier without necessarily needing to use
an additional runtimepath. You can also create a file in your home
directory to assign filetypes to programs, for use with the file
manager. A file can be placed in ~/.vim/ with file associations and
prorams to launch them with. The file manager will also open a file with
vim by hitting shift+enter, since e isn't all that comfortablly placed.
The vimrc can now also point to the darkcloud-vimconfig folder, rather
than relying on the vim folder being in a specific location, and the
after folder is now configured to work in the project too.
2014-04-04 19:49:02 -04:00
"
2022-04-15 01:04:33 -04:00
" (error/location list)
2014-06-09 17:15:05 -04:00
" <Left> | (A) -> up
" <Right> | (A) -> down
" l | (A) -> k
2022-04-15 01:04:33 -04:00
" h | (A) -> j
" <LClick><LClick> | (A) -> select entry
" <Space> | (A) -> select entry but remain in qf sidebar
" q | (A) -> close the list
2014-04-08 00:13:03 -04:00
"
2014-04-09 13:04:34 -04:00
" (vimdiff)
2014-06-09 17:15:05 -04:00
" <Leader><> | (N) -> update differences
2014-10-26 21:45:38 -04:00
" <Leader>,. | (N) -> update differences
2014-06-09 17:15:05 -04:00
" <Leader>>< | (N) -> update differences
2014-10-26 21:45:38 -04:00
" <Leader>., | (N) -> update differences
2014-06-09 17:15:05 -04:00
" <Leader>> | (N) -> replace diff in other pane with current pane
2014-10-22 03:41:50 -04:00
" <Leader>. | (N) -> replace diff in other pane with current pane
2024-03-06 15:23:20 -05:00
" <Leader>< | (N) -> replace diff in current pane with other pane
" <Leader>, | (N) -> replace diff in current pane with other pane
2014-06-09 17:15:05 -04:00
"DISABLED DEFAULT MAPPING: UNSET SHORTCUTS {{{
2014-06-13 00:58:13 -04:00
"-unmapping tabbing from < and > for use with diff
"+these commands are replaced by tab and shift+tab
2014-06-09 17:15:05 -04:00
noremap > < Nop >
noremap < < Nop >
2014-06-13 00:58:13 -04:00
2024-03-05 21:57:59 -05:00
"-unmapping help from F1, Alt-F1 and Ctrl-F1
2014-06-13 00:58:13 -04:00
map < F1 > < Nop >
2014-06-25 02:47:29 -04:00
map < A - F1 > < Nop >
2014-06-13 00:58:13 -04:00
map < C - F1 > < Nop >
2014-07-17 09:59:47 -04:00
2014-08-07 23:03:22 -04:00
"-unmap the suspend function
map < C - z > < Nop >
2015-09-18 16:09:44 -04:00
"-unmap ex mode
nnoremap Q < Nop >
2019-12-02 11:54:38 -05:00
"unmap shift+k opening help
nnoremap < S - k > < Nop >
2014-06-09 17:15:05 -04:00
"}}}
2014-02-20 23:24:20 -05:00
2024-03-19 21:25:30 -04:00
"MAPPINGS: GENERAL KEYBINDINGS AND REBINDING {{{
2014-04-03 23:00:34 -04:00
"MOUSE:{
2014-04-07 00:41:03 -04:00
"hold ctrl to scroll left/right instead of up/down
2022-06-08 14:12:50 -04:00
noremap < C - ScrollWheelUp > 4 zh
nnoremap < C - ScrollWheelUp > 4 zh
xnoremap < C - ScrollWheelUp > 4 zh
snoremap < C - ScrollWheelUp > 4 zh
vnoremap < C - ScrollWheelUp > 4 zh
inoremap < C - ScrollWheelUp > < C - O > 4 zh
noremap < A - ScrollWheelUp > 4 zh
nnoremap < A - ScrollWheelUp > 4 zh
xnoremap < A - ScrollWheelUp > 4 zh
snoremap < A - ScrollWheelUp > 4 zh
vnoremap < A - ScrollWheelUp > 4 zh
inoremap < A - ScrollWheelUp > < C - O > 4 zh
noremap < S - ScrollWheelUp > 4 zh
nnoremap < S - ScrollWheelUp > 4 zh
xnoremap < S - ScrollWheelUp > 4 zh
snoremap < S - ScrollWheelUp > 4 zh
vnoremap < S - ScrollWheelUp > 4 zh
inoremap < S - ScrollWheelUp > < C - O > 4 zh
noremap < C - ScrollWheelDown > 4 zl
nnoremap < C - ScrollWheelDown > 4 zl
xnoremap < C - ScrollWheelDown > 4 zl
snoremap < C - ScrollWheelDown > 4 zl
vnoremap < C - ScrollWheelDown > 4 zl
inoremap < C - ScrollWheelDown > < C - O > 4 zl
noremap < A - ScrollWheelDown > 4 zl
nnoremap < A - ScrollWheelDown > 4 zl
xnoremap < A - ScrollWheelDown > 4 zl
snoremap < A - ScrollWheelDown > 4 zl
vnoremap < A - ScrollWheelDown > 4 zl
inoremap < A - ScrollWheelDown > < C - O > 4 zl
noremap < S - ScrollWheelDown > 4 zl
nnoremap < S - ScrollWheelDown > 4 zl
xnoremap < S - ScrollWheelDown > 4 zl
snoremap < S - ScrollWheelDown > 4 zl
vnoremap < S - ScrollWheelDown > 4 zl
inoremap < S - ScrollWheelDown > < C - O > 4 zl
2022-06-08 13:51:27 -04:00
2014-06-12 19:18:16 -04:00
"middle & ctrl+left = select from cursor
nnoremap < MiddleMouse > < RightMouse >
xnoremap < MiddleMouse > < RightMouse >
2015-01-22 21:42:12 -05:00
snoremap < MiddleMouse > < RightMouse >
vnoremap < MiddleMouse > < RightMouse >
2014-06-16 01:52:53 -04:00
inoremap < MiddleMouse > < RightMouse >
2015-01-22 21:42:12 -05:00
2014-06-12 19:18:16 -04:00
nnoremap < C - LeftMouse > < RightMouse >
xnoremap < C - LeftMouse > < RightMouse >
2015-01-22 21:42:12 -05:00
snoremap < C - LeftMouse > < RightMouse >
vnoremap < C - LeftMouse > < RightMouse >
2014-06-16 01:52:53 -04:00
inoremap < C - LeftMouse > < RightMouse >
2014-06-12 19:18:16 -04:00
"alt+left = line
nnoremap < A - LeftMouse > < LeftMouse > V
xnoremap < A - LeftMouse > < RightMouse > $
2015-01-22 21:42:12 -05:00
snoremap < A - LeftMouse > < RightMouse > $
vnoremap < A - LeftMouse > < RightMouse > $
2014-06-12 19:18:16 -04:00
inoremap < A - LeftMouse > < Esc > < LeftMouse > V
2014-04-11 11:45:29 -04:00
2014-06-12 19:18:16 -04:00
"ctrl+alt+left = select paragraph
nnoremap < C - A - LeftMouse > < LeftMouse > vip
xnoremap < C - A - LeftMouse > < RightMouse > ip $
2015-01-22 21:42:12 -05:00
snoremap < C - A - LeftMouse > < RightMouse > ip $
vnoremap < C - A - LeftMouse > < RightMouse > ip $
2014-06-12 19:18:16 -04:00
inoremap < C - A - LeftMouse > < Esc > < LeftMouse > vip
"ctrl+(middle/right) = copy
2014-04-18 05:12:35 -04:00
nnoremap < C - RightMouse > < LeftMouse > Vy
2015-01-22 21:42:12 -05:00
xnoremap < C - RightMouse > y
snoremap < C - RightMouse > y
2014-04-18 05:12:35 -04:00
vnoremap < C - RightMouse > y
2014-06-12 19:18:16 -04:00
inoremap < C - RightMouse > < C -0 > y
2015-01-22 21:42:12 -05:00
2014-06-12 19:18:16 -04:00
nnoremap < C - MiddleMouse > < LeftMouse > Vy
2015-01-22 21:42:12 -05:00
xnoremap < C - MiddleMouse > y
snoremap < C - MiddleMouse > y
2014-04-18 05:12:35 -04:00
vnoremap < C - MiddleMouse > y
2014-06-12 19:18:16 -04:00
inoremap < C - MiddleMouse > < C -0 > y
2014-04-18 05:12:35 -04:00
2014-06-12 19:18:16 -04:00
"alt+(middle/right) = cut
2014-04-18 05:12:35 -04:00
nnoremap < A - RightMouse > x
xnoremap < A - RightMouse > x
2015-01-22 21:42:12 -05:00
snoremap < A - RightMouse > x
vnoremap < A - RightMouse > x
2014-04-18 05:12:35 -04:00
inoremap < A - RightMouse > < C - O > x
2015-01-22 21:42:12 -05:00
2014-06-12 19:18:16 -04:00
nnoremap < A - MiddleMouse > x
xnoremap < A - MiddleMouse > x
2015-01-22 21:42:12 -05:00
snoremap < A - MiddleMouse > x
vnoremap < A - MiddleMouse > x
2014-04-18 05:12:35 -04:00
inoremap < A - MiddleMouse > < C - O > x
2014-06-12 19:18:16 -04:00
"ctrl+alt+(middle/right) = paste
2014-04-18 05:12:35 -04:00
nnoremap < C - A - RightMouse > p
xnoremap < C - A - RightMouse > p
2015-01-22 21:42:12 -05:00
snoremap < C - A - RightMouse > p
vnoremap < C - A - RightMouse > p
2014-04-18 05:12:35 -04:00
inoremap < C - A - RightMouse > < C - O > p
2015-01-22 21:42:12 -05:00
2014-06-12 19:18:16 -04:00
nnoremap < C - A - MiddleMouse > p
xnoremap < C - A - MiddleMouse > p
2015-01-22 21:42:12 -05:00
snoremap < C - A - MiddleMouse > p
vnoremap < C - A - MiddleMouse > p
2014-04-18 05:12:35 -04:00
inoremap < C - A - MiddleMouse > < C - O > p
2014-04-03 23:00:34 -04:00
"}
2024-03-01 21:59:23 -05:00
"TERMINAL:{
tnoremap < Esc > < C - \> < C - n >
"}
2014-04-03 23:00:34 -04:00
"TABS:{
2024-03-05 21:57:59 -05:00
nnoremap < silent > < expr > < C - n > ':tabnext<CR>'
nnoremap < silent > < expr > < C - p > ':tabprev<CR>'
nnoremap < silent > < expr > < C - t > ':tabnew<CR>'
2014-04-03 23:00:34 -04:00
"}
2014-10-31 01:22:22 -04:00
"SPLIT:{
nmap < expr > < silent > < C - w > ] ':vs<CR>'
nmap < expr > < silent > < C - w > [ ':sp<CR>:wincmd j<CR>'
2024-03-28 17:44:30 -04:00
"}
"ROTATE:{
nmap < expr > < silent > < C - w > { ':wincmd R<CR>'
nmap < expr > < silent > < C - w > } ':wincmd r<CR>'
2014-10-31 01:22:22 -04:00
"}
2014-10-22 03:41:50 -04:00
"DISPLAY:{
"clear search and reset buffer
2014-10-27 07:52:44 -04:00
nnoremap < silent > < expr > < BackSpace > ':noh<CR>:redraw!<CR>'
2014-10-22 03:41:50 -04:00
nnoremap < silent > < expr > // ':noh<CR>:redraw!<CR>'
2014-10-29 07:15:02 -04:00
"keep the currently highlighted term in a search vertically centered
nnoremap < silent > n nzz
nnoremap < silent > N Nzz
nnoremap < silent > * *zz
nnoremap < silent > # #zz
2014-10-22 03:41:50 -04:00
"}
2014-06-13 00:58:13 -04:00
"TOGGLES AND FEATURES:{
2024-03-05 18:14:53 -05:00
"VCS vimdiff in a new tab with signify
nnoremap < silent > < expr > < Leader > d ':SignifyDiff<CR>'
2014-11-06 13:17:57 -05:00
"add/remove cursor character as a keyword
nmap < expr > < silent > < Leader > k ':execute "setlocal iskeyword+=".getline(".")[col(".")-1]<CR>:echo "The character ".getline(".")[col(".")-1]." has been added to iskeyword"<CR>'
nmap < expr > < silent > < Leader > K ':execute "setlocal iskeyword-=".getline(".")[col(".")-1]<CR>:echo "The character ".getline(".")[col(".")-1]." has been removed from iskeyword"<CR>'
2024-03-28 17:44:30 -04:00
"toggle the gutter
2023-01-05 17:26:21 -05:00
nnoremap < silent > < expr > ` ':if (&number)<Bar>set nonumber<Bar>if exists("b:sy")<Bar>SignifyDisable<Bar>endif<Bar>else<Bar>set number<Bar>if exists("b:sy")<Bar>SignifyEnable<Bar>endif<Bar>endif<CR>:echo "gutter visibility toggled"<CR>'
2014-04-07 00:41:03 -04:00
2024-03-28 17:44:30 -04:00
"toggle the fold sidebar
2024-04-02 22:27:30 -04:00
function ! FoldToggle ( )
if ( &foldcolumn = = 0 )
set foldenable
set foldcolumn = 1
normal zR
else
set nofoldenable
set foldcolumn = 0
endif
endfunction
nnoremap < silent > < expr > ~ ':call FoldToggle()<CR>'
2014-04-07 00:41:03 -04:00
2014-06-13 00:58:13 -04:00
"toggle line wrapping (and bottom bar if using the gui)
2014-07-20 21:17:26 -04:00
nnoremap < silent > < expr > < F1 > ':set wrap!<CR>:echo "line wrapping toggled"<CR>'
xnoremap < silent > < expr > < F1 > '<Esc>:set wrap!<CR>gv'
inoremap < silent > < expr > < F1 > '<C-O>:set wrap!<CR>'
2014-06-17 08:19:40 -04:00
2014-07-26 03:14:40 -04:00
"toggle show spelling errors
2015-05-07 12:37:40 -04:00
nnoremap < silent > < expr > < F2 > ':set spell!<CR>:if &spell =~ "0"<Bar>echo "spellcheck toggled off"<Bar>else<Bar>echo "spellcheck toggled on"<Bar>endif<CR>'
2014-07-20 21:17:26 -04:00
xnoremap < silent > < expr > < F2 > '<Esc>:set spell!<CR>gv'
inoremap < silent > < expr > < F2 > '<C-O>:set spell!<CR>'
2014-06-13 00:58:13 -04:00
2014-06-17 08:19:40 -04:00
"toggle external-paste mode
2023-04-21 14:02:29 -04:00
nnoremap < silent > < expr > < F3 > ':if &paste<Bar>set paste!<Bar>else<Bar>set paste<Bar>endif<CR>'
2014-07-20 21:17:26 -04:00
"toggle syntax checking
2018-03-13 22:50:50 -04:00
function ! ToggleAle ( )
ALEToggle
if g :ale_enabled
set scl = yes
else
set scl = auto
endif
endfunction
nnoremap < silent > < expr > < F4 > ':call ToggleAle()<CR>'
xnoremap < silent > < expr > < F4 > '<Esc>:call ToggleAle()<CR>gv'
inoremap < silent > < expr > < F4 > '<C-O>:call ToggleAle()<CR>'
2022-04-15 01:04:33 -04:00
"view commit history and diffs
2024-03-01 16:28:35 -05:00
nnoremap < expr > < silent > < F11 > ':vs<CR>:0Gclog<CR>:wincmd b<CR>'
nnoremap < silent > < expr > < Leader > [ ':vs<CR>:0Gclog<CR>:wincmd b<CR>'
2022-04-15 01:04:33 -04:00
2024-03-06 02:08:39 -05:00
"bindings to trigger the vista list of tags
nnoremap < silent > < expr > < F12 > ':Vista!!<CR>'
nnoremap < silent > < expr > < Leader > ] ':Vista!!<CR>'
2022-04-15 01:04:33 -04:00
"toggle the location list
2024-03-13 18:14:17 -04:00
nnoremap < Leader > < Leader > < cmd > lua require ( 'qf' ) .toggle ( 'l' , false ) < CR >
2014-06-25 02:47:29 -04:00
"}
"SPELLCHECK:{
2024-03-19 21:25:30 -04:00
"add the selected misspelled word to the local dictionary
2014-06-25 02:47:29 -04:00
nnoremap ?+ zg
2024-03-19 21:25:30 -04:00
"display a list of suggestions for the selected misspelled word
2020-12-18 12:02:33 -05:00
nnoremap ?? hea < C - X > s
2014-06-25 02:47:29 -04:00
2024-03-19 21:25:30 -04:00
"go to the next misspelled word
2014-06-25 02:47:29 -04:00
nnoremap ?N ]s
2024-03-19 21:25:30 -04:00
"go to the previous misspelled word
2014-06-25 02:47:29 -04:00
nnoremap ?P [s
2014-04-03 23:00:34 -04:00
"}
2014-07-31 01:53:33 -04:00
"COPY PASTE AND UNDO REDO:{
"display contents of paste buffers
nnoremap < silent > < expr > < Leader > p ':reg<CR>'
"P pastes and replaces the buffer, p pastes and keeps it
vnoremap P p
2024-03-17 17:47:58 -04:00
vnoremap p P
2014-07-31 01:53:33 -04:00
2022-04-15 01:04:33 -04:00
"delete/cut operations that don't replace the paste buffer
2014-07-31 01:53:33 -04:00
nnoremap < Leader > x "_x
vnoremap < Leader > x "_x
nnoremap < Leader > X "_X
vnoremap < Leader > X "_X
nnoremap < Leader > D "_D
vnoremap < Leader > D "_D
nnoremap < Leader > dd "_dd
nnoremap < Leader > dw "_dw
vnoremap < Leader > d "_d
"}
2018-03-13 11:32:04 -04:00
"FIXING AND FORMATTING:{
2014-10-21 11:04:17 -04:00
"format width to text width (or 80 chars if text width is 0)
nnoremap < silent > < expr > < Leader > J ':let b:tw=&textwidth<CR>:if (b:tw == 0)<Bar>set tw=80<Bar>endif<CR>gg0vG$gq:if (b:tw == 0)<Bar>set tw=0<Bar>let b:tw=80<Bar>endif<CR>:echo "Document has been formatted to a width of ".b:tw." characters"<CR>'
vnoremap < silent > < expr > < Leader > J '<Esc>:let b:tw=&textwidth<CR>:if (b:tw == 0)<Bar>set tw=80<Bar>endif<CR>gvgq:if (b:tw == 0)<Bar>set tw=0<Bar>let b:tw=80<Bar>endif<CR>:echo "Selection has been formatted to a width of ".b:tw." characters"<CR>'
2018-03-13 11:32:04 -04:00
"format by Vim syntax
2014-06-25 02:47:29 -04:00
nnoremap < Leader > f mzgg = G `z < CR > :echo "The document has been formatted" < CR >
vnoremap < Leader > f mz = `z < CR > :echo "The selection has been formatted" < CR >
2014-10-21 11:04:17 -04:00
2018-03-13 11:32:04 -04:00
"fix with ale
nnoremap < silent > < expr > < Leader > F ':ALEFix<CR>:echo "Available ale fixers have been run on the document"<CR>'
2014-10-22 03:41:50 -04:00
"convert tabs to spaces and spaces to tabs
2015-04-06 12:36:19 -04:00
nnoremap < silent > < expr > < Leader > t ':let b:et=&expandtab<CR>:set expandtab<CR>:retab!<CR>:let &expandtab=b:et<CR>:echo "Tabs have been converted to spaces"<CR>'
nnoremap < silent > < expr > < Leader > T ':let b:et=&expandtab<CR>:set noexpandtab<CR>:%retab!<CR>:let &expandtab=b:et<CR>:echo "Spaces have been converted to tabs"<CR>'
2014-10-22 03:41:50 -04:00
"remove trailing whitespace
2014-06-25 02:47:29 -04:00
nnoremap < silent > < expr > < Leader > w ':FixWhitespace<CR>:echo "Trailing whitespace has been removed"<CR>'
2014-10-21 11:04:17 -04:00
2024-03-19 21:25:30 -04:00
"indent and unindent the currently selected lines
2014-04-07 00:41:03 -04:00
vnoremap < Tab > > gv
nnoremap < Tab > v > gv < Esc >
vnoremap < S - Tab > < gv
nnoremap < S - Tab > v < gv < Esc >
2024-03-05 21:34:28 -05:00
"insert blank lines above and below the current one
nnoremap < silent > ]< Space > :< C - u > call append ( line ( "." ) , repeat ( ["" ], v :count1 ) ) < CR >
nnoremap < silent > [< Space > :< C - u > call append ( line ( "." ) -1 , repeat ( ["" ], v :count1 ) ) < CR >
2014-04-03 23:00:34 -04:00
"}
2021-09-17 15:24:17 -04:00
"MACROS:{
nnoremap ' @
"}
2014-04-03 23:00:34 -04:00
"MOVEMENT:{
2014-04-07 00:41:03 -04:00
"additional mappings for easier access
nnoremap = +
2014-07-28 06:08:10 -04:00
nnoremap _ -
2014-04-07 00:41:03 -04:00
2024-10-16 21:42:08 -04:00
"map ctrl+up/down to moving the cursor up and down by 4 lines
2016-03-24 16:24:21 -04:00
nnoremap < C - Up > 4 k
nnoremap < C - Down > 4 j
2024-10-16 22:02:17 -04:00
nnoremap < C - k > 4 k
nnoremap < C - j > 4 j
2024-10-16 21:42:08 -04:00
"map ctrl+right/left to moving the cursor left and right by one word
2016-03-24 16:24:21 -04:00
nnoremap < C - Right > < S - Right >
nnoremap < C - Left > < S - Left >
2024-10-16 22:02:17 -04:00
nnoremap < C - l > < S - Right >
nnoremap < C - h > < S - Left >
2016-03-24 16:24:21 -04:00
2024-10-16 21:42:08 -04:00
"map alt+direction to moving the viewport in that direction
2024-10-17 13:03:01 -04:00
noremap < A - Up > < ScrollWheelUp >
nnoremap < A - Up > < ScrollWheelUp >
xnoremap < A - Up > < ScrollWheelUp >
snoremap < A - Up > < ScrollWheelUp >
vnoremap < A - Up > < ScrollWheelUp >
inoremap < A - Up > < ScrollWheelUp >
noremap < A - Down > < ScrollWheelDown >
nnoremap < A - Down > < ScrollWheelDown >
xnoremap < A - Down > < ScrollWheelDown >
snoremap < A - Down > < ScrollWheelDown >
vnoremap < A - Down > < ScrollWheelDown >
inoremap < A - Down > < ScrollWheelDown >
noremap < A - Right > 4 zl
nnoremap < A - Right > 4 zl
xnoremap < A - Right > 4 zl
snoremap < A - Right > 4 zl
vnoremap < A - Right > 4 zl
inoremap < A - Right > < C - O > 4 zl
noremap < A - Left > 4 zh
nnoremap < A - Left > 4 zh
xnoremap < A - Left > 4 zh
snoremap < A - Left > 4 zh
vnoremap < A - Left > 4 zh
inoremap < A - Left > < C - O > 4 zh
2024-10-16 21:57:16 -04:00
noremap < A - k > < ScrollWheelUp >
nnoremap < A - k > < ScrollWheelUp >
xnoremap < A - k > < ScrollWheelUp >
snoremap < A - k > < ScrollWheelUp >
vnoremap < A - k > < ScrollWheelUp >
inoremap < A - k > < ScrollWheelUp >
noremap < A - j > < ScrollWheelDown >
nnoremap < A - j > < ScrollWheelDown >
xnoremap < A - j > < ScrollWheelDown >
snoremap < A - j > < ScrollWheelDown >
vnoremap < A - j > < ScrollWheelDown >
inoremap < A - j > < ScrollWheelDown >
noremap < A - l > 4 zl
nnoremap < A - l > 4 zl
xnoremap < A - l > 4 zl
snoremap < A - l > 4 zl
vnoremap < A - l > 4 zl
inoremap < A - l > < C - O > 4 zl
noremap < A - h > 4 zh
nnoremap < A - h > 4 zh
xnoremap < A - h > 4 zh
snoremap < A - h > 4 zh
vnoremap < A - h > 4 zh
inoremap < A - h > < C - O > 4 zh
2014-04-07 00:41:03 -04:00
"remap keys to scroll to the end in a direction
2014-06-26 07:35:39 -04:00
nnoremap < S - Up > gg0
nnoremap < S - Down > G $
nnoremap < S - Right > $
nnoremap < S - Left > ^
2014-04-07 00:41:03 -04:00
2014-04-07 12:05:52 -04:00
"move to next/previous difference (vimdiff/signify)
2024-03-05 15:53:12 -05:00
nmap ]g < plug > ( signify - next - hunk )
nmap [g < plug > ( signify - prev - hunk )
nmap > > ]g
nmap < < [g
2024-03-13 18:14:17 -04:00
"jump to the previous and next issues in the location list
nnoremap [[ < cmd > lua require ( 'qf' ) .above ( 'l' ) < CR >
nnoremap ]] < cmd > lua require ( 'qf' ) .below ( 'l' ) < CR >
2014-04-03 23:00:34 -04:00
"}
"SELECTION:{
2014-08-05 06:01:38 -04:00
"ctrl-a to select all
2014-04-07 00:41:03 -04:00
nnoremap < C - a > gg0vG $
xnoremap < C - a > < Esc > gg0vG $
"map remap keys for speedier text selection
2014-06-26 07:35:39 -04:00
xnoremap < C - Up > 4 k
xnoremap < C - Down > 4 j
xnoremap < C - Right > < S - Right >
xnoremap < C - Left > < S - Left >
2014-04-07 00:41:03 -04:00
"remap keys to select all text in one direction
2014-06-26 07:35:39 -04:00
xnoremap < S - Up > gg0
xnoremap < S - Down > G $
xnoremap < S - Right > $
xnoremap < S - Left > ^
2014-04-03 23:00:34 -04:00
"}
2014-03-28 22:12:13 -04:00
"}}}
2014-03-11 03:05:09 -04:00
Tons of changes all in one commit because I'd broken a commit a while
back and opted to simply reverse them all- Lots of colour changes, the
update script now removes decommissioned bundles, gentags script can now
have additional paths added to it when generating a tags file, README is
much improved, fixed a few issues that required remapping some toggles,
fixed a bunch of issues with the colourscheme between the terminal and
gvim. You can now setup a custom config file to have loaded after the
darkcloud-vimconfig ones, and there's a custom location for pathogen
modules too, to make things tidier without necessarily needing to use
an additional runtimepath. You can also create a file in your home
directory to assign filetypes to programs, for use with the file
manager. A file can be placed in ~/.vim/ with file associations and
prorams to launch them with. The file manager will also open a file with
vim by hitting shift+enter, since e isn't all that comfortablly placed.
The vimrc can now also point to the darkcloud-vimconfig folder, rather
than relying on the vim folder being in a specific location, and the
after folder is now configured to work in the project too.
2014-04-04 19:49:02 -04:00
"FILETYPE SPECIFIC MAPPINGS: {{{
2014-04-09 13:04:34 -04:00
"help
2014-04-17 12:35:49 -04:00
if ! &diff
autocmd FileType help map < buffer > < silent > < expr > q ':q<CR>'
endif
2014-04-09 13:04:34 -04:00
2022-04-15 01:04:33 -04:00
"error/location list
2014-04-09 13:04:34 -04:00
autocmd FileType qf map < buffer > < Left > < Up >
autocmd FileType qf map < buffer > < Right > < Down >
2022-04-15 01:04:33 -04:00
autocmd FileType qf map < buffer > l j
autocmd FileType qf map < buffer > h k
autocmd FileType qf map < buffer > < 2 - LeftMouse > < CR >
autocmd FileType qf map < buffer > < Space > < CR > < C - w > p
2024-03-13 18:14:17 -04:00
autocmd FileType qf map < buffer > < silent > < expr > q ':q<CR>'
2014-04-09 13:04:34 -04:00
2014-04-07 10:04:48 -04:00
"vimdiff
2014-10-26 21:45:38 -04:00
autocmd FilterWritePre * if &diff | nmap < buffer > < silent > < expr > < Leader > < > ':diffu<CR>' | endif
autocmd FilterWritePre * if &diff | nmap < buffer > < silent > < expr > < Leader > , . ':diffu<CR>' | endif
autocmd FilterWritePre * if &diff | nmap < buffer > < silent > < expr > < Leader > > < ':diffu<CR>' | endif
autocmd FilterWritePre * if &diff | nmap < buffer > < silent > < expr > < Leader > ., ':diffu<CR>' | endif
autocmd FilterWritePre * if &diff | nmap < buffer > < Leader > > dp | endif
autocmd FilterWritePre * if &diff | nmap < buffer > < Leader > . dp | endif
autocmd FilterWritePre * if &diff | nmap < buffer > < Leader > < do | endif
autocmd FilterWritePre * if &diff | nmap < buffer > < Leader > , do | endif
2014-04-07 10:04:48 -04:00
autocmd FilterWritePre * if &diff | cabbrev q ! qall ! | endif
Tons of changes all in one commit because I'd broken a commit a while
back and opted to simply reverse them all- Lots of colour changes, the
update script now removes decommissioned bundles, gentags script can now
have additional paths added to it when generating a tags file, README is
much improved, fixed a few issues that required remapping some toggles,
fixed a bunch of issues with the colourscheme between the terminal and
gvim. You can now setup a custom config file to have loaded after the
darkcloud-vimconfig ones, and there's a custom location for pathogen
modules too, to make things tidier without necessarily needing to use
an additional runtimepath. You can also create a file in your home
directory to assign filetypes to programs, for use with the file
manager. A file can be placed in ~/.vim/ with file associations and
prorams to launch them with. The file manager will also open a file with
vim by hitting shift+enter, since e isn't all that comfortablly placed.
The vimrc can now also point to the darkcloud-vimconfig folder, rather
than relying on the vim folder being in a specific location, and the
after folder is now configured to work in the project too.
2014-04-04 19:49:02 -04:00
"}}}
2024-03-19 21:25:30 -04:00
"MAPPINGS DISABLED FOR GIVEN FILE TYPES: {{{
2014-04-09 13:04:34 -04:00
"remove incompatible toggles from specific file types
2024-03-06 02:08:39 -05:00
autocmd Filetype help , qf , diff , vista noremap < buffer > < F11 > < Nop >
autocmd Filetype help , qf , diff , vista noremap < buffer > < Leader > [ < Nop >
autocmd Filetype help , qf , diff noremap < buffer > < F12 > < Nop >
autocmd Filetype help , qf , diff noremap < buffer > < Leader > ] < Nop >
2014-06-13 00:58:13 -04:00
"disable modifier keys with directions that would interfere with logic
2024-03-01 16:28:35 -05:00
autocmd Filetype qf noremap < buffer > < C - Up > < Nop >
autocmd Filetype qf noremap < buffer > < C - k > < Nop >
autocmd Filetype qf noremap < buffer > < C - Down > < Nop >
autocmd Filetype qf noremap < buffer > < C - j > < Nop >
autocmd Filetype qf noremap < buffer > < C - Right > < Nop >
autocmd Filetype qf noremap < buffer > < C - l > < Nop >
autocmd Filetype qf noremap < buffer > < C - Left > < Nop >
autocmd Filetype qf noremap < buffer > < C - h > < Nop >
autocmd Filetype qf noremap < buffer > < A - Up > < Nop >
autocmd Filetype qf noremap < buffer > < A - k > < Nop >
autocmd Filetype qf noremap < buffer > < A - Down > < Nop >
autocmd Filetype qf noremap < buffer > < A - j > < Nop >
autocmd Filetype qf noremap < buffer > < A - Right > < Nop >
autocmd Filetype qf noremap < buffer > < A - l > < Nop >
autocmd Filetype qf noremap < buffer > < A - Left > < Nop >
autocmd Filetype qf noremap < buffer > < A - h > < Nop >
autocmd Filetype qf noremap < buffer > < S - Up > < Nop >
autocmd Filetype qf noremap < buffer > < S - k > < Nop >
autocmd Filetype qf noremap < buffer > < S - Down > < Nop >
autocmd Filetype qf noremap < buffer > < S - j > < Nop >
autocmd Filetype qf noremap < buffer > < S - Right > < Nop >
autocmd Filetype qf noremap < buffer > < S - l > < Nop >
autocmd Filetype qf noremap < buffer > < S - Left > < Nop >
autocmd Filetype qf noremap < buffer > < S - h > < Nop >
2014-03-11 03:05:09 -04:00
"}}}