@@ -172,16 +172,213 @@ vim.opt.rtp:prepend(lazypath)
172172
173173-- [[ Configure plugins ]]
174174-- NOTE: Here is where you install your plugins.
175- -- You can configure plugins using the `config` key.
176- --
177- -- You can also configure plugins after the setup call,
178- -- as they will be available in your neovim runtime.
179175require (' lazy' ).setup {
180- -- NOTE: First, some plugins that don't require any configuration
181- {
182- ' junegunn/fzf' ,
183- build = function ()
184- vim .fn [' fzf#install' ]()
176+ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
177+ ' tpope/vim-sleuth' , -- Detect tabstop and shiftwidth automatically
178+
179+ -- NOTE: Plugins can also be added by using a table,
180+ -- with the first argument being the link and the following
181+ -- keys can be used to configure plugin behavior/loading/etc.
182+ --
183+ -- Use `opts = {}` to force a plugin to be loaded.
184+ --
185+
186+ -- Here is a more advanced example where we pass configuration
187+ -- options to `gitsigns.nvim`. This is equivalent to the following Lua:
188+ -- require('gitsigns').setup({ ... })
189+ --
190+ -- See `:help gitsigns` to understand what the configuration keys do
191+ { -- Adds git related signs to the gutter, as well as utilities for managing changes
192+ ' lewis6991/gitsigns.nvim' ,
193+ opts = {
194+ signs = {
195+ add = { text = ' +' },
196+ change = { text = ' ~' },
197+ delete = { text = ' _' },
198+ topdelete = { text = ' ‾' },
199+ changedelete = { text = ' ~' },
200+ },
201+ },
202+ },
203+
204+ -- NOTE: Plugins can also be configured to run Lua code when they are loaded.
205+ --
206+ -- This is often very useful to both group configuration, as well as handle
207+ -- lazy loading plugins that don't need to be loaded immediately at startup.
208+ --
209+ -- For example, in the following configuration, we use:
210+ -- event = 'VimEnter'
211+ --
212+ -- which loads which-key before all the UI elements are loaded. Events can be
213+ -- normal autocommands events (`:help autocmd-events`).
214+ --
215+ -- Then, because we use the `config` key, the configuration only runs
216+ -- after the plugin has been loaded:
217+ -- config = function() ... end
218+
219+ { -- Useful plugin to show you pending keybinds.
220+ ' folke/which-key.nvim' ,
221+ event = ' VimEnter' , -- Sets the loading event to 'VimEnter'
222+ opts = {
223+ icons = {
224+ -- set icon mappings to true if you have a Nerd Font
225+ mappings = vim .g .have_nerd_font ,
226+ -- If you are using a Nerd Font: set icons.keys to an empty table which will use the
227+ -- default which-key.nvim defined Nerd Font icons, otherwise define a string table
228+ keys = vim .g .have_nerd_font and {} or {
229+ Up = ' <Up> ' ,
230+ Down = ' <Down> ' ,
231+ Left = ' <Left> ' ,
232+ Right = ' <Right> ' ,
233+ C = ' <C-…> ' ,
234+ M = ' <M-…> ' ,
235+ D = ' <D-…> ' ,
236+ S = ' <S-…> ' ,
237+ CR = ' <CR> ' ,
238+ Esc = ' <Esc> ' ,
239+ ScrollWheelDown = ' <ScrollWheelDown> ' ,
240+ ScrollWheelUp = ' <ScrollWheelUp> ' ,
241+ NL = ' <NL> ' ,
242+ BS = ' <BS> ' ,
243+ Space = ' <Space> ' ,
244+ Tab = ' <Tab> ' ,
245+ F1 = ' <F1>' ,
246+ F2 = ' <F2>' ,
247+ F3 = ' <F3>' ,
248+ F4 = ' <F4>' ,
249+ F5 = ' <F5>' ,
250+ F6 = ' <F6>' ,
251+ F7 = ' <F7>' ,
252+ F8 = ' <F8>' ,
253+ F9 = ' <F9>' ,
254+ F10 = ' <F10>' ,
255+ F11 = ' <F11>' ,
256+ F12 = ' <F12>' ,
257+ },
258+ },
259+
260+ -- Document existing key chains
261+ spec = {
262+ { ' <leader>c' , group = ' [C]ode' , mode = { ' n' , ' x' } },
263+ { ' <leader>d' , group = ' [D]ocument' },
264+ { ' <leader>r' , group = ' [R]ename' },
265+ { ' <leader>s' , group = ' [S]earch' },
266+ { ' <leader>w' , group = ' [W]orkspace' },
267+ { ' <leader>t' , group = ' [T]oggle' },
268+ { ' <leader>h' , group = ' Git [H]unk' , mode = { ' n' , ' v' } },
269+ },
270+ },
271+ },
272+
273+ -- NOTE: Plugins can specify dependencies.
274+ --
275+ -- The dependencies are proper plugin specifications as well - anything
276+ -- you do for a plugin at the top level, you can do for a dependency.
277+ --
278+ -- Use the `dependencies` key to specify the dependencies of a particular plugin
279+
280+ { -- Fuzzy Finder (files, lsp, etc)
281+ ' nvim-telescope/telescope.nvim' ,
282+ event = ' VimEnter' ,
283+ branch = ' 0.1.x' ,
284+ dependencies = {
285+ ' nvim-lua/plenary.nvim' ,
286+ { -- If encountering errors, see telescope-fzf-native README for installation instructions
287+ ' nvim-telescope/telescope-fzf-native.nvim' ,
288+
289+ -- `build` is used to run some command when the plugin is installed/updated.
290+ -- This is only run then, not every time Neovim starts up.
291+ build = ' make' ,
292+
293+ -- `cond` is a condition used to determine whether this plugin should be
294+ -- installed and loaded.
295+ cond = function ()
296+ return vim .fn .executable ' make' == 1
297+ end ,
298+ },
299+ { ' nvim-telescope/telescope-ui-select.nvim' },
300+
301+ -- Useful for getting pretty icons, but requires a Nerd Font.
302+ { ' nvim-tree/nvim-web-devicons' , enabled = vim .g .have_nerd_font },
303+ },
304+ config = function ()
305+ -- Telescope is a fuzzy finder that comes with a lot of different things that
306+ -- it can fuzzy find! It's more than just a "file finder", it can search
307+ -- many different aspects of Neovim, your workspace, LSP, and more!
308+ --
309+ -- The easiest way to use Telescope, is to start by doing something like:
310+ -- :Telescope help_tags
311+ --
312+ -- After running this command, a window will open up and you're able to
313+ -- type in the prompt window. You'll see a list of `help_tags` options and
314+ -- a corresponding preview of the help.
315+ --
316+ -- Two important keymaps to use while in Telescope are:
317+ -- - Insert mode: <c-/>
318+ -- - Normal mode: ?
319+ --
320+ -- This opens a window that shows you all of the keymaps for the current
321+ -- Telescope picker. This is really useful to discover what Telescope can
322+ -- do as well as how to actually do it!
323+
324+ -- [[ Configure Telescope ]]
325+ -- See `:help telescope` and `:help telescope.setup()`
326+ require (' telescope' ).setup {
327+ -- You can put your default mappings / updates / etc. in here
328+ -- All the info you're looking for is in `:help telescope.setup()`
329+ --
330+ -- defaults = {
331+ -- mappings = {
332+ -- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
333+ -- },
334+ -- },
335+ -- pickers = {}
336+ extensions = {
337+ [' ui-select' ] = {
338+ require (' telescope.themes' ).get_dropdown (),
339+ },
340+ },
341+ }
342+
343+ -- Enable Telescope extensions if they are installed
344+ pcall (require (' telescope' ).load_extension , ' fzf' )
345+ pcall (require (' telescope' ).load_extension , ' ui-select' )
346+
347+ -- See `:help telescope.builtin`
348+ local builtin = require ' telescope.builtin'
349+ vim .keymap .set (' n' , ' <leader>sh' , builtin .help_tags , { desc = ' [S]earch [H]elp' })
350+ vim .keymap .set (' n' , ' <leader>sk' , builtin .keymaps , { desc = ' [S]earch [K]eymaps' })
351+ vim .keymap .set (' n' , ' <leader>sf' , builtin .find_files , { desc = ' [S]earch [F]iles' })
352+ vim .keymap .set (' n' , ' <leader>ss' , builtin .builtin , { desc = ' [S]earch [S]elect Telescope' })
353+ vim .keymap .set (' n' , ' <leader>sw' , builtin .grep_string , { desc = ' [S]earch current [W]ord' })
354+ vim .keymap .set (' n' , ' <leader>sg' , builtin .live_grep , { desc = ' [S]earch by [G]rep' })
355+ vim .keymap .set (' n' , ' <leader>sd' , builtin .diagnostics , { desc = ' [S]earch [D]iagnostics' })
356+ vim .keymap .set (' n' , ' <leader>sr' , builtin .resume , { desc = ' [S]earch [R]esume' })
357+ vim .keymap .set (' n' , ' <leader>s.' , builtin .oldfiles , { desc = ' [S]earch Recent Files ("." for repeat)' })
358+ vim .keymap .set (' n' , ' <leader><leader>' , builtin .buffers , { desc = ' [ ] Find existing buffers' })
359+
360+ -- Slightly advanced example of overriding default behavior and theme
361+ vim .keymap .set (' n' , ' <leader>/' , function ()
362+ -- You can pass additional configuration to Telescope to change the theme, layout, etc.
363+ builtin .current_buffer_fuzzy_find (require (' telescope.themes' ).get_dropdown {
364+ winblend = 10 ,
365+ previewer = false ,
366+ })
367+ end , { desc = ' [/] Fuzzily search in current buffer' })
368+
369+ -- It's also possible to pass additional configuration options.
370+ -- See `:help telescope.builtin.live_grep()` for information about particular keys
371+ vim .keymap .set (' n' , ' <leader>s/' , function ()
372+ builtin .live_grep {
373+ grep_open_files = true ,
374+ prompt_title = ' Live Grep in Open Files' ,
375+ }
376+ end , { desc = ' [S]earch [/] in Open Files' })
377+
378+ -- Shortcut for searching your Neovim configuration files
379+ vim .keymap .set (' n' , ' <leader>sn' , function ()
380+ builtin .find_files { cwd = vim .fn .stdpath ' config' }
381+ end , { desc = ' [S]earch [N]eovim files' })
185382 end ,
186383 },
187384 {
@@ -326,20 +523,15 @@ require('lazy').setup {
326523 },
327524 },
328525
329- -- NOTE: Plugins can also be configured to run Lua code when they are loaded.
330- --
331- -- This is often very useful to both group configuration, as well as handle
332- -- lazy loading plugins that don't need to be loaded immediately at startup.
333- --
334- -- For example, in the following configuration, we use:
335- -- event = 'VimEnter'
336- --
337- -- which loads which-key before all the UI elements are loaded. Events can be
338- -- normal autocommands events (`:help autocmd-events`).
339- --
340- -- Then, because we use the `config` key, the configuration only runs
341- -- after the plugin has been loaded:
342- -- config = function() ... end
526+ -- Change diagnostic symbols in the sign column (gutter)
527+ -- if vim.g.have_nerd_font then
528+ -- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
529+ -- local diagnostic_signs = {}
530+ -- for type, icon in pairs(signs) do
531+ -- diagnostic_signs[vim.diagnostic.severity[type]] = icon
532+ -- end
533+ -- vim.diagnostic.config { signs = { text = diagnostic_signs } }
534+ -- end
343535
344536 { -- Useful plugin to show you pending keybinds.
345537 ' folke/which-key.nvim' ,
0 commit comments