Skip to content

Commit 811f609

Browse files
committed
transfer most of features to lazyVim
1 parent f80a5f0 commit 811f609

File tree

12 files changed

+412
-209
lines changed

12 files changed

+412
-209
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
*.swp
22
tags
33
packer_compiled.lua
4+
configs/lazynvim/.gitignore
5+
configs/lazynvim/LICENSE
6+
configs/lazynvim/README.md
7+
configs/lazynvim/lazy-lock.json
8+
configs/lazynvim/.neoconf.json
9+
configs/lazynvim/.luarc.json
10+
*.pyc

Debian-based.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,20 @@ sudo apt-get update
99
sudo apt-get install -y git build-essential cmake python-dev htop zsh autossh exuberant-ctags
1010
# Optional (the installation of these softwares may fail due to different system versions)
1111
sudo apt-get install -y vim vim-nox tmux \
12-
clang python-flake8 python-pip software-properties-common silversearcher-ag moreutils # this line is for common use
13-
12+
clang python-flake8 python-pip software-properties-common silversearcher-ag moreutils # this line is for common use
1413

1514
# sudo apt-get install -y gnupg2
1615
# ruby和 rvm 后面都选择在 ./deploy_apps/install_tmuxinator.sh 中在个人账户安装
1716
# sudo apt-get install -y software-properties-common
1817
# sudo apt-add-repository -y ppa:rael-gc/rvm
1918
# sudo apt-get update
20-
# sudo apt-get install -y rvm # this is for installing latest
19+
# sudo apt-get install -y rvm # this is for installing latest
2120
# sudo su - $USER -c 'rvm install ruby'
2221
# sudo su - $USER -c 'gem install tmuxinator'
2322

2423
# sudo apt-get install -y tmuxinator # this will be installed by gem
2524

26-
sudo apt-get install -y ack-grep # TODO: 可能是不必须的
25+
sudo apt-get install -y ack-grep # TODO: 可能是不必须的
2726
sudo apt-get install -y cloc
2827

2928
# clang is for YCM

RPM-based.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ sudo yum install -y git tmux cmake python-devel clang htop python-flake8 autossh
55
# python-flake8 is needed by vim-flake8
66
# clang is for YCM
77

8-
98
# TODO: make sure one of them is right !!!
109
# gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
1110
# curl -sSL https://get.rvm.io | bash -s stable --ruby
12-
sudo yum install -y tmuxinator
11+
sudo yum install -y tmuxinator

