-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
148 lines (109 loc) · 3.05 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
set nocompatible
syntax on
filetype plugin indent on
set number
" set relativenumber
set backspace=2
set cursorline
" autoload file changes
set autoread
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
Plug 'altercation/vim-colors-solarized'
Plug 'folke/tokyonight.nvim'
" Plug 'itchyny/lightline.vim'
Plug 'arcticicestudio/nord-vim'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'jremmen/vim-ripgrep'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-vinegar'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-rails'
Plug 'vim-test/vim-test'
Plug 'neovimhaskell/haskell-vim'
" nvim stuffs
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lualine/lualine.nvim'
Plug 'folke/trouble.nvim'
Plug 'rebelot/kanagawa.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'nvim-lua/plenary.nvim'
" Plug 'nvim-neorg/neorg'
" Plug 'epwalsh/obsidian.nvim'
call plug#end()
set background=dark
colorscheme solarized
" needed for vim-gitgutter to display correctly in Solarized
highlight clear SignColumn
" tabbing
set tabstop=2
set shiftwidth=2
set expandtab
" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive
set smartcase " ... unless they contain at least one captial letter
" testing - turn off annoying bell when <ESC> in normal mode
set visualbell
set noerrorbells
set belloff=all
let mapleader="\<space>"
" FZF
nnoremap <c-p> :FZF<cr>
nnoremap <leader>p :GFiles<cr>
nnoremap <leader>b :Buffers<cr>
let g:fzf_preview_window = []
let g:fzf_layout = { 'down': '30%' }
" handle line breaked text
nnoremap j gj
nnoremap k gk
" fix slow O inserts
set timeout timeoutlen=1000 ttimeoutlen=100
" vimsplits
set splitbelow
set splitright
" use <C>hjkl to switch between splits
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" yank to the end of the line
nnoremap Y y$
" Maintain the cursor position when yanking a visual selection
" http://ddrscott.github.io/blog/2016/yank-without-jank/
vnoremap y myy`y
vnoremap Y myY`y
" Easier find and replace
vnoremap <C-r> "hy:%s/<C-r>h//gc<left><left><left>
map <Leader>rp "hyiw:%s/<C-r>h//gc<left><left><left>
set laststatus=2
set noshowmode
set scrolloff=1
" highlight 80 and 120 column
let &colorcolumn="80,120"
" yank to clipboard
if has("clipboard")
set clipboard=unnamed " copy to the system clipboard
endif
" testing strip whitespace on save
autocmd BufWritePre *.rb :%s/\s\+$//e
autocmd BufWritePre *.js :%s/\s\+$//e
autocmd BufWritePre *.py :%s/\s\+$//e
" test out setting mardown hard wrap to 80 chars
" au BufRead,BufNewFile *.md setlocal textwidth=80
" vim-test mappings
nmap <silent> <leader>t :TestFile<CR>
nmap <silent> <leader>s :TestNearest<CR>
nmap <silent> <leader>l :TestLast<CR>
let test#strategy = "neovim"
" Insert a hash rocket with <c-l>
imap <c-l> <space>=><space>
map <Leader>j :%!jq <CR>
" Rg search for work under cursor
nnoremap <leader>r :Rg<cr>
vmap gs :sort<CR>