my nvim cfg
This commit is contained in:
parent
cef944b20e
commit
7754883738
15
init.vim
Normal file
15
init.vim
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
runtime ./vimrc.vim
|
||||||
|
|
||||||
|
" 插件管理
|
||||||
|
lua require('plugins')
|
||||||
|
lua require('lsp/setup')
|
||||||
|
lua require('frame/setup')
|
||||||
|
lua require('utils/setup')
|
||||||
|
|
||||||
|
|
||||||
|
runtime ./plug.vim
|
||||||
|
|
||||||
|
|
||||||
|
" 按键映射
|
||||||
|
runtime ./maps.vim
|
||||||
|
|
||||||
143
lua/frame/setup.lua
Normal file
143
lua/frame/setup.lua
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
local tree_cb = require 'nvim-tree.config'.nvim_tree_callback -- following options are the default
|
||||||
|
|
||||||
|
-- r rename
|
||||||
|
-- d delete
|
||||||
|
-- s open item in system tool
|
||||||
|
-- a add file/dir
|
||||||
|
require 'nvim-tree'.setup {
|
||||||
|
open_on_setup = true;
|
||||||
|
git = {
|
||||||
|
enable = true,
|
||||||
|
ignore = true,
|
||||||
|
timeout = 400,
|
||||||
|
},
|
||||||
|
filters = {
|
||||||
|
dotfiles = true,
|
||||||
|
custom = {},
|
||||||
|
exclude = {},
|
||||||
|
},
|
||||||
|
system_open = {
|
||||||
|
cmd = nil,
|
||||||
|
args = {},
|
||||||
|
},
|
||||||
|
view = {
|
||||||
|
mappings = {
|
||||||
|
custom_only = true,
|
||||||
|
list = {
|
||||||
|
{ key = "<BS>", cb = tree_cb("dir_up") },
|
||||||
|
{ key = { "q", "<Esc>" }, cb = tree_cb("close") },
|
||||||
|
{ key = { "<2-RightMouse>", "<CR>" }, cb = tree_cb("cd") },
|
||||||
|
{ key = "<Tab>", cb = tree_cb("preview") },
|
||||||
|
{ key = "R", cb = tree_cb("refresh") },
|
||||||
|
{ key = "h", cb = tree_cb("close_node") },
|
||||||
|
|
||||||
|
|
||||||
|
{ key = { "o", "<CR>", "<2-RightMouse>" }, cb = tree_cb("edit") },
|
||||||
|
{ key = "a", cb = tree_cb("create") },
|
||||||
|
{ key = "d", cb = tree_cb("remove") },
|
||||||
|
{ key = "r", cb = tree_cb("rename") },
|
||||||
|
{ key = "x", cb = tree_cb("cut") },
|
||||||
|
{ key = "c", cb = tree_cb("copy") },
|
||||||
|
{ key = "p", cb = tree_cb("paste") },
|
||||||
|
|
||||||
|
{ key = "G", cb = tree_cb("prev_git_item") },
|
||||||
|
{ key = "g", cb = tree_cb("next_git_item") },
|
||||||
|
{ key = "?", cb = tree_cb("toggle_help") },
|
||||||
|
|
||||||
|
{ key = "<", cb = tree_cb("prev_sibling") },
|
||||||
|
{ key = ">", cb = tree_cb("next_sibling") },
|
||||||
|
{ key = "P", cb = tree_cb("parent_node") },
|
||||||
|
{ key = "K", cb = tree_cb("first_sibling") },
|
||||||
|
{ key = "J", cb = tree_cb("last_sibling") },
|
||||||
|
{ key = "I", cb = tree_cb("toggle_ignored") },
|
||||||
|
{ key = "H", cb = tree_cb("toggle_dotfiles") },
|
||||||
|
{ key = "<C-r>", cb = tree_cb("full_rename") },
|
||||||
|
{ key = "y", cb = tree_cb("copy_name") },
|
||||||
|
{ key = "Y", cb = tree_cb("copy_path") },
|
||||||
|
{ key = "gy", cb = tree_cb("copy_absolute_path") },
|
||||||
|
{ key = "S", cb = tree_cb("system_open") },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vim.opt.background = "dark" -- or "light" for light mode
|
||||||
|
vim.cmd([[colorscheme gruvbox]])
|
||||||
|
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
require("bufferline").setup {
|
||||||
|
options = {
|
||||||
|
-- 左侧让出 nvim-tree 的位置
|
||||||
|
diagnostics = "nvim_lsp";
|
||||||
|
offsets = { {
|
||||||
|
filetype = "NvimTree",
|
||||||
|
text = "veypi.com",
|
||||||
|
highlight = "Directory",
|
||||||
|
text_align = "center"
|
||||||
|
} }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
require('lualine').setup {
|
||||||
|
options = {
|
||||||
|
icons_enabled = true,
|
||||||
|
theme = 'auto',
|
||||||
|
component_separators = { left = '', right = '' },
|
||||||
|
section_separators = { left = '', right = '' },
|
||||||
|
disabled_filetypes = {},
|
||||||
|
always_divide_middle = true,
|
||||||
|
globalstatus = false,
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = { 'mode' },
|
||||||
|
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
||||||
|
lualine_c = { 'filename' },
|
||||||
|
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
||||||
|
lualine_y = { 'progress' },
|
||||||
|
lualine_z = { 'location' }
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = { 'filename' },
|
||||||
|
lualine_x = { 'location' },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {}
|
||||||
|
},
|
||||||
|
tabline = {},
|
||||||
|
extensions = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
require 'nvim-treesitter.configs'.setup {
|
||||||
|
-- A list of parser names, or "all"
|
||||||
|
ensure_installed = { "c", "lua", "rust", "go", "javascript", "html", "json", "python", "typescript", "vue", "css" },
|
||||||
|
|
||||||
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
|
sync_install = false,
|
||||||
|
|
||||||
|
-- List of parsers to ignore installing (for "all")
|
||||||
|
ignore_install = { "" },
|
||||||
|
|
||||||
|
highlight = {
|
||||||
|
-- `false` will disable the whole extension
|
||||||
|
enable = true,
|
||||||
|
|
||||||
|
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||||
|
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||||
|
-- the name of the parser)
|
||||||
|
-- list of language that will be disabled
|
||||||
|
disable = {},
|
||||||
|
|
||||||
|
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||||
|
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||||
|
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||||
|
-- Instead of true it can also be a list of languages
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
}
|
||||||
27
lua/lsp/base.lua
Normal file
27
lua/lsp/base.lua
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
local runtime_path = vim.split(package.path, ';')
|
||||||
|
table.insert(runtime_path, "lua/?.lua")
|
||||||
|
table.insert(runtime_path, "lua/?/init.lua")
|
||||||
|
return {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = 'LuaJIT',
|
||||||
|
-- Setup your lua path
|
||||||
|
path = runtime_path,
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = {'vim'},
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
-- Make the server aware of Neovim runtime files
|
||||||
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
|
},
|
||||||
|
-- Do not send telemetry data containing a randomized but unique identifier
|
||||||
|
telemetry = {
|
||||||
|
enable = false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
0
lua/lsp/go.lua
Normal file
0
lua/lsp/go.lua
Normal file
0
lua/lsp/lua.lua
Normal file
0
lua/lsp/lua.lua
Normal file
0
lua/lsp/python.lua
Normal file
0
lua/lsp/python.lua
Normal file
118
lua/lsp/setup.lua
Normal file
118
lua/lsp/setup.lua
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||||
|
local lsp_installer = require "nvim-lsp-installer"
|
||||||
|
|
||||||
|
|
||||||
|
-- Mappings.
|
||||||
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||||
|
local keyOpts = { noremap = true, silent = true }
|
||||||
|
vim.api.nvim_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', keyOpts)
|
||||||
|
|
||||||
|
-- Use an on_attach function to only map the following keys
|
||||||
|
-- after the language server attaches to the current buffer
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
|
-- Mappings.
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', keyOpts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', keyOpts)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- 安装列表
|
||||||
|
-- https://github.com/williamboman/nvim-lsp-installer#available-lsps
|
||||||
|
-- { key: 语言 value: 配置文件 }
|
||||||
|
local servers = {
|
||||||
|
sumneko_lua = require "lsp.base", -- /lua/lsp/lua.lua
|
||||||
|
gopls = require "lsp.base",
|
||||||
|
volar = require "lsp.base"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- 自动安装 LanguageServers
|
||||||
|
for name, _ in pairs(servers) do
|
||||||
|
local server_is_found, server = lsp_installer.get_server(name)
|
||||||
|
if server_is_found then
|
||||||
|
if not server:is_installed() then
|
||||||
|
print("Installing " .. name)
|
||||||
|
server:install()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
lsp_installer.on_server_ready(function(server)
|
||||||
|
local opts = servers[server.name]
|
||||||
|
opts.on_attach = on_attach
|
||||||
|
opts.capabilities = capabilities
|
||||||
|
opts.flags = {
|
||||||
|
debounce_text_changes = 150,
|
||||||
|
}
|
||||||
|
server:setup(opts)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- luasnip setup
|
||||||
|
local luasnip = require 'luasnip'
|
||||||
|
|
||||||
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
|
require('nvim-ts-autotag').setup()
|
||||||
|
|
||||||
|
-- nvim-cmp setup
|
||||||
|
local cmp = require 'cmp'
|
||||||
|
cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
|
||||||
|
|
||||||
|
cmp.setup {
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
['<CR>'] = cmp.mapping.confirm {
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = true,
|
||||||
|
},
|
||||||
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
}),
|
||||||
|
sources = {
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'buffer' },
|
||||||
|
{ name = 'path' }
|
||||||
|
},
|
||||||
|
}
|
||||||
49
lua/plugins.lua
Normal file
49
lua/plugins.lua
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
|
||||||
|
|
||||||
|
-- Only required if you have packer configured as `opt`
|
||||||
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
|
||||||
|
return require('packer').startup(function()
|
||||||
|
-- Packer can manage itself
|
||||||
|
use 'wbthomason/packer.nvim'
|
||||||
|
|
||||||
|
-- LSP
|
||||||
|
|
||||||
|
use { 'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer' }
|
||||||
|
|
||||||
|
use 'windwp/nvim-autopairs'
|
||||||
|
use 'windwp/nvim-ts-autotag'
|
||||||
|
|
||||||
|
use 'hrsh7th/nvim-cmp'
|
||||||
|
use 'hrsh7th/cmp-path'
|
||||||
|
use 'hrsh7th/cmp-buffer'
|
||||||
|
use 'hrsh7th/cmp-nvim-lsp'
|
||||||
|
use 'saadparwaiz1/cmp_luasnip'
|
||||||
|
use 'L3MON4D3/LuaSnip'
|
||||||
|
|
||||||
|
|
||||||
|
-- Frame
|
||||||
|
|
||||||
|
use { "ellisonleao/gruvbox.nvim" }
|
||||||
|
-- need to install nerd font
|
||||||
|
use 'kyazdani42/nvim-web-devicons'
|
||||||
|
use 'kyazdani42/nvim-tree.lua'
|
||||||
|
use 'akinsho/bufferline.nvim'
|
||||||
|
use 'nvim-lualine/lualine.nvim'
|
||||||
|
|
||||||
|
use {
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
run = ':TSUpdate'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- utils
|
||||||
|
use 'numToStr/Comment.nvim'
|
||||||
|
use {
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
requires = { { 'nvim-lua/plenary.nvim' } }
|
||||||
|
}
|
||||||
|
use {"akinsho/toggleterm.nvim"}
|
||||||
|
|
||||||
|
|
||||||
|
end)
|
||||||
11
lua/utils/setup.lua
Normal file
11
lua/utils/setup.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
require('Comment').setup()
|
||||||
|
|
||||||
|
require('nvim-autopairs').setup()
|
||||||
|
|
||||||
|
require("toggleterm").setup {
|
||||||
|
open_mapping = [[<c-\>]],
|
||||||
|
hide_numbers = true,
|
||||||
|
insert_mappings = true, -- whether or not the open mapping applies in insert mode
|
||||||
|
terminal_mappings = true,
|
||||||
|
shell = vim.o.shell,
|
||||||
|
}
|
||||||
64
maps.vim
Normal file
64
maps.vim
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
" window
|
||||||
|
"-------------------------------------------------------------------------------
|
||||||
|
" Split window
|
||||||
|
nmap ss :split<Return><C-w>w
|
||||||
|
nmap sv :vsplit<Return><C-w>w
|
||||||
|
" Move window
|
||||||
|
"nmap <Space> <C-w>w
|
||||||
|
"map s<left> <C-w>h
|
||||||
|
"map s<up> <C-w>k
|
||||||
|
"map s<down> <C-w>j
|
||||||
|
"map s<right> <C-w>l
|
||||||
|
map sh <C-w>h
|
||||||
|
map sk <C-w>k
|
||||||
|
map sj <C-w>j
|
||||||
|
map sl <C-w>l
|
||||||
|
|
||||||
|
" Resize window
|
||||||
|
nmap <leader><up> <C-w>+
|
||||||
|
nmap <leader><down> <C-w>-
|
||||||
|
nmap <leader><left> <C-w><
|
||||||
|
nmap <leader><right> <C-w>>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
" 插入模式移动光标
|
||||||
|
inoremap <leader>h <Left>
|
||||||
|
inoremap <leader>j <Down>
|
||||||
|
inoremap <leader>k <Up>
|
||||||
|
inoremap <leader>l <Right>
|
||||||
|
inoremap <leader>d <Delete>
|
||||||
|
|
||||||
|
nnoremap L $
|
||||||
|
nnoremap H ^
|
||||||
|
|
||||||
|
" 退出
|
||||||
|
" nmap <leader>w :wq<CR>
|
||||||
|
" nmap <leader>q :wqa<CR>
|
||||||
|
|
||||||
|
|
||||||
|
nmap q :bdelete<CR>
|
||||||
|
nmap Q :q!<CR>
|
||||||
|
|
||||||
|
" 重新加载设置
|
||||||
|
map R :source $MYVIMRC<CR>
|
||||||
|
|
||||||
|
|
||||||
|
" 全选
|
||||||
|
nmap <C-a> gg<S-v>G
|
||||||
|
|
||||||
|
" 切换页面
|
||||||
|
" nmap <S-Tab> :bprev<Return>
|
||||||
|
" nmap <Tab> :bnext<Return>
|
||||||
|
nmap <S-Tab> :BufferLineCyclePrev<CR>
|
||||||
|
nmap <Tab> :BufferLineCycleNext<CR>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
nnoremap <F2> :NvimTreeToggle<CR>
|
||||||
|
|
||||||
|
|
||||||
|
" telescope
|
||||||
|
nnoremap sf <cmd>Telescope find_files<cr>
|
||||||
|
nnoremap sw <cmd>Telescope live_grep<cr>
|
||||||
55
vimrc.vim
Normal file
55
vimrc.vim
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
"----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
|
||||||
|
|
||||||
|
|
||||||
|
" 在文件外修改时自动加载
|
||||||
|
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
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user