8f75956041d81b7230fa64f4577bb565cffad3d3
dblume Soften the status line colo...

dblume authored 11 months ago

1) " Version 2024-03-17.1 - status line color tweak
David Blume first commit

David Blume authored 9 years ago

2) set nocompatible    " Use Vim defaults, forget compatibility with vi.
3) set bs=2            " allow backspacing over everything in insert mode
4) set wildmenu        " Allows command-line completion with tab
5) set autoindent      " Copy indent from current line when starting a new line
6) set smartindent     " Do smart auto indenting when starting  new line
7) set smarttab        " Honor 'shiftwidth', 'tabstop' or 'softtabstop'
8) set hlsearch        " highlight all matches for previous search
dblume Better fold settings for zA

dblume authored 1 year ago

9) set foldlevel=99
David Blume first commit

David Blume authored 9 years ago

10) set nowrap          " no wrapping text lines on the screen (exceptions below)
11) set sidescroll=5
dblume May use nbsp in PS1; add it...

dblume authored 2 years ago

12) set listchars+=tab:>-,precedes:<,extends:>,nbsp:· " for :set list
dblume Add - as a word character

dblume authored 1 year ago

13) set iskeyword+=-    " Add - to list of non-word-breaking chars.
dblume Starting trial with vim 'in...

dblume authored 1 year ago

14) set incsearch       " Navigate to matched strings while typing. Toggle: :set is!
dblume Set scrolloff to 0, EC2 def...

dblume authored 11 months ago

15) set scrolloff=0     " EC2 defaults to 5. Set explicitly to be consistent
dblume Vim to delete comment char...

dblume authored 10 months ago

16) set formatoptions+=j " Delete comment character when joining commented lines.
dblume Improve Esc key reaction, f...

dblume authored 10 months ago

17) set ttimeoutlen=100 " Affects Esc key, not leader.
dblume .vimrc needs explicit "noru...

dblume authored 10 months ago

18) set noruler         " Don't show cursor pos on right side of status bar
dblume Simplify vim titlestring: p...

dblume authored 9 months ago

19) " Set the title of the terminal window. Consider changing titlestring, %t, %M
20) set title titlestring=%f%m\ -\ vim
dblume Synchronize vim's default r...

dblume authored 9 months ago

21) set clipboard^=unnamed  " Synchronize vim's default register and clipboard
David Blume first commit

David Blume authored 9 years ago

22) 
23) if v:version >= 703
24)   " Do save the undo tree to file, but not in the local directory.
25)   " Don't forget to mkdir ~/.vim_undo
26)   set undodir=~/.vim_undo,.
27)   set undofile        " undo even after closing and reopening a file
28) endif
29) 
David Blume vimrc key remappings. jk as...

David Blume authored 6 years ago

30) " Make j and k move to the next row, not file line
31) nnoremap j gj
32) nnoremap k gk
33) 
34) " From Steve Losh: http://learnvimscriptthehardway.stevelosh.com/chapters/10.html
dblume Use j and k for navigating...

dblume authored 2 years ago

35) " Map jk to ESC in insert mode (except when navigating popup menu)
36) inoremap <expr> jk pumvisible() ? '' : '<esc>'
37) inoremap <expr> j pumvisible() ? '<Down>' : 'j'
38) inoremap <expr> k pumvisible() ? '<Up>' : 'k'
dblume Map Tab and CR to pull-up-m...

dblume authored 10 months ago

39) inoremap <expr> <Tab> pumvisible() ? '<Down>' : '<Tab>'
40) inoremap <expr> <S-Tab> pumvisible() ? '<Up>' : '<S-Tab>'
41) inoremap <expr> <cr> pumvisible() ? '<C-y>' : '<cr>'
David Blume vimrc key remappings. jk as...

David Blume authored 6 years ago

42) 
dblume Add easier window navigation.

dblume authored 2 years ago

43) " https://stevelosh.com/blog/2010/09/coming-home-to-vim/#s3-why-i-came-back-to-vim
44) nnoremap <leader>v <C-w>v<C-w>l
45) nnoremap <C-h> <C-w>h
46) nnoremap <C-j> <C-w>j
47) nnoremap <C-k> <C-w>k
48) nnoremap <C-l> <C-w>l
49) 
David Blume vimrc key remappings. jk as...

David Blume authored 6 years ago

50) " clear search highlights
51) nnoremap <cr> :noh<cr><cr>
David Blume first commit

David Blume authored 9 years ago

52) 
dblume Have terminal emulator send...

dblume authored 9 months ago

53) " tmux 3.2+ doesn't send C-i, so have Alacritty iTerm2 map C-i to <leader>i
54) " iTerm2: Settings > Keys > Key Bindings > + > Shortcut:^i Action:Send Text "\i"
55) nnoremap <leader>i <C-i>
56) " Use (Shift-)Tab to navigate buffers, retain C-i/C-o for jumps.
dblume bash PROMPT_COMMAND to set...

dblume authored 9 months ago

57) " Test with this:
dblume typo: .vimrc to use vim, no...

dblume authored 9 months ago

58) " vim -Nu NONE +'nno <C-i> :echom "C-i pressed"<cr>' +'nno <tab> :echom "Tab pressed"<cr>'
dblume Have terminal emulator send...

dblume authored 9 months ago

59) "if stridx(expand($TERM), 'xterm') == 0
60)   nnoremap <C-i> <C-i>
61)   nmap <Tab> :bn<cr>
62) "endif
dblume Restore Ctrl-i (Tab) to mea...

dblume authored 9 months ago

63) nnoremap <S-Tab> :bp<cr>
dblume tab key navigation of buffers

dblume authored 1 year ago

64) 
dblume Remap Y to yank to end of l...

dblume authored 11 months ago

65) " Use yy to yank a whole line, use Y to yank to end of line like C and D
66) nnoremap Y y$
67) 
David Blume first commit

David Blume authored 9 years ago

68) syntax on
69) 
70) set t_Co=256
71) if v:version >= 703
72)   set colorcolumn=80
73) endif
74) if has('gui_running') " Didn't work: if &term != 'builtin_gui'
75)   " Light backgrounds for GUI experiences
76)   set background=light
77)   " colorscheme peaksea                        " install peaksea
78)   colorscheme tolerable                        " install tolerable
79)   if v:version >= 703
80)     highlight ColorColumn ctermbg=255 guibg=#F6F6F6
81)   endif
dblume nvim ColorColumn was inverted

dblume authored 11 months ago

82)   highlight statusline   ctermfg=17 ctermbg=Gray  " override scheme
83)   highlight statuslineNC ctermfg=20 ctermbg=LightGray  " override scheme
David Blume Specify a font for gvim on...

David Blume authored 4 years ago

84)   if has('win32')
85)     set guifont=DejaVu_Sans_Mono_for_Powerline:h10:cANSI:qDRAFT
86)   endif
David Blume first commit

David Blume authored 9 years ago

87)   set lines=50 columns=100
88) else
89)   " Dark backgrounds for tty experiences
90)   set background=dark
91)   colorscheme desert                           " install desert
92)   if v:version >= 703
David Blume Windows PuTTY shows ctermbg...

David Blume authored 6 years ago

93)     highlight ColorColumn ctermbg=233 guibg=Black " dark gray (or 17, dark blue)
David Blume first commit

David Blume authored 9 years ago

94)   endif
dblume Make the normal statusbar m...

dblume authored 10 months ago

95)   highlight statusline   ctermfg=23 ctermbg=250  " override scheme
dblume Change hightlight of curren...

dblume authored 10 months ago

96) "  highlight User1        ctermfg=250 ctermbg=30
dblume Soften the status line colo...

dblume authored 11 months ago

97)   highlight statuslineNC ctermfg=237 ctermbg=Gray  " override scheme
dblume Better statusline color.

dblume authored 2 years ago

98)   highlight MatchParen   term=reverse ctermbg=23  " 23 is more subtle than default
David Blume first commit

David Blume authored 9 years ago

99) endif
dblume Better statusline color.

dblume authored 2 years ago

100) 
dblume Vim insert mode's blue shou...

dblume authored 10 months ago

101) au InsertEnter * hi statusline guibg=Cyan ctermfg=25 guifg=Black ctermbg=248
dblume Make the normal statusbar m...

dblume authored 10 months ago

102) au InsertLeave * hi statusline term=bold,reverse cterm=bold,reverse ctermfg=23 ctermbg=250 guifg=black guibg=#c2bfa5
dblume Maybe I like these statusli...

dblume authored 1 year ago

103) 
David Blume first commit

David Blume authored 9 years ago

104) " set mouse=v     " visual mode, not working great for PuTTY
105) 
106) set tags=tags;/
107) 
dblume Make vim StatuslineGit() re...

dblume authored 11 months ago

108) set history=500
dblume Update vim statusline to pr...

dblume authored 1 year ago

109) set laststatus=2
110) 
dblume Retrieve git branch only on...

dblume authored 11 months ago

111) function! GitBranch()
dblume Make vim StatuslineGit() re...

dblume authored 11 months ago

112)   let l:branchname = system("git -C " . expand('%:p:h') . " rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
dblume vim to use the "git branch"...

dblume authored 10 months ago

113)   return strlen(l:branchname) > 0 ? '  │  '.l:branchname : ''
dblume Update vim statusline to pr...

dblume authored 1 year ago

114) endfunction
115) 
dblume Only show encoding and form...

dblume authored 10 months ago

116) function! EncodingAndFormat()
117)   if (len(&fileencoding) && &fileencoding != 'utf-8') || &fileformat != 'unix'
118)     return &fileencoding?&fileencoding:&encoding .'['. &fileformat . '] │ '
119)   endif
120)   return ''
121) endfunction
122) 
dblume Make "set ruler!" change st...

dblume authored 10 months ago

123) function! OnRuler()
124)   if &ruler
125)     return '│ '.line('.').':'.col('.').' '
126)   endif
127)   return ''
128) endfunction
129) 
dblume Default to mode() if not in...

dblume authored 1 year ago

130) function! Current_mode()
131)   let l:currentmode={
dblume Update vim statusline to pr...

dblume authored 1 year ago

132)     \ 'n'  : 'NORMAL',
133)     \ 'v'  : 'VISUAL',
134)     \ 'V'  : 'V·LINE',
135)     \ '' : 'V·BLOCK',
136)     \ 's'  : 'SELECT',
137)     \ 'S'  : 'S·LINE',
138)     \ 'i'  : 'INSERT',
dblume Default to mode() if not in...

dblume authored 1 year ago

139)     \ 'r'  : 'I·REPLACE',
dblume Update vim statusline to pr...

dblume authored 1 year ago

140)     \ 'R'  : 'REPLACE',
141)     \ 'Rv' : 'V·REPLACE',
142)     \ 'c'  : 'COMMAND',
143)     \}
dblume Default to mode() if not in...

dblume authored 1 year ago

144)     return get(l:currentmode, mode(), mode())
145) endfunction
dblume Update vim statusline to pr...

dblume authored 1 year ago

146) 
147) function! Trim_brackets(fn)
dblume Support older vim on raspi

dblume authored 1 year ago

148)   if v:version > 800
149)     return trim(a:fn, "[]")
150)   else
151)     return a:fn
152)   endif
dblume Update vim statusline to pr...

dblume authored 1 year ago

153) endfunction
154) 
dblume Default to mode() if not in...

dblume authored 1 year ago

155) set statusline=\ %{Current_mode()}
dblume Update vim statusline to pr...

dblume authored 1 year ago

156) set statusline+=%{&paste?'\ \ ·\ PASTE':''}
dblume Retrieve git branch only on...

dblume authored 11 months ago

157) set statusline+=%{b:git_branch}
dblume vimrc use box drawing vertical

dblume authored 1 year ago

158) set statusline+=\ │\ %f
dblume Default to mode() if not in...

dblume authored 1 year ago

159) set statusline+=%m
160) set statusline+=\ %r
161) set statusline+=\ %=
dblume Update vim statusline to pr...

dblume authored 1 year ago

162) set statusline+=%h
dblume Default to mode() if not in...

dblume authored 1 year ago

163) set statusline+=\ %{Trim_brackets(&filetype)}
164) set statusline+=\ %#StatusLineNC#
dblume Only show encoding and form...

dblume authored 10 months ago

165) set statusline+=\ %{b:enc_fmt}
166) set statusline+=%p%%\ of
dblume Drop column and line number...

dblume authored 11 months ago

167) set statusline+=\ %L\ 
dblume Make "set ruler!" change st...

dblume authored 10 months ago

168) set statusline+=%{OnRuler()}
David Blume first commit

David Blume authored 9 years ago

169) 
170) set encoding=utf-8
171) 
dblume No comments after key mappi...

dblume authored 2 years ago

172) " Fast saving
173) nmap <leader>w :w!<cr>
David Blume first commit

David Blume authored 9 years ago

