初装linux的一些配置

来源:互联网 发布:互联网金融数据平台 编辑:程序博客网 时间:2024/05/01 08:59

vim

拷贝vimrc到/home/下,并且改名为.vimrc
(文件vimrc一般在/usr/share/vim下)
添加内容:

set mouse=a"set mouse-=aset smartindentset tabstop=4set shiftwidth=4set softtabstop=4set expandtab"set noexpandtabset number  "=set nu"set nonumber  "=set nonu

苹果电脑Mac安装vim(资源地址)

1. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"2. brew install macvim ctags git3. cd ~ && git clone https://github.com/ruchee/vimrc.git4. rm -rf ~/.vimrc ~/.vim5. ln -s ~/vimrc/vimfiles ~/.vim && ln -s ~/vimrc/_vimrc ~/.vimrc6. finished, enjoy来自:https://www.zhihu.com/question/28796264/answer/42147165

Debian/Ubuntu和Mint 下载安装vim8.0

来源:链接

sudo apt install ncurses-devwget https://github.com/vim/vim/archive/master.zipunzip master.zipcd vim-mastercd src/./configuremakesudo make installvim

PS:记得重启电脑

在 Ubuntu 13.10, 13.04, 12.04等linux上升级 Vim 7.4

来源:链接
Vim 7.4 is available in the default repositories of Ubuntu 13.10 Saucy Salamander, Linux Mint 16 Petra and Debian Sid, so installing it on Ubuntu and Linux Mint is easy. All you have to do is:

sudo apt-get update  sudo apt-get install vim  

To install Vim 7.4 on Ubuntu 13.04 Raring Ringtail, Ubuntu 12.04 Precise Pangolin, Linux Mint 15 Olivia and Linux Mint 13 Maya, we have to add a third-party PPA. Do this for a successful installation:

sudo add-apt-repository ppa:fcwu-tw/ppasudo apt-get updatesudo apt-get install vim

Linux在文件夹下内如何右键进入终端(Terminal)

打开终端,输入如下命令:sudo apt-get install nautilus-open-terminal


设置shell,修改rm指令为mv,防止误删文件

因为,经常用到rm指令,有时候稍不留心,在删除xx.c~时不小心把xx.c给删除了,因此,有必要把rm指令改一下,防止误删文件。
另外,我这有个缺陷,就是用到真正的rm指令时,还需要改成这样:rmOPEN = 1,再输入命令source ~/.cshrc设置一下,就能把rm还原了。
1. 查看使用的shellecho $SHELL
我的显示为/tool/pandora/bin/tcsh,因此,我的shell用的是tcshell
2. 一般用默认的文件名.chsrc,用vim ~/.cshrc 即可编辑

#!/tool/pandora/bin/tcshset rmOPEN = 0if($rmOPEN) then    alias rm 'rm'else    #删除文件,xxx为usermame    alias rm '/home/xxx/.cshrc_rm.sh'endif# 恢复删除的文件alias ur '/home/xxx/.cshrc_ur.sh'

3.文件.cshrc_rm.sh

#!/tool/pandora/bin/tcsh#将要删除的文件移动到trash下(自己新建一个trash文件夹)mv $argv[*] /home/xxx/trash

4.文件.cshrc_ur.sh

#!/tool/pandora/bin/tcsh#计算出argv从1开始的参数个数set num = $#argvwhile($num)    mv -i /home/xxx/trash/$argv[num] ./    echo $argv[num] 'recovery'    @ num--end

5.source ~/.cshrc,在shell下输入如下指令试试

$ mkdir file$ rm file$ ur file$ mkdir file1 file2 file3$ rm file1 file2 file3$ ur file1 file2 file3

argv存储了所有的命令行参数, 每个参数(以空白符分隔)占用一个argv[i]。
argv[0] 在linux指令中为空
argv[1] 为第一个参数比如 file1
argv[2] 为第二个参数比如 file2
argv[3] 为第三个参数比如 file3
若用arg[*],表示所有参数
用$#argv,可以获得参数的个数,从1开始计数,这里是3

参考文件:
tcsh入门 - BlogJava
csh 语法实例参考 | 学步园
csh 语法实例参考 - iTech - 博客园
Csh的基本语法介绍linux shell脚本之家


原创粉丝点击