zoukankan      html  css  js  c++  java
  • 04-配置快捷键启动终端/终端美化

    一、配置启动终端快捷命令:

    1.打开自动操作

     

     2.选择快速操作

     3.将“工作流程收到”设置为“没有输入”;然后将左侧的“运行AppleScript”拖到右侧

     4.在右侧代码处替换如下的代码,该代码是在桌面打开终端,所处的路径是 ~

    可以点击运行开是否能执行成功,加入下面这些代码后,可在任意位置打开终端

    on run {input, parameters}
        tell application "Finder"
            set myWin to window 1
            set thePath to (quoted form of POSIX path of (target of myWin as alias))
            if application "Terminal" is running then
                tell application "Terminal"
                    do script "cd " & thePath
                    activate
                end tell
            else
                tell application "Terminal"
                    do script "cd " & thePath in window 1
                    activate
                end tell
            end if
        end tell
    end run

     5.保存后可命名为 “打开终端”

    之后打开 系统偏好——>键盘——>快捷键

    在左侧选择服务,右侧通用处找到刚刚命名的文件,然后设置喜欢的快捷键即可

     然后就可以在任意地方按所设置的快捷键打开终端了~


     二、美化终端

    shell 的类型有很多种,mac、linux下默认的是bash,虽然bash的功能已经很强大,但对于以懒惰为美德的程序员来说,bash的提示功能不够强大,界面也不够炫,并非理想工具。而zsh的功能极其强大,上面这些 bash 没有的功能它都有。

    如果没有安装zsh,去安装:然后再切换( 切换之后需要退出用户重新登陆 )

    # 安装 zsh
    brew install zsh

     切换shell为zsh:

    chsh - s /bin/zsh

    1.下载安装iTerm2 Mac神器iTerm2基本命令

    2.安装 ohmyzsh 一般Mac都有安装wget,未安装的先安装wget:

    brew install wget

    安装ohmyzsh指令:

    sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

    **错误1: **ohmyzsh 报 “Insecure completion-dependent directories detected“ 错误

    权限问题:

    chmod 755 /usr/local/share/zsh
    
    chmod 755 /usr/local/share/zsh/site-functions

    即可。

    **错误2: **chsh - s /bin/zsh ,总是提示 chsh: no changes made错误

    提示chsh:no changes made 解决办法:终端输入:

    **dscl . -read /Users/$USER/ UserShell**
    
    **exec su - $USER**

    然后在输入密码即可。完美解决

    出现:

      ____  / /_     ____ ___  __  __   ____  _____/ /_  
     / __ / __    / __ `__ / / / /  /_  / / ___/ __  
    / /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / 
    \____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  
                            /____/                       ....is now installed!
    Please look over the ~/.zshrc file to select plugins, themes, and options.
    
    p.s. Follow us at https://twitter.com/ohmyzsh.
    
    p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.

    就说明安装成功了,这时在打开终端,就已经可以看的高亮了

    3.安装ohmyzsh额外的插件:

    安装历史命令提示插件:

    git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

    安装高亮插件

    git clone git://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

    4.添加 source ~/.bash_profile

    zsh 默认是加载 ~/.zshrc , 默认是没有加载用户环境变量的 需要在 ~/.zshrc 中添加一行

     source ~/.bash_profile

    之后,每次启动控制台窗口都会去加载用户环境变量

    5.更换主题、字体等

     

     6.设置oh-my-zsh 主题  更多主题

    #修改主题
    vim ~/.zshrc

    将ZSH_THEME改成 : af-magic 这个主题(有分割线)

     

     7.修改过后,最后要更新一下配置

    # 更新配置
    source ~/.zshrc

     效果展示:

     

  • 相关阅读:
    栈区,堆区,全局区,文字常量区,程序代码区 详解
    2010年IT行业十大收购
    三大数据备份方式:完全备份、增量备份以及差异备
    Driver Development Part 1: Introduction to Drivers (code project)
    手工构造典型PE文件(转)
    访问IIS元数据库失败[转]
    代码注入的三种方法(转)
    对象的初始化(转)
    网络和黑客编程基本知识 (转)
    破解linux中root密码(图) 转自csdn
  • 原文地址:https://www.cnblogs.com/haoqiyouyu/p/15534199.html
Copyright © 2011-2022 走看看