From becf28986a34d24437e300cab4ce03357fc52b30 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 13 Mar 2024 14:04:45 -0400 Subject: [PATCH] start with v3.0 and merge in ptv3 --- .gitignore | 1 + init.lua | 58 ++++++++++++++++++++++++++++++++ lua/plugins/configs/nvimtree.lua | 21 ++++++------ 3 files changed, 69 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index d8a93d9..6524937 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ syntax coc-settings.json .luarc.json lazy-lock.json +*.log after **/.DS_Store diff --git a/init.lua b/init.lua index 9e53d71..d47323c 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,5 @@ require "core" +vim.api.nvim_set_var('mapleader', ';') pcall(require, 'custom') @@ -14,6 +15,63 @@ dofile(vim.g.base46_cache .. "defaults") vim.opt.rtp:prepend(lazypath) require "plugins" +-- new from v3.0 vim.schedule(function() require "core.mappings" end, 0) + +-- Configure Telescope to scroll files with ctrl+j/k +local actions = require('telescope.actions') +local sorters = require('telescope.sorters') + +require('telescope').setup { + defaults = { + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + }, + }, + file_sorter = sorters.get_fzy_sorter, + file_ignore_patterns = { '.git/*', 'node_modules/*', 'vendor/*' }, + generic_sorter = sorters.get_generic_fuzzy_sorter, + }, + extensions = { + fzf = { + fuzzy = true, + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", + } + } +} + + +vim.api.nvim_set_keymap('n', 'e', ':NvimTreeToggle', {noremap = true, silent = true}) + +-- Cycle through open buffers with leader+a +vim.api.nvim_set_keymap('n', 'a', ':bprevious', {noremap = true, silent = true}) +vim.api.nvim_set_keymap('n', 'f', ':bnext', {noremap = true, silent = true}) + +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'ff', builtin.find_files, {}) + +-- move the whole page without moving the cursor +vim.api.nvim_set_keymap('n', 'J', '', { noremap = true }) +vim.api.nvim_set_keymap('n', 'K', '', { noremap = true }) + +-- Resize windows +vim.api.nvim_set_keymap('n', '', '5+', { silent = true }) +vim.api.nvim_set_keymap('n', '', '5-', { silent = true }) +vim.api.nvim_set_keymap('n', '', '10>', { silent = true }) +vim.api.nvim_set_keymap('n', '', '10<', { silent = true }) + +-- Set the tab width to 4 spaces +vim.cmd('set tabstop=4') +vim.cmd('set shiftwidth=4') +vim.cmd('set expandtab') + +vim.o.hidden = true + +-- Git diffthis +vim.api.nvim_set_keymap('n', 'gd', ':Gitsigns diffthis', {noremap = true, silent = true}) diff --git a/lua/plugins/configs/nvimtree.lua b/lua/plugins/configs/nvimtree.lua index c54248e..f15aa2d 100644 --- a/lua/plugins/configs/nvimtree.lua +++ b/lua/plugins/configs/nvimtree.lua @@ -16,11 +16,12 @@ local options = { adaptive_size = false, side = "left", width = 30, - preserve_window_proportions = true, + preserve_window_proportions = true + -- hide_root_folder = true, }, git = { - enable = false, - ignore = true, + enable = true, + ignore = false, }, filesystem_watchers = { enable = true, @@ -31,10 +32,8 @@ local options = { }, }, renderer = { - root_folder_label = false, - highlight_git = false, + highlight_git = true, highlight_opened_files = "none", - indent_markers = { enable = true, }, @@ -44,16 +43,16 @@ local options = { file = true, folder = true, folder_arrow = true, - git = false, + git = true, }, glyphs = { - default = "󰈚", + default = "", symlink = "", folder = { - default = "", - empty = "", - empty_open = "", + default = "", + empty = "", + empty_open = "", open = "", symlink = "", symlink_open = "",