@@ -48,7 +48,217 @@ vim.g.maplocalleader = ' '
4848require ' lazy-bootstrap'
4949
5050-- [[ Configure plugins ]]
51+ <<<<<<< HEAD
5152require ' lazy-plugins'
53+ =======
54+ -- NOTE: Here is where you install your plugins.
55+ -- You can configure plugins using the `config` key.
56+ --
57+ -- You can also configure plugins after the setup call,
58+ -- as they will be available in your neovim runtime.
59+ require (' lazy' ).setup ({
60+ -- NOTE: First, some plugins that don't require any configuration
61+
62+ -- Git related plugins
63+ ' tpope/vim-fugitive' ,
64+ ' tpope/vim-rhubarb' ,
65+
66+ -- Detect tabstop and shiftwidth automatically
67+ ' tpope/vim-sleuth' ,
68+
69+ -- NOTE: This is where your plugins related to LSP can be installed.
70+ -- The configuration is done below. Search for lspconfig to find it below.
71+ {
72+ -- LSP Configuration & Plugins
73+ ' neovim/nvim-lspconfig' ,
74+ dependencies = {
75+ -- Automatically install LSPs to stdpath for neovim
76+ ' williamboman/mason.nvim' ,
77+ ' williamboman/mason-lspconfig.nvim' ,
78+
79+ -- Useful status updates for LSP
80+ -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
81+ { ' j-hui/fidget.nvim' , opts = {} },
82+
83+ -- Additional lua configuration, makes nvim stuff amazing!
84+ ' folke/neodev.nvim' ,
85+ },
86+ },
87+
88+ {
89+ -- Autocompletion
90+ ' hrsh7th/nvim-cmp' ,
91+ dependencies = {
92+ -- Snippet Engine & its associated nvim-cmp source
93+ ' L3MON4D3/LuaSnip' ,
94+ ' saadparwaiz1/cmp_luasnip' ,
95+
96+ -- Adds LSP completion capabilities
97+ ' hrsh7th/cmp-nvim-lsp' ,
98+ ' hrsh7th/cmp-path' ,
99+
100+ -- Adds a number of user-friendly snippets
101+ ' rafamadriz/friendly-snippets' ,
102+ },
103+ },
104+
105+ -- Useful plugin to show you pending keybinds.
106+ { ' folke/which-key.nvim' , opts = {} },
107+ {
108+ -- Adds git related signs to the gutter, as well as utilities for managing changes
109+ ' lewis6991/gitsigns.nvim' ,
110+ opts = {
111+ -- See `:help gitsigns.txt`
112+ signs = {
113+ add = { text = ' +' },
114+ change = { text = ' ~' },
115+ delete = { text = ' _' },
116+ topdelete = { text = ' ‾' },
117+ changedelete = { text = ' ~' },
118+ },
119+ on_attach = function (bufnr )
120+ local gs = package.loaded .gitsigns
121+
122+ local function map (mode , l , r , opts )
123+ opts = opts or {}
124+ opts .buffer = bufnr
125+ vim .keymap .set (mode , l , r , opts )
126+ end
127+
128+ -- Navigation
129+ map ({ ' n' , ' v' }, ' ]c' , function ()
130+ if vim .wo .diff then
131+ return ' ]c'
132+ end
133+ vim .schedule (function ()
134+ gs .next_hunk ()
135+ end )
136+ return ' <Ignore>'
137+ end , { expr = true , desc = ' Jump to next hunk' })
138+
139+ map ({ ' n' , ' v' }, ' [c' , function ()
140+ if vim .wo .diff then
141+ return ' [c'
142+ end
143+ vim .schedule (function ()
144+ gs .prev_hunk ()
145+ end )
146+ return ' <Ignore>'
147+ end , { expr = true , desc = ' Jump to previous hunk' })
148+
149+ -- Actions
150+ -- visual mode
151+ map (' v' , ' <leader>hs' , function ()
152+ gs .stage_hunk { vim .fn .line ' .' , vim .fn .line ' v' }
153+ end , { desc = ' stage git hunk' })
154+ map (' v' , ' <leader>hr' , function ()
155+ gs .reset_hunk { vim .fn .line ' .' , vim .fn .line ' v' }
156+ end , { desc = ' reset git hunk' })
157+ -- normal mode
158+ map (' n' , ' <leader>hs' , gs .stage_hunk , { desc = ' git stage hunk' })
159+ map (' n' , ' <leader>hr' , gs .reset_hunk , { desc = ' git reset hunk' })
160+ map (' n' , ' <leader>hS' , gs .stage_buffer , { desc = ' git Stage buffer' })
161+ map (' n' , ' <leader>hu' , gs .undo_stage_hunk , { desc = ' undo stage hunk' })
162+ map (' n' , ' <leader>hR' , gs .reset_buffer , { desc = ' git Reset buffer' })
163+ map (' n' , ' <leader>hp' , gs .preview_hunk , { desc = ' preview git hunk' })
164+ map (' n' , ' <leader>hb' , function ()
165+ gs .blame_line { full = false }
166+ end , { desc = ' git blame line' })
167+ map (' n' , ' <leader>hd' , gs .diffthis , { desc = ' git diff against index' })
168+ map (' n' , ' <leader>hD' , function ()
169+ gs .diffthis ' ~'
170+ end , { desc = ' git diff against last commit' })
171+
172+ -- Toggles
173+ map (' n' , ' <leader>tb' , gs .toggle_current_line_blame , { desc = ' toggle git blame line' })
174+ map (' n' , ' <leader>td' , gs .toggle_deleted , { desc = ' toggle git show deleted' })
175+
176+ -- Text object
177+ map ({ ' o' , ' x' }, ' ih' , ' :<C-U>Gitsigns select_hunk<CR>' , { desc = ' select git hunk' })
178+ end ,
179+ },
180+ },
181+
182+ {
183+ -- Theme inspired by Atom
184+ ' navarasu/onedark.nvim' ,
185+ priority = 1000 ,
186+ config = function ()
187+ vim .cmd .colorscheme ' onedark'
188+ end ,
189+ },
190+
191+ {
192+ -- Set lualine as statusline
193+ ' nvim-lualine/lualine.nvim' ,
194+ -- See `:help lualine.txt`
195+ opts = {
196+ options = {
197+ icons_enabled = false ,
198+ theme = ' onedark' ,
199+ component_separators = ' |' ,
200+ section_separators = ' ' ,
201+ },
202+ },
203+ },
204+
205+ {
206+ -- Add indentation guides even on blank lines
207+ ' lukas-reineke/indent-blankline.nvim' ,
208+ -- Enable `lukas-reineke/indent-blankline.nvim`
209+ -- See `:help ibl`
210+ main = ' ibl' ,
211+ opts = {},
212+ },
213+
214+ -- "gc" to comment visual regions/lines
215+ { ' numToStr/Comment.nvim' , opts = {} },
216+
217+ -- Fuzzy Finder (files, lsp, etc)
218+ {
219+ ' nvim-telescope/telescope.nvim' ,
220+ branch = ' 0.1.x' ,
221+ dependencies = {
222+ ' nvim-lua/plenary.nvim' ,
223+ -- Fuzzy Finder Algorithm which requires local dependencies to be built.
224+ -- Only load if `make` is available. Make sure you have the system
225+ -- requirements installed.
226+ {
227+ ' nvim-telescope/telescope-fzf-native.nvim' ,
228+ -- NOTE: If you are having trouble with this installation,
229+ -- refer to the README for telescope-fzf-native for more instructions.
230+ build = ' make' ,
231+ cond = function ()
232+ return vim .fn .executable ' make' == 1
233+ end ,
234+ },
235+ },
236+ },
237+
238+ {
239+ -- Highlight, edit, and navigate code
240+ ' nvim-treesitter/nvim-treesitter' ,
241+ dependencies = {
242+ ' nvim-treesitter/nvim-treesitter-textobjects' ,
243+ },
244+ build = ' :TSUpdate' ,
245+ },
246+
247+ -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
248+ -- These are some example plugins that I've included in the kickstart repository.
249+ -- Uncomment any of the lines below to enable them.
250+ -- require 'kickstart.plugins.autoformat',
251+ -- require 'kickstart.plugins.debug',
252+
253+ -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
254+ -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
255+ -- up-to-date with whatever is in the kickstart repo.
256+ -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
257+ --
258+ -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
259+ -- { import = 'custom.plugins' },
260+ }, {})
261+ >>>>>>> 76 c5b1e (feat (cmp ): path completion feature (# 536 ))
52262
53263-- [[ Setting options ]]
54264require ' options'
@@ -150,8 +360,61 @@ require 'treesitter-setup'
150360require ' lsp-setup'
151361
152362-- [[ Configure nvim-cmp ]]
363+ <<<<<<< HEAD
153364-- (completion)
154365require ' cmp-setup'
366+ =======
367+ -- See `:help cmp`
368+ local cmp = require ' cmp'
369+ local luasnip = require ' luasnip'
370+ require (' luasnip.loaders.from_vscode' ).lazy_load ()
371+ luasnip .config .setup {}
372+
373+ cmp .setup {
374+ snippet = {
375+ expand = function (args )
376+ luasnip .lsp_expand (args .body )
377+ end ,
378+ },
379+ completion = {
380+ completeopt = ' menu,menuone,noinsert' ,
381+ },
382+ mapping = cmp .mapping .preset .insert {
383+ [' <C-n>' ] = cmp .mapping .select_next_item (),
384+ [' <C-p>' ] = cmp .mapping .select_prev_item (),
385+ [' <C-d>' ] = cmp .mapping .scroll_docs (- 4 ),
386+ [' <C-f>' ] = cmp .mapping .scroll_docs (4 ),
387+ [' <C-Space>' ] = cmp .mapping .complete {},
388+ [' <CR>' ] = cmp .mapping .confirm {
389+ behavior = cmp .ConfirmBehavior .Replace ,
390+ select = true ,
391+ },
392+ [' <Tab>' ] = cmp .mapping (function (fallback )
393+ if cmp .visible () then
394+ cmp .select_next_item ()
395+ elseif luasnip .expand_or_locally_jumpable () then
396+ luasnip .expand_or_jump ()
397+ else
398+ fallback ()
399+ end
400+ end , { ' i' , ' s' }),
401+ [' <S-Tab>' ] = cmp .mapping (function (fallback )
402+ if cmp .visible () then
403+ cmp .select_prev_item ()
404+ elseif luasnip .locally_jumpable (- 1 ) then
405+ luasnip .jump (- 1 )
406+ else
407+ fallback ()
408+ end
409+ end , { ' i' , ' s' }),
410+ },
411+ sources = {
412+ { name = ' nvim_lsp' },
413+ { name = ' luasnip' },
414+ { name = ' path' },
415+ },
416+ }
417+ >>>>>>> 76 c5b1e (feat (cmp ): path completion feature (# 536 ))
155418
156419-- The line beneath this is called `modeline`. See `:help modeline`
157420-- vim: ts=2 sts=2 sw=2 et
0 commit comments