Skip to content
This repository was archived by the owner on Jan 22, 2021. It is now read-only.

Commit

Permalink
Commit before macOS issue
Browse files Browse the repository at this point in the history
  • Loading branch information
PasiBergman committed Jan 4, 2021
1 parent 1c06b72 commit 084d558
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 118 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
autoload/
session/

undodir/
!undodir/dummy.txt

slowsave
.netrwhist

Expand Down
1 change: 1 addition & 0 deletions files/info/dummy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
" Placeholder file for folder.
5 changes: 5 additions & 0 deletions ftplugin/cs.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
nmap <silent> gd :OmniSharpGotoDefinition<CR>
nnoremap <buffer> <Leader>fu :OmniSharpFindUsages<CR>
nnoremap <buffer> <Leader>fi :OmniSharpFindImplementations<CR>
nnoremapder> <Leader>ca :OmniSharpGetCodeActions<CR>
nnoremap <Leader>, :OmniSharpDocumentation<CR>
27 changes: 20 additions & 7 deletions general/settings.vim
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
set noerrorbells " Do not make noise. Disabled, because iTerm has visible bell option.
" Tabs
set tabstop=4 softtabstop=4 " Insert 2 spaces for a tab
set shiftwidth=4 " Change the number of space characters inserted for indentation
set expandtab " Converts tabs to spaces
set smarttab " Makes tabbing smarter will realize you have 2 vs 4
set smartindent " Makes indenting smart
" Row numbering
set number " Line numbers
set rnu " Show line numbers relative to current line"
" Search
set smartcase " Search case insensitive unless capital letter exists in the search term
set incsearch " Match already while typing the search term
" File stuff
set noswapfile
set nobackup
set undodir=$HOME/.config/nvim/undodir " Directory to store undo history
set undofile

set iskeyword+=- " treat dash separated words as a word text object"
set formatoptions-=cro " Stop newline continution of comments

Expand All @@ -16,15 +35,8 @@ set splitbelow " Horizontal splits will automatically b
set splitright " Vertical splits will automatically be to the right
set t_Co=256 " Support 256 colors
set conceallevel=0 " So that I can see `` in markdown files
set tabstop=4 " Insert 2 spaces for a tab
set shiftwidth=4 " Change the number of space characters inserted for indentation
set smarttab " Makes tabbing smarter will realize you have 2 vs 4
set expandtab " Converts tabs to spaces
set smartindent " Makes indenting smart
set autoindent " Good auto indent
set laststatus=2 " Always display the status line
set number " Line numbers
set rnu " Show line numbers relative to current line"
set cursorline " Enable highlighting of the current line
set background=dark " tell vim what the background color looks like
set showtabline=2 " Always show tabs
Expand Down Expand Up @@ -70,3 +82,4 @@ autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
cmap w!! w !sudo tee %
set shada=!,'100,n$HOME/.config/nvim/files/info/viminfo

170 changes: 99 additions & 71 deletions keys/cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@

Cheatsheet for Neovim with the plugins and configurations in the repository.

## C# / OmniSharp

On .cs files:

| Keymap | Mode | Usage |
| ------------ | ---- | ---------------------------------------------------- |
| `gd` | N | Go to definition (:OmniSharpGotoDefinition) |
| `<Leader>fu` | N | Find usages (:OmniSharpFindUsages) |
| `<Leader>fi` | N | Find implementations (:OmniSharpFindImplementations) |
| `<Leader>ca` | N | Get code actions (:OmniSharpGetCodeActions) |

## Comments (tpope/vim-commentary)

| Keymap | Mode | Usage |
|--|--|--|
| `gcc` | N |Comment/Uncomment single line |
| `gc`| N,V | Comment/Uncomment target motion, e.g. `gcap` for paragraph or selection in visual mode. |
| | | |
| Keymap | Mode | Usage |
| ------ | ---- | --------------------------------------------------------------------------------------- |
| `gcc` | N | Comment/Uncomment single line |
| `gc` | N,V | Comment/Uncomment target motion, e.g. `gcap` for paragraph or selection in visual mode. |
| | | |

## Debugging

