diff --git a/init.lua b/init.lua index 08717d53..bd750267 100644 --- a/init.lua +++ b/init.lua @@ -100,6 +100,7 @@ vim.g.have_nerd_font = false -- Make line numbers default vim.opt.number = true +vim.opt.relativenumber = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! -- vim.opt.relativenumber = true @@ -148,6 +149,10 @@ vim.opt.splitbelow = true vim.opt.list = true vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } +vim.opt.tabstop = 4 -- A TAB character looks like 4 spaces +vim.opt.expandtab = true -- Pressing the TAB key will insert spaces instead of a TAB character +vim.opt.softtabstop = 4 -- Number of spaces inserted instead of a TAB character +vim.opt.shiftwidth = 4 -- Number of spaces inserted when indenting -- Preview substitutions live, as you type! vim.opt.inccommand = 'split' @@ -175,6 +180,8 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn -- or just use <C-\><C-n> to exit terminal mode vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }) +vim.keymap.set('n', '<leader><tab>', '<Cmd>Neotree toggle<CR>') + -- TIP: Disable arrow keys in normal mode -- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>') -- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>') @@ -227,6 +234,7 @@ vim.opt.rtp:prepend(lazypath) -- :Lazy update -- -- NOTE: Here is where you install your plugins. + require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically @@ -267,9 +275,8 @@ require('lazy').setup({ -- which loads which-key before all the UI elements are loaded. Events can be -- normal autocommands events (`:help autocmd-events`). -- - -- Then, because we use the `config` key, the configuration only runs - -- after the plugin has been loaded: - -- config = function() ... end + -- Then, because we use the `opts` key (recommended), the configuration runs + -- after the plugin has been loaded as `require(MODULE).setup(opts)`. { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', @@ -629,8 +636,8 @@ require('lazy').setup({ -- lua_ls = { - -- cmd = {...}, - -- filetypes = { ...}, + -- cmd = { ... }, + -- filetypes = { ... }, -- capabilities = {}, settings = { Lua = { @@ -679,16 +686,16 @@ require('lazy').setup({ 'stevearc/conform.nvim', event = { 'BufWritePre' }, cmd = { 'ConformInfo' }, - keys = { - { - '<leader>f', - function() - require('conform').format { async = true, lsp_format = 'fallback' } - end, - mode = '', - desc = '[F]ormat buffer', - }, - }, + -- keys = { + -- { + -- '<leader>f', + -- function() + -- require('conform').format { async = true, lsp_format = 'fallback' } + -- end, + -- mode = '', + -- desc = '[F]ormat buffer', + -- }, + -- }, opts = { notify_on_error = false, format_on_save = function(bufnr) @@ -895,7 +902,8 @@ require('lazy').setup({ { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', - main = 'nvim-treesitter.configs', -- Sets main module to use for opts + main = 'nvim-treesitter.configs', -- Sets main module to use for opts, + -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, @@ -909,6 +917,7 @@ require('lazy').setup({ additional_vim_regex_highlighting = { 'ruby' }, }, indent = { enable = true, disable = { 'ruby' } }, + -- compilers = { 'gcc' } }, -- There are additional nvim-treesitter modules that you can use to interact -- with nvim-treesitter. You should go explore a few and see what interests you: @@ -931,7 +940,7 @@ require('lazy').setup({ -- require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.neo-tree', -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` @@ -965,6 +974,23 @@ require('lazy').setup({ }, }, }) - +require('nvim-treesitter.install').compilers = { 'clang' } +local builtin = require 'telescope.builtin' +vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' }) +vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' }) +vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' }) +vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' }) +require('telescope').setup { + defaults = { + file_ignore_patterns = { + 'node_modules', + 'Dependencies', + 'CMakeFiles', + 'cmake-build-debug', + 'out/build', + 'x64', + }, + }, +} -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et