174) " I use relative number for cursor movement.
175) nmap <leader>r :set relativenumber!<cr>
176) nmap <leader>n :set number!<cr>
177) 
178) " Useful mappings for managing tabs
dblume Remove bad vim mappings for...

dblume authored 2 years ago

179) " Tab Previous: gT or C-PageUp
180) " Tab Next: gt or C-PageDown
David Blume first commit

David Blume authored 9 years ago

181) nmap <leader>tn :tabnew
182) nmap <leader>to :tabonly<cr>
183) nmap <leader>tc :tabclose<cr>
184) nmap <leader>tm :tabmove
dblume Add shortcuts for tab selec...

dblume authored 2 years ago

185) nmap <leader>1 1gt
186) nmap <leader>2 2gt
187) nmap <leader>3 3gt
188) nmap <leader>4 4gt
189) nmap <leader>5 5gt
190) nmap <leader>6 6gt
191) nmap <leader>7 7gt
192) nmap <leader>8 8gt
193) nmap <leader>9 9gt
dblume Use <leader>o OpenCurrentAs...

dblume authored 2 years ago

194) 
195) " Open current buffer in new tab. Close with C-w,c
196) " https://vim.fandom.com/wiki/Maximize_window_and_return_to_previous_split_structure
197) function! OpenCurrentAsNewTab()
dblume Restore entire window view...

dblume authored 2 years ago

198)     let l:currentView = winsaveview()
dblume Use <leader>o OpenCurrentAs...

dblume authored 2 years ago

199)     tabedit %
dblume Restore entire window view...

dblume authored 2 years ago

200)     call winrestview(l:currentView)
dblume Use <leader>o OpenCurrentAs...

dblume authored 2 years ago

201) endfunction
202) nmap <leader>o :call OpenCurrentAsNewTab()<CR>
David Blume first commit

David Blume authored 9 years ago

203) 
204) " pastetoggle
205) nmap <leader>p :set invpaste paste?<cr>
206) 
David Blume Add mapping to paste onto n...

David Blume authored 6 years ago

207) " Control+p to paste onto next line
208) nmap <C-p> :pu<cr>
209) 
David Blume Will use netrw's Explore in...

David Blume authored 3 years ago

210) " Make netrw's Explore behave a little like NERDTreeToggle
211) " http://vimcasts.org/blog/2013/01/oil-and-vinegar-split-windows-and-project-drawer/
David Blume Remove NERDTree and use net...

David Blume authored 4 years ago

212) function! ToggleNetrw()
David Blume Improve the toggling of the...

David Blume authored 3 years ago

213)   if bufwinnr("NetrwTreeListing") > 0
214)     for i in range(1, bufnr("$"))
215)       if (getbufvar(i, "&filetype") == "netrw")
David Blume Use netrw Vexplore to assur...

David Blume authored 3 years ago

216)         silent exe "bwipeout " . i
David Blume Improve the toggling of the...

David Blume authored 3 years ago

217)         return
218)       endif
219)     endfor
220)   endif
David Blume Use netrw Vexplore to assur...

David Blume authored 3 years ago

221)   silent Vexplore %:p:h
David Blume Remove NERDTree and use net...

David Blume authored 4 years ago

222) endfunction
223) nmap <leader>e :call ToggleNetrw()<cr>
224) 
dblume No comments after key mappi...

dblume authored 2 years ago

225) " install taglist
226) let Tlist_GainFocus_On_ToggleOpen = 1  " Jump to taglist window on open
227) let Tlist_Exit_OnlyWindow = 1          " if you are the last, kill yourself
228) let Tlist_Close_On_Select = 1          " Close taglist window on select
dblume Update taglist to 4.6 in vi...

dblume authored 10 months ago

229) let Tlist_Inc_Winwidth = 0             " Only needed for neovim in tmux
dblume No comments after key mappi...

dblume authored 2 years ago

230) nmap <leader>l :TlistToggle<cr>
231) 
232) " install vim-bbye
233) nmap <leader>bd :Bdelete<cr>
David Blume first commit

David Blume authored 9 years ago

234) 
235) " Visual mode mappings
236) """
237) 
238) " map sort function to a key
239) vnoremap <leader>s :sort<cr>
240) 
241) "easier moving of code blocks
David Blume vimrc key remappings. jk as...

David Blume authored 6 years ago

242) vnoremap < <gv
243) vnoremap > >gv
David Blume first commit

David Blume authored 9 years ago

244) 
245) " If too many file system events are getting triggered.
246) set nobackup       " ~ files
247) set nowritebackup  " Don't write buff to temp, delete orig, rename temp to orig
248) set noswapfile     " .swp files
249) 
250) " Allow tags to open another buffer even if this one is modified
251) set hidden
252) 
253) " Switch between source and header files
254) function! SwitchSourceHeader()
255)   let s:ext  = expand("%:e")
256)   let s:base = expand("%:t:r")
257)   let s:cmd  = "find " . s:base
258)   if (s:ext == "cpp" || s:ext == "c")
259)     if findfile(s:base . ".h"  ) != "" | exe s:cmd . ".h"   | return | en
260)     if findfile(s:base . ".hpp") != "" | exe s:cmd . ".hpp" | return | en
261)   else
262)     if findfile(s:base . ".cpp") != "" | exe s:cmd . ".cpp" | return | en
263)     if findfile(s:base . ".c"  ) != "" | exe s:cmd . ".c"   | return | en
264)   endif
265) endfunc
266) 
267) " Demonstrates a way to look in a mirror directory
268) " function! OpenOther()
269) "    if expand("%:e") == "cpp"
270) "      exe "split" fnameescape(expand("%:p:r:s?src?include?").".h")
271) "    elseif expand("%:e") == "h"
272) "      exe "split" fnameescape(expand("%:p:r:s?include?src?").".cpp")
273) "    endif
274) " endfunc
275) 
276) " Delete trailing white space on save, useful for Python and CoffeeScript ;)
277) function! DeleteTrailingWS()
278)   exe "normal mz"
279)   %s/\s\+$//ge
280)   exe "normal `z"
281) endfunc
282) 
David Blume Add OpenInOtherWindow to .v...

David Blume authored 8 years ago

283) function! OpenInOtherWindow()
284)   if winnr('$') == 1
285)     exe "wincmd F"
286)   else
287)     let curNum = winnr()
288)     let oldBuf = bufnr( "%" )
289)     if curNum == 1
290)       let othNum = 2
291)     else
292)       let othNum = 1
293)     endif
294)     exe "normal! gF"
295)     let newBuf = bufnr( "%" )
296)     let newLine = line(".")
297)     exe 'hide buf' oldBuf
298)     exe othNum . "wincmd w"
299)     exe 'hide buf' newBuf
300)     exe "normal! " . newLine . "G"
301)   endif
302) endfunc
303) 
304) nmap <silent> <leader>F :call OpenInOtherWindow()<cr>
dblume Make OpenInOtherWindow easier.

dblume authored 2 years ago

305) nmap <silent> <leader>f :call OpenInOtherWindow()<cr>
David Blume Add OpenInOtherWindow to .v...

David Blume authored 8 years ago

306) 
David Blume first commit

David Blume authored 9 years ago

307) if has("autocmd")
308)   autocmd BufWrite *.py :call DeleteTrailingWS()  " Delete trailing whitespace
309)   " Don't let smartindent unindent the # character in Python files
310)   autocmd FileType python  inoremap # X<c-h>#
dblume expand tabs for Python

dblume authored 1 year ago

311)   autocmd FileType python,c,cpp,php,brs,sh  set expandtab  " Use spaces instead of tabs
David Blume first commit

David Blume authored 9 years ago

312)   autocmd Filetype make    setl noexpandtab       " ...not for files that use tabs.
313) 
314)   " Use the vim command %retab before applying the following
315)   " two with files that have 8-space tabs.
David Blume Add .vimrc tab values for ....

David Blume authored 8 years ago

316)   autocmd FileType c,cpp,python,php  set tabstop=4
dblume Remove some lines, allow mo...

dblume authored 2 years ago

317)   autocmd FileType c,cpp,php  set shiftwidth=4
David Blume first commit

David Blume authored 9 years ago

318) 
319)   autocmd FileType python  set foldmethod=indent  " 'za' to fold
320) 
David Blume Disable vim-airline whitesp...

David Blume authored 6 years ago

321)   autocmd FileType c,cpp nmap <buffer> <leader>s :call SwitchSourceHeader()<cr>
David Blume first commit

David Blume authored 9 years ago

322)   autocmd FileType c,cpp set foldmethod=syntax
323) 
dblume Improve focus-based switchi...

dblume authored 10 months ago

324) " https://jeffkreeftmeijer.com/vim-number/
325) augroup numbertoggle
326)   autocmd!
327)   autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu   | endif
328)   autocmd BufLeave,FocusLost,InsertEnter,WinLeave   * if &nu                  | set nornu | endif
329) augroup END
David Blume first commit

David Blume authored 9 years ago

330) 
dblume Remove some lines, allow mo...

dblume authored 2 years ago

331)   autocmd BufRead *.txt set wrap linebreak   " "soft" wrap of existing lines
332)   autocmd BufRead README set wrap linebreak  " "soft" wrap of existing lines
dblume Add .local/bin to $PATH

dblume authored 2 years ago

333)   autocmd BufRead *.rs :setlocal tags=./rusty-tags.vi;/
David Blume first commit

David Blume authored 9 years ago

334) 
dblume Always start on first line...

dblume authored 11 months ago

335)   " When editing a file, always jump to the last cursor position...
David Blume first commit

David Blume authored 9 years ago

336)   autocmd BufReadPost *
dblume Improve Esc key reaction, f...

dblume authored 10 months ago

337)   \ if &ft != "gitcommit" && line("'\"") > 0 && line ("'\"") <= line("$") |
dblume When openging files jump to...

dblume authored 9 months ago

338)   \   exe "normal! g`\"" |
David Blume first commit

David Blume authored 9 years ago

339)   \ endif
dblume Improve Esc key reaction, f...

dblume authored 10 months ago

340)   " ...except for gitcommit where we always want to start at the top (nvim)
dblume Always start on first line...

dblume authored 11 months ago

341)   autocmd FileType gitcommit exe "normal! gg"
dblume Retrieve git branch only on...

dblume authored 11 months ago

342) 
dblume Only show encoding and form...

dblume authored 10 months ago

343)   autocmd BufNewFile,BufReadPost *
344)   \ let b:git_branch = GitBranch() |
345)   \ let b:enc_fmt = EncodingAndFormat()
346)   autocmd BufEnter *
347)   \ let b:git_branch = GitBranch() |
348)   \ let b:enc_fmt = EncodingAndFormat()
David Blume first commit

David Blume authored 9 years ago

349) endif
350) 
351) " This requires vim to be compiled with +python
352) " Use auto complete in insert mode with ctrl-x, ctrl-o
353) " See :help new-omni-completion for more.
354) filetype plugin on
355) set omnifunc=syntaxcomplete#Complete
dblume Completion tweaks

dblume authored 2 years ago

356) 
357) " Torn on whether I like the omni completion preview window left open or not.
358) " autocmd CompleteDone * pclose
359) 
360) " Omni completion via ctrl-space (in addition to ctrl-x ctrl-o)
361) inoremap <Nul> <C-x><C-o>
362) 
dblume Add commands SynStack and H...

dblume authored 10 months ago

363) " These two commands display syntax/highlight info for what's under the cursor.
364) if exists(":SynStack") != 2
365)     command SynStack :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
366) endif
367) 
368) function! SynGroup()
369)     let l:s = synID(line('.'), col('.'), 1)
370)     echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name')
371) endfun
372) command Hi :call SynGroup()
373) 
David Blume Add cscope support

David Blume authored 7 years ago

374) " cscope
375) if has("cscope")
376)     set cscopetag  " Use both cscope and ctag for 'ctrl-]'
David Blume I prefer ctags to be search...

David Blume authored 7 years ago

377)     set csto=1     " 0=cscope first; 1=ctags first
dblume Use QuickFix for cscope.

dblume authored 2 years ago

378)     set cscopequickfix=s-,c-,d-,i-,t-,e-,a- " cscope to quickfix window
379) 
David Blume Use local cscope.out databa...

David Blume authored 3 years ago

380)     set nocsverb
381)     " add any database in current directory
382)     if filereadable("cscope.out")
383)         cs add cscope.out
384)     " else add database pointed to by environment
385)     elseif $CSCOPE_DB != ""
386)         cs add $CSCOPE_DB
387)     endif
388)     set csverb
David Blume Add cscope support

David Blume authored 7 years ago

389) endif
390) 
David Blume Sort QuickFix tool by filen...

David Blume authored 3 years ago

391) " From https://stackoverflow.com/questions/15393301/how-to-automatically-sort-quickfix-entries-by-line-text-in-vim
392) " :grep term %
393) " :grep -r term path/
394) " :cw
395) " :ccl (or C-w,q)
dblume QuickFix window: only sort...

dblume authored 2 years ago

396) autocmd! QuickfixCmdPost * call MaybeSortQuickfix('QfStrCmp')
397) 
398) function! MaybeSortQuickfix(fn)
399) "    exe 'normal! '  " Doesn't work. Wanted to jump back to where we were.
400)     let t = getqflist({'title': 1}).title
dblume QuickFix sorts for 'vimgrep...

dblume authored 2 years ago

401)     " Only sort the files if for search-style commands, not "make".
dblume Follow up integrate ripgrep...

dblume authored 2 years ago

402)     if stridx(t, "cs ") == 0 || stridx(t, ":gr") == 0 || stridx(t, ":vim") == 0 || stridx(t, ":rg") == 0
dblume QuickFix window: only sort...

dblume authored 2 years ago

403)         call setqflist(sort(getqflist(), a:fn), 'r')
404)         call setqflist([], 'r', {'title': t})
405)     endif
406)     cwindow
David Blume Sort QuickFix tool by filen...

David Blume authored 3 years ago

407) endfunction
408) 
409) function! QfStrCmp(e1, e2)
410)     let [t1, t2] = [bufname(a:e1.bufnr), bufname(a:e2.bufnr)]
411)     return t1 <# t2 ? -1 : t1 ==# t2 ? 0 : 1
412) endfunction
413) 
dblume Integrate ripgrep into vim.

dblume authored 2 years ago

414) " Use ripgrep for search instead of grep
415) if executable('rg')
416)     " set grepprg=rg\ --vimgrep\ --hidden\ —glob '!.git'
417)     set grepprg=rg
418) endif
419) " Navigate quickfix list with ease
420) nnoremap <silent> [q :cprevious<CR>
421) nnoremap <silent> ]q :cnext<CR>
422) 
dblume Add DiffOrig from the vim h...

dblume authored 10 months ago

423) " From `:help :DiffOrig`.
dblume Make "set ruler!" change st...

dblume authored 10 months ago

424) if exists(":DiffOrig") != 2
425)   command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_
dblume Add DiffOrig from the vim h...

dblume authored 10 months ago

426)     \ | diffthis | wincmd p | diffthis
dblume Make "set ruler!" change st...

dblume authored 10 months ago

427) endif
dblume Add DiffOrig from the vim h...

dblume authored 10 months ago

428) 
David Blume Add tip for using Roboto Mo...

David Blume authored 6 years ago

429) " I use Roboto Mono from https://github.com/powerline/fonts
David Blume Change from vim-powerline t...

David Blume authored 6 years ago

430) " On iTerm2, Preferences -> Profiles -> Text -> Font
David Blume Add tip for using Roboto Mo...

David Blume authored 6 years ago

431) " Cygwin64 won't let you choose it. Launch Cygwin64 as follows:
432) " C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -o Font="Roboto Mono for Powerline" -
David Blume Change from vim-powerline t...

David Blume authored 6 years ago

433) 
David Blume Remove NERDTree and use net...

David Blume authored 4 years ago

434) " Settings that make netrw more like NERDTree
435) let g:netrw_banner = 0
436) let g:netrw_liststyle = 3
David Blume Use netrw Vexplore to assur...

David Blume authored 3 years ago

437) let g:netrw_browse_split = 4
David Blume Remove NERDTree and use net...

David Blume authored 4 years ago

438) let g:netrw_altv = 1
David Blume Use netrw Vexplore to assur...

David Blume authored 3 years ago

439) " set g:netrw_winsize to negative for absolute width, positive for relative
440) let g:netrw_winsize = -36
441) " let g:netrw_winsize = 35
David Blume Remove NERDTree and use net...

David Blume authored 4 years ago

442) " sort is affecting only: directories on the top, files below
443) let g:netrw_sort_sequence = '[\/]$,*'
David Blume Change from vim-powerline t...

David Blume authored 6 years ago

444) 
dblume Added vim-rooter.

dblume authored 2 years ago

445) " Experimenting with vim-rooter
446) let g:rooter_patterns = ['.git', 'Makefile', 'builds/']
dblume Make vim-rooter manual.

dblume authored 2 years ago

447) let g:rooter_cd_cmd = 'lcd'
448) let g:rooter_manual_only = 1