Skip to content

Commit 3d934b7

Browse files
Transform vim & set it as the default editor (#109)
* [refactor][vim] transform vim + set as default editor * [refactor][vim][ci][cd] unit test for vim * [refactor][vim] syntax error fix * [refactor][vim] install plugins in non-interactive mode * [refactor][vim] vim-fugitive fix
1 parent 5321e1f commit 3d934b7

File tree

5 files changed

+61
-9
lines changed

5 files changed

+61
-9
lines changed

.github/workflows/ci-unit-test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
- name: Getting Started
2424
run: |
2525
./start.sh
26+
- name: Execute post-setup (vim)
27+
run: |
28+
./linux/systems/.local/bin/org.jcchikikomori.dotfiles/bin/dotfiles-vim
2629
- name: Execute post-setup (git)
2730
run: |
2831
./linux/systems/.local/bin/org.jcchikikomori.dotfiles/bin/dotfiles-git
@@ -77,6 +80,9 @@ jobs:
7780
- name: Getting Started
7881
run: |
7982
./start.sh
83+
- name: Execute post-setup (vim)
84+
run: |
85+
./linux/systems/.local/bin/org.jcchikikomori.dotfiles/bin/dotfiles-vim
8086
- name: Execute post-setup (git)
8187
run: |
8288
./linux/systems/.local/bin/org.jcchikikomori.dotfiles/bin/dotfiles-git
@@ -131,6 +137,9 @@ jobs:
131137
- name: Getting Started
132138
run: |
133139
./start.sh
140+
- name: Execute post-setup (vim)
141+
run: |
142+
./linux/systems/.local/bin/org.jcchikikomori.dotfiles/bin/dotfiles-vim
134143
- name: Execute post-setup (git)
135144
run: |
136145
./linux/systems/.local/bin/org.jcchikikomori.dotfiles/bin/dotfiles-git

linux/bash/.bashrc.d/00-env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export PATH="${HOME}/bin:${PATH}"
33
export PATH="${HOME}/.local/bin/org.jcchikikomori.dotfiles/bin:${PATH}"
44

55
# Development environments
6-
export EDITOR=nano
6+
export EDITOR=vim
77
export PYENV_ROOT="$HOME/.pyenv"
88
export RBENV_ROOT="$HOME/.rbenv"
99
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"

linux/systems/.local/bin/org.jcchikikomori.dotfiles/bin/dotfiles-vim

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ install_plugins() {
2929
exit 1
3030
}
3131
log_message "Starting plugin installation..."
32-
vim +"set verbosefile=/tmp/vim-verbose.log" \
33-
"+PlugInstall --sync" \
34-
"+qall!"
32+
vim +PlugInstall +qall >/dev/null 2>&1
3533
STATUS=$?
3634
case $STATUS in
3735
0)
@@ -43,6 +41,30 @@ install_plugins() {
4341
esac
4442
exit $STATUS
4543
) 200>$LOCK_FILE
44+
45+
log_message "Installing Vundle..."
46+
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/autoload/vundle.vim
47+
48+
log_message "Installing vim-fugitive..."
49+
(
50+
flock -n 200 || {
51+
log_message "Another installation is in progress"
52+
exit 1
53+
}
54+
mkdir -p ~/.vim/pack/tpope/start
55+
git clone https://tpope.io/vim/fugitive.git ~/.vim/pack/tpope/start/fugitive
56+
cd ~/.vim/pack/tpope/start && vim -u NONE -c "helptags fugitive/doc" -c q
57+
STATUS=$?
58+
case $STATUS in
59+
0)
60+
log_message "vim-fugitive was installed successfully"
61+
;;
62+
*)
63+
log_message "vim-fugitive installation failed with status $STATUS"
64+
;;
65+
esac
66+
exit $STATUS
67+
) 200>$LOCK_FILE
4668
}
4769

4870
# Main execution

linux/systems/.profile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if [ -f /etc/os-release ]; then
4545
fi
4646

4747
# Core environment variables
48-
export EDITOR=nano
48+
export EDITOR=vim
4949
export PATH="${HOME}/bin:${PATH}"
5050

5151
# Development environments

linux/vim/.vimrc

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ filetype indent on
77
" Disable audible sound
88
set vb
99

10+
" Initialize plugins first (vim-plug)
1011
call plug#begin('~/.vim/plugged')
1112

1213
Plug 'morhetz/gruvbox' " color scheme
@@ -26,14 +27,31 @@ Plug 'editorconfig/editorconfig-vim' " Editor config plugin
2627

2728
Plug 'powerline/powerline' " Powerline
2829
Plug 'preservim/nerdtree' " FileTree View
30+
Plug 'sheerun/vim-polyglot' " Syntax and indent support
31+
Plug 'LunarWatcher/auto-pairs' " Pair autocompletion
32+
Plug 'maxboisvert/vim-simple-complete' " Keyword autocompletion
33+
Plug 'matze/vim-move' " Moves lines and selections in a more visual manner
2934

3035
call plug#end()
3136

3237
" Gruvbox configuration
3338
let g:gruvbox_contrast_dark = 'hard'
3439
let g:gruvbox_invert_selection = '0'
40+
41+
" Pair autocompletion
42+
let g:AutoPairsShortcutToggle = '<C-P>'
43+
44+
" vim-move
45+
" NOTE: Key modifier NOT FINAL
46+
" <C-k> Move current line/selections up
47+
" <C-j> Move current line/selections down
48+
let g:move_key_modifier = 'C'
49+
" <S-k> Move currently selected block up
50+
" <S-j> Move currently selected block down
51+
let g:move_key_modifier_visualmode = 'S'
52+
3553
" Color scheme
36-
colorscheme gruvbox
54+
silent! colorscheme gruvbox
3755

3856
set autoread
3957
set smartcase
@@ -59,9 +77,9 @@ set smarttab
5977
highlight ColorColumn ctermbg=gray
6078
set colorcolumn=80
6179

62-
" 1 tab == 4 spaces
63-
set shiftwidth=4
64-
set tabstop=4
80+
" 1 tab == 2 spaces
81+
set shiftwidth=2
82+
set tabstop=2
6583
set expandtab
6684

6785
" Set colors
@@ -84,10 +102,13 @@ set listchars=tab:>-,eol:$ " for non-printable characters
84102

85103
" Show tabs correctly when doing 'set list'
86104
set statusline+=%F
105+
87106
" allow backspacing over everything in insert mode
88107
set backspace=indent,eol,start
108+
89109
" When a bracket is inserted, briefly jump to matching one
90110
set showmatch
111+
91112
" Show matches very breifly (tenths of a second)
92113
set matchtime=1
93114

0 commit comments

Comments
 (0)