Nvim configuration.
This commit is contained in:
parent
8577646177
commit
bb8a0eaec7
10 changed files with 61 additions and 37 deletions
|
|
@ -4,12 +4,16 @@ vim.g.maplocalleader = ' '
|
||||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||||
|
|
||||||
-- Load modules
|
-- Load modules
|
||||||
require("utils.lazy").lazy_init()
|
if vim.g.vscode then
|
||||||
require("lazy").setup("plugins", {
|
require("config.mappings")
|
||||||
change_detection = {
|
else
|
||||||
enabled = false,
|
require("utils.lazy").lazy_init()
|
||||||
notify = false,
|
require("lazy").setup("plugins", {
|
||||||
},
|
change_detection = {
|
||||||
})
|
enabled = false,
|
||||||
|
notify = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
require("config")
|
require("config")
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
require("config.options")
|
|
||||||
require("config.plugins")
|
|
||||||
require("config.mappings")
|
|
||||||
require("config.autocmd")
|
require("config.autocmd")
|
||||||
require("config.lsp")
|
require("config.lsp")
|
||||||
|
require("config.mappings")
|
||||||
|
require("config.options")
|
||||||
|
require("config.plugins")
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
|
|
||||||
|
-- Unbind used keys
|
||||||
|
map('n', '<C-q>', '<NOP>')
|
||||||
|
|
||||||
-- Movements between splits
|
-- Movements between splits
|
||||||
map('n', '<C-h>', '<C-w>h')
|
map('n', '<C-h>', '<C-w>h')
|
||||||
map('n', '<C-j>', '<C-w>j')
|
map('n', '<C-j>', '<C-w>j')
|
||||||
|
|
@ -16,14 +19,15 @@ map('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||||
|
|
||||||
-- Exit buffers/nvim with <leader>
|
-- Exit buffers/nvim with <leader>
|
||||||
map("n", "<leader>q", function() require('utils.close_buffer').close_buffer() end)
|
map("n", "<leader>q", function() require('utils.close_buffer').close_buffer() end)
|
||||||
|
map("n", "<leader><C-q>", function() require('utils.close_buffer').close_buffer(true) end)
|
||||||
map("n", "<leader>Q", ":%bd | quit<CR>")
|
map("n", "<leader>Q", ":%bd | quit<CR>")
|
||||||
map("n", "<leader><C-Q>", ":%bd! | quit!<CR>")
|
|
||||||
map("n", "<leader>w", ":write<CR>")
|
map("n", "<leader>w", ":write<CR>")
|
||||||
|
|
||||||
-- Copy and paste from clipboard
|
-- Copy and paste from clipboard
|
||||||
map("n", "<leader>y", '"+yy')
|
map("n", "<leader>y", '"+yy')
|
||||||
map("v", "<leader>y", '"+y')
|
map("v", "<leader>y", '"+y')
|
||||||
map({ "n", "v" }, "<leader>p", '"+p')
|
map({ "n", "v" }, "<leader>p", '"+p')
|
||||||
|
map({ "n", "v" }, "<leader>P", '"+P')
|
||||||
|
|
||||||
-- Remap comments
|
-- Remap comments
|
||||||
map("n", "<C-_>", require("Comment.api").toggle.linewise.current)
|
map("n", "<C-_>", require("Comment.api").toggle.linewise.current)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
require("config.plugins.treesitter")
|
require("config.plugins.lualine")
|
||||||
require("config.plugins.telescope")
|
require("config.plugins.nvim-autopairs")
|
||||||
require("config.plugins.nvim-cmp")
|
require("config.plugins.nvim-cmp")
|
||||||
require("config.plugins.nvim-tree")
|
require("config.plugins.nvim-tree")
|
||||||
require("config.plugins.lualine")
|
require("config.plugins.telescope")
|
||||||
|
require("config.plugins.treesitter")
|
||||||
|
|
|
||||||
4
.config/nvim/lua/config/plugins/nvim-autopairs.lua
Normal file
4
.config/nvim/lua/config/plugins/nvim-autopairs.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
require('nvim-autopairs').setup({
|
||||||
|
disable_filetype = { "TelescopePrompt" , "vim" },
|
||||||
|
enable_check_bracket_line = false,
|
||||||
|
})
|
||||||
|
|
@ -5,7 +5,10 @@ return {
|
||||||
'nvim-tree/nvim-web-devicons',
|
'nvim-tree/nvim-web-devicons',
|
||||||
"nvim-tree/nvim-tree.lua",
|
"nvim-tree/nvim-tree.lua",
|
||||||
'nvim-lualine/lualine.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
|
'tpope/vim-surround',
|
||||||
|
'tmux-plugins/vim-tmux',
|
||||||
{ 'numToStr/Comment.nvim', opts = {} },
|
{ 'numToStr/Comment.nvim', opts = {} },
|
||||||
{ 'ethanholz/nvim-lastplace', config = {} },
|
{ 'ethanholz/nvim-lastplace', config = {} },
|
||||||
{ "akinsho/bufferline.nvim", config = {} },
|
{ "akinsho/bufferline.nvim", config = {} },
|
||||||
|
{ 'wakatime/vim-wakatime', event = 'VeryLazy' },
|
||||||
}
|
}
|
||||||
|
|
|
||||||
5
.config/nvim/lua/plugins/nvim-autopairs.lua
Normal file
5
.config/nvim/lua/plugins/nvim-autopairs.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
return {
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
event = "InsertEnter",
|
||||||
|
opts = {}
|
||||||
|
}
|
||||||
|
|
@ -1,23 +1,31 @@
|
||||||
local M = { }
|
local M = { }
|
||||||
|
|
||||||
function M.close_buffer()
|
local function try_quit(command)
|
||||||
local try_quit = function(command)
|
local success, errorMsg = pcall(vim.api.nvim_command, command)
|
||||||
local success, errorMsg = pcall(vim.api.nvim_command, command)
|
if not success then
|
||||||
if not success then
|
print("Failed to quit: " .. errorMsg)
|
||||||
print("Failed to quit: " .. errorMsg)
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
local tree = require("nvim-tree.api").tree
|
function M.close_buffer(force)
|
||||||
local buffer_count = #vim.fn.filter(vim.fn.range(1, vim.fn.bufnr '$'), 'buflisted(v:val)')
|
local buf_cmd = "bd"
|
||||||
|
local quit_cmd = "qa"
|
||||||
|
|
||||||
if buffer_count ~= 1 then
|
if force then
|
||||||
tree.toggle({ focus = false })
|
buf_cmd = "bd!"
|
||||||
try_quit("bd")
|
quit_cmd = "qa!"
|
||||||
tree.toggle({ focus = false })
|
end
|
||||||
else
|
|
||||||
try_quit("qa")
|
local tree = require("nvim-tree.api").tree
|
||||||
end
|
local buffer_count = #vim.fn.filter(vim.fn.range(1, vim.fn.bufnr '$'), 'buflisted(v:val)')
|
||||||
|
|
||||||
|
if buffer_count == 1 or buffer_count == 0 then
|
||||||
|
try_quit(quit_cmd)
|
||||||
|
else
|
||||||
|
tree.toggle({ focus = false })
|
||||||
|
try_quit(buf_cmd)
|
||||||
|
tree.toggle({ focus = false })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
return {
|
|
||||||
require("utils.lazy"),
|
|
||||||
require("utils.close_buffer"),
|
|
||||||
}
|
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,4 +1,3 @@
|
||||||
# lazy.nvim lockfile
|
# lazy.nvim lockfile
|
||||||
lazy-lock.json
|
.config/tmux/plugins/
|
||||||
**/tmux/plugins/
|
|
||||||
.zcompdump
|
.zcompdump
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue