nvim/vimrc.vim
2022-04-22 17:42:26 +08:00

59 lines
1.2 KiB
VimL

"----vim 个人使用习惯配置start------
set encoding=UTF-8
" leader设置成空格
let mapleader="\\"
" 使用鼠标
set mouse=a
" 显示行号
set nu
" 相对行号
set relativenumber
" tab=4个空格
set tabstop=4
set shiftwidth=4
" 高度光标所在行
"set cursorline
"
" 设置不换行
"set nowrap
set wrap
" 打开文件时返回编辑的光标地点
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" 始终显示左侧符号栏 如git error信息等
set signcolumn=yes:1
" 在文件外修改时自动加载
set autoread
"自动保存
set autowrite
" 显示按下的按键
set showcmd
" 按tab显示菜单
set wildmenu
" 不需要备份文件
set nobackup
" 复制剪贴
set clipboard=unnamedplus
"随机选一个颜色风格
function RandomColorScheme()
let mycolors = split(globpath(&rtp,"**/colors/*.vim"),"\n")
exe 'so ' . mycolors[localtime() % len(mycolors)]
unlet mycolors
endfunction
"call RandomColorScheme()
:command NewColor call RandomColorScheme()
" 文件类型设置 "
" ---------------------------------------------------------------------
" JSX 语法高亮
" set filetypes as typescriptreact
autocmd BufNewFile,BufRead *.tsx,*.jsx,*.js set filetype=typescript