zoukankan      html  css  js  c++  java
  • MacOS 实用设置和工具

    1 办公

    a) 输入法

    自带中文输入法中英切换需要按ctrl+space,很麻烦。

    使用搜狗输入法,按shift切换中英文

    b) 删除光标后面的内容

    按fn+DELETE

    c) 定时休息

    http://www.dejal.com/timeout/

    d) 在Finder中查看隐藏文件、全路径

    查看隐藏文件:

    $ defaults write com.apple.finder AppleShowAllFiles -bool true

    取消查看:

    $ defaults write com.apple.finder AppleShowAllFiles -bool false

    查看全路径:

    $ defaults write com.apple.finder _FXShowPosixPathInTitle -bool TRUE;killall Finder

    取消查看:

    $ defaults delete com.apple.finder _FXShowPosixPathInTitle;killall Finder

    e) 快捷键参考:

    1. 在terminal中,⌘+enter 全屏显示
    2. 在Finder中点选任意文件或者文件夹,点击空格键预览或查看详情
    3. ⌘ + C 复制(拷贝) ; ⌘ + V 粘贴 ; ⌘ + option + V 移动
    4. ⌘ + option + esc 强制退出某个软件
    5. ⌘ + delete 删除选中项

    其中:

    ⌘(command)

    ⌥(option)

    ⇧(shift)

    ⇪(caps lock)

    ⌃(control)

    ↩(return)

    ⌅(enter)

    f) 远程连接

    1. 终端:ssh username@remote_ip
    2. vssh
    3. shuttle

    2 shell加强版

    2.1 ssh连接到GitHub提示Permission denied (publickey).

    https://segmentfault.com/q/1010000000095149/a-1020000010281766

    首先拷贝已有private key,接着通过ssh-add把key添加到authentication agent就可以了。

    2.2 设置terminal颜色、自动补全忽略大小写

    http://blog.csdn.net/songjinshi/article/details/8945809

    $ nano ~/.bash_profile
    alias ls="ls -G"
    alias ll="ls -lh"
    export CLICOLOR=1
    export LSCOLORS=gxfxaxdxcxegedabagacad
    
    $ nano .inputrc
    set completion-ignore-case on
    set show-all-if-ambiguous on
    TAB: menu-complete
    

    2.3 第三方shell

    自带shell的缺点在于:

    1. 不能cmd+数字切换terminal
      ...

    而iTerm2号称MAC 下最好的终端工具。

    首先安装iTerm 2

    安装Oh My Zsh(方便管理和配置 zsh,自带了很多好用的基本配置):
    curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh

    或者
    $ wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

    iTerm 2 && Oh My Zsh http://www.jianshu.com/p/7de00c73a2bb
    iterm2用法 https://www.zhihu.com/question/27447370 http://wulfric.me/2015/08/iterm2/
    我在用的mac软件(1)--终端环境之iTerm2

    3 命令行工具

    自带open工具:$ open your-filename相当于双击filename

    3.1 通过homebrew安装其他工具

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    例如,安装下载工具wget:brew install wget

    3.2 查看树形的目录结构

    1、 ls/grep/sed组合命令

    ls -R | grep ":" | sed -e 's/://' -e 's/[^-][^/]*//--/g' -e 's/^/   /' -e 's/-/|/'
    

    简化命令:

    vim ~/.bash_profile
    alias mytree="ls -R | grep ':' | sed -e 's/://' -e 's/[^-][^/]*//--/g' -e 's/^/   /' -e 's/-/|/'"
    source ~/.bash_profile
    

    注意,在zsh下,.bash_profile中的命令并不会新建terminal自动执行。可以在~/.zshrc添加source ~/.bash_profile

    3.3 homebrew提供的tree命令

    brew install tree
    Downloading https://homebrew.bintray.com/bottles/tree-1.7.0.el_capitan.bottl
    ######################################################################## 100.0%
    ==> Pouring tree-1.7.0.el_capitan.bottle.1.tar.gz
    

    示例:

    ➜  mytree
       |-src
       |---main
       |-----java
       |-----resources
       |---test
       |-----java
    ➜  tree
    .
    ├── f1.iml
    ├── pom.xml
    └── src
        ├── main
        │   ├── java
        │   └── resources
        └── test
            └── java
    

    tree like structure http://hints.macworld.com/article.php?story=20060209130749352

    3.4 查找进程

    $ sudo lsof -i -P | grep -i "listen"

    lsof命令在mac下运行很慢,添加选项即可: lsof -n

    https://apple.stackexchange.com/questions/81140/why-is-lsof-on-os-x-so-ridiculously-slow

    3.4 连接到Linux服务器之后,使用rzsz传输文件

    cd /usr/local/bin
    sudo wget https://raw.github.com/mmastrac/iterm2-zmodem/master/iterm2-send-zmodem.sh
    sudo wget https://raw.github.com/mmastrac/iterm2-zmodem/master/iterm2-recv-zmodem.sh
    sudo chmod a+x iterm2-*
    

    添加iTerm2 trigger: iTerm2 --> Profiles --> default --> advanced --> Edit Trigger

    http://www.cnblogs.com/dingdada/p/4498766.html

    4 QA

    1、 如何关闭chrome右滑返回

    https://jingyan.baidu.com/article/bad08e1ede062b09c8512103.html

    $ defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false   
    $ defaults read com.google.Chrome  # 查看修改后的结果
    {
        AppleEnableSwipeNavigateWithScrolls = 0;
        KeychainReauthorizeInAppSpring2017 = 2;
        KeychainReauthorizeInAppSpring2017Success = 1;
        LastRunAppBundlePath = "/Applications/Google Chrome.app";
        NSNavLastRootDirectory = "~/Documents";
        NSNavPanelExpandedSizeForOpenMode = "{704, 415}";
        NSNavPanelExpandedSizeForSaveMode = "{712, 597}";
    }
    
  • 相关阅读:
    jQuery源码 support
    jQuery 源码: 延迟对象补充。
    web FG interview all
    Img load
    浅谈js中this指向问题
    浅谈ES6原生Promise
    BootStrap的两种模态框方式
    让div盒子相对父盒子垂直居中的几种方法
    normalize与reset
    JS实现继承的方式
  • 原文地址:https://www.cnblogs.com/lawlietfans/p/7220038.html
Copyright © 2011-2022 走看看