Expand All @@ -18,96 +29,113 @@ Using Visual Studio (Code) mappings, i.e.
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
```

| Key | Function | API |
| --- | --- | --- |
| `F5` | When debugging, continue. Otherwise start debugging. | `vimspector#Continue()` |
| `Shift F5` | Stop debugging. | `vimspector#Stop()` |
| `Ctrl Shift F5` | Restart debugging with the same configuration. | `vimspector#Restart()` |
| `F6` | Pause debugee. | `vimspector#Pause()` |
| `F9` | Toggle line breakpoint on the current line. | `vimspector#ToggleBreakpoint()` |
| `Shift F9` | Add a function breakpoint for the expression under cursor | `vimspector#AddFunctionBreakpoint( '<cexpr>' )` |
| `F10` | Step Over | `vimspector#StepOver()` |
| `F11` | Step Into | `vimspector#StepInto()` |
| `Shift F11` | Step out of current function scope | `vimspector#StepOut()` |
| Key | Function | API |
| --------------- | --------------------------------------------------------- | ----------------------------------------------- |
| `F5` | When debugging, continue. Otherwise start debugging. | `vimspector#Continue()` |
| `Shift F5` | Stop debugging. | `vimspector#Stop()` |
| `Ctrl Shift F5` | Restart debugging with the same configuration. | `vimspector#Restart()` |
| `F6` | Pause debugee. | `vimspector#Pause()` |
| `F9` | Toggle line breakpoint on the current line. | `vimspector#ToggleBreakpoint()` |
| `Shift F9` | Add a function breakpoint for the expression under cursor | `vimspector#AddFunctionBreakpoint( '<cexpr>' )` |
| `F10` | Step Over | `vimspector#StepOver()` |
| `F11` | Step Into | `vimspector#StepInto()` |
| `Shift F11` | Step out of current function scope | `vimspector#StepOut()` |

## Diff & Folding

| Keymap | Mode | Usage |
| ----------- | ---- | ------------------------------------------------------- |
| `zf` | V | Create fold with the selection in visual mode |
| `za` | N | Toggle fold (under the cursor) |
| `zo` | N | Open fold |
| `zc` | N | Close fold |
| `zd` | N | Delete fold |
| `zr` | N | Open (reduce) folds by one level |
| `zm` | N | Fold (more) folds by one level |
| `:diffthis` | N | Make current file part of diff. Execute for two files. |
| `dp` | N | Put difference under the cursor to the other file |
| `do` | N | Obtain difference from other file to current difference |
| `]c` | N | Jump to next diff |
| `[c` | N | Jump to previous diff |

## Git (Fugitive)

| Keymap | Mode | Usage |
|--|--|--|
| `zf` | V | Create fold with the selection in visual mode |
| `za` | N | Toggle fold (under the cursor)|
| `zo` | N | Open fold |
| `zc` | N | Close fold |
| `zd` | N | Delete fold |
| `zr` | N | Open (reduce) folds by one level |
| `zm` | N | Fold (more) folds by one level |
| `:diffthis` | N | Make current file part of diff. Execute for two files. |
| `dp` | N | Put difference under the cursor to the other file |
| `do` | N | Obtain difference from other file to current difference |
| `]c` | N | Jump to next diff |
| `[c` | N | Jump to previous diff |
| ------ | ---- | ----- |
| | | |
| | | |

## Git (Checkout)

| Keymap | Mode | Usage |
| ---------------- | ---------- | ----------------------------------------------------- |
| `<Option-Enter>` | :GCeckout | Track remote branch locally |
| `<Ctrl-b>` | :GCheckout | Create a branch or tag with the current query as name |
| `<Ctrl-d>` | :GCheckout | Delete a branch or tag |
| `<Ctrl-e>` | :GCheckout | Merge a branch |
| `<Ctrl-r>` | :GCheckout | Rebase a branch |

## Inserting/Appending

| Keymap | Mode | Usage |
|--|--|--|
| `I` | N | Insert at the beginning of the line |
| `ea` | N | Insert (append) at the end of the word |
| `Ctrl+h` | I | Delete the character before cursor on the insert mode |
| Keymap | Mode | Usage |
| -------- | ---- | ----------------------------------------------------- |
| `I` | N | Insert at the beginning of the line |
| `ea` | N | Insert (append) at the end of the word |
| `Ctrl+h` | I | Delete the character before cursor on the insert mode |

## Search

| Keymap | Mode | Usage |
|--|--|--|
| `noh` | N | Turn of search highlight until next search |
| `n` | N | Repeat searh forward |
| `N` | N | Repeat searh backword |
| Keymap | Mode | Usage |
| ------ | ---- | ------------------------------------------ |
| `noh` | N | Turn of search highlight until next search |
| `n` | N | Repeat searh forward |
| `N` | N | Repeat searh backword |

## Surround (tpope/vim-surround)

| Keymap | Mode | Usage |
|--|--|--|
| `cs{from}{to}` | N | Change 'surrounds' {from} to {to}, e.g. `cs"'` to change from " to ' |
| `cst{to}` | N | Change tag to {to}, e.g. `cst"` to change html-tag to " |
| `ds{from}` | N | Delete {from} surrounds. |
| `yss)` | N | Surround sentence with () |
| `S{to}` | V | In visual mode, surround selection with {to} |
| `ys{action}{to}` | N | Add {to} surrounds based on {action} |
| | | |
| Keymap | Mode | Usage |
| ---------------- | ---- | -------------------------------------------------------------------- |
| `cs{from}{to}` | N | Change 'surrounds' {from} to {to}, e.g. `cs"'` to change from " to ' |
| `cst{to}` | N | Change tag to {to}, e.g. `cst"` to change html-tag to " |
| `ds{from}` | N | Delete {from} surrounds. |
| `yss)` | N | Surround sentence with () |
| `S{to}` | V | In visual mode, surround selection with {to} |
| `ys{action}{to}` | N | Add {to} surrounds based on {action} |
| | | |

## Tabs

| Keymap | Mode | Usage |
|--|--|--|
| `Ctrl-w T` | N | Move current split windot to its own tab |
| `gt` | N | Move to next tab |
| `gT` | N | Move to previous tab |
| `#gt` | N | Move to tab number # |
| `:tabm #` | N | Move current tab to #th position (0-index) (:tabmove) |
| `:tabc` | N | Close current tab (:tabclose)|
| `:tabo` | N | Close all other tabs except current one (:tabonly) |
| `:tab ba`| N | Edit all bufferes as tabs |
| | | |
| Keymap | Mode | Usage |
| ---------- | ---- | ----------------------------------------------------- |
| `Ctrl-w T` | N | Move current split windot to its own tab |
| `gt` | N | Move to next tab |
| `gT` | N | Move to previous tab |
| `#gt` | N | Move to tab number # |
| `:tabm #` | N | Move current tab to #th position (0-index) (:tabmove) |
| `:tabc` | N | Close current tab (:tabclose) |
| `:tabo` | N | Close all other tabs except current one (:tabonly) |
| `:tab ba` | N | Edit all bufferes as tabs |
| | | |

## Visual mode

| Keymap | Mode | Usage |
|--|--|--|
| ------ | ---- | ----- |

Plug 'romgrk/barbar.nvim'
| `v` (lower) | V | Character mode |
| `V` (upper) | V | Line mode |
| `Ctrl+v` | V | Block mode |

## Window management

| Keymap | Mode | Usage |
|--|--|--|
| `Ctrl-h` | N | Move to the window on the left (`Ctrl-w h`) |
| `Ctrl-j` | N | Move to the window below (`Ctrl-w j`) |
| `Ctrl-k` | N | Move to the window above (`Ctrl-w k`)|
| `Ctrl-l` | N | Move to the window on the right (`Ctrl-w l`) |
| `Ctrl-w o` | N | Only one window. 'This one' |
| `Ctrl-w =` | N | Make all windows/panes equal hheight & width |
| `<Leader>|` | N | Split window to right (Which key mapping to `Ctrl-w v`) |
| `<Leader>-` | N | Split window to below (Which key mapping to `Ctrl-w s) |

| Keymap | Mode | Usage |
| ----------- | ---- | ------------------------------------------------------- |
| `Ctrl-h` | N | Move to the window on the left (`Ctrl-w h`) |
| `Ctrl-j` | N | Move to the window below (`Ctrl-w j`) |
| `Ctrl-k` | N | Move to the window above (`Ctrl-w k`) |
| `Ctrl-l` | N | Move to the window on the right (`Ctrl-w l`) |
| `Ctrl-w o` | N | Only one window. 'This one' |
| `Ctrl-w =` | N | Make all windows/panes equal hheight & width |
| `<Leader>` | N | Split window to right (Which key mapping to `Ctrl-w v`) |
| `<Leader>-` | N | Split window to below (Which key mapping to `Ctrl-w s) |
28 changes: 15 additions & 13 deletions keys/mappings.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ else
inoremap <expr> <c-k> ("\<C-p>")
" I hate escape more than anything else
inoremap jk <Esc>
inoremap kj <Esc>
inoremap jj <Esc>
" TAB in general mode will move to text buffer
nnoremap <silent> <TAB> :bnext<CR>
Expand Down Expand Up @@ -67,10 +66,10 @@ else
" nnoremap <silent> <M-h> :vertical resize -2<CR>
" nnoremap <silent> <M-l> :vertical resize +2<CR>

nnoremap <silent> <C-Up> :resize -2<CR>
nnoremap <silent> <C-Down> :resize +2<CR>
nnoremap <silent> <C-Left> :vertical resize -2<CR>
nnoremap <silent> <C-Right> :vertical resize +2<CR>
" nnoremap <silent> <C-Up> :resize -2<CR>
" nnoremap <silent> <C-Down> :resize +2<CR>
" nnoremap <silent> <C-Left> :vertical resize -2<CR>
" nnoremap <silent> <C-Right> :vertical resize +2<CR>

let g:elite_mode=0 " Disable arrows"
" Disable arrow movement, resize splits instead.
Expand All @@ -81,18 +80,21 @@ else
nnoremap <C-Right> :vertical resize +2<CR>
endif

" Use Ctrl-q to close buffer
nnoremap <C-q> :bd<CR>
endif

" Better nav for omnicomplete
inoremap <expr> <c-j> ("\<C-n>")
inoremap <expr> <c-k> ("\<C-p>")
" Help mappings simplify navigating the results of quickfix commands such as (among others) :helpgrep
:nnoremap <S-F1> :cc<CR>
:nnoremap <F2> :cnext<CR>
:nnoremap <S-F2> :cprev<CR>
:nnoremap <F3> :cnfile<CR>
:nnoremap <S-F3> :cpfile<CR>
:nnoremap <F4> :cfirst<CR>
:nnoremap <S-F4> :clast<CR>
" :nnoremap <S-F1> :cc<CR>
" :nnoremap <F2> :cnext<CR>
" :nnoremap <S-F2> :cprev<CR>
" :nnoremap <F3> :cnfile<CR>
" :nnoremap <S-F3> :cpfile<CR>
" :nnoremap <F4> :cfirst<CR>
" :nnoremap <S-F4> :clast<CR>

4 changes: 2 additions & 2 deletions plug-config/coc/coc-extensions.vim
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ let g:coc_global_extensions = [
\ 'coc-html',
\ 'coc-json',
\ 'coc-lists',
\ 'coc-marketplace',
\ 'coc-markdownlint',
\ 'coc-marketplace',
\ 'coc-omnisharp',
\ 'coc-pairs',
\ 'coc-powershell',
Expand All @@ -22,8 +22,8 @@ let g:coc_global_extensions = [
\ 'coc-sh',
\ 'coc-snippets',
\ 'coc-sourcekit',
\ 'coc-stylelintplus',
\ 'coc-sql',
\ 'coc-stylelintplus',
\ 'coc-tasks',
\ 'coc-tsserver',
\ 'coc-vetur',
Expand Down
2 changes: 1 addition & 1 deletion plug-config/coc/coc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ let g:coc_explorer_global_presets = {
\ 'floating-width': 30,
\ },
\ 'simplify': {
\ 'file.child.template': '[selection | clip | 1] [indent][icon | 1] [filename omitCenter 1]'
\ 'file.child.template': '[selection | clip | 1] [git | 1] [indent][icon | 1] [filename omitCenter 1]'
\ }
\ }
nmap <silent> <Ctrl-e> :CocCommand explorer<CR>
Expand Down
7 changes: 2 additions & 5 deletions plug-config/omnisharp.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
" Support for different goto definitions for different file types
autocmd FileType cs nmap <silent> gd :OmniSharpGotoDefinition<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fu :OmniSharpFindUsages<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fi :OmniSharpFindImplementations<CR>
autocmd FileType cs nnoremap <Leader>ca :OmniSharpGetCodeActions<CR>
"
" See ftplugin/cs.vim for .cs file specific key mappings for OmniSharp
3 changes: 0 additions & 3 deletions plug-config/vim-fugitivie.vim

This file was deleted.

1 change: 1 addition & 0 deletions plug-config/vim-hexokinase.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading

0 comments on commit 084d558

Please sign in to comment.