• 初始化我的arcolinux


    初始化我的arcolinux

    1. 配置git

    1.1. 配置git用户名,邮箱

    git config --global user.name "username"
    git config --global user.email "email.@qq.com"
    
    • 1
    • 2

    配置完查看是否配置成功 git config --global --list
    如果没有错误,我们就可以进行下一步了。

    1.2. 生成ssh密钥

    1.查看是否已经有了ssh密钥:cd ~/.ssh
    如果没有密钥则不会有此文件夹,有则备份删除
    2.生存密钥:

     ssh-keygen -t rsa -C “Your SSH key comment”
    
    • 1

    后面一直回车

    然后将 ~/.ssh/id_rsa.pub内容复制到剪贴版,进入github创造一个新的ssh,将上面复制的内容粘贴进去然后保存。

    1.3. 验证安装

    选择一个自己的仓库,选择ssh克隆,然后输入yes,如果成功克隆,那么恭喜你已经成功配置好ssh了。

    2. 配置ohmyzsh

    zsh 是一个非常好用的shell,相比于原生的zsh更加强大。

    但是,自己配置zsh是一个非常麻烦的事情,而且不一定能够配置好的,所以,我们就直接用ohmyzsh

    2.1. 安装 zsh

    一条命令轻松安装

    sudo pacman -S zsh
    
    • 1

    2.2. 设置zsh为默认shell

    先查看 zsh 的路径
    which zsh

    chsh -s /usr/bin/zsh

    记得重新启动下archlinux
    查看自己是否设置成功
    输出当前SHELL
    echo $SHELL
    查看系统中的SHELL
    cat /etc/shells

    2.2. 安装ohmyzsh

    Oh My Zsh is installed by running one of the following commands in your terminal. You can install this via the command-line with either curl, wget or another similar tool.

    MethodCommand
    curlsh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    wgetsh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    fetchsh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

    国内源加速:

    sh -c "$(curl -fsSL https://gitee.com/lxyoucan/tools/raw/master/common/ohmyzshinstall.sh)"
    
    • 1

    2.3. 安装好用的zsh插件

    • zsh-syntax-highlighting

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

    • zsh-autosuggestions

    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

    • zsh-completions

    git clone https://github.com/zsh-users/zsh-completions KaTeX parse error: Expected '}', got 'EOF' at end of input: {ZSH_CUSTOM:-{ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions

    开启插件,在 .zshrc 中找到plugins

    plugins=(
    	# ohmyzsh builtin plugins
    	git
    	z
    	# user plugins
    	zsh-syntax-highlighting
    	zsh-autosuggestions
    	zsh-completions
    )
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    2.4. 安装好看的主题 powerlevel10k

    1. Clone this repository:

    powerlevel10k-github

    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
    
    • 1

    中国镜像:

    git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
    
    • 1
    1. Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.

    2. 配置 powerlevel10k:
      输入命令p10k configure 就能根据提示来进行配置 powerlevel10k

    修改 powerlevel10k 图标:
    vim .p10k.zsh

    例如:
    例如修改图标为 arch:

      typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION=''
    
    • 1

    想要了解更加具体可以看这个链接 https://github.com/romkatv/powerlevel10k/issues/515

    3. 配置 neovim

    3.1. 安装最新的 neovim 版本

    build来进行安装最新的neovim

    1. Install build prerequisites on your system
    sudo pacman -S cmake
    
    • 1
    1. git clone https://github.com/neovim/neovim
    2. cd neovim && make CMAKE_BUILD_TYPE=RelWithDebInfo
      • If you want the stable release, also run git checkout stable.
      • If you want to install to a custom location, set CMAKE_INSTALL_PREFIX. See also Installing Neovim.
      • On BSD, use gmake instead of make.
      • To build on Windows, see the Building on Windows section.
    3. sudo make install
      • Default install location is /usr/local

    如果想要了解更多请看这个视频

    安装完需要的neovim依赖:

    sudo pacman -S npm
    sudo pacman -S fd
    # write markdown use this to show file structure
    sudo pacman -S tree
    
    • 1
    • 2
    • 3
    • 4

    4. screenkey

    平时,如果我需要做视频教程的话,那么我就需要使用一个显示自己按键的软件

    4.1. 安装

    sudo pacman -S screenkey
    # 修改screenkey 位置需要的软件
    sudo pacman -S slop
    
    • 1
    • 2
    • 3

    4.2. 配置

    我用的是i3可以在左上角看到screenkey图标然后能够进行修改。
    可以调节:

    • 透明度
    • 显示区域
    • 字体
    • 字体大小,颜色

    5. 配置字体

    一个好的字体能够让你生活变得更加舒服。
    那么就让我们开始安装一个好的字体吧。

    archwiki-fonts-cn

    5.1.了解下字体。

    • 未单个用户安装
      字体一般都被安装到这个位置 ~/.local/share/fonts
    • 为系统用户安装(所有用户)

    5.2. 安装字体

    通过pacman字体安装位置是 /usr/share/fonts/

    我一般是直接使用pacman进行安装

    sudo pacman -S nert-fonts-complete
    
    • 1

    当然单独有nerd-font是不够,有时候,我们需要一些其他的字体,那么我们要学会如何安装其他字体。

    字体来源当然是从对应的字体网站下载获得。

    比如我现在已经下载好了Operator Mono

    sudo cp -r OperatorMono /usr/share/fonts/
    cd /usr/share/fonts
    # 加载字体
    fc-cache-fv
    
    • 1
    • 2
    • 3
    • 4

    查看是否安装成功:

    fc-list | grep OperatorMono

    如果出现结果,那么我们就安装成功了。

    6. Stow 管理dotfile

    6.1 安装

    sudo pacman -S stow
    
    • 1

    stow --help 获得帮助文档:

    # 我这里就说明最经常使用的几个命令。
    
    # 删除一个stow链接
    stow -D
    
    # 重新同步一个stow链接
    stow -R
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    6.2 使用

    我就拿 alacritty 来进行举例,我在$HOME目录下建立一个 .dotfile 文件夹[这样stow管理的默认位置就是$HOME],来进行管理这些 stow 好的文件夹。

    alacrrity的配置在 ~/.config/alacrrity/ 这个文件夹下面。

    我们首先在dotfile 里面建立一个alacritty文件夹,文件夹里面的结构是这个样子的:

    alacritty
    └── .config
        └── alacritty
            ├── alacritty.yml
            ├── alacritty.yml.bak
            ├── default-arcolinux.yml
            └── default-github.yml
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    注意:

    • 如果原来在~/.config/alacritty的文件没有被删除的话,那么就会出现问题。

    然后我们回到.dotflie文件夹,然后stow alacritty,然后就能在~/.config/alacritty/ 生成对应的文件和文件夹。

    7. 配置 fzf

    archwiki-fzf

    7.1. 安装

    sudo pacman -S fzf
    
    • 1

    7.2. 配置

    通过 pacman 安装的 fzf 是和 github 上面安装是不一样的。

    安装好的脚本都在 /usr/share/fzf/key-bindings.zsh

    .zshrc 最下面添加这么两句话:

    # fzf configuration
    # fzf 判断是否存在,然后引用。
    [ -f /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh
    # enable completion
    [ -f /usr/share/fzf/completion.zsh ] && source /usr/share/fzf/completion.zsh
    
    • 1
    • 2
    • 3
    • 4
    • 5

    然后这个时候,我们就能够使用 fzf 的快捷键:

    • Ctrl+t list files+folders in current directory (e.g., type git add , press Ctrl+t, select a few files using Tab, finally Enter)
    • Ctrl+r search history of shell commands
    • Alt+c fuzzy change directory

    7.3. pacman 结合 fzf

    Try this to fuzzy-search through all available packages, with package info shown in a preview window, and then install selected packages:

    pacman -Slq | fzf --multi --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S
    
    • 1

    List all your installed packages, and then remove selected packages:

    pacman -Qq | fzf --multi --preview 'pacman -Qi {1}' | xargs -ro sudo pacman -Rns
    
    • 1

    If you want to add package file list in preview – may be a bit slower updating preview window (make sure you run pacman -Fy with root privileges at least once before invocation to sync the pacman file database):

    $ pacman -Slq | fzf --multi --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' | xargs -ro sudo pacman -S
    
    • 1

    8. lazygit

    lazygit-github

    8.1. 安装

    sudo pacman -S lazygit
    
    • 1

    8.2 配置

    默认配置为 ~/.config/layzgit/config.yml

    lazygit-configuration-doc

    使用 git-delta 来进行预览

    安装 git-delta

    sudo pacman -S git-delta
    
    • 1

    配置

    git:
      paging:
        pager: delta
    
    • 1
    • 2
    • 3

    9. rofi

    rofi-github 是 i3wm 一个很好的窗口启动器,默认的 rofi 有点丑。

    9.1. 安装

    sudo pacman -S rofi
    
    • 1

    9.2. 配置

    rofi 默认配置文件在 ~/.config/rofi/config.rasi
    生成默认配置:

    mkdir -p ~/.config/rofi
    rofi -dump-config > ~/.config/rofi/config.rasi
    
    • 1
    • 2

    rofi 配置说明

    9.3. 主题

    默认的 rofi 主题其实很一般,所以我们就需要换一个好看的主题,毕竟颜值才是第一生产力。

    9.3.1. 快速更换主题

    我使用的是 i3 自带的 dmenu 来进行命令

    rofi-theme-selector
    
    • 1

    然后就可以快乐的选择自己喜欢的主题,他会把主题配置写入到配置文件内。

    pacman安装的主题配置文件在 /usr/share/rofi/themes/

    我现在使用的是 gruvbox-common,简单舒服。

    10. i3 窗口管理器

    archwiki-i3

    10.1. 安装

    sudo pacman -S i3
    
    • 1

    10.2. i3 浮动窗口

    10.2.1. 获取窗口 WM_CLASS

    首先我们需要了解哪些窗口是我们要浮动的。
    i3wm识别一个浮动窗口是识别它的 WM_CLASS

    你只需要在同一个workspace中打开您的应用和终端,在终端中输入xprop这里你的鼠标会变成十字线,点击你的应用程序即可获取到窗口的信息。

    更方便的方法查询 WM_CLASS

    xprop | grep WM_CLASS
    
    • 1

    i3wm启动窗口指定浮动窗口的大小和位置

    示例:

    for_window [class="窗口"] floating enable resize set 640 480,move right 330px,move down 70px
    
    • 1

    11. polybar

    默认的 i3-status 有点简陋,这个是用来替代的。
    polybar-github

    11.1. 安装

    sudo pacman -S polybar
    
    • 1

    11.2. 配置

    polybar 的默认配置在 /etc/polybar/config.ini,也可以自定义在 ~/.config/ploybar/config.ini

    复制默认配置:

    mkdir ~/.config/polybar
    cp /etc/polybar/config.ini ~/.config/polybar/config.ini
    
    • 1
    • 2

    12. 音量、亮度调节

    参考文章|csdn

    12.1. 亮度调节

    安装依赖:

    yay -S light-git
    
    • 1

    写入 i3 配置文件:

    bindsym XF86MonBrightnessUp exec light -A 10 # increase screen brightness
    bindsym XF86MonBrightnessDown exec light -U 10 # decrease screen brightness
    
    • 1
    • 2

    12.2. 音量调节

    安装

    sudo pacman -S alsa-utils
    
    • 1

    使用 alsamixer 来启动
    通过方向键或者jk来调节音量。
    esc 退出。

    13.ranger文件管理器

    13.1. 安装

    sudo pacman -S ranger
    
    • 1

    13.2. 配置

    使用图标

    git clone https://github.com/alexanderjeurissen/ranger_devicons ~/.config/ranger/plugins/ranger_devicons
    echo "default_linemode devicons" >> $HOME/.config/ranger/rc.conf
    
    • 1
    • 2

    13.3. 使用 kitty 终端预览图片

    安装 pip

    sudo pacman -S python-pip
    
    • 1

    安装pillow

    pip3 install -i https://mirrors.aliyun.com/pypi/simple pillow
    
    • 1

    修改 rc.conf :

    set preview_images true
    set preview_images_method kitty
    
    • 1
    • 2

    然后,我们就能愉快的使用 ranger 来进行图片预览了。

    13.3. 参考文章

    14. 常用简单软件下载

    14.1. 开放工具

    • alacritty
    sudo pacman -S alacritty
    
    • 1
    • vscode
    yay -S visual-studio-code-bin
    
    • 1

    14.2. 浏览器

    • Chrome
    yay -S google-chrome
    
    • 1
    • Firefox
    sudo pacman -S firefox
    
    • 1
    • Microsoft Edge
    yay -S microsoft-edge
    
    • 1

    14.3. 休闲

    • qq and wechat
    yay -S deepin-wine-wechat deepin-wine-qq
    
    • 1
    • 网易云音乐
    yay -S netease-cloud
    
    • 1

    14.4. 办公

    • 坚果云
    yay -S nutstore
    
    • 1
    • obsidian
    sudo pacman -S obsidian
    
    • 1
    • office
    # 安装国内版 office
    yay -S wap-office-cn
    # 安装字体
    yay -S ttf-wps-fonts
    # 中文语言包(建议安装)
    yay -S wps-office-mui-zh-cn
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • utools
    yay -S utools
    
    • 1

    14.5. 炫技

    • cmatrix
    sudo pacman -S cmatrix
    
    • 1

    18. pacman和yay常用命令

    18.1. pacman

    • S:安装
    • Ss: 从pacman 搜索安装包
    • Syyu:每日更新
    • Ql : 从已经安装好的包进行搜索

    18.2. yay

    • S : 安装
    • Sy:从远程镜像获取软件包更新信息
    • Syy:强制获取更新信息
    • Syyu:更新软件包
    • Sc:删除以下载的过时安装包
    • Syyw:下载较新的软件包,但不安装
    • Ss:从远程仓库中搜索软件包
    • R:删除软件
    • Rs:删除软件及其依赖文件
    • Rns:删除软件和依赖文件及其配置文件
    • Qe:显示用户安装的软件包
    • Qq:不输出软件的版本信息
    • Qn:显示从官方镜像中下载的软件
    • Qm:显示从 AUR 中下载的软件
    • Qdt:显示孤包
    • Qs:显示本地库的包

    19. 常见问题

    19.1. Connecting to raw.githubusercontent.com :443… failed: Connection refused.

    我们先去这个网站查询 raw.githubusercontent.com

    然后就把查找到的 host 然后 sudo vim /etc/hosts

    然后在尾部添加这个数据:

    185.199.108.133 raw.githubusercontent.com
    
    • 1

    类似上面形式,这个问题就解决了。

    20. 使用技巧

    20.1 查找文件并删除

    例如,我现在文件中有这么一群文件,如下图所示:

    .
    ├── 1.aaa.txt
    ├── 1.bbb.txt
    ├── 2.aaa.txt
    └── 2.bbb.txt
    
    • 1
    • 2
    • 3
    • 4
    • 5

    然后我们要实现的目标是删除文件名包含1.的文件。

    那么,我们就写一个shell脚本

    # 查找文件放入到一个数组内
    file_list=`fd '1.'`
    # 循环删除
    for file in ${file_list}
    do
      rm ${file}
    done
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    然后我们执行命令,就能看到删除成功了。

    .
    ├── 2.aaa.txt
    └── 2.bbb.txt
    
    • 1
    • 2
    • 3

    20.2. grep 遍历一个文件夹里面的内容

    grep -r "要查找的内容" ./

    在这里插入图片描述

  • 相关阅读:
    The difference between Manhattan distance and Cosine Distance
    【JAVA EE】详解单点登录
    以矩阵的形式,对点或线段或多边形绕固定点旋转方法
    C++ 11:多线程相关问题
    【前端指南】Axios框架与应用
    使用 Kubeadm 部署 Kubernetes(K8S) 安装
    python文本
    QCC51XX---官网文章编号索引
    MyEclipse数据库工具使用教程:使用 SQL
    JavaScript面试刷题指南
  • 原文地址:https://blog.csdn.net/Leiyi_Ann/article/details/125983292