2026/03/07

Git Bash로 터미널 쉘(shell) 이전



Powershell에 익숙하지 않아 Windows에서도 GNU Coreutils를 사용하다 git을 설치하고 bash로 이전.
Windows Terminal에 프로파일을 Git Bash로 추가한 후 로그인 쉘로 등록하고 기본프로파일로 설정.

라인편집 모드도 기본 emacs인데 vi모드로 바꾸고 하루동안 쓰는데 화면깨짐등의 트러블이 많이 발생하는데 하나씩 해결하며 정착중.


Windows Terminal: settings.json
            {
                "guid": "{cdf3eba2-9f16-4378-b083-76f60c33483c}",
                "closeOnExit": "always",
                "colorScheme": "One Half Dark",
                "commandline": "\"c:/program files/Git/bin/bash.exe\" --login -i",
                "font": 
                {
                    "face": "Sarasa Fixed K",
                    "size": 12,
                    "weight": "bold"
                },
                "hidden": false,
                "icon": "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico",
                "name": "Git Bash",
                "opacity": 85,
                "historySize": 5000,
                "snapOnInput": true,
                "startingDirectory": null
            }



ntxlds@MOON:~# cat .bash_profile
if net session >/dev/null 2>&1; then
    export PS1='\[\e[1;31m\]\u@\h:\w# \[\e[0m\]'
else
    export PS1='\[\e[1;32m\]\u@\h:\w\$ \[\e[0m\]'
fi
if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi



ntxlds@MOON:~# cat .bashrc
# locale
export LANG=ko_KR.UTF-8

# PATH
export PATH=/usr/bin:$PATH

# ls
#alias ls='ls --color=auto'
#alias l='ls -CF'
alias l='ls'
alias ll='ls -alF'
alias la='ls -A'

# grep
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'

# navigation
alias ..='cd ..'
alias ...='cd ../..'

# utility
alias cls='clear'
alias vim='/c/Program\ Files/Vim/vim91/vim'
alias du1='du -h --max-depth=1'
alias lsize='ls -lhS'
alias o='explorer .'
alias copy='clip.exe'

# history
HISTSIZE=5000
HISTFILESIZE=10000
HISTCONTROL=ignoredups:erasedups
shopt -s histappend

# shell behavior
shopt -s autocd
shopt -s cdspell
shopt -s dirspell
shopt -s checkwinsize



ntxlds@MOON:~# cat .inputrc
set enable-bracketed-paste on
set editing-mode vi
set show-mode-in-prompt on

set vi-ins-mode-string \1\e[6 q\2
set vi-cmd-mode-string \1\e[2 q\2

set completion-prefix-display-length 2
set completion-ignore-case on
set show-all-if-ambiguous on
set mark-directories on
set mark-symlinked-directories on
set colored-stats on
set completion-map-case on



ntxlds@MOON:~# cat .vimrc
set nocompatible
filetype off
syntax on

set mouse=a
set clipboard=unnamed
set encoding=utf-8
set fileencodings=utf-8,ucs-bom,utf-16le,utf-16,cp949,euc-kr
set backspace=indent,eol,start
set pastetoggle=<F1>
set history=1000
set notitle
set noundofile
set nobackup
set noswapfile

set expandtab
set tabstop=2
set autoindent
set shiftwidth=2
set softtabstop=2
set number
set ruler

set hlsearch
set incsearch
set ignorecase
set smartcase
set nowrapscan

set nojoinspaces
set showcmd
set showmatch
set hidden

let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"

autocmd VimEnter * :silent! normal! gg