configs/lazynvim/lua/config/lazy.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
99
require("lazy").setup({
1010
spec = {
1111
-- add LazyVim and import its plugins
12-
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
1312
-- import any extras modules here
13+
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
1414
-- { import = "lazyvim.plugins.extras.lang.typescript" },
1515
-- { import = "lazyvim.plugins.extras.lang.json" },
1616
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
1717
-- import/override with your plugins
18+
{ import = "lazyvim.plugins.extras.dap.core" },
19+
{ import = "lazyvim.plugins.extras.coding.copilot" },
1820
{ import = "plugins" },
1921
},
2022
defaults = {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
-- if true then
2+
-- return {}
3+
-- end
4+
5+
-- this is only for change the position of notification
6+
-- https://github.com/rcarriga/nvim-notify/issues/94
7+
-- The key difference is stages_util.DIRECTION.BOTTOM_UP & anchor = "SW"
8+
9+
local opts = {
10+
stages = {
11+
function(state)
12+
local stages_util = require("notify.stages.util")
13+
local next_height = state.message.height + 2
14+
local next_row = stages_util.available_slot(state.open_windows, next_height, stages_util.DIRECTION.BOTTOM_UP)
15+
if not next_row then
16+
return nil
17+
end
18+
return {
19+
relative = "editor",
20+
-- anchor = "NE",
21+
anchor = "SW", -- 非常奇怪,这里会让提示信息从右下角往上方再提高一点; 虽然不是按字面意义跑,但是也能达到想要的效果
22+
width = state.message.width,
23+
height = state.message.height,
24+
col = vim.opt.columns:get(),
25+
row = next_row,
26+
border = "rounded",
27+
style = "minimal",
28+
opacity = 0,
29+
}
30+
end,
31+
function()
32+
return {
33+
opacity = { 100 },
34+
col = { vim.opt.columns:get() },
35+
}
36+
end,
37+
function()
38+
return {
39+
col = { vim.opt.columns:get() },
40+
time = true,
41+
}
42+
end,
43+
function()
44+
return {
45+
width = {
46+
1,
47+
frequency = 2.5,
48+
damping = 0.9,
49+
complete = function(cur_width)
50+
return cur_width < 3
51+
end,
52+
},
53+
opacity = {
54+
0,
55+
frequency = 2,
56+
complete = function(cur_opacity)
57+
return cur_opacity <= 4
58+
end,
59+
},
60+
col = { vim.opt.columns:get() },
61+
}
62+
end,
63+
},
64+
}
65+
return {
66+
{
67+
"rcarriga/nvim-notify",
68+
-- opts = opts,
69+
config = function()
70+
require("notify").setup(opts)
71+
end,
72+
},
73+
}
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-- simple plugins are added here
2+
3+
return {
4+
{
5+
"rafcamlet/nvim-luapad",
6+
keys = {
7+
{
8+
"<leader>Li",
9+
function()
10+
require("luapad").init()
11+
-- It seems that this is not working
12+
-- require("luapad").attach({
13+
-- context = {
14+
-- return_4 = function()
15+
-- return 4
16+
-- end,
17+
-- },
18+
-- })
19+
end,
20+
-- "<cmd>Luapad<cr>",
21+
mode = "n",
22+
desc = "Luapad",
23+
},
24+
},
25+
-- TODO: attach to current buffer
26+
},
27+
}
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
function reset_slime()
2+
if vim.api.nvim_get_var("slime_target") == "neovim" then
3+
if vim.o.filetype == "toggleterm" then
4+
vim.api.nvim_set_var("slime_last_toggleterm_channel", vim.o.channel)
5+
else
6+
local ok, last_channel = pcall(vim.api.nvim_get_var, "slime_last_toggleterm_channel")
7+
if ok then
8+
vim.api.nvim_buf_set_var(0, "slime_config", { jobid = last_channel })
9+
end
10+
end
11+
end
12+
end
13+
14+
return {
15+
{
16+
"jpalardy/vim-slime",
17+
config = function()
18+
vim.cmd([[
19+
20+
let g:slime_target = "neovim"
21+
let g:slime_python_ipython = 1
22+
23+
" clear previous command
24+
nnoremap <c-c><c-u> :SlimeSend0 "\x15"<CR>
25+
nnoremap <c-c><c-i> :SlimeSend0 "\x03"<CR>
26+
" Interupted command
27+
" ^D EOT 004 04 End of Transmission
28+
nnoremap <c-c><c-d> :SlimeSend0 "\x04"<CR>
29+
" `esc` `k` `carriage return`
30+
nnoremap <c-c><c-p> :SlimeSend0 "\x1bk\x0d"<CR>
31+
32+
if get(g:, "slime_target", "") == "neovim"
33+
augroup auto_channel
34+
autocmd!
35+
" autocmd TermEnter * let g:slime_last_channel = &channel
36+
autocmd BufEnter,WinEnter,TermOpen * lua reset_slime()
37+
augroup END
38+
end
39+
]])
40+
end,
41+
},
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
local opts = {
2+
-- size can be a number or function which is passed the current terminal
3+
size = function(term)
4+
if term.direction == "horizontal" then
5+
return 15
6+
elseif term.direction == "vertical" then
7+
return vim.o.columns * 0.4
8+
end
9+
end,
10+
open_mapping = [[<c-\><c-\>]],
11+
-- on_open = fun(t: Terminal), -- function to run when the terminal opens
12+
hide_numbers = true, -- hide the number column in toggleterm buffers
13+
shade_filetypes = {},
14+
shade_terminals = true,
15+
-- shading_factor = '<number>', -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
16+
-- start_in_insert = true,
17+
start_in_insert = false,
18+
insert_mappings = true, -- whether or not the open mapping applies in insert mode
19+
persist_size = true,
20+
-- direction = 'vertical' | 'horizontal' | 'window' | 'float',
21+
-- direction = 'float',
22+
direction = "horizontal",
23+
close_on_exit = true, -- close the terminal window when the process exits
24+
shell = vim.o.shell, -- change the default shell
25+
-- This field is only relevant if direction is set to 'float'
26+
float_opts = {
27+
-- The border key is *almost* the same as 'nvim_open_win'
28+
-- see :h nvim_open_win for details on borders however
29+
-- the 'curved' border is a custom border type
30+
-- not natively supported but implemented in this plugin.
31+
-- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open
32+
-- width = <value>,
33+
-- height = <value>,
34+
-- winblend = 3,
35+
highlights = {
36+
border = "Normal",
37+
background = "Normal",
38+
},
39+
},
40+
}
41+
42+
return {
43+
{
44+
"akinsho/toggleterm.nvim",
45+
config = function()
46+
require("toggleterm").setup(opts)
47+
-- config will override automatically setup(opts).
48+
for _, mode in pairs({ "i", "v", "n", "t" }) do
49+
for i = 1, 4 do
50+
-- vim.api.nvim_set_keymap(mode, "<c-"..tostring(i)..">", "<cmd>ToggleTerm "..tostring(i).."<cr>", {expr = true, noremap = true})
51+
vim.api.nvim_set_keymap(
52+
mode,
53+
"<F" .. tostring(i) .. ">",
54+
"<cmd>ToggleTerm " .. tostring(i) .. "<cr>",
55+
{ expr = false, noremap = true }
56+
)
57+
-- expr = false 非常重要; 不然就会触发 vim mapping 的 <expr> 机制, 导致先用vim命令执行一遍, 再把结果作为map的目标
58+
end
59+
end
60+
vim.api.nvim_set_keymap("t", "<c-w>w", "<c-\\><c-n><c-w><c-w>", { expr = false, noremap = true })
61+
end,
62+
},
63+
}

0 commit comments

Comments
 (0)