From 6a6ba9cd6bc70c101f148b91249d61117c9595b2 Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Mon, 7 Nov 2022 03:25:06 +0000 Subject: [PATCH] Changed some vim options --- .config/nvim/lua/mappings.lua | 49 +++++++++++++++ .config/nvim/lua/plugins/barbar.lua | 74 +++++++++++++++++++++++ .config/nvim/lua/plugins/packer.lua | 79 ++++++++++++++----------- .config/nvim/lua/plugins/rust-tools.lua | 12 ++++ .config/nvim/lua/plugins/telescope.lua | 5 ++ 5 files changed, 183 insertions(+), 36 deletions(-) create mode 100644 .config/nvim/lua/plugins/barbar.lua create mode 100644 .config/nvim/lua/plugins/rust-tools.lua create mode 100644 .config/nvim/lua/plugins/telescope.lua diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index 5dc8d48..0c4ed3d 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua @@ -1,5 +1,54 @@ --Relative line numbers vim.wo.number=true vim.wo.relativenumber= true +vim.g.instant_username = "Afonso" +vim.opt.clipboard= 'unnamedplus' +vim.opt.hlsearch = false +vim.opt.smartindent = true +vim.opt.wrap = false +vim.g.mapleader = " " +--TAB KEYBINDINGS +local map = vim.api.nvim_set_keymap +local opts = { noremap = true, silent = true } + +-- Move to previous/next +map('n', '', 'BufferPrevious', opts) +map('n', '', 'BufferNext', opts) +-- Re-order to previous/next +map('n', '', 'BufferMovePrevious', opts) +map('n', '>', 'BufferMoveNext', opts) +-- Goto buffer in position... +map('n', '', 'BufferGoto 1', opts) +map('n', '', 'BufferGoto 2', opts) +map('n', '', 'BufferGoto 3', opts) +map('n', '', 'BufferGoto 4', opts) +map('n', '', 'BufferGoto 5', opts) +map('n', '', 'BufferGoto 6', opts) +map('n', '', 'BufferGoto 7', opts) +map('n', '', 'BufferGoto 8', opts) +map('n', '', 'BufferGoto 9', opts) +map('n', '', 'BufferLast', opts) +-- Pin/unpin buffer +map('n', '', 'BufferPin', opts) +-- Close buffer +map('n', '', 'BufferClose', opts) +-- Wipeout buffer +-- :BufferWipeout +-- Close commands +-- :BufferCloseAllButCurrent +-- :BufferCloseAllButPinned +-- :BufferCloseAllButCurrentOrPinned +-- :BufferCloseBuffersLeft +-- :BufferCloseBuffersRight +-- Magic buffer-picking mode +map('n', '', 'BufferPick', opts) +-- Sort automatically by... +map('n', 'bb', 'BufferOrderByBufferNumber', opts) +map('n', 'bd', 'BufferOrderByDirectory', opts) +map('n', 'bl', 'BufferOrderByLanguage', opts) +map('n', 'bw', 'BufferOrderByWindowNumber', opts) +--NVimTree + +map('n', '', 'NvimTreeToggle',opts) diff --git a/.config/nvim/lua/plugins/barbar.lua b/.config/nvim/lua/plugins/barbar.lua new file mode 100644 index 0000000..527076d --- /dev/null +++ b/.config/nvim/lua/plugins/barbar.lua @@ -0,0 +1,74 @@ +-- Set barbar's options +require'bufferline'.setup { + -- Enable/disable animations + animation = true, + + -- Enable/disable auto-hiding the tab bar when there is a single buffer + auto_hide = false, + + -- Enable/disable current/total tabpages indicator (top right corner) + tabpages = true, + + -- Enable/disable close button + closable = true, + + -- Enables/disable clickable tabs + -- - left-click: go to buffer + -- - middle-click: delete buffer + clickable = true, + + -- Excludes buffers from the tabline + exclude_ft = {'javascript'}, + exclude_name = {'package.json'}, + + -- Show every buffer + hide = {current = false, inactive = false, visible = false}, + + + -- Enable/disable icons + -- if set to 'numbers', will show buffer index in the tabline + -- if set to 'both', will show buffer index and icons in the tabline + icons = true, + + -- If set, the icon color will follow its corresponding buffer + -- highlight group. By default, the Buffer*Icon group is linked to the + -- Buffer* group (see Highlighting below). Otherwise, it will take its + -- default value as defined by devicons. + icon_custom_colors = false, + + -- Configure icons on the bufferline. + icon_separator_active = '▎', + icon_separator_inactive = '▎', + icon_close_tab = '', + icon_close_tab_modified = '●', + icon_pinned = '車', + + -- If true, new buffers will be inserted at the start/end of the list. + -- Default is to insert after current buffer. + insert_at_end = false, + insert_at_start = false, + + -- Sets the maximum padding width with which to surround each tab + maximum_padding = 1, + + -- Sets the minimum padding width with which to surround each tab + minimum_padding = 1, + + -- Sets the maximum buffer name length. + maximum_length = 30, + + -- If set, the letters for each buffer in buffer-pick mode will be + -- assigned based on their name. Otherwise or in case all letters are + -- already assigned, the behavior is to assign letters in order of + -- usability (see order below) + semantic_letters = true, + + -- New buffer letters are assigned in this order. This order is + -- optimal for the qwerty keyboard layout but might need adjustement + -- for other layouts. + letters = 'asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP', + + -- Sets the name of unnamed buffers. By default format is "[Buffer X]" + -- where X is the buffer number. But only a static string is accepted here. + no_name_title = nil, +} diff --git a/.config/nvim/lua/plugins/packer.lua b/.config/nvim/lua/plugins/packer.lua index 728987b..815c86f 100644 --- a/.config/nvim/lua/plugins/packer.lua +++ b/.config/nvim/lua/plugins/packer.lua @@ -12,76 +12,83 @@ local plugins = packer.startup({function(use) use{ "lervag/vimtex", - config = function () - require "plugins.vimtex" - end - } - + config = function () + require "plugins.vimtex" + end + } + use { "ggandor/leap.nvim", - config = function () - require('leap').add_default_mappings() - end - } - + config = function () + require('leap').add_default_mappings() + end + } + use { "neovim/nvim-lspconfig", - config = function () - require "plugins.lspconfig" - end - } + config = function () + require "plugins.lspconfig" + end + } use { "williamboman/mason.nvim", - config = function () - require "plugins.mason" - end - } + config = function () + require "plugins.mason" + end + } use { "feline-nvim/feline.nvim" } use {"joshdick/onedark.vim" } use {"nvim-tree/nvim-tree.lua", - requires = { - 'nvim-tree/nvim-web-devicons', + requires = { + 'nvim-tree/nvim-web-devicons', }, config = function() require("nvim-tree").setup() end - } + } use {"nvim-treesitter/nvim-treesitter", config = function() require "plugins.treesitter" end - } + } - use {'akinsho/bufferline.nvim', - tag = "v3.*", + use {'romgrk/barbar.nvim', requires = 'kyazdani42/nvim-web-devicons', config = function () - require("bufferline").setup{} + require "plugins.barbar" end } use {"windwp/nvim-autopairs", - config = function() require("nvim-autopairs").setup {} end + config = function() require("nvim-autopairs").setup {} end } use {"neoclide/coc.nvim", config = function() require("plugins.nvim-coc") end } + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.0', + -- or , branch = '0.1.x', + requires = { {'nvim-lua/plenary.nvim'} }, + config = function() require('plugins.telescope') end + } + + use {"jbyuki/instant.nvim"} end, config = { - auto_clean = true, - compile_on_sync = true, - git = { clone_timeout = 6000 }, - display = { - working_sym = "ﲊ", - error_sym = "✗ ", - done_sym = " ", - removed_sym = " ", - moved_sym = "", - }, + auto_clean = true, + compile_on_sync = true, + git = { clone_timeout = 6000 }, + display = { + working_sym = "ﲊ", + error_sym = "✗ ", + done_sym = " ", + removed_sym = " ", + moved_sym = "", + }, } }) diff --git a/.config/nvim/lua/plugins/rust-tools.lua b/.config/nvim/lua/plugins/rust-tools.lua new file mode 100644 index 0000000..bcda183 --- /dev/null +++ b/.config/nvim/lua/plugins/rust-tools.lua @@ -0,0 +1,12 @@ +local rt = require("rust-tools") + +rt.setup({ + server = { + on_attach = function(_, bufnr) + -- Hover actions + vim.keymap.set("n", "", rt.hover_actions.hover_actions, { buffer = bufnr }) + -- Code action groups + vim.keymap.set("n", "a", rt.code_action_group.code_action_group, { buffer = bufnr }) + end, + }, +}) diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..c55f118 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,5 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'ff', builtin.find_files, {}) +vim.keymap.set('n', 'fg', builtin.live_grep, {}) +vim.keymap.set('n', 'fb', builtin.buffers, {}) +vim.keymap.set('n', 'fh', builtin.help_tags, {})