Difference between revisions of "VIM"
Jump to navigation
Jump to search
Line 10: | Line 10: | ||
nano ~/.vimrc | nano ~/.vimrc | ||
``` | ``` | ||
− | colorscheme desert | + | " colorscheme desert |
"colorscheme wombat256 | "colorscheme wombat256 | ||
syntax on | syntax on | ||
Line 46: | Line 46: | ||
wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O ~/.vim/syntax/nginx.vim | wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O ~/.vim/syntax/nginx.vim | ||
− | + | " Set location of Nginx config file | |
cat > ~/.vim/filetype.vim <<EOF | cat > ~/.vim/filetype.vim <<EOF | ||
au BufRead,BufNewFile /etc/nginx/*,/etc/nginx/conf.d/*,/usr/local/nginx/conf/*,*/conf/nginx.conf if &ft == '' | setfiletype nginx | endif | au BufRead,BufNewFile /etc/nginx/*,/etc/nginx/conf.d/*,/usr/local/nginx/conf/*,*/conf/nginx.conf if &ft == '' | setfiletype nginx | endif |
Revision as of 05:22, 13 April 2020
VIM Editor
Quick Commands
- %s;^(\s+);\=repeat(' ', len(submatch(0))/2);g
Very Basic VIM setup
nano ~/.vimrc
" colorscheme desert "colorscheme wombat256 syntax on filetype plugin indent on " show existing tab with 4 spaces width set tabstop=4 " when indenting with '>', use 4 spaces width set shiftwidth=4 " On pressing tab, insert 4 spaces set expandtab " Uncomment the following to have Vim jump to the last position when " reopening a file if has("autocmd") au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif endif autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab " set default filetype if no extension, usually sh or py au BufNewFile,BufRead * if &syntax == '' | set syntax=py | endif filetype plugin on au BufNewFile,BufRead * if &ft == '' | set ft=py | endif "fix copy/paste issues with mouse :set mouse=v au BufReadPost *.sls set syntax=yaml
NGINX highlight
mkdir -p ~/.vim/syntax/ wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O ~/.vim/syntax/nginx.vim " Set location of Nginx config file cat > ~/.vim/filetype.vim <<EOF au BufRead,BufNewFile /etc/nginx/*,/etc/nginx/conf.d/*,/usr/local/nginx/conf/*,*/conf/nginx.conf if &ft == '' | setfiletype nginx | endif EOF