-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
92 lines (75 loc) · 2.41 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
set nocompatible
set number relativenumber
set ruler
syntax on
set modeline
" Set encoding
set encoding=utf-8
" Whitespace stuff
set nowrap
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set list listchars=tab:»·,trail:·
" Indent settings for the detected filetype.
autocmd FileType go setlocal noexpandtab
" Allow backspacing over everything in insert mode.
set backspace=indent,eol,start
" Directories for swp files.
set backupdir=~/.vim/backup
set directory=~/.vim/backup
" Font.
set guifont=Hack:h18
" Home and end using emacs.
inoremap <C-E> <End>
nnoremap <C-E> <End>
inoremap <C-A> <Home>
nnoremap <C-A> <Home>
" Move through windows.
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Toggle relative number with `ctrl + shift + n`
map <C-S-n> :set relativenumber!<CR>
" Use system clipboard https://vi.stackexchange.com/a/96
noremap <Leader>y "*y
noremap <Leader>p "*p
noremap <Leader>Y "+y
noremap <Leader>P "+p
" Do not replace buffer with pasted-over contents.
" https://stackoverflow.com/questions/3837772/vim-replace-selection-with-default-buffer-without-overwriting-the-buffer#comment76964481_3837845
vnoremap p "_dP
" Paste inner word.
noremap gpiw ciw<C-r>0<Esc>
" Paste inner paragraph.
noremap gpip cip<C-r>0<Esc>
" Use system clipboard.
" https://stackoverflow.com/a/30691754
set clipboard=unnamed
" Plugins, using Vim Plug. https://github.com/junegunn/vim-plug
call plug#begin()
" The default plugin directory will be as follows:
" - Vim (Linux/macOS): '~/.vim/plugged'
" - Vim (Windows): '~/vimfiles/plugged'
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
" - e.g. `call plug#begin('~/.vim/plugged')`
" - Avoid using standard Vim directory names like 'plugin'
" Make sure you use single quotes
Plug 'chrisbra/matchit'
Plug 'christoomey/vim-tmux-navigator'
Plug 'jeffkreeftmeijer/vim-numbertoggle', { 'branch': 'main' }
Plug 'kana/vim-textobj-user'
Plug 'nelstrom/vim-textobj-rubyblock'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-vinegar'
Plug 'vim-utils/vim-line'
" Initialize plugin system
" - Automatically executes `filetype plugin indent on` and `syntax enable`.
call plug#end()
" You can revert the settings after the call like so:
" filetype indent off " Disable file-type-specific indentation
" syntax off " Disable syntax highlighting