nipunsadvilkar
2/18/2017 - 2:18 PM

VIM and Tmux dotfiles

VIM and Tmux dotfiles

tmux and VIM works smoothly:

Q: The statusline has strange characters like ^B in it!: A: https://github.com/tmux/tmux/issues/328

In .tmux.conf add:

`set -g default-terminal "screen-256color"`
   $ locale
    LANG=
    LC_COLLATE="C"
    LC_CTYPE="C"
    LC_MESSAGES="C"
    LC_MONETARY="C"
    LC_NUMERIC="C"
    LC_TIME="C"
    LC_ALL=

and after

export LC_ALL=en_GB.UTF-8
export LANG=en_GB.UTF-8

Q: How to Pluginstall in .spacevim for cim-fugitive to get branch symbols in vim A: Airline requires vim-fugitive to be installed

function! UserInit()

    " Space has been set as the default leader key,
    " if you want to change it, uncomment and set it here.
    " let g:spacevim_leader = "<\Space>"
    " let g:spacevim_localleader = ','

    " Install private plugins
    " Plug 'extr0py/oni'
    Plug 'tpope/vim-fugitive'

endfunction
# 设置终端类型为256色
set -g default-terminal "screen-256color"
set-option -ga terminal-overrides ',*:enacs@:smacs@:rmacs@:acsc@'

# Enable italic font in iterm2
# Refer to http://apple.stackexchange.com/questions/249307/tic-doesnt-read-from-stdin-and-segfaults-when-adding-terminfo-to-support-italic/249385
set -g default-terminal "tmux-256color"
set -as terminal-overrides ',xterm*:sitm=\E[3m'

# 开启剪切板
set -g set-clipboard on

# 关闭窗口后重新编号
set -g renumber-windows on
set-window-option -g utf8 on
# Index starts from 1
set-option -g base-index 1
setw -g pane-base-index 1   # make pane numbering consistent with windows

setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on  # renumber windows when a window is closed

set -g set-titles on                        # set terminal title
set -g set-titles-string '#h ❐ #S ● #I #W'

# 事件窗口信息,如有内容变动,进行提示
setw -g monitor-activity on
set -g visual-activity on
# set -g status-utf8 on          #  在状态栏开启UTF-8
set -g history-limit 102400    #  scrollback buffer n lines
set -g mode-keys vi    #  user vi mode

set -g repeat-time 0

# 支持鼠标选择窗口,调节窗口大小
#setw -g mode-mouse on
#set -g mouse-select-pane on
#set -g mouse-resize-pane on
#set -g mouse-select-window on

# 设置重新连接不同窗口大小的tmux
setw -g aggressive-resize on

set -g default-shell /bin/zsh
# invoke reattach-to-user-namespace every time a new window/pane opens
#set -g default-command "reattach-to-user-namespace -l zsh"

# 重新绑定纵向和横向切分window快捷键。|,-,更直观地表明了切割方向
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"

# 在不同面板间切换,改为vim风格
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# 快速选择面板
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# 调整面板大小
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5

# 设置前缀键,默认为Ctrl+b
# set -g prefix C-b
# 释放之前的Ctrl-b前缀快捷键
# unbind C-b

#jtmux有一个延时以方便用户按键组合,默认有点长。这里设置为1秒钟
set -s escape-time 1

# 设置动态加载tmux配置文件的快捷键
bind r source-file ~/.tmux.conf \; display "Configuration Reloaded"

# 设置窗口标签的前景及背景色
setw -g window-status-fg colour72
setw -g window-status-bg colour234
setw -g window-status-attr dim

# 设置当前窗口标签的前景及背景色,所谓当前窗口标签会显示在状态栏中间
setw -g window-status-current-fg colour22
setw -g window-status-current-bg colour73
# setw -g window-status-current-attr bright

# 设置窗口分割的边框颜色
set -g pane-border-fg green
set -g pane-border-bg black

# 设置当前窗口分割的边框颜色
set -g pane-active-border-fg white
set -g pane-active-border-bg yellow

# 设置提示信息的前景及背景色
set -g message-fg colour250
set -g message-bg colour232
set -g message-attr bright

#set -g set-titles-string '#T'

###################  状态栏设置  ###############################
# 以下色彩为mac环境下,Linux下可能需重新设置颜色
# 设置状态栏前景色,背景色
#set -g status-fg white
#set -g status-bg black

# 设置状态栏前景及背景色
set -g status-bg colour236
set -g status-fg colour68

# 设置状态栏左部宽度  默认为10
set -g status-left-length 35
# 设置状态栏左部显示内容。
set -g status-left "#[fg=colour252,bold,bg=colour243] 🌺  S: #S #[fg=colour250,bg=colour239] 🏵  W: #I #[fg=yellow,bg=colour237] ☘ #[fg=colour250,bg=colour237] P: #P#[default]"
# 设置状态栏右部宽度
set -g status-right-length 48
# 设置状态栏右部内容,这里设置为时间信息
set -g status-right "#[fg=colour251,bold,bg=colour237] 🗓  %Y-%b-%d #[fg=colour251,bold,bg=colour239] ⏱  %R #[fg=colour251,bold,bg=colour243] 🐳  #(ifconfig | grep 'inet.*netmask.*broadcast' | awk '{print $2}')"
# 窗口信息居中显示
set -g status-justify centre
# 设置状态栏更新时间 每60秒更新一次,默认是15秒更新
set -g status-interval 60
" You can enable the existing layers in space-vim and
" exclude the partial plugins in a certain layer.
" The command Layer and Exlcude are vaild in the function Layers().
function! Layers()

    " Default layers, recommended!
    Layer 'fzf'
    Layer 'unite'
    Layer 'better-defaults'
    Layer 'emoji' 
    Layer 'goyo'

    Layer 'html' 
    Layer 'c-c ++' 
    Layer 'python' 
    Layer 'markdown' 
    Layer 'graphviz'
    Layer 'airline'

    Layer 'text-align' 
    Layer 'programming'

    Layer 'ycmd' 
    Layer 'syntax-checking'
    
endfunction

" Put your private plugins here.
function! UserInit()

    " Space has been set as the default leader key,
    " if you want to change it, uncomment and set it here.
    " let g:spacevim_leader = "<\Space>"
    " let g:spacevim_localleader = ','

    " Install private plugins
    " Plug 'extr0py/oni'
    Plug 'tpope/vim-fugitive'

endfunction

" Put your costom configurations here, e.g., change the colorscheme.
function! UserConfig()

    " If you enable airline layer and have installed the powerline fonts, set it here.
    let g:airline_powerline_fonts=1
    
    " color desert

endfunction