Linuxの超軽量テキストベースのプログラミング環境の推奨設定

Linuxの超軽量テキストベースのプログラミング環境の推奨設定

私は特定の要件に合った設定の提案を探しています。私は大学を卒業して以来、多くのLinux作業をしていませんでした。性能が劣るハードウェア(512MB RAM、シングルコア)を使用しています。テキストベースのシェルとエディタ(vimなど)ですべてのことをしたいと思います。私の目標は、マウスに絶対に触れないことです。

同時に複数のシェルを開くことができるはずです。 1つはWebサーバーを実行し、1つはvimを実行し、1つはアプリケーションビルドパイプラインを実行し、1つはwget、grepping、untarringなどの一時シェルコマンド用です。キーボードを使用して新しいシェルを開き、シェル間をすばやく切り替えることができる必要があります。

しかし、いくつかの殻を望んでいても、それでもそうです。いいえグラフィックデスクトップ環境が欲しい。私はマウスを使用したい誘惑を感じたくありません。私の目的の1つは、さまざまなタスクを実行するコマンドライン方法を学ぶことを強制することでした。

また、大きなモニターを活用してvimを実行し、何百もの列を表示できるようにしたいです。

可能ですか?

ベストアンサー1

あなたの質問を何度も読んだ後、私はあなたに間違いなく提案するものがあることに気づきました。 vimとtmux: http://tmux.sourceforge.net/

tmuxは、「1つ以内」に複数のウィンドウとウィンドウを持つことができる画面「マルチプレクサ」です。

これは、長い間多くのCLIコーダーの主なツールであった古代の「スクリーン」プログラムの後続のプログラムです。 vimと比較して、最初の機能の1つは、ウィンドウを垂直と水平に分割する機能でした。ただし、画面が進化し、これもこれを行うことができます。

例:

ここに画像の説明を入力してください。

私が推奨する別の設定部分は良いエイリアスセットです。これにより、入力とのやり取りがより簡単かつ高速になります。

私の好きな例は次のとおりです。

alias gcv='git commit'
alias gg='git grep ' # for searching (add parameter)
alias gst='git status -sb' # I must use this 100 times a day!!!
alias h='history | tail'
alias hg='history | grep' # for searching my history (add parameter)
alias l='ls -alFtrG'
alias ls='ls --color=auto'
alias mv='mv -i'
alias p='pwd'# at least 200 times a day! so 2 chrs saved * 200 = 400 less characters to type ;)

エイリアスは、.bashrc で呼び出される .bash_aliases ファイルで設定できます。 # エイリアスの定義。 if [ -f ~/.bash_aliases ]; ~/.bash_aliases fi

このコードはすでに存在している可能性があるため、独自の.bash_aliasesファイルを使用してください。

どちらのオプションもMacで動作します。これは私自身(主にUbuntuユーザー)にとって重要な考慮事項です。

tmux remapキーを使用して簡単にするほとんどの人。基本的なバインディングはあまり良くありません。これは私の設定です。

$猫〜/tmux.conf

# mdd tmux settings
bind r source-file ~/.tmux.conf \; display "Reloaded!"  # Reload with ctrl-r
set -g prefix C-a         # prefix from ctrl-b to ctrl-a
unbind C-b                # allow ctrl-b for other things
set -sg escape-time 1     # quicker responses
bind C-a send-prefix      # Pass on ctrl-a for other apps
set -g base-index 1        # Numbering of windows
setw -g pane-base-index 1  # Numbering of Panes
# bind | split-window -h    # Split panes horizontal
bind \ split-window -h    # Split panes horizontal
bind - split-window -v    # Split panes vertically
bind h select-pane -L     # Switch to Pane Left
bind j select-pane -D     # Switch to Pane Down
bind k select-pane -U     # Switch to Pane Up
bind l select-pane -R     # Switch to Pane Right
bind -r C-h select-window -t :-  # Quick Pane Selection
bind -r C-l select-window -t :+  # Quick Pane Selection
bind -r H resize-pane -L 5       # Switch to Pane Left
bind -r J resize-pane -D 5       # Switch to Pane Down
bind -r K resize-pane -U 5       # Switch to Pane Up
bind -r L resize-pane -R 5       # Switch to Pane Right
setw -g mode-mouse off           # Mouse Off
set -g mouse-select-pane off     # Mouse Off  
set -g mouse-resize-pane off     # Mouse Off
set -g mouse-select-window off   # Mouse Off
#set -g  default-terminal "screen-256color"
setw -g monitor-activity on      # Activity Alerts
set -g visual-activity on
set -g status-fg white           # Status line Colors
set -g status-bg black
setw -g window-status-fg cyan    # Window list color
setw -g window-status-bg default
setw -g window-status-attr dim
setw -g window-status-current-fg white     # Active Window Color
setw -g window-status-current-bg red
setw -g window-status-current-attr bright
set -g pane-border-fg green      # Pane colors
set -g pane-border-bg black 
set -g pane-active-border-fg white 
set -g pane-active-border-bg yellow
set -g message-fg white          # Command/Message Line.
set -g message-bg black
set -g message-attr bright
set -g status-left-length 40     # Status Line, left side
set -g status-left "#[fg=white]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
set -g status-utf8 on            # Status Line, right side
set -g status-right "-------"
set -g status-interval 60        # frequency of status line updates
set -g status-justify centre     # center window list
setw -g mode-keys vi             # vi keys to move 
unbind v                         # Open panes in same directory as tmux-panes script
unbind n
bind v send-keys " ~/tmux-panes -h" C-m
bind n send-keys " ~/tmux-panes -v" C-m
unbind Up                        # Maximizing and Minimizing...
bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
# Make keys for copy mode be like vi
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection

最後に、(ループを閉じるために)シェルを使いやすくするために、.vimrc設定自体は次のようになります。

" mdd specific stuff --- start
set hlsearch
set incsearch
set number
" more3 mdd stuff - set tabs to be spaces and length of 2 characters.
set smartindent
set tabstop=2
set shiftwidth=2
set expandtab
" mdd specific stuff --- end
"
" Forget being compatible with good ol' vi
set nocompatible

" Get that filetype stuff happening
filetype on
filetype plugin on
filetype indent on

" Turn on that syntax highlighting
syntax on

" Why is this not a default
set hidden

" Don't update the display while executing macros
set lazyredraw

" At least let yourself know what mode you're in
set showmode

" Enable enhanced command-line completion. Presumes you have compiled
" with +wildmenu.  See :help 'wildmenu'
set wildmenu

" Let's make it easy to edit this file (mnemonic for the key sequence is
" 'e'dit 'v'imrc)
nmap <silent> ,ev :e $MYVIMRC<cr>

" And to source this file as well (mnemonic for the key sequence is
" 's'ource 'v'imrc)
nmap <silent> ,sv :so $MYVIMRC<cr>

highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()

最後に、.bashrcファイルをいくつか変更してshopt -s autocd(存在する)ディレクトリ名を入力すると、シェルがすぐにそのディレクトリに移動するようになりました。かわいい!私の.bashrcの変更は次のとおりです。

# Automatic cd'ing
shopt -s autocd

# Have cd show directory info ('cos my shell doesn't show full directory path in $PS1 prompt (intended).
cd() {
      builtin cd "$@" && pwd 
  }

# enable programmable completion features
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # Load RVM into a shell session *as a function*

# mdd Terminal Multiplexor 6/15/2012
if [[ ! $TERM =~ screen ]]; then
    exec tmux
fi

[ -z "$TMUX" ] && export TERM=xterm-256color

export EDITOR=vim

git config --global --add color.ui true

おすすめ記事