Commit Graph

61 Commits

Author SHA1 Message Date
fed62f3b6d vim:keys: Keep the cursor position when formatting
Quickly formatting multiple paragraphs is now not as simple as before,
but the benefits still prevail.
2023-01-08 14:04:13 +01:00
06c0d17fe4 vim:keys: Add <leader>v/ to search in visual selec 2022-12-29 19:55:02 +01:00
616988560a vim:keys: Add mapping for commit amending
Map `<leader>gca` to fugitives `G commit --amend`, as I use that quite
often.

Also change the normal commit mapping to use double `c`s for unambiguity
between the mappings and as I already got the habit of pressing `c`
twice to skip waiting `timeoutlen` (As the mapping was already
ambiguous with `<leader>gcd` for `:Gcd`).
2022-12-28 13:55:08 +01:00
dacd6d5de0 vim:keys:<leader>": Convert only pairs of quotes
When converting double to single quotes with `<leader>"`, only pairs of
quotes should be converted. This lowers the false positive rate by
trying to make sure that the double quotes are really used for string
quotation and not for something else (e.g. exactly these mappings).
2022-12-28 13:53:33 +01:00
fe669c0aa7 vim:keys: Add visual equivalent of substitute maps 2022-12-28 13:23:05 +01:00
731a290d7b vim:keys: Map <leader>" to s/"/'/g
I prefer single quotes when a language supports them for normal strings
(e.g. python & vimlang). Add this mapping for a quick conversion.
2022-12-28 12:57:13 +01:00
fd1cb36437 vim:keys: Rephrase wrap-move comment s/real/normal 2022-12-28 12:32:55 +01:00
46ec34826e vim:keys: Map display movements only when wrapping 2022-12-27 04:24:21 +01:00
3a7f06256f vim:keys: Keep selection when changing indentation 2022-12-25 22:42:22 +01:00
4c111c0e3b vim:keys: Make display-line movements the default
I'd rather have the movement mappings behave on display-lines to make it
easier when navigating in very long lines.
2022-12-22 10:55:16 +01:00
7a4e8e6df2 vim: Set only local value when cycling spelllang
When having multiple windows open, I want it to change only for the
current buffer/window.
2022-11-21 15:18:13 +01:00
b698873d2c vim:keys: Fix BCommits and G blame mapping clash 2022-10-21 00:52:45 +02:00
a94f72c4d9 vim:keys:<leader>*: Start vim's search too
Additionally to start the search with ripgrep, start a vim search as
well. That way navigation between search results in the opened file is
easier.

