diff --git a/.gitignore b/.gitignore index 55273366..c40b6f34 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,5 @@ temp_dirs/yankring_history_v2.txt sources_forked/yankring/doc/tags sources_non_forked/tlib/doc/tags sources_non_forked/ctrlp.vim/doc/tags* -my_plugins/ -my_configs.vim tags .DS_Store diff --git a/my_configs.vim b/my_configs.vim new file mode 100644 index 00000000..6dc795c6 --- /dev/null +++ b/my_configs.vim @@ -0,0 +1,45 @@ +" 使用系统剪贴板 +set clipboard=unnamedplus +set ts=4 +set nu + +map q :q + +" map w :w +" map b + +map t :tabe + +" 使光标位置屏幕中间位置 +map j gjzz +map k gkzz +map * *zz +map # #zz +map n nzz +map zz +map zz +map zz + +map ggVG + +" 缩进 +map V> +map V< +map gt + +" 切换目录树窗口 +map :NERDTreeToggle +" 最近文件 +map :MRU + + +" 切换窗口 +" ^[ = Alt +map w w +map h h +map j j +map k k +map l l + +" 编辑器模式下复制新行 +imap Vypi diff --git a/my_plugins/swap_lines/plugin/swap_lines.vim b/my_plugins/swap_lines/plugin/swap_lines.vim new file mode 100644 index 00000000..c43d7e7f --- /dev/null +++ b/my_plugins/swap_lines/plugin/swap_lines.vim @@ -0,0 +1,33 @@ + +function! s:swap_lines(n1, n2) + let line1 = getline(a:n1) + let line2 = getline(a:n2) + call setline(a:n1, line2) + call setline(a:n2, line1) +endfunction + +function! s:swap_up() + let n = line('.') + if n == 1 + return + endif + + call s:swap_lines(n, n - 1) + exec n - 1 +endfunction + +function! s:swap_down() + let n = line('.') + if n == line('$') + return + endif + + call s:swap_lines(n, n + 1) + exec n + 1 +endfunction + +nmap :call swap_up() +nmap :call swap_down() + +imap :call swap_up() +imap :call swap_down()