update
This commit is contained in:
parent
f63458175a
commit
9a31426958
4 changed files with 201 additions and 21 deletions
|
@ -3,21 +3,21 @@ vim.g.mapleader = " "
|
||||||
-- {{{ Plugins
|
-- {{{ Plugins
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
vim.fn.system({
|
vim.fn.system({
|
||||||
"git",
|
"git",
|
||||||
"clone",
|
"clone",
|
||||||
"--filter=blob:none",
|
"--filter=blob:none",
|
||||||
"https://github.com/folke/lazy.nvim.git",
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
"--branch=stable", -- latest stable release
|
"--branch=stable", -- latest stable release
|
||||||
lazypath,
|
lazypath,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
{
|
{
|
||||||
'christoomey/vim-tmux-navigator',
|
'christoomey/vim-tmux-navigator',
|
||||||
config = function ()
|
config = function()
|
||||||
vim.g.tmux_navigator_no_mappings = 1
|
vim.g.tmux_navigator_no_mappings = 1
|
||||||
vim.keymap.set('', '<M-h>', ':<C-U>TmuxNavigateLeft<cr>')
|
vim.keymap.set('', '<M-h>', ':<C-U>TmuxNavigateLeft<cr>')
|
||||||
vim.keymap.set('', '<M-j>', ':<C-U>TmuxNavigateDown<cr>')
|
vim.keymap.set('', '<M-j>', ':<C-U>TmuxNavigateDown<cr>')
|
||||||
|
@ -34,7 +34,7 @@ require("lazy").setup({
|
||||||
highlight = { enable = true },
|
highlight = { enable = true },
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
},
|
},
|
||||||
config = function (_, opts)
|
config = function(_, opts)
|
||||||
require("nvim-treesitter.configs").setup(opts);
|
require("nvim-treesitter.configs").setup(opts);
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
@ -58,24 +58,181 @@ require("lazy").setup({
|
||||||
config = true,
|
config = true,
|
||||||
},
|
},
|
||||||
{ "nvim-tree/nvim-web-devicons", lazy = true },
|
{ "nvim-tree/nvim-web-devicons", lazy = true },
|
||||||
|
{
|
||||||
|
'VonHeikemen/lsp-zero.nvim',
|
||||||
|
branch = 'v2.x',
|
||||||
|
event = "User EnableIDE",
|
||||||
|
dependencies = {
|
||||||
|
-- LSP Support
|
||||||
|
{ 'neovim/nvim-lspconfig' }, -- Required
|
||||||
|
{ 'williamboman/mason.nvim' }, -- Optional
|
||||||
|
{ 'williamboman/mason-lspconfig.nvim' }, -- Optional
|
||||||
|
|
||||||
|
-- Autocompletion
|
||||||
|
{ 'hrsh7th/nvim-cmp' }, -- Required
|
||||||
|
{ 'hrsh7th/cmp-nvim-lsp' }, -- Required
|
||||||
|
{ 'L3MON4D3/LuaSnip' }, -- Required
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- {{{ LSP config
|
||||||
|
local lsp = require('lsp-zero').preset({})
|
||||||
|
|
||||||
|
lsp.on_attach(function(client, bufnr)
|
||||||
|
-- see :help lsp-zero-keybindings
|
||||||
|
-- to learn the available actions
|
||||||
|
lsp.default_keymaps({ buffer = bufnr })
|
||||||
|
vim.keymap.set('n', 'gr', '<cmd>Telescope lsp_references<cr>', { buffer = true })
|
||||||
|
vim.keymap.set('x', 'f', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', { buffer = true })
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- (Optional) Configure lua language server for neovim
|
||||||
|
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
|
||||||
|
|
||||||
|
lsp.setup()
|
||||||
|
|
||||||
|
local cmp = require('cmp')
|
||||||
|
local cmp_action = require('lsp-zero').cmp_action()
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
mapping = {
|
||||||
|
['<Tab>'] = cmp_action.luasnip_supertab(),
|
||||||
|
['<S-Tab>'] = cmp_action.luasnip_shift_supertab(),
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = {
|
||||||
|
max_height = 10,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
-- }}}
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
tag = '0.1.2',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
|
config = function ()
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<leader>ff', function()
|
||||||
|
builtin.find_files({ follow = true })
|
||||||
|
end, {})
|
||||||
|
vim.keymap.set('n', '<leader>fg', builtin.git_files, {})
|
||||||
|
vim.keymap.set('n', '<leader>fo', builtin.buffers, {})
|
||||||
|
vim.keymap.set('n', '<leader>st', builtin.live_grep, {})
|
||||||
|
vim.keymap.set('n', '<leader>ss', builtin.lsp_dynamic_workspace_symbols, {})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
|
-- {{{ Git signs
|
||||||
|
opts = {
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
|
local function map(mode, l, r, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.buffer = bufnr
|
||||||
|
vim.keymap.set(mode, l, r, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Navigation
|
||||||
|
map('n', ']c', function()
|
||||||
|
if vim.wo.diff then return ']c' end
|
||||||
|
vim.schedule(function() gs.next_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, {expr=true})
|
||||||
|
|
||||||
|
map('n', '[c', function()
|
||||||
|
if vim.wo.diff then return '[c' end
|
||||||
|
vim.schedule(function() gs.prev_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, {expr=true})
|
||||||
|
|
||||||
|
-- Actions
|
||||||
|
map('n', '<leader>gs', gs.stage_hunk)
|
||||||
|
map('n', '<leader>gr', gs.reset_hunk)
|
||||||
|
map('v', '<leader>gs', function() gs.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
|
||||||
|
map('v', '<leader>gr', function() gs.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
|
||||||
|
map('n', '<leader>gu', gs.undo_stage_hunk)
|
||||||
|
map('n', '<leader>gR', gs.reset_buffer)
|
||||||
|
map('n', '<leader>gp', gs.preview_hunk)
|
||||||
|
map('n', '<leader>gl', function() gs.blame_line{full=true} end)
|
||||||
|
map('n', '<leader>gt', gs.toggle_current_line_blame)
|
||||||
|
map('n', '<leader>gj', gs.next_hunk)
|
||||||
|
map('n', '<leader>gk', gs.prev_hunk)
|
||||||
|
|
||||||
|
-- Text object
|
||||||
|
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||||
|
end
|
||||||
|
},
|
||||||
|
-- }}}
|
||||||
|
config = true,
|
||||||
|
event = "User EnableIDE",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'tpope/vim-fugitive',
|
||||||
|
event = "User EnableIDE",
|
||||||
|
},
|
||||||
})
|
})
|
||||||
-- }}}
|
-- }}}
|
||||||
|
-- {{{ Keymap
|
||||||
-- folding
|
|
||||||
vim.opt.foldmethod = "marker"
|
|
||||||
|
|
||||||
-- quick vertical movement
|
-- quick vertical movement
|
||||||
vim.keymap.set('', '<C-j>', '10j')
|
vim.keymap.set('', '<C-j>', '10j')
|
||||||
vim.keymap.set('', '<C-k>', '10k')
|
vim.keymap.set('', '<C-k>', '10k')
|
||||||
|
|
||||||
-- tabs
|
|
||||||
vim.opt.expandtab = true
|
|
||||||
vim.opt.tabstop = 4
|
|
||||||
vim.opt.shiftwidth = 4
|
|
||||||
|
|
||||||
-- buffers
|
-- buffers
|
||||||
vim.keymap.set('', 'H', '<cmd>bprevious<cr>');
|
vim.keymap.set('', 'H', '<cmd>bprevious<cr>');
|
||||||
vim.keymap.set('', 'L', '<cmd>bnext<cr>');
|
vim.keymap.set('', 'L', '<cmd>bnext<cr>');
|
||||||
|
|
||||||
|
-- do not exit visual mode when indenting
|
||||||
|
vim.keymap.set('v', '<', '<gv')
|
||||||
|
vim.keymap.set('v', '>', '>gv')
|
||||||
|
|
||||||
|
-- close buffer with confirm
|
||||||
|
vim.keymap.set('n', '<leader>c', ':confirm bdelete<cr>')
|
||||||
|
|
||||||
|
-- copy to system clipboard
|
||||||
|
vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
|
||||||
|
vim.keymap.set("n", "<leader>Y", [["+Y]])
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>fv", "<cmd>Ex<cr>")
|
||||||
|
-- }}}
|
||||||
|
-- {{{ Vim options
|
||||||
|
|
||||||
|
-- tabs
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.smartindent = true
|
||||||
|
|
||||||
|
|
||||||
-- disable modeline
|
-- disable modeline
|
||||||
vim.opt.modeline = false
|
vim.opt.modeline = false
|
||||||
|
|
||||||
|
-- folding
|
||||||
|
vim.opt.foldmethod = "marker"
|
||||||
|
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
|
vim.opt.scrolloff = 8
|
||||||
|
|
||||||
|
vim.opt.wrap = false
|
||||||
|
|
||||||
|
-- undos
|
||||||
|
vim.opt.swapfile = false
|
||||||
|
vim.opt.backup = false
|
||||||
|
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||||
|
vim.opt.undofile = true
|
||||||
|
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
|
-- }}}
|
||||||
|
-- {{{ IDE mode
|
||||||
|
vim.api.nvim_create_user_command("IDE", function ()
|
||||||
|
vim.api.nvim_exec_autocmds("User", { pattern = "EnableIDE" })
|
||||||
|
end, {})
|
||||||
|
if os.getenv("NVIM_IDE_MODE") == "1" then
|
||||||
|
vim.cmd [[IDE]]
|
||||||
|
end
|
||||||
|
-- }}}
|
||||||
|
|
|
@ -1,8 +1,19 @@
|
||||||
{
|
{
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "c4d6298347f7707e9757351b2ee03d0c00da5c20" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "d8590288417fef2430f85bc8b312fae8b1cf2c40" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" },
|
"lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" },
|
||||||
|
"lsp-zero.nvim": { "branch": "v2.x", "commit": "f084f4a6a716f55bf9c4026e73027bb24a0325a3" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
|
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "dfdd771b792fbb4bad8e057d72558255695aa1a7" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "c811fbf09c7642eebb37d6694f1a016a043f6ed3" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "a27356f1ef9c11e1f459cc96a3fcac5c265e72d6" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "cb74c1c5aefd8b903f1b547d08d4df42be07aa2a" },
|
"nvim-treesitter": { "branch": "master", "commit": "cb74c1c5aefd8b903f1b547d08d4df42be07aa2a" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" },
|
"nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "0dbe561ae023f02c2fb772b879e905055b939ce3" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" },
|
||||||
"tokyodark.nvim": { "branch": "master", "commit": "4bfb42924274abc5de9f5f4779075b77c6112c85" },
|
"tokyodark.nvim": { "branch": "master", "commit": "4bfb42924274abc5de9f5f4779075b77c6112c85" },
|
||||||
|
"vim-fugitive": { "branch": "master", "commit": "572c8510123cbde02e8a1dafcd376c98e1e13f43" },
|
||||||
"vim-tmux-navigator": { "branch": "master", "commit": "addb64a772cb4a3ae1f1363583012b2cada2cd66" }
|
"vim-tmux-navigator": { "branch": "master", "commit": "addb64a772cb4a3ae1f1363583012b2cada2cd66" }
|
||||||
}
|
}
|
|
@ -30,6 +30,17 @@ bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
|
||||||
set -g @catppuccin_flavour "mocha"
|
set -g @catppuccin_flavour "mocha"
|
||||||
set -g @catppuccin_status_modules "-"
|
set -g @catppuccin_status_modules "-"
|
||||||
|
|
||||||
|
# Session splitting
|
||||||
|
bind D kill-session
|
||||||
|
bind C-c \
|
||||||
|
break-pane \
|
||||||
|
\; run-shell 'urxvt -e tmux new \; move-window -s #{session_name}:#{window_id} \; kill-window -t 1 \; move-window -r &' \
|
||||||
|
\; move-window -r
|
||||||
|
|
||||||
|
bind C \
|
||||||
|
run-shell 'urxvt -e tmux new \; move-window -s #{session_name}:#{window_id} \; kill-window -t 1 \; move-window -r &' \
|
||||||
|
\; move-window -r
|
||||||
|
|
||||||
# Smart pane switching with awareness of Vim splits.
|
# Smart pane switching with awareness of Vim splits.
|
||||||
# See: https://github.com/christoomey/vim-tmux-navigator
|
# See: https://github.com/christoomey/vim-tmux-navigator
|
||||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||||
|
|
|
@ -12,7 +12,8 @@ export EDITOR="/usr/bin/nvim"
|
||||||
export VISUAL="/usr/bin/nvim"
|
export VISUAL="/usr/bin/nvim"
|
||||||
alias activate-venv="source venv/bin/activate"
|
alias activate-venv="source venv/bin/activate"
|
||||||
alias rootvenv="source ~/.venv/bin/activate"
|
alias rootvenv="source ~/.venv/bin/activate"
|
||||||
alias glvim="lvim -c 'set autoindent noexpandtab tabstop=4 shiftwidth=4'"
|
alias ide="NVIM_IDE_MODE=1 nvim"
|
||||||
|
alias gide="ide -c 'set autoindent noexpandtab tabstop=4 shiftwidth=4'"
|
||||||
alias showkey="ssh-keygen -y -f"
|
alias showkey="ssh-keygen -y -f"
|
||||||
|
|
||||||
ffmpeg_compat() {
|
ffmpeg_compat() {
|
||||||
|
|
Loading…
Reference in a new issue