Working on vim settings

This commit is contained in:
2021-12-31 14:04:23 -05:00
parent 8841d92e87
commit 9b10825aa0
6 changed files with 121 additions and 107 deletions

View File

@@ -1,43 +0,0 @@
" Settings:
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
set exrc
set relativenumber
set nohlsearch
set hidden
set nu
set nowrap
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
set incsearch
set termguicolors
set scrolloff=8
set noshowmode
set signcolumn=yes
set colorcolumn=80
set noerrorbells
set number
syntax enable
set background=dark
let mapleader = " "
fun! TrimWhiteSpace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfun
augroup MICHAEL
autocmd!
autocmd BufWritePre * :call TrimWhiteSpace()
autocmd Filetype yaml setlocal ts=2 sts=2 sw=2 expandtab
augroup END

87
vim/.vim/vimrc Normal file
View File

@@ -0,0 +1,87 @@
" ----------------------- settings ----------------------------------
set autoindent
set autowrite " automatically write files when changing
set background=dark
set ruler " turns on col and row in lower right
" used with `set ruler`
set ruf=%30(%=%#LineNr#%.50F\ [%{strlen(&ft)?&ft:'none'}]\ %l:%c\ %p%%%)
set showmode " show command and insert mode
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab " replace tabs with spaces automatically
set textwidth=72
set smartindent
set smarttab
set nofixendofline
set foldmethod=manual
set exrc
set relativenumber
set nohlsearch
set hidden
set nocompatible
set nu
set nowrap
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
set icon
set incsearch
set termguicolors
set scrolloff=8
set signcolumn=yes
set colorcolumn=80
set noerrorbells
set number
set wildmenu
set ttyfast " faster scrolling
set viminfo='20,<1000,s1000 " prevents truncated yanks, deletes, etc.
set hidden
set history=100 " command history
syntax enable
filetype plugin on " sense the filesystem
let mapleader = " "
" ----------------------- plugins ----------------------------------
" Install vim-plug if not found
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
call plug#begin('~/.vim/plugged')
Plug 'junegunn/fzf'
Plug 'vim-pandoc/vim-pandoc'
Plug 'rwxrob/vim-pandoc-syntax-simple'
Plug 'morhetz/gruvbox'
call plug#end()
colorscheme gruvbox
" highlight Normal guibg=none
" ----------------------- utilities ----------------------------------
" Edit/Reload vimr configuration file
nnoremap confe :e $HOME/.vimrc<CR>
nnoremap confr :source $HOME/.vimrc<CR>
fun! TrimWhiteSpace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfun
augroup MICHAEL
autocmd!
autocmd BufWritePre * :call TrimWhiteSpace()
autocmd Filetype yaml setlocal ts=2 sts=2 sw=2 expandtab
augroup END

View File

@@ -1,61 +0,0 @@
" Settings:
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
set smartindent
set exrc
set relativenumber
set nohlsearch
set hidden
set nu
set nowrap
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
set incsearch
set termguicolors
set scrolloff=8
set noshowmode
set signcolumn=yes
set colorcolumn=80
set noerrorbells
set number
syntax enable
set background=dark
let mapleader = " "
" Install vim-plug if not found
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
call plug#begin('~/.vim/plugged')
" Plug 'morhetz/gruvbox'
call plug#end()
highlight Normal guibg=none
fun! TrimWhiteSpace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfun
augroup MICHAEL
autocmd!
autocmd BufWritePre * :call TrimWhiteSpace()
autocmd Filetype yaml setlocal ts=2 sts=2 sw=2 expandtab
augroup END

15
vim/setup Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
set -e
if test -z "$(type vim)"; then
echo "Does not look like you have vim installed."
exit 1
fi
mkdir "${HOME}/.vim" |true
ln -sfv "${PWD}/.vim/vimrc" "${HOME}/.vim/vimrc"