Skip to content

Commit

Permalink
updates to minimal vim
Browse files Browse the repository at this point in the history
  • Loading branch information
0xMF committed Aug 1, 2024
1 parent 8e2b371 commit 99a5507
Showing 1 changed file with 56 additions and 8 deletions.
64 changes: 56 additions & 8 deletions editors/vim/vimrc-minimal.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,68 @@

let loaded_matchparen = 1

set expandtab
set nohlsearch
set textwidth=78
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set textwidth=78
set tabstop=2

au BufNewFile,BufRead *.py setlocal tabstop=4
au BufWritePost * call DeleteTrailingSpaces()

map b <C-B>
syntax on

imap ;n <ESC>:set number!a<CR>
imap ;l <ESC>:set list!a<CR>
imap ;w <ESC>:set wrap!a<CR>
map b <PageUp>
map f <PageDown>
map ;h <Esc>:set hltsearch!<CR>
map ;l <Esc>:set list!<CR>
map ;n <Esc>:set number!<CR>
map ;w <Esc>:set wrap!<CR>
map <BS> <PageUp>
map <Space> <PageDown>
map <S-Space> <PageUp>
map <Space> <C-f>
map ;<Space> <PageUp>
map ;h <Esc>:set hlsearch!<CR>
map ;l :set list!<CR>
map ;n :set number!<CR>
map ;w :set wrap!<CR>
map <C-n> <Esc>:call BufferNext()<CR>
map <C-p> <Esc>:call BufferPrevious()<CR>
function! DeleteTrailingSpaces()
let l:savecursor = winsaveview()
:silent :%g/ *$/:s/ *$//
call winrestview(l:savecursor)
endfunction

" get previous buffer for console vim
function! BufferPrevious()
:set showtabline=0 " =0 never show tabs, =1 show if 2 or more tabs, =2 always show
let mybuflist = getbufinfo()
:if len(mybuflist) < 2
: echo "no previous buffer"
:else
: bprevious
: if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
: exe "normal! g`\""
: endif
:endif
endfunction

" get next buffer function! BufferNext()
function! BufferNext()
:set showtabline=0 " =0 never show tabs, =1 show if 2 or more tabs, =2 always show
let mybuflist = getbufinfo()
:if len(mybuflist) < 2
: echo "no next buffer"
:else
: bnext
" see restore-cursor
: if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
: exe "normal! g`\""
: endif
:endif
endfunction

0 comments on commit 99a5507

Please sign in to comment.