Hans Martin 1 rok pred
rodič
commit
f48acdb0bd

+ 2 - 2
.config/nvim/after/plugin/colors.lua

@@ -1,6 +1,6 @@
-function ColorMyPencils(color)
+function MuchoColores(color)
 	color = color or "rose-pine"
 	vim.cmd.colorscheme(color)
 end
 
-ColorMyPencils()
+MuchoColores()

+ 35 - 2
.config/nvim/after/plugin/lsp.lua

@@ -11,17 +11,45 @@ lsp.ensure_installed({
 	'nimls',
 	'bashls',
 	'jsonls',
+    'clangd'
 })
 
 local cmp = require('cmp')
+local luasnip = require('luasnip')
+
 local cmp_select = {behavior = cmp.SelectBehavior.Select}
 local cmp_mappings = lsp.defaults.cmp_mappings({
-	['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
-	['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
+	['K'] = cmp.mapping.select_prev_item(cmp_select),
+	['J'] = cmp.mapping.select_next_item(cmp_select),
 	['<C-y>'] = cmp.mapping.confirm({select =true}),
 	['<C-Space>'] = cmp.mapping.complete(),
+    -- the next two mappings are for usin Tab and S-Tab for 
+    -- navigating inside of snippets
+    ['<Tab>'] =  cmp.mapping(function(fallback)
+      if cmp.visible() then
+        cmp.select_next_item()
+      elseif luasnip.expand_or_jumpable() then
+        luasnip.expand_or_jump()
+      elseif has_words_before() then
+        cmp.complete()
+      else
+        fallback()
+      end
+    end, { "i", "s" }),
+   ["<S-Tab>"] = cmp.mapping(function(fallback)
+      if cmp.visible() then
+        cmp.select_prev_item()
+      elseif luasnip.jumpable(-1) then
+        luasnip.jump(-1)
+      else
+        fallback()
+      end
+    end, { "i", "s" }),
 })
 
+
+
+
 lsp.set_preferences({
 	sign_icons = {}
 })
@@ -37,5 +65,10 @@ lsp.on_attach(function(client, bufnr)
 	vim.keymap.set("n", "<leader>r", function() vim.lsp.buf.rename() end, opts)
 end)
 
+-- Enable the custom keymappings
+lsp.setup_nvim_cmp({
+	mapping = cmp_mappings
+})
+
 lsp.setup()
 

+ 51 - 51
.config/nvim/lua/msc/packer.lua

@@ -1,58 +1,58 @@
--- This file can be loaded by calling `lua require('plugins')` from your init.vim
-
 -- Only required if you have packer configured as `opt`
 vim.cmd [[packadd packer.nvim]]
 
 return require('packer').startup(function(use)
 	--
-  -- Packer can manage itself
-  use 'wbthomason/packer.nvim'
-	
-  use {
-	  'nvim-telescope/telescope.nvim', tag = '0.1.0',
-	  -- or                            , branch = '0.1.x',
-	  requires = { {'nvim-lua/plenary.nvim'} }
-  }
-
-  use({
-	  'rose-pine/neovim',
-	  as = 'rose-pine',
-	  config = function()
-		  vim.cmd('colorscheme rose-pine')
-	  end
-  })
-
-  -- Much better syntax and shit
-  use('nvim-treesitter/nvim-treesitter', {run= ':TSUpdate'})
-
-  use('mbbill/undotree')
-
-  -- Git Bindings
-  use('tpope/vim-fugitive')
-
-  use {
-	  'VonHeikemen/lsp-zero.nvim',
-	  requires = {
-		  -- LSP Support
-		  {'neovim/nvim-lspconfig'},
-		  {'williamboman/mason.nvim'},
-		  {'williamboman/mason-lspconfig.nvim'},
-
-		  -- Autocompletion
-		  {'hrsh7th/nvim-cmp'},
-		  {'hrsh7th/cmp-buffer'},
-		  {'hrsh7th/cmp-path'},
-		  {'saadparwaiz1/cmp_luasnip'},
-		  {'hrsh7th/cmp-nvim-lsp'},
-		  {'hrsh7th/cmp-nvim-lua'},
-
-		  -- Snippets
-		  {'L3MON4D3/LuaSnip'},
-		  {'rafamadriz/friendly-snippets'},
-	  }
-  }
-
-
-  use("alaviss/nim.nvim")
+	-- Packer can manage itself
+	use 'wbthomason/packer.nvim'
+
+	use {
+		'nvim-telescope/telescope.nvim', tag = '0.1.0',
+		-- or                            , branch = '0.1.x',
+		requires = { {'nvim-lua/plenary.nvim'} }
+	}
+
+	use({
+		'rose-pine/neovim',
+		as = 'rose-pine',
+		config = function()
+			vim.cmd('colorscheme rose-pine')
+		end
+	})
+
+	-- Much better syntax and shit
+	use('nvim-treesitter/nvim-treesitter', {run= ':TSUpdate'})
+
+	use('mbbill/undotree')
+
+	-- Git Bindings
+	use('tpope/vim-fugitive')
+
+	use {
+		'VonHeikemen/lsp-zero.nvim',
+		requires = {
+			-- LSP Support
+			{'neovim/nvim-lspconfig'},
+			{'williamboman/mason.nvim'},
+			{'williamboman/mason-lspconfig.nvim'},
+
+			-- Autocompletion
+			{'hrsh7th/nvim-cmp'},
+			{'hrsh7th/cmp-buffer'},
+			{'hrsh7th/cmp-path'},
+			{'saadparwaiz1/cmp_luasnip'},
+			{'hrsh7th/cmp-nvim-lsp'},
+			{'hrsh7th/cmp-nvim-lua'},
+
+			-- Snippets
+			{'L3MON4D3/LuaSnip'},
+			{'rafamadriz/friendly-snippets'},
+		}
+	}
+
+
+	use("alaviss/nim.nvim")
+
+	use("HansMartin/inline-python")
 
 end)

+ 6 - 0
.config/nvim/lua/msc/remap.lua

@@ -1,6 +1,8 @@
 -- map leader to <space>
 vim.g.mapleader = " "
 
+vim.keymap.set("n", "Q", ":EvalPython<CR>")
+
 -- show the vim builtin Explorer
 vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
 
@@ -27,3 +29,7 @@ vim.keymap.set("n","<C-y>", "5<C-y>")
 vim.keymap.set("v", "<", "<gv")
 vim.keymap.set("v", ">", ">gv")
 
+
+-- Buffer next/prev
+vim.keymap.set("n", "<leader>a", ":bp!<CR>")
+vim.keymap.set("n", "<leader>s", ":bn!<CR>")

+ 3 - 0
.config/nvim/lua/msc/set.lua

@@ -1,3 +1,5 @@
+vim.opt.foldenable = false
+
 vim.opt.nu = true
 vim.opt.relativenumber = true
 
@@ -16,6 +18,7 @@ vim.opt.undodir = os.getenv("HOME") .. ".vim/undodir"
 
 vim.opt.hlsearch = false
 vim.opt.incsearch = true
+vim.opt.ignorecase = true
 
 vim.opt.termguicolors = true
 vim.opt.scrolloff = 8

+ 5 - 0
.config/nvim/plugin/packer_compiled.lua

@@ -109,6 +109,11 @@ _G.packer_plugins = {
     path = "/home/msc/.local/share/nvim/site/pack/packer/start/friendly-snippets",
     url = "https://github.com/rafamadriz/friendly-snippets"
   },
+  ["inline-python"] = {
+    loaded = true,
+    path = "/home/msc/.local/share/nvim/site/pack/packer/start/inline-python",
+    url = "https://github.com/HansMartin/inline-python"
+  },
   ["lsp-zero.nvim"] = {
     loaded = true,
     path = "/home/msc/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",