Skip to content

Instantly share code, notes, and snippets.

@luiarthur
Last active February 16, 2023 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luiarthur/bae778b7c88f8b702967097292fb25a7 to your computer and use it in GitHub Desktop.
Save luiarthur/bae778b7c88f8b702967097292fb25a7 to your computer and use it in GitHub Desktop.
simple vimrc (for vim 7+)
" Plugins.
call plug#begin()
Plug 'luiarthur/tmux.vim'
Plug 'luiarthur/red.vim'
call plug#end()
" Color scheme.
silent! colorscheme noir " depends on `luiarthur/red.vim`
" Tab / buffer navigation.
map <S-Right> :tabnext<CR>
map <S-Left> :tabprevious<CR>
map <S-Down> :bnext<CR>
map <S-Up> :bprevious<CR>
" Basic stuff
set number " Show line numbers on side.
syntax enable " Syntax highlighting
set hlsearch " Highlight search items
set incsearch " Highlight search items as you type
set showmatch " Show matches for parenthesis, etc.
set expandtab " Use softtabs
set tabstop=2 shiftwidth=2 " Set tab width
set autoindent " Automaticall indent lines
set nobackup " Don't create .swp
set clipboard=unnamedplus " copy and paste to clipboard.
set guicursor=a:blinkon0 " disable cursor blinking
set laststatus=0 ruler " Hides status bar. The airline plugin seems to ignore this.
set splitbelow " vertical splits create windows below by default.
set splitright " horizontal splits create window to the right by default.
set mouse=a " enable copy / paste using mouse, while in vim.
set fillchars=stl:- " fill active window's statusline with -
set fillchars+=stlnc:- " also fill inactive windows' statusline with -
" Indenting / unindenting in visual mode
vmap < <gv
vmap > >gv
vmap <s-tab> <gv
vmap <tab> >gv
" disable F1 for help
nmap <F1> <nop>
" Reset syntax highlight
noremap <F10> <ESC>:syntax sync fromstart<CR>
inoremap <F10> <C-o>:syntax sync fromstart<CR>
" Return to last position
augroup return_cursor_to_last_position
autocmd!
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
augroup END
" Always open new files as tabs.
" NOTE: tabs can be close with `:bd`.
augroup open-tabs
au!
au VimEnter * ++nested if !&diff | tab all | tabfirst | endif
augroup end
" Spell check for markdown files.
au BufRead *.md setlocal spell
" Highlight column 80
" function! MarkCol80()
" highlight ColorColumn ctermbg=red
" call matchadd('ColorColumn', '\%81v', 100)
" endfunction
" au BufRead *.{py,jl,R,scala,md} call MarkCol80()
" Copy and paste between vim sessions.
" Copy the current visual selection to ~/.vbuf.
" For servers, uncomment the following lines:
vmap <C-S-y> :w! ~/.vbuf<CR> " copy the current visual selection to ~/.vbuf
nmap <C-S-p> :r ~/.vbuf<CR> " paste the contents of the buffer file
@luiarthur
Copy link
Author

luiarthur commented Aug 7, 2022

Alternatively, we can avoid using plug.vim by putting tmux.vim in ~/.vim/plugin/, and putting red.vim and noir.vim in ~/.vim/colors/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment