python 自动补全, 自动切换输入法
This commit is contained in:
parent
890bd09c49
commit
2e183e81e3
5
init.vim
5
init.vim
@ -1,5 +1,8 @@
|
|||||||
runtime ./vimrc.vim
|
|
||||||
|
|
||||||
|
let g:username = 'veypi'
|
||||||
|
let g:email = 'veypi@qq.com'
|
||||||
|
|
||||||
|
runtime ./vimrc.vim
|
||||||
" 插件管理
|
" 插件管理
|
||||||
lua require('plugins')
|
lua require('plugins')
|
||||||
lua require('lsp/setup')
|
lua require('lsp/setup')
|
||||||
|
|||||||
15
lua/lsp/efm.lua
Normal file
15
lua/lsp/efm.lua
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
-- 部分补全代码不支持autoformat 需使用efm自动补全
|
||||||
|
-- https://github.com/mattn/efm-langserver
|
||||||
|
return {
|
||||||
|
init_options = {documentFormatting = true},
|
||||||
|
filetypes = {'python'},
|
||||||
|
settings = {
|
||||||
|
rootMarkers = {".git/"},
|
||||||
|
languages = {
|
||||||
|
python = {
|
||||||
|
-- pip install yapf
|
||||||
|
{formatCommand = "yapf --quiet", formatStdin = true}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,16 +6,19 @@ local lsp_installer = require "nvim-lsp-installer"
|
|||||||
-- Mappings.
|
-- Mappings.
|
||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||||
local keyOpts = { noremap = true, silent = true }
|
local keyOpts = { noremap = true, silent = true }
|
||||||
-- vim.api.nvim_buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
-- vim.api.nvim_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
vim.api.nvim_set_keymap('n', '<C-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', keyOpts)
|
vim.api.nvim_set_keymap('n', '<C-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', keyOpts)
|
||||||
vim.api.nvim_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', keyOpts)
|
vim.api.nvim_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', keyOpts)
|
||||||
vim.api.nvim_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', keyOpts)
|
vim.api.nvim_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', keyOpts)
|
||||||
|
vim.api.nvim_set_keymap('n', 'e[', '<cmd>lua vim.diagnostic.goto_prev()<CR>',keyOpts)
|
||||||
|
vim.api.nvim_set_keymap('n', 'e]', '<cmd>lua vim.diagnostic.goto_next()<CR>', keyOpts)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- 安装列表
|
-- 安装列表
|
||||||
-- https://github.com/williamboman/nvim-lsp-installer#available-lsps
|
-- https://github.com/williamboman/nvim-lsp-installer#available-lsps
|
||||||
-- { key: 语言 value: 配置文件 }
|
-- { key: 语言 value: 配置文件 }
|
||||||
|
-- pyright 不支持autoformat
|
||||||
local servers = {
|
local servers = {
|
||||||
sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua
|
sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua
|
||||||
gopls = require "lsp.base",
|
gopls = require "lsp.base",
|
||||||
@ -28,6 +31,7 @@ local servers = {
|
|||||||
pyright = require "lsp.base",
|
pyright = require "lsp.base",
|
||||||
rust_analyzer = require "lsp.base",
|
rust_analyzer = require "lsp.base",
|
||||||
tailwindcss = require "lsp.base",
|
tailwindcss = require "lsp.base",
|
||||||
|
efm = require "lsp.efm"
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 自动安装 LanguageServers
|
-- 自动安装 LanguageServers
|
||||||
|
|||||||
@ -45,10 +45,14 @@ return require('packer').startup(function()
|
|||||||
requires = { { 'nvim-lua/plenary.nvim' } }
|
requires = { { 'nvim-lua/plenary.nvim' } }
|
||||||
}
|
}
|
||||||
|
|
||||||
use {"akinsho/toggleterm.nvim"}
|
use { "akinsho/toggleterm.nvim" }
|
||||||
|
|
||||||
|
|
||||||
use "Pocco81/AutoSave.nvim"
|
use "Pocco81/AutoSave.nvim"
|
||||||
|
|
||||||
use 'lewis6991/gitsigns.nvim'
|
use 'lewis6991/gitsigns.nvim'
|
||||||
|
|
||||||
|
use 'ybian/smartim'
|
||||||
|
|
||||||
|
use 'aperezdc/vim-template'
|
||||||
end)
|
end)
|
||||||
|
|||||||
@ -30,3 +30,4 @@ require("autosave").setup {
|
|||||||
require('gitsigns').setup {
|
require('gitsigns').setup {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
44
maps.vim
44
maps.vim
@ -37,7 +37,7 @@ nnoremap H ^
|
|||||||
" nmap <leader>q :wqa<CR>
|
" nmap <leader>q :wqa<CR>
|
||||||
|
|
||||||
|
|
||||||
nmap q :BufferLineCycleNext<CR>:BufferLineCloseLeft<CR>
|
nmap q :bd<CR>
|
||||||
nmap Q :qa!<CR>
|
nmap Q :qa!<CR>
|
||||||
|
|
||||||
" 重新加载设置
|
" 重新加载设置
|
||||||
@ -52,15 +52,15 @@ nmap <C-a> gg<S-v>G
|
|||||||
" nmap <Tab> :bnext<Return>
|
" nmap <Tab> :bnext<Return>
|
||||||
nmap <S-Tab> :BufferLineCyclePrev<CR>
|
nmap <S-Tab> :BufferLineCyclePrev<CR>
|
||||||
nmap <Tab> :BufferLineCycleNext<CR>
|
nmap <Tab> :BufferLineCycleNext<CR>
|
||||||
nmap 1g :BufferLineGoToBuffer 1<CR>
|
nmap <leader>1 :BufferLineGoToBuffer 1<CR>
|
||||||
nmap 2g :BufferLineGoToBuffer 2<CR>
|
nmap <leader>2 :BufferLineGoToBuffer 2<CR>
|
||||||
nmap 3g :BufferLineGoToBuffer 3<CR>
|
nmap <leader>3 :BufferLineGoToBuffer 3<CR>
|
||||||
nmap 4g :BufferLineGoToBuffer 4<CR>
|
nmap <leader>4 :BufferLineGoToBuffer 4<CR>
|
||||||
nmap 5g :BufferLineGoToBuffer 5<CR>
|
nmap <leader>5 :BufferLineGoToBuffer 5<CR>
|
||||||
nmap 6g :BufferLineGoToBuffer 6<CR>
|
nmap <leader>6 :BufferLineGoToBuffer 6<CR>
|
||||||
nmap 7g :BufferLineGoToBuffer 7<CR>
|
nmap <leader>7 :BufferLineGoToBuffer 7<CR>
|
||||||
nmap 8g :BufferLineGoToBuffer 8<CR>
|
nmap <leader>8 :BufferLineGoToBuffer 8<CR>
|
||||||
nmap 9g :BufferLineGoToBuffer 9<CR>
|
nmap <leader>9 :BufferLineGoToBuffer 9<CR>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -76,3 +76,27 @@ nnoremap sw <cmd>Telescope live_grep<CR>
|
|||||||
" map <F1> <Nop>
|
" map <F1> <Nop>
|
||||||
map <F1> :ToggleTerm<CR>
|
map <F1> :ToggleTerm<CR>
|
||||||
|
|
||||||
|
|
||||||
|
map <F5> :call CompileRunGcc()<CR>
|
||||||
|
|
||||||
|
func! CompileRunGcc()
|
||||||
|
exec "w"
|
||||||
|
if &filetype == 'c'
|
||||||
|
exec '!g++ % -o %<'
|
||||||
|
exec '!time ./%<'
|
||||||
|
elseif &filetype == 'cpp'
|
||||||
|
exec '!g++ % -o %< -lboost_system'
|
||||||
|
exec '!time ./%<'
|
||||||
|
elseif &filetype == 'python'
|
||||||
|
exec '!time python %'
|
||||||
|
elseif &filetype == 'sh'
|
||||||
|
:!time bash %
|
||||||
|
elseif &filetype == 'go'
|
||||||
|
exec 'GoRun'
|
||||||
|
elseif &filetype == 'rust'
|
||||||
|
exec 'TermExec cmd="cargo run"'
|
||||||
|
elseif &filetype == 'verilog'
|
||||||
|
exec '!iverilog -o test.vvp % && ./test.vvp && open -a gtkwave test.vcd'
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user