-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
149 lines (139 loc) · 3.16 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
-- Setup lazy.vim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath
})
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
{
'vim-airline/vim-airline',
branch = 'master',
},
{
'tinted-theming/tinted-vim',
branch = 'main',
},
{
'neoclide/coc.nvim',
branch = 'release',
},
{
'nvim-telescope/telescope-fzf-native.nvim',
branch = 'main',
build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release'
},
{
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim'
}
},
{
'tpope/vim-repeat',
branch = 'master',
},
{
'tpope/vim-surround',
branch = 'master',
},
{
'tpope/vim-fugitive',
tag = 'v3.7',
},
{
'tpope/vim-rhubarb',
branch = 'master',
},
{
'lewis6991/gitsigns.nvim',
tag = 'v0.8.1',
},
{
'rbong/vim-flog',
branch = 'master',
lazy = true,
cmd = { 'Flog', 'Flogsplit', 'Floggit' },
},
{
'nvim-treesitter/nvim-treesitter',
branch = 'master',
build = ':TSUpdate',
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = { "lua", "vim", "vimdoc", "javascript", "html", "css", "typescript", "tsx", "c" },
sync_install = true,
highlight = { enable = true },
indent = { enable = true },
})
end,
},
})
require('telescope').setup {
defaults = {
mappings = {
i = {
["<CR>"] = "select_tab",
},
n = {
["<CR>"] = "select_tab",
},
},
},
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
}
}
}
require('telescope').load_extension('fzf')
require('gitsigns').setup {
on_attach = function(bufnr)
local gitsigns = require('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
vim.cmd.normal({']c', bang = true})
else
gitsigns.nav_hunk('next')
end
end)
map('n', '[c', function()
if vim.wo.diff then
vim.cmd.normal({'[c', bang = true})
else
gitsigns.nav_hunk('prev')
end
end)
-- Actions
map('n', '<leader>hs', gitsigns.stage_hunk)
map('n', '<leader>hr', gitsigns.reset_hunk)
map('v', '<leader>hs', function() gitsigns.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
map('v', '<leader>hr', function() gitsigns.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
map('n', '<leader>hS', gitsigns.stage_buffer)
map('n', '<leader>hu', gitsigns.undo_stage_hunk)
map('n', '<leader>hR', gitsigns.reset_buffer)
map('n', '<leader>hp', gitsigns.preview_hunk)
end
}
vim.cmd([[
set runtimepath^=~/.vim
let &packpath=&runtimepath
source ~/.vimrc
]])