Skip to content

Commit

Permalink
[vim] Update configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
fifthdrew committed Sep 23, 2024
1 parent 6710363 commit 17567f9
Showing 1 changed file with 14 additions and 38 deletions.
52 changes: 14 additions & 38 deletions vim/.vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ set wildignore+=*/.git/**/*,*/.hg/**/*,*/.svn/**/*
set wildignore+=tags
set wildignore+=*.tar.*

" This set the char used to behave like Tab in selection menus
" This is useful for mappings like:
" nnoremap <leader>b :buffer <C-n>
set wildcharm=<C-n>

" Allow load a buffer in a window that
" currently has a modified buffer
set hidden
Expand Down Expand Up @@ -139,11 +144,6 @@ set ttyfast
" http://bugs.debian.org/608242
" set t_RV=

" Automatically invoke completion mode in mappings
" This is necessary for the following:
" nnoremap <leader>B :buffer <C-z><S-Tab>
set wildcharm=<C-z>

" Set the working directory to wherever the open file lives
set autochdir

Expand Down Expand Up @@ -191,6 +191,9 @@ let g:netrw_fastbrowse = 0
" Explore
let g:explore_is_open = 0

" Quickfix
let g:quickfix_is_open = 0

" Value used in colorcolumn option
let g:limit_column_start = 81
let g:limit_column_end = g:limit_column_start * 2
Expand Down Expand Up @@ -232,9 +235,6 @@ let g:gruvbox_improved_warnings = 0
let mapleader="\<space>"
let maplocalleader=","

" Quickfix
let g:quickfix_is_open = 0

" Comment characters for each language
" SOURCE: https://stackoverflow.com/questions/1676632
let s:comment_map = {
Expand Down Expand Up @@ -414,23 +414,6 @@ function! FilePath() abort
return '' . l:path . '/' . expand('%:t')
endfunction

function! SaveSession()
execute 'mksession! /tmp/session.vim'
endfunction

function! RestoreSession()
if filereadable('/tmp/session.vim')
execute 'so /tmp/session.vim'
if bufexists(1)
for l in range(1, bufnr('$'))
if bufwinnr(l) == -1
exec 'sbuffer ' . l
endif
endfor
endif
endif
endfunction

function! IsNotDiff()
return expand('%:e') != 'diff'
endfunction
Expand Down Expand Up @@ -553,18 +536,16 @@ augroup END
nmap <Leader>v :edit $MYVIMRC<CR>
nmap <Leader>s :source $MYVIMRC<CR>
" Create and source my session file
nmap <Leader>cs :mksession! /tmp/session.vim<CR>
nmap <Leader>ls :source /tmp/session.vim<CR>
" Put a semicolon at the and of the actual line
nnoremap <Leader>; A;<Esc>
" List buffers and ask for the target buffer
nnoremap <Leader>b :ls<CR>:b<Space>
nnoremap <Leader>B :ls<CR>:b<Space>
" List buffers and ask for the target buffer (with completion mode)
nnoremap <Leader>B :buffer <C-z><S-Tab>
" <C-n> is set to behave like <Tab> using the 'wildcharm' option
nnoremap <Leader>b :buffer <C-n>
nnoremap <Leader>bb :buffer <C-n>
" Navigate to next and previous buffers
nnoremap <Leader>bn :bnext<CR>
Expand All @@ -574,7 +555,8 @@ nnoremap <Leader>bp :bprevious<CR>
nnoremap <Leader>m :marks<CR>:'
" Open builtin terminal
nmap <Leader>t :term<Space>
nmap <Leader>t :term ++curwin<Space>
nmap <Leader>tt :term ++curwin<Space>
" Quick fix operations
nmap <Leader>qq :call ToggleQuickfix()<CR>
Expand Down Expand Up @@ -614,12 +596,6 @@ nmap <Leader>* :grep -R <cword> * --exclude-dir={.git,tmp,log,node_modules}<CR><
" Open a new fresh tab
nmap <Leader>tn :tabnew<CR>
" Split window vertically
nmap <Leader>sv :call SplitVertically()<CR>
" Split window horizontally
nmap <Leader>sh :call SplitHorizontally()<CR>
" Re-size windows
nmap <Down> :resize +10<CR>
nmap <Up> :resize -10<CR>
Expand Down

0 comments on commit 17567f9

Please sign in to comment.