The register is modified directly and hlsearch is turned on manually
instead of using the builtin `*`, so that the cursor does not move to
the next result in the current file.
2022-10-21 00:45:47 +02:00
1aa6266200 vim:keys: Fix <leader>* for words starting w/ b
`<C-R><C-W>` inserts the cword, but skips over any character that were
already typed. This broke the search for words beginning with a `b`.
2022-10-21 00:39:21 +02:00
39e8b266d0 vim:keys: Add mapping to strip trailing whitespace 2022-10-16 01:57:16 +02:00
896970de81 vim:keys: Remove unused mappings to move lines 2022-10-13 18:48:35 +02:00
7be49e9318 vim:keys: Use RFC 3339 for vmap version of utc
Forgot to change the format for both mappings in 73aa0e9752
("vim:keys: Use RFC 3339 when converting unix times").
2022-10-13 18:29:30 +02:00
3b86618541 vim:keys: Map :{,B}Commits in other modes too
They support a range to show only commits that track the range.
2022-10-13 18:29:29 +02:00
a02fbd4403 vim:keys: Swap behaviour of ]] and ][
Swap the behaviour of `[[` `[]`. This way the first bracket indicates
the direction of the motion and the second the target (i.e. open or
closed brace).

I assume that the reason behind these mappings is to be able to easily
change the direction of the move by 'inverting' the keys (e.g. `]]` ->
`[[`). I understand that, but find the new way more intuitive.
2022-10-13 18:29:29 +02:00
1d2cdf7aea vim:keys: Use word boundaries with <leader>*
Ripgrep supports word boundaries, may as well use them to act closer to
`*` (:h star).
2022-10-12 12:37:17 +02:00
e25a0d29a7 vim:keys: Add binding for Signed-off-by trailer 2022-10-06 18:50:50 +02:00
5606967050 vim:keys: Fix <leader>dd (clear line)
`0` is necessary to move to real beginning of the line.
2022-08-30 20:39:21 +02:00
bcebc70082 vim:keys: Add mappings for git log 2022-08-30 19:52:23 +02:00
947a939f67 vim: Move CycleSpellLang into keys.vim
See ba3a54fc4 ("vim: Move numbertoggle autocmd into settings.vim").
2022-08-30 19:52:23 +02:00
6f0b433fdf vim:keys: Add <leader>dd to clear line
I sometimes have the situation that I want to create empty lines but
they contain either whitespace from keeping the indentation and/or the
comment string (`o` on a comment line). My current workflow is to either
delete it and recreate it properly (e.g. from the 'other side' i.e. a
non-comment line) or clear it with `cc`. Both ways are a bit awkward.

Add a mapping that clears a line but stays in normal mode.

Also remove the `<leader>d` mapping that deletes and puts the content
into the system clipboard as I rarely use this one.
2022-08-30 14:57:52 +02:00
c0892a8bdb vim:keys: Map <leader>bt to buffer ctags 2022-08-30 14:33:41 +02:00
7a081c0bd9 vim:keys: Map <leader>* to :Rg search of cword 2022-08-30 14:32:54 +02:00
b56eaa0eb2 vim:keys: Map <leader>gb to git blame 2022-08-28 00:11:16 +02:00
ede49ac9f7 vim:keys: Map <leader>gf to git status files 2022-08-28 00:11:15 +02:00
5ab97d6111 vim:keys: Map <leader>gg only with fugitive 2022-08-28 00:10:55 +02:00
fb90ae3142 vim:keys: Xmap <leader>ga to git add selection
As `GitGutterStageHunk` adds only the selected lines and not the full
hunk, remove the `h` for hunk from the mapping.
2022-08-26 08:37:11 +02:00
9ce1cd236b vim: Remove german umlaut mappings
As I started to type on the international US layout I don't need any
extra bindings for special characters in vim.

Move the update of `spellfile` into xdg.vim, as it was the only
remaining body of `NewSpellLang()` and fits thematically.
2022-08-25 04:27:51 +02:00
794293aa81 vim: Wrap autocmds in augroups
To prevent the piling up of autocommands when reloading the vimrc, wrap
all autocommands in groups.
2022-08-25 04:22:19 +02:00
73aa0e9752 vim:keys: Use RFC 3339 when converting unix times
Use a format conforming to RFC 3339 instead of following the systems
locale.
2022-08-25 01:14:39 +02:00
bc7a539186 vim:keys: Add <leader>utc to convert unix time
Add `<leader>utc` to convert unix timestamps into a human readable
format.
2022-07-14 14:25:00 +02:00
83d991cb53 vim:keys: Map <leader>gg to `:G 2022-07-14 14:24:59 +02:00
46565c2d6b vim:keys: Nvim does not replace has('clipboard')
Neovim does not make `has('clipboard')` obsolete. It only simplifies
clipboard support but `has('clipboard')` will still return `0` if no
supported clipboard program is installed.

See `:help clipboard`

    Nvim has no direct connection to the system clipboard. Instead it
    depends on a |provider| which transparently uses shell commands to
    communicate with the system clipboard or any other clipboard
    "backend".

and `:help clipboard-tool`

    The presence of a working clipboard tool implicitly enables the '+'
    and '*' registers. Nvim looks for these clipboard tools, in order of
    priority:

      - |g:clipboard|
      - pbcopy, pbpaste (macOS)
      - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
      - xclip (if $DISPLAY is set)
      - xsel (if $DISPLAY is set)
      - lemonade (for SSH) https://github.com/pocke/lemonade
      - doitclient (for SSH)
        http://www.chiark.greenend.org.uk/~sgtatham/doit/
      - win32yank (Windows)
      - termux (via termux-clipboard-set, termux-clipboard-set)
      - tmux (if $TMUX is set)
2022-07-12 21:00:11 +02:00
c906c5ffb6 vim:keys: Add <leader>h mapped to :Helptags 2022-07-12 21:00:07 +02:00
f13acebdb2 vim:keys: Format current paragraph with Q 2022-07-12 21:00:00 +02:00
58daf17e79 vim:keys: Add fugitive version of <leader>gcd
Add a fugitive version of the `<leader>gcd` mapping to jump to the root
of the repo.
2022-07-12 20:59:58 +02:00
9e18f6db16 vim:keys: Make git mappings fugitive independent
Make the git {add,stash,checkout} mappings independent of fugitive.vim.
2022-07-12 20:59:58 +02:00
733481900f vim:keys: Fix commit reference when at EOL
Fix the commit reference mapping `<leader>grc` in the case that nothing
follows the commit hash on the line. In that case the join would add a
trailing space.

`gJ` is not suitable as that would break in the other case that text
follows. When splitting the line behind the commit hash, the space in
front of whatever follows is deleted. Thus when joining everything
together at the end, there would be no space between the closing
parentheses and the rest.

Using the `system()` was the only solution I found to insert the subject
directly behind the hash without destroying the formatting and the text
behind it.

For this to work the trailing newline had to be cut off of git's output.
2022-07-12 20:59:58 +02:00
158dcb4b96 vim:keys: Add mapping to insert commit subject
Insert a commit's subject behind the SHA1 that the cursor is currently
on with `<leader>grc`.

Mnemonic: "git reference commit"
2022-06-23 23:59:02 +02:00
4cf0eedd56 vim,tmux:plugs: Add vim-tmux-navigator
[vim-tmux-navigator][1]:

> Seamless navigation between tmux panes and vim splits

Add the hybrid vim/tmux plugin `vim-tmux-navigator` to switch between
tmux panes and vim splits with `C-[hjkl]`.

Add vim-tmux-navigator as a submodule in tmux/plugins and create a
symlink from vim/pack/plugins/start.

Get rid of similar switching keymappings in the vim and tmux configs.

[1]: https://github.com/christoomey/vim-tmux-navigator
2022-06-23 23:58:46 +02:00
7eb4a29b4d vim:keys: Improve and add new git mappings
- Drop the mapping for `:Gcd` as I rarely use it and prefer to commit
  with one keystroke less.
- Add the current file instead of calling `git add -p` for the whole
  repository. If I want to add hunks I can do that with the gitgutter
  mappings.
- Add mappings to stash and checkout the current file.
- Use mnemonic 'add' instead of 'stage' for `GitGutterStageHunk`
  mappings.

TODO: Extend gitgutter for a `GitGutterStashHunk` function
2022-06-23 23:56:52 +02:00
2def35d0e7 vim:keys: Add gm to open a manpage
Open the manpage in the WORD under the cursor.
2022-06-23 23:56:52 +02:00
55cfb89a8d vim:keys: Add mapping for "+Y 2022-03-30 14:55:39 +02:00
ef438aeac1 vim:keys: Bind clipboard mappings to all modes
Also bind the system clipboard mappings to visual, etc.
2022-03-30 14:54:32 +02:00
10da37b676 vim:keys: Make call to NewSpellLang silent 2022-03-30 14:47:09 +02:00
241f315eec vim:keys: Add more git mappings 2022-03-30 14:36:40 +02:00