minor changes to vim/vi and usage

This commit is contained in:
Solomon Laing 2023-02-15 22:13:43 +10:30
parent 648b4ae031
commit 484deb5def
2 changed files with 22 additions and 5 deletions

View File

@ -1,21 +1,24 @@
let mapleader =" " let mapleader =" "
if ! filereadable(system('echo -n ".vim/autoload/plug.vim"')) if ! filereadable(system('echo -n "$HOME/.vim/autoload/plug.vim"'))
echo "Downloading junegunn/vim-plug to manage plugins..." echo "Downloading junegunn/vim-plug to manage plugins..."
silent !mkdir -p .vim/autoload/ silent !mkdir -p "$HOME/.vim/autoload/"
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > .vim/autoload/plug.vim silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > "$HOME/.vim/autoload/plug.vim"
autocmd VimEnter * PlugInstall autocmd VimEnter * PlugInstall
endif endif
call plug#begin(system('echo -n ".vim/plugged"')) call plug#begin(system('echo -n "$HOME/.vim/plugged"'))
Plug 'tpope/vim-surround' Plug 'tpope/vim-surround'
Plug 'preservim/nerdtree' Plug 'preservim/nerdtree'
Plug 'junegunn/goyo.vim' Plug 'junegunn/goyo.vim'
Plug 'jreybert/vimagit' Plug 'jreybert/vimagit'
Plug 'vimwiki/vimwiki' Plug 'vimwiki/vimwiki'
Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-commentary' Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'ap/vim-css-color' Plug 'ap/vim-css-color'
Plug 'jreybert/vimagit'
call plug#end() call plug#end()
set title set title
@ -72,9 +75,17 @@ set noshowcmd
" Compile document, be it groff/LaTeX/markdown/etc. " Compile document, be it groff/LaTeX/markdown/etc.
map <leader>c :w! \| !compiler "<c-r>%"<CR> map <leader>c :w! \| !compiler "<c-r>%"<CR>
" Cycle buffers a bit easier
map L :bnext<CR>
map H :bprevious<CR>
" Open corresponding .pdf/.html or preview " Open corresponding .pdf/.html or preview
map <leader>p :!opout <c-r>%<CR><CR> map <leader>p :!opout <c-r>%<CR><CR>
" Easy save
nnoremap <c-s> :w!<CR>
inoremap <c-s> <ESC>:w!<CR>a
" Runs a script that cleans out tex build files whenever I close out of a .tex file. " Runs a script that cleans out tex build files whenever I close out of a .tex file.
autocmd VimLeave *.tex !texclear % autocmd VimLeave *.tex !texclear %
@ -125,3 +136,9 @@ function! ToggleHiddenAll()
endif endif
endfunction endfunction
nnoremap <leader>h :call ToggleHiddenAll()<CR> nnoremap <leader>h :call ToggleHiddenAll()<CR>
" Extra plugins configuration
" Airline
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme='base16_gruvbox_dark_hard'

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
cmd=$(command -v "$1") cmd=$(command -v "$1")
test -n "$cmd" && exec vi "$cmd" test -n "$cmd" && exec vim "$cmd" || exec vi "$cmd"