init
This commit is contained in:
commit
f249120097
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
lua/lazy/*
|
3
coc-settings.json
Normal file
3
coc-settings.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"snippets.ultisnips.pythonPrompt": false
|
||||||
|
}
|
7
init.lua
Normal file
7
init.lua
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
vim.g.mapleader = ' '
|
||||||
|
|
||||||
|
require('plug')
|
||||||
|
require('options')
|
||||||
|
require('keymap')
|
||||||
|
require('coc')
|
||||||
|
|
15
lazy-lock.json
Normal file
15
lazy-lock.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"auto-pairs": { "branch": "master", "commit": "39f06b873a8449af8ff6a3eee716d3da14d63a76" },
|
||||||
|
"bullets.vim": { "branch": "master", "commit": "746f92ae05cdcc988857d8e76418326f07af9494" },
|
||||||
|
"coc.nvim": { "branch": "release", "commit": "95b43f67147391cf2c69e550bd001b742781d226" },
|
||||||
|
"colorizer": { "branch": "master", "commit": "72790a003d5a706c287486a1a81e3a6b32158b54" },
|
||||||
|
"gruvbox": { "branch": "master", "commit": "bf2885a95efdad7bd5e4794dd0213917770d79b7" },
|
||||||
|
"nerdcommenter": { "branch": "master", "commit": "98cc4a2d64ca67cccbf5b5cf47c682ebadaaff58" },
|
||||||
|
"vim-airline": { "branch": "master", "commit": "1d9ae3f972e76a1d36384da7a2890f6402d07d6c" },
|
||||||
|
"vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" },
|
||||||
|
"vim-instant-markdown": { "branch": "master", "commit": "383aa2900f855eddc42ffbe9d636c54e2f2939d5" },
|
||||||
|
"vim-markdown-toc": { "branch": "master", "commit": "7ec05df27b4922830ace2246de36ac7e53bea1db" },
|
||||||
|
"vim-surround": { "branch": "master", "commit": "6c5e229e85e3248b9db27a2e6276583c586bf3dd" },
|
||||||
|
"vim-table-mode": { "branch": "master", "commit": "9555a3e6e5bcf285ec181b7fc983eea90500feb4" },
|
||||||
|
"wildfire.vim": { "branch": "master", "commit": "b371e2b1d938ae0e164146136051de164ecb9aa5" }
|
||||||
|
}
|
50
lua/coc.lua
Normal file
50
lua/coc.lua
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
vim.cmd([[
|
||||||
|
let g:coc_global_extensions = [
|
||||||
|
\ 'coc-clangd',
|
||||||
|
\ 'coc-lua',
|
||||||
|
\ 'coc-python',
|
||||||
|
\
|
||||||
|
\ 'coc-explorer',
|
||||||
|
\ 'coc-translator',
|
||||||
|
\ ]
|
||||||
|
]])
|
||||||
|
|
||||||
|
local map = vim.api.nvim_set_keymap
|
||||||
|
-- coc 设置
|
||||||
|
-- Autocomplete
|
||||||
|
function _G.check_back_space()
|
||||||
|
local col = vim.fn.col('.') - 1
|
||||||
|
return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Use Tab for trigger completion with characters ahead and navigate
|
||||||
|
-- NOTE: There's always a completion item selected by default, you may want to enable
|
||||||
|
-- no select by setting `"suggest.noselect": true` in your configuration file
|
||||||
|
-- NOTE: Use command ':verbose imap <tab>' to make sure Tab is not mapped by
|
||||||
|
-- other plugins before putting this into your config
|
||||||
|
local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false}
|
||||||
|
map("i", "<TAB>", [[ coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh() ]] , opts)
|
||||||
|
map("i", "<S-TAB>", [[ coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>" ]], opts)
|
||||||
|
-- Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||||
|
-- <C-g>u breaks current undo, please make your own choice
|
||||||
|
map("i", "<cr>", [[ coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" ]], opts)
|
||||||
|
|
||||||
|
-- Use `[g` and `]g` to navigate diagnostics
|
||||||
|
-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
|
||||||
|
map("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true})
|
||||||
|
map("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true})
|
||||||
|
|
||||||
|
-- GoTo code navigation
|
||||||
|
map("n", "gd", "<Plug>(coc-definition)", {silent = true})
|
||||||
|
map("n", "gy", "<Plug>(coc-type-definition)", {silent = true})
|
||||||
|
map("n", "gi", "<Plug>(coc-implementation)", {silent = true})
|
||||||
|
map("n", "gr", "<Plug>(coc-references)", {silent = true})
|
||||||
|
|
||||||
|
-- Symbol renaming
|
||||||
|
map("n", "<leader>rn", "<Plug>(coc-rename)", {silent = true})
|
||||||
|
|
||||||
|
-- Formatting selected code
|
||||||
|
map("x", "<leader>i", "<Plug>(coc-format-selected)", {silent = true})
|
||||||
|
map("n", "<leader>i", "<Plug>(coc-format-selected)", {silent = true})
|
||||||
|
|
43
lua/keymap.lua
Normal file
43
lua/keymap.lua
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
local map = vim.api.nvim_set_keymap
|
||||||
|
|
||||||
|
map('n', '<leader>y', '"+y', {noremap = true})
|
||||||
|
map('n', '<leader>p', '"+p', {noremap = true})
|
||||||
|
map('n', '<leader>d', '"+d', {noremap = true})
|
||||||
|
|
||||||
|
map('n', 'L', '$', {noremap = true})
|
||||||
|
map('n', 'H', '^', {noremap = true})
|
||||||
|
map('n', '>', '>>', {noremap = true})
|
||||||
|
map('n', '<', '<<', {noremap = true})
|
||||||
|
map('n', 'Q', ':q!<CR>', {noremap = true})
|
||||||
|
map('n', '?', 'set hlsearch<CR>?', {noremap = true})
|
||||||
|
map('n', '/', 'set hlsearch<CR>/', {noremap = true})
|
||||||
|
map('n', '<c-s-j>', '5j', {noremap = true})
|
||||||
|
map('n', '<c-s-k>', '5k', {noremap = true})
|
||||||
|
|
||||||
|
|
||||||
|
map('n', '<c-n>', ':nohlsearch<CR>', {noremap = true})
|
||||||
|
map('n', '<c-j>', ':w<CR><c-w>j', {noremap = true})
|
||||||
|
map('n', '<c-h>', ':w<CR><c-w>h', {noremap = true})
|
||||||
|
map('n', '<c-k>', ':w<CR><c-w>k', {noremap = true})
|
||||||
|
map('n', '<c-l>', ':w<CR><c-w>l', {noremap = true})
|
||||||
|
map('n', '<c-c>', ':wq<CR>', {noremap = true})
|
||||||
|
|
||||||
|
|
||||||
|
map('n', '<leader><leader>y', 'ggyG', {noremap = true})
|
||||||
|
map('n', '<leader><leader>p', 'ggpG', {noremap = true})
|
||||||
|
map('n', '<leader><leader>v', 'ggVG', {noremap = true})
|
||||||
|
|
||||||
|
map('n', '<up>', ':res -5<CR>', {noremap = true})
|
||||||
|
map('n', '<down>', ':res +5<CR>', {noremap = true})
|
||||||
|
map('n', '<left>', ':vertical resize -5<CR>', {noremap = true})
|
||||||
|
map('n', '<right>', ':vertical resize +5<CR>', {noremap = true})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
40
lua/options.lua
Normal file
40
lua/options.lua
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
-- 行号
|
||||||
|
vim.o.nu = true
|
||||||
|
vim.o.rnu = true
|
||||||
|
vim.o.scrolloff = 999
|
||||||
|
|
||||||
|
-- 自动保存
|
||||||
|
vim.o.autowrite = true
|
||||||
|
vim.o.autowriteall = true
|
||||||
|
|
||||||
|
-- tab键
|
||||||
|
vim.o.sw = 2
|
||||||
|
vim.o.ts = 2
|
||||||
|
vim.o.softtabstop = 2
|
||||||
|
vim.o.smarttab = true
|
||||||
|
vim.o.expandtab = true
|
||||||
|
vim.o.autoindent = true
|
||||||
|
|
||||||
|
-- 光标
|
||||||
|
vim.o.cursorline = true
|
||||||
|
|
||||||
|
-- 分屏
|
||||||
|
vim.o.splitright = true
|
||||||
|
vim.o.splitbelow = true
|
||||||
|
|
||||||
|
-- 搜索
|
||||||
|
vim.o.ignorecase = true
|
||||||
|
vim.o.incsearch = true
|
||||||
|
|
||||||
|
-- 不换行
|
||||||
|
vim.o.textwidth = 999
|
||||||
|
vim.o.wrap = false
|
||||||
|
|
||||||
|
-- 背景
|
||||||
|
vim.g.bg = dark
|
||||||
|
vim.cmd([[colorscheme gruvbox]])
|
||||||
|
|
||||||
|
-- 输入法自动根据模式自动切换
|
||||||
|
vim.cmd([[
|
||||||
|
au InsertLeave * :silent !fcitx5-remote -c
|
||||||
|
]])
|
47
lua/plug.lua
Normal file
47
lua/plug.lua
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
local lazypath = '~/.config/nvim/lua/lazy/lazy.lua'
|
||||||
|
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system({
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--depin=1",
|
||||||
|
"https://github.com/newbieQQ/lazy.nvim.git",
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
require("lazy").setup({
|
||||||
|
-- 主题插件
|
||||||
|
'vim-airline/vim-airline',
|
||||||
|
'morhetz/gruvbox',
|
||||||
|
|
||||||
|
{'neoclide/coc.nvim', branch = 'release'},
|
||||||
|
'jiangmiao/auto-pairs',
|
||||||
|
|
||||||
|
-- surround 和 wildfire 配合有神奇的效果
|
||||||
|
'yaocccc/vim-surround',
|
||||||
|
'gcmt/wildfire.vim',
|
||||||
|
|
||||||
|
-- 格式整理
|
||||||
|
'junegunn/vim-easy-align',
|
||||||
|
'scrooloose/nerdcommenter',
|
||||||
|
|
||||||
|
--颜色识别
|
||||||
|
'lilydjwg/colorizer',
|
||||||
|
|
||||||
|
--markdown
|
||||||
|
'suan/vim-instant-markdown',
|
||||||
|
'dhruvasagar/vim-table-mode',
|
||||||
|
'mzlogin/vim-markdown-toc',
|
||||||
|
'dkarter/bullets.vim'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user