vim

.vimrc setup

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
set showmode
set encoding=utf-8
set t_Co=256
set tabstop=4
set shiftwidth=4
set expandtab

set nolist

set number

set paste

set showmatch

autocmd BufNewFile *.py,*.sh exec ":call SetTitle()"

func SetTitle()
if expand("%:e") == 'sh'
call setline(1,"#!/bin/bash")
elseif expand("%:e") == 'py'
call setline(1,"#!/bin/python")
endif

call setline(2,"")
call setline(3,"#------------------------------------------------#")
call setline(4,"#Author: wpsze")
call setline(5,"#Email: wpsze@gmail.com")
call setline(6,"#date: ".strftime("%Y-%m-%d %H:%M:%S"))
call setline(7,"#Version: 0.0 ")
call setline(8,"#Description: The purpose of the script")
call setline(9,"#Copyright (C): ".strftime("%Y")." All rights reserved")
call setline(10,"#------------------------------------------------#")
call setline(11,"")
call setline(12,"")

if expand("%:e") == 'sh'
call setline(14, "#source /home/wpsze/anaconda3/bin/activate venv")
call setline(16, "export SCRIPT_DIR=\x22$( cd \x22$( dirname \x22${BASH_SOURCE[0]}\x22 )\x22 >/dev/null 2>&1 && pwd )\x22")
endif

endfunc

autocmd BufNewFile * normal G

vim
https://waipangsze.github.io/2023/10/20/vim/
Author
wpsze
Posted on
October 20, 2023
Updated on
October 8, 2024
Licensed under