mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
No commits in common. "c3d8dc3e1d23f74f02f7972d9d40bfe3dddd394f" and "6e60475f3f956ee4b7a2a2deea47f44d9676ed9a" have entirely different histories.
c3d8dc3e1d
...
6e60475f3f
16
README.md
16
README.md
@ -84,7 +84,6 @@ and how to set up on different platforms (Linux, macOS, and Windows).
|
|||||||
+ Tags navigation via [vista](https://github.com/liuchengxu/vista.vim).
|
+ Tags navigation via [vista](https://github.com/liuchengxu/vista.vim).
|
||||||
+ Code formatting via [Neoformat](https://github.com/sbdchd/neoformat).
|
+ Code formatting via [Neoformat](https://github.com/sbdchd/neoformat).
|
||||||
+ Undo management via [vim-mundo](https://github.com/simnalamburt/vim-mundo)
|
+ Undo management via [vim-mundo](https://github.com/simnalamburt/vim-mundo)
|
||||||
+ Code folding with [nvim-ufo](https://github.com/kevinhwang91/nvim-ufo) and [statuscol.nvim](https://github.com/luukvbaal/statuscol.nvim)
|
|
||||||
+ ......
|
+ ......
|
||||||
|
|
||||||
# UI Demo
|
# UI Demo
|
||||||
@ -141,12 +140,6 @@ Go to a string starting with `se`
|
|||||||
<img src="https://user-images.githubusercontent.com/16662357/128589873-aadb8264-1098-4834-9876-fa66a309be05.gif" width="800">
|
<img src="https://user-images.githubusercontent.com/16662357/128589873-aadb8264-1098-4834-9876-fa66a309be05.gif" width="800">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## code folding with nvim-ufo and statuscol.nvim
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<img src="https://github.com/user-attachments/assets/a01a56b2-7c91-43de-b305-f2fbaa81dcec" width="800">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
# Shortcuts
|
# Shortcuts
|
||||||
|
|
||||||
Some of the shortcuts I use frequently are listed here. In the following shortcuts, `<leader>` represents ASCII character `,`.
|
Some of the shortcuts I use frequently are listed here. In the following shortcuts, `<leader>` represents ASCII character `,`.
|
||||||
@ -172,14 +165,12 @@ Some of the shortcuts I use frequently are listed here. In the following shortcu
|
|||||||
| `<space>t` | Normal | Linux/macOS/Win | Toggle tag window (show project tags in the right window) |
|
| `<space>t` | Normal | Linux/macOS/Win | Toggle tag window (show project tags in the right window) |
|
||||||
| `<leader>gs` | Normal | Linux/macOS/Win | Show Git status result |
|
| `<leader>gs` | Normal | Linux/macOS/Win | Show Git status result |
|
||||||
| `<leader>gw` | Normal | Linux/macOS/Win | Run Git add for current file |
|
| `<leader>gw` | Normal | Linux/macOS/Win | Run Git add for current file |
|
||||||
|
| `<leader>gd` | Normal | Linux/macOS/Win | Run git diff for current file |
|
||||||
| `<leader>gc` | Normal | Linux/macOS/Win | Run git commit |
|
| `<leader>gc` | Normal | Linux/macOS/Win | Run git commit |
|
||||||
| `<leader>gpl` | Normal | Linux/macOS/Win | Run git pull |
|
| `<leader>gpl` | Normal | Linux/macOS/Win | Run git pull |
|
||||||
| `<leader>gpu` | Normal | Linux/macOS/Win | Run git push |
|
| `<leader>gpu` | Normal | Linux/macOS/Win | Run git push |
|
||||||
| `<leader>gbd` | Normal | Linux/macOS/Win | Delete a branch |
|
|
||||||
| `<leader>gbn` | Normal | Linux/macOS/Win | Create a new branch |
|
|
||||||
| `<leader>gl` | Normal/Visual | Linux/macOS/Win | Get perm link for current/visually-select lines |
|
| `<leader>gl` | Normal/Visual | Linux/macOS/Win | Get perm link for current/visually-select lines |
|
||||||
| `<leader>gbr` | Normal | macOS | Browse current git repo in browser |
|
| `<leader>gb` | Normal | macOS | Browse current git repo in browser |
|
||||||
| `<leader>gb` | Visual | macOS | Blame current line |
|
|
||||||
| `<F9>` | Normal | Linux/macOS/Win | Compile&run current source file (for C++, LaTeX, Lua, Python) |
|
| `<F9>` | Normal | Linux/macOS/Win | Compile&run current source file (for C++, LaTeX, Lua, Python) |
|
||||||
| `<F11>` | Normal | Linux/macOS/Win | Toggle spell checking |
|
| `<F11>` | Normal | Linux/macOS/Win | Toggle spell checking |
|
||||||
| `<F12>` | Normal | Linux/macOS/Win | Toggle paste mode |
|
| `<F12>` | Normal | Linux/macOS/Win | Toggle paste mode |
|
||||||
@ -201,11 +192,10 @@ Some of the shortcuts I use frequently are listed here. In the following shortcu
|
|||||||
In addition to commands provided by various plugins, I have also created some custom commands for personal use.
|
In addition to commands provided by various plugins, I have also created some custom commands for personal use.
|
||||||
|
|
||||||
| command | description | example |
|
| command | description | example |
|
||||||
|--------------|-------------------------------------------------------------------------|--------------------------------|
|
|------------|-------------------------------------------------------------------------|--------------------------------|
|
||||||
| `Redir` | capture command output to a tabpage for easier inspection. | `Redir hi` |
|
| `Redir` | capture command output to a tabpage for easier inspection. | `Redir hi` |
|
||||||
| `Edit` | edit multiple files at the same time, supports globing | `Edit *.vim` |
|
| `Edit` | edit multiple files at the same time, supports globing | `Edit *.vim` |
|
||||||
| `Datetime` | print current date and time or convert Unix time stamp to date and time | `Datetime 12345` or `Datetime` |
|
| `Datetime` | print current date and time or convert Unix time stamp to date and time | `Datetime 12345` or `Datetime` |
|
||||||
| `JSONFormat` | format a JSON file | `JSONFormat` |
|
|
||||||
|
|
||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
require("bufferline").setup {
|
require("bufferline").setup {
|
||||||
options = {
|
options = {
|
||||||
numbers = "none",
|
numbers = "buffer_id",
|
||||||
close_command = "bdelete! %d",
|
close_command = "bdelete! %d",
|
||||||
right_mouse_command = nil,
|
right_mouse_command = nil,
|
||||||
left_mouse_command = "buffer %d",
|
left_mouse_command = "buffer %d",
|
||||||
@ -44,7 +44,3 @@ require("bufferline").setup {
|
|||||||
sort_by = "id",
|
sort_by = "id",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.keymap.set("n", "<space>bp", "<cmd>BufferLinePick<CR>", {
|
|
||||||
desc = "pick a buffer",
|
|
||||||
})
|
|
||||||
|
|||||||
@ -10,8 +10,8 @@ keymap.set("v", "<leader>gb", ":Git blame<cr>", { desc = "Git: blame selected li
|
|||||||
-- convert git to Git in command line mode
|
-- convert git to Git in command line mode
|
||||||
vim.fn["utils#Cabbrev"]("git", "Git")
|
vim.fn["utils#Cabbrev"]("git", "Git")
|
||||||
|
|
||||||
keymap.set("n", "<leader>gbn", function()
|
keymap.set("n", "<leader>gnb", function()
|
||||||
vim.ui.input({ prompt = "Enter a new branch name" }, function(user_input)
|
vim.ui.input({ prompt = "Enter the new branch nmae" }, function(user_input)
|
||||||
if user_input == nil or user_input == "" then
|
if user_input == nil or user_input == "" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@ -45,21 +45,7 @@ keymap.set("n", [[\x]], "<cmd>windo lclose <bar> cclose <cr>", {
|
|||||||
-- Delete a buffer, without closing the window, see https://stackoverflow.com/q/4465095/6064933
|
-- Delete a buffer, without closing the window, see https://stackoverflow.com/q/4465095/6064933
|
||||||
keymap.set("n", [[\d]], "<cmd>bprevious <bar> bdelete #<cr>", {
|
keymap.set("n", [[\d]], "<cmd>bprevious <bar> bdelete #<cr>", {
|
||||||
silent = true,
|
silent = true,
|
||||||
desc = "delete current buffer",
|
desc = "delete buffer",
|
||||||
})
|
|
||||||
|
|
||||||
keymap.set("n", [[\D]], function()
|
|
||||||
local buf_ids = vim.api.nvim_list_bufs()
|
|
||||||
local cur_buf = vim.api.nvim_win_get_buf(0)
|
|
||||||
|
|
||||||
for _, buf_id in pairs(buf_ids) do
|
|
||||||
-- do not Delete unlisted buffers, which may lead to unexpected errors
|
|
||||||
if vim.api.nvim_get_option_value("buflisted", { buf = buf_id }) and buf_id ~= cur_buf then
|
|
||||||
vim.api.nvim_buf_delete(buf_id, { force = true })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end, {
|
|
||||||
desc = "delete other buffers",
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Insert a blank line below or above current line (do not move the cursor),
|
-- Insert a blank line below or above current line (do not move the cursor),
|
||||||
@ -232,14 +218,11 @@ keymap.set("n", "<leader>cb", function()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
timer:start(
|
timer:start(0, 100, vim.schedule_wrap(function()
|
||||||
0,
|
vim.cmd [[
|
||||||
100,
|
|
||||||
vim.schedule_wrap(function()
|
|
||||||
vim.cmd([[
|
|
||||||
set cursorcolumn!
|
set cursorcolumn!
|
||||||
set cursorline!
|
set cursorline!
|
||||||
]])
|
]]
|
||||||
|
|
||||||
if cnt == blink_times then
|
if cnt == blink_times then
|
||||||
timer:close()
|
timer:close()
|
||||||
@ -248,4 +231,5 @@ keymap.set("n", "<leader>cb", function()
|
|||||||
cnt = cnt + 1
|
cnt = cnt + 1
|
||||||
end)
|
end)
|
||||||
)
|
)
|
||||||
end, { desc = "show cursor" })
|
end,
|
||||||
|
{ desc = "show cursor" })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user