From 1c8503345693788660ac0a132b111ebeb08ed87f Mon Sep 17 00:00:00 2001 From: talha Date: Sun, 26 Jul 2026 11:55:58 +0500 Subject: Updated config --- lua/talha/init.lua | 2 +- lua/talha/lazy.lua | 1 + lua/talha/plugins/oil.lua | 24 ++++++++++++++++++++++++ lua/talha/plugins/telescope.lua | 38 ++++++++++++++++++++++++++++++++++++-- lua/talha/plugins/treesitter.lua | 30 ++++++++++++++++++------------ lua/talha/remap.lua | 13 ++++++++++++- lua/talha/set.lua | 4 ---- 7 files changed, 92 insertions(+), 20 deletions(-) create mode 100644 lua/talha/plugins/oil.lua (limited to 'lua') diff --git a/lua/talha/init.lua b/lua/talha/init.lua index 7b2074b..eadef49 100644 --- a/lua/talha/init.lua +++ b/lua/talha/init.lua @@ -4,4 +4,4 @@ require("talha.remap") require("talha.set") require("talha.autocmds") -vim.lsp.enable('clangd') +vim.lsp.enable({ "clangd", "pyright" }) diff --git a/lua/talha/lazy.lua b/lua/talha/lazy.lua index 5eb32fe..6ca7073 100644 --- a/lua/talha/lazy.lua +++ b/lua/talha/lazy.lua @@ -18,5 +18,6 @@ vim.opt.rtp:prepend(lazypath) require("lazy").setup({ { "bluz71/vim-moonfly-colors", name = "moonfly", lazy = false, priority = 1000 }, { "nvim-lua/plenary.nvim" }, + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, { import = "talha.plugins" }, }) diff --git a/lua/talha/plugins/oil.lua b/lua/talha/plugins/oil.lua new file mode 100644 index 0000000..a7196fa --- /dev/null +++ b/lua/talha/plugins/oil.lua @@ -0,0 +1,24 @@ +return { + 'stevearc/oil.nvim', + dependencies = { { "nvim-mini/mini.icons", version = '*', + config = function() + require('mini.icons').setup() + end + } }, + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + lazy = false, + config = function() + require("oil").setup({ + columns = { + "icon", + }, + view_options = { + show_hidden = true, + }, + keymaps = { + [""] = { "actions.select", mode = "n" }, + [""] = { "actions.parent", mode = "n" }, + } + }) + end +} diff --git a/lua/talha/plugins/telescope.lua b/lua/talha/plugins/telescope.lua index 8b3a54b..65bfae9 100644 --- a/lua/talha/plugins/telescope.lua +++ b/lua/talha/plugins/telescope.lua @@ -1,6 +1,6 @@ return { { - "nvim-telescope/telescope.nvim", version = "0.1.2", + "nvim-telescope/telescope.nvim", version = "*", dependencies = { "nvim-lua/plenary.nvim" }, config = function() local builtin = require('telescope.builtin') @@ -13,6 +13,40 @@ return { vim.keymap.set('n', 'pb', builtin.buffers) vim.keymap.set('n', 'ph', builtin.help_tags) vim.keymap.set('n', 'mp', builtin.man_pages) - end + + + local actions = require('telescope.actions') + require("telescope").setup({ + defaults = { + mappings = { + i = { -- Insert mode mappings + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + [""] = actions.preview_scrolling_left, + [""] = actions.preview_scrolling_right, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + [""] = actions.results_scrolling_left, + [""] = actions.results_scrolling_right, + }, + n = { -- Normal mode mappings + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + [""] = actions.preview_scrolling_left, + [""] = actions.preview_scrolling_right, + [""] = actions.move_selection_previous, + [""] = actions.move_selection_next, + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + [""] = actions.results_scrolling_left, + [""] = actions.results_scrolling_right, + [""] = actions.close, + }, + }, + }, + }) + end } } diff --git a/lua/talha/plugins/treesitter.lua b/lua/talha/plugins/treesitter.lua index 53d3ca0..7cf6c38 100644 --- a/lua/talha/plugins/treesitter.lua +++ b/lua/talha/plugins/treesitter.lua @@ -1,22 +1,28 @@ return { { "nvim-treesitter/nvim-treesitter", + branch = "main", lazy = false, build = ":TSUpdate", config = function () - local configs = require("nvim-treesitter.configs") + local ts = require("nvim-treesitter") - configs.setup({ - ensure_installed = { - "c", "cpp", "python", - "vim", "vimdoc", "query", - }, - sync_install = false, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - indent = { enable = true }, + -- Automatically install your specified parsers + ts.install({ + "c", "cpp", "python", + "vim", "vimdoc", "query" + }) + + -- Enable highlighting and indentation using Neovim's built-in APIs + vim.api.nvim_create_autocmd("FileType", { + pattern = { "*.yml", "*.sql", "Dockerfile*", "CMakeLists*", "*.py", "*.c", "*.cpp", "*.h", "*.hpp" }, + callback = function() + -- Replaces highlight = { enable = true } + vim.treesitter.start() + + -- Replaces indent = { enable = true } + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end, }) end } diff --git a/lua/talha/remap.lua b/lua/talha/remap.lua index ee80890..fd785a2 100644 --- a/lua/talha/remap.lua +++ b/lua/talha/remap.lua @@ -4,7 +4,7 @@ vim.keymap.set("n", "", vim.cmd.tabp) vim.keymap.set("n", "", vim.cmd.tabn) -- open project view with netrw -vim.keymap.set("n", "pv", vim.cmd.Ex) +vim.keymap.set("n", "pv", vim.cmd.Oil) -- file splitting vim.keymap.set("n", "vs", vim.cmd.vsplit) @@ -40,3 +40,14 @@ vim.keymap.set("n", "", function() SafeCListNav(1) end) vim.keymap.set("n", "", function() SafeCListNav(-1) end) -- open error list when there are errors vim.keymap.set("n", "", vim.cmd.cw) + +---- builtin terminal +vim.keymap.set("n", "to", function() + vim.cmd.new() + vim.cmd.term() + vim.cmd.wincmd("J") + vim.api.nvim_win_set_height(0, 10) +end) + +vim.keymap.set("t", "", [[]]) + diff --git a/lua/talha/set.lua b/lua/talha/set.lua index a7888b3..c6e6485 100644 --- a/lua/talha/set.lua +++ b/lua/talha/set.lua @@ -37,7 +37,3 @@ if vim.fn.executable('rg') > 0 then op.grepprg = 'rg --vimgrep' end --- netrw settings -vim.g.netrw_keepdir = 1 -vim.g.netrw_banner = 0 -vim.g.netrw_altv = 1 -- cgit v1.2.3