From f4b6559d02fef784fb0592b3aafd28fb9118d578 Mon Sep 17 00:00:00 2001 From: mehdi fajraoui Date: Sat, 23 Mar 2024 00:27:48 +0100 Subject: [PATCH] feat(init) first small changes added git commands in telescope changed themes to catpuccin added lsp for angular and ts --- init.lua | 64 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/init.lua b/init.lua index 013fcc29..b4200173 100644 --- a/init.lua +++ b/init.lua @@ -190,6 +190,10 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- Custom keybinds +-- Use jk to exit edit mode +vim.keymap.set('i', 'jk', '') + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -204,6 +208,20 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) +-- line number when inserting and then relative when inserting +-- vim.api.nvim_win_set_config('number'); +vim.api.nvim_create_autocmd('InsertEnter', { + desc = 'Set absolute line number when entering insert mode', + pattern = '*', + command = 'set norelativenumber', +}) + +vim.api.nvim_create_autocmd('InsertLeave', { + desc = 'Set relative line number when exiting insert mode', + pattern = '*', + command = 'set relativenumber', +}) + -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' @@ -255,6 +273,12 @@ require('lazy').setup({ topdelete = { text = '‾' }, changedelete = { text = '~' }, }, + current_line_blame = true, + current_line_blame_opts = { + virt_text_pos = 'right_align', + delay = 500, + ignore_whitespace = true, + }, }, }, @@ -286,6 +310,7 @@ require('lazy').setup({ ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, + ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, } end, }, @@ -353,6 +378,12 @@ require('lazy').setup({ -- }, -- }, -- pickers = {} + -- + defaults = { + layout_config = { + horizontal = { width = 0.9 }, + }, + }, extensions = { ['ui-select'] = { require('telescope.themes').get_dropdown(), @@ -376,13 +407,17 @@ require('lazy').setup({ vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', 'gs', builtin.git_status, { desc = '[G]it [S]tatus' }) + vim.keymap.set('n', 'gc', builtin.git_commits, { desc = '[G]it [C]ommits' }) + vim.keymap.set('n', 'gb', builtin.git_branches, { desc = '[G]it [B]ranches' }) + vim.keymap.set('n', 't', builtin.treesitter, { desc = '[T]ree sitter' }) -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() -- You can pass additional configuration to Telescope to change the theme, layout, etc. builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { winblend = 10, - previewer = false, + previewer = true, }) end, { desc = '[/] Fuzzily search in current buffer' }) @@ -548,8 +583,8 @@ require('lazy').setup({ -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`tsserver`) will work just fine - -- tsserver = {}, - -- + tsserver = {}, + angularls = {}, lua_ls = { -- cmd = {...}, @@ -735,13 +770,24 @@ require('lazy').setup({ -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. 'folke/tokyonight.nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. - init = function() - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + -- priority = 1000, -- Make sure to load this before all the other start plugins. + -- init = function() + -- Load the colorscheme here. + -- Like many other themes, this one has different styles, and you could load + -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. + -- vim.cmd.colorscheme 'tokyonight-night' + -- You can configure highlights by doing something like: + -- vim.cmd.hi 'Comment gui=none' + -- end, + }, + { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + config = function() + -- Load the colorscheme here + vim.cmd.colorscheme 'catppuccin-frappe' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' end,