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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
syntax on
filetype plugin on
filetype indent on
" leader
let maplocalleader = "\\"
let mapleader = ","
set nocompatible
set scrolloff=1
set history=799
set wildignore=**/__pycache*/**
set wildoptions=pum
set wildmenu
set wildchar=<TAB>
set showmatch
set ruler
set showcmd
set nohlsearch
set incsearch
set ignorecase
set smartindent
set smartcase
set tabstop=4
set softtabstop=4
set shiftwidth=4
set splitbelow
set noswapfile
set nobackup
set splitright
set autoindent
set expandtab
set hidden
set path+=**
set relativenumber
set number
set more
set signcolumn=yes
set colorcolumn=0
set equalalways
set showmode
set listchars=tab:»→,trail:␣
set shortmess+=c
set tags+=./tags
set background=dark
set completeopt=menuone,longest
" Function to allow adding a line of text to taskwarrior
function! TaskWarriorAddCurrentLine()
let current_line = getline('.')
silent execute ":!task add " . shellescape(current_line)
redraw!
echo "Task added: " . current_line
delete
endfunction
nnoremap <leader>q :call TaskWarriorAddCurrentLine()<CR>
" colorscheme goes here, outside source control
source ~/.vim/ephemera.vim
highlight SignColumn guibg=blue ctermbg=black
" macro to go to end of sentence and add a line break (for
" one-line-per-sentence vimming...)
let @s = ")i\<BS>\<CR>\<Esc>"
" i don't bother with folding, but it's here if i need it.
if has('folding')
set foldmethod=marker
set foldmarker=#\ {{{,#\ }}}
set viewoptions=folds,options,cursor,unix,slash
endif
" disable folding by default with vim-markdown
let g:vim_markdown_folding_disabled = 1
" Open vimrc
nnoremap <leader>ev <C-w>s<C-w>j<C-w>L:e $HOME/.vim/vimrc<cr>
" Jump up or down by 10 lines.
noremap <silent> J 10j
noremap <silent> K 10k
" Place timestamps, be it date (YYYY-MM-DD) or time (HH:MM:SS).
if (exists("*strftime"))
noremap <silent> <leader>date "=strftime("%F")<CR>p9h
noremap <silent> <leader>time "=strftime("%X")<CR>p7h
endif
" Place timestamps, be it date (YYYY-MM-DD) or time (HH:MM:SS).
if (exists("*strftime"))
noremap <silent> <leader>date "=strftime("%F")<CR>p9h
noremap <silent> <leader>time "=strftime("%X")<CR>p7h
endif
"keymap for Fern
nnoremap ;f :Fern . -drawer<cr>
call plug#begin()
"Plug 'vim-scripts/AutoComplPop'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'lambdalisue/fern.vim'
Plug 'junegunn/goyo.vim'
Plug 'sheerun/vim-polyglot'
Plug 'preservim/vim-markdown'
Plug 'mhinz/vim-signify'
Plug 'vim-test/vim-test'
Plug 'ledger/vim-ledger'
Plug 'fatih/vim-go', {'do': ':GoUpdateBinaries' }
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-fugitive'
Plug 'SirVer/UltiSnips'
Plug 'honza/vim-snippets'
call plug#end()
" Make :grep use ripgrep
if executable('rg')
set grepprg=rg\ --color=never\ --vimgrep
endif
" and search with ripgrep
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always --ignore-case '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)
nnoremap <C-p>a :Rg
" Generate ctags for current working directory
nnoremap <leader>tt :silent !ctags -R . <CR>:redraw!<CR>
" notes stuff - from https://www.edwinwenink.xyz/posts/43-notes_tagging/
" Go to index of notes and set working directory to my notes
nnoremap <leader>ni :e $NOTES_DIR/index.md<CR>:cd $NOTES_DIR<CR>
" 'Notes Grep' with ripgrep (see grepprg)
" -i case insensitive
" -g glob pattern
" ! to not immediately open first search result
command! -nargs=1 Ngrep :silent grep! "<args>" -i -g '*.md' $NOTES_DIR | execute ':redraw!'
nnoremap <leader>nn :Ngrep
" Open quickfix list in a right vertical split (good for Ngrep results)
command! Vlist botright vertical copen | vertical resize 50
nnoremap <leader>v : Vlist<CR>
" vim-test
nmap <silent> tn :TestNearest<CR>
nmap <silent> tf :TestFile<CR>
nmap <silent> ts :TestSuite<CR>
nmap <silent> tl :TestLast<CR>
nmap <silent> <leader>tv :TestVisit<CR>
let test#strategy = "basic"
let test#python#pytest#options = '-q -s'
let test#python#runner = 'pytest'
let test#vimterminal#term_position = "belowright"
" clear search highlights
nnoremap <leader><space> :noh<cr>:call clearmatches()<cr>
runtime macros/matchit.vim "allows jumping between brackets with % in normal mode
" remap :W to :w - :W was previous Windows in fzf
command! W w
" FZF
" This is the default extra key bindings
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
" - FZF Popup window (center of the screen)
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
" Customize fzf colors to match your color scheme
let g:fzf_colors =
\ { 'fg': ['fg', '#f8f8f2'],
\ 'bg': ['bg', '#282a36'],
\ 'hl': ['fg', '#bd93f9'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', '#ffb86c'],
\ 'prompt': ['fg', '#50fa7b'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', '#ffb86c'],
\ 'header': ['fg', '#6272a4'] }
" More fzf settings
" (https://github.com/zenbro/dotfiles/blob/master/.nvimrc#L151-L187)
let g:fzf_nvim_statusline = 0 " disable statusline overwriting
nnoremap <C-s> :GFiles!<CR>
nnoremap <leader><C-p> :<C-u>FZF!<CR>
nnoremap <leader>t :Files<CR>
nnoremap <leader>o :Tags<CR>
nnoremap <leader>h :History<CR>
nnoremap <silent> <leader>0 :Files<CR>
nnoremap <silent> <leader>; :BLines<CR>
nnoremap <silent> <leader>l :Lines<CR>
nnoremap <silent> <leader>o :BTags<CR>
nnoremap <silent> <leader>b :Buffers<CR>
nnoremap <silent> <leader>? :History:<CR>
nnoremap <silent> <leader>/ :execute 'Ag ' . input('Ag/')<CR>
nnoremap <silent> <leader>ft :Filetypes<CR>
nnoremap <silent> <leader>CC :Commands<CR>
imap <C-x><C-f> <plug>(fzf-complete-file-ag)
imap <C-x><C-l> <plug>(fzf-complete-line)
|