From 1c0c481daa689b13c9c79fd725d733d109010ce0 Mon Sep 17 00:00:00 2001 From: Felix Ingram Date: Mon, 22 May 2023 12:39:02 +0100 Subject: [PATCH] add some things --- after/queries/python/injections.scm | 3 + init.lua | 131 +++++++++++++++++++--------- lua/custom/plugins/null-ls.lua | 14 +++ 3 files changed, 109 insertions(+), 39 deletions(-) create mode 100644 after/queries/python/injections.scm create mode 100644 lua/custom/plugins/null-ls.lua diff --git a/after/queries/python/injections.scm b/after/queries/python/injections.scm new file mode 100644 index 00000000..1db7b878 --- /dev/null +++ b/after/queries/python/injections.scm @@ -0,0 +1,3 @@ +; extends +(assignment (identifier) @_id (#any-of? @_id "DEFAULT_CSS" "CSS") +(string (string_content) @css)) diff --git a/init.lua b/init.lua index 1cfa228b..a43374f9 100644 --- a/init.lua +++ b/init.lua @@ -1,18 +1,5 @@ --[[ -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== - -Kickstart.nvim is *not* a distribution. - -Kickstart.nvim is a template for your own configuration. - The goal is that you can read every line of code, top-to-bottom, and understand - what your configuration is doing. - - Once you've done that, you should start exploring, configuring and tinkering to - explore Neovim! - If you don't know anything about Lua, I recommend taking some time to read through a guide. One possible example: - https://learnxinyminutes.com/docs/lua/ @@ -33,15 +20,21 @@ are first encountering a few different constructs in your nvim config. I hope you enjoy your Neovim journey, - TJ -P.S. You can delete this when you're done too. It's your config now :) --]] - -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' +-- Important settings +vim.opt.relativenumber = true +vim.opt.number = true +vim.opt.splitbelow = true +vim.opt.splitright = true +vim.opt.hlsearch = false +vim.opt.incsearch = true + -- Install package manager -- https://github.com/folke/lazy.nvim -- `:help lazy.nvim.txt` for more info @@ -66,16 +59,23 @@ vim.opt.rtp:prepend(lazypath) require('lazy').setup({ -- NOTE: First, some plugins that don't require any configuration + -- Kiss the ring -- Git related plugins 'tpope/vim-fugitive', 'tpope/vim-rhubarb', - -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', + -- Vinegar cos you need it + 'tpope/vim-vinegar', + -- Need unimpaired + 'tpope/vim-unimpaired', + -- Why is this not a default? + 'tpope/vim-surround', -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. - { -- LSP Configuration & Plugins + { + -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs to stdpath for neovim @@ -84,21 +84,23 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', }, }, - { -- Autocompletion + { + -- Autocompletion 'hrsh7th/nvim-cmp', dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, - { -- Adds git releated signs to the gutter, as well as utilities for managing changes + { 'folke/which-key.nvim', opts = {} }, + { + -- Adds git releated signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', opts = { -- See `:help gitsigns.txt` @@ -112,28 +114,43 @@ require('lazy').setup({ }, }, - { -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, + { + -- Theme inspired by Atom + 'navarasu/onedark.nvim' + -- priority = 1000, + -- config = function() + -- vim.cmd.colorscheme 'onedark' + -- end, + }, + { + 'rose-pine/neovim', + name = 'rose-pine', config = function() - vim.cmd.colorscheme 'onedark' + vim.cmd.colorscheme 'rose-pine' end, }, - - { -- Set lualine as statusline + { + 'habamax/vim-habamax' + }, + { + 'owickstrom/vim-colors-paramount', + }, + { + -- Set lualine as statusline 'nvim-lualine/lualine.nvim', -- See `:help lualine.txt` opts = { options = { icons_enabled = false, - theme = 'onedark', + theme = 'rose-pine', component_separators = '|', section_separators = '', }, }, }, - { -- Add indentation guides even on blank lines + { + -- Add indentation guides even on blank lines 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help indent_blankline.txt` @@ -144,7 +161,7 @@ require('lazy').setup({ }, -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, + { 'numToStr/Comment.nvim', opts = {} }, -- Fuzzy Finder (files, lsp, etc) { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } }, @@ -162,18 +179,34 @@ require('lazy').setup({ end, }, - { -- Highlight, edit, and navigate code + { + -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects', }, build = ":TSUpdate", }, + { + -- Highlight, edit, and navigate code + 'nvim-treesitter/playground', + dependencies = { + 'nvim-treesitter/nvim-treesitter', + }, + }, + { + "jay-babu/mason-null-ls.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "williamboman/mason.nvim", + "jose-elias-alvarez/null-ls.nvim", + }, + }, -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', + require 'kickstart.plugins.autoformat', -- require 'kickstart.plugins.debug', -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` @@ -190,11 +223,6 @@ require('lazy').setup({ -- [[ Setting options ]] -- See `:help vim.o` --- Set highlight on search -vim.o.hlsearch = false - --- Make line numbers default -vim.wo.number = true -- Enable mouse mode vim.o.mouse = 'a' @@ -238,6 +266,26 @@ vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +-- from https://github.com/ThePrimeagen/init.lua/blob/master/lua/theprimeagen/remap.lua +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("n", "J", "mzJ`z") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") +-- greatest remap ever +vim.keymap.set("x", "p", [["_dP]]) + +-- next greatest remap ever : asbjornHaland +vim.keymap.set({ "n", "v" }, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) + +vim.keymap.set({ "n", "v" }, "d", [["_d]]) + +vim.keymap.set("n", "Q", "") + -- [[ Highlight on yank ]] -- See `:help vim.highlight.on_yank()` local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) @@ -286,7 +334,7 @@ vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { de -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim', 'html', 'css' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, @@ -483,7 +531,12 @@ cmp.setup { end, { 'i', 's' }), }, sources = { - { name = 'nvim_lsp' }, + { + name = 'nvim_lsp', + entry_filter = function(entry, ctx) + return require('cmp.types').lsp.CompletionItemKind[entry:get_kind()] ~= 'Text' + end + }, { name = 'luasnip' }, }, } diff --git a/lua/custom/plugins/null-ls.lua b/lua/custom/plugins/null-ls.lua new file mode 100644 index 00000000..7d1827d9 --- /dev/null +++ b/lua/custom/plugins/null-ls.lua @@ -0,0 +1,14 @@ +local null_ls = require("null-ls") + +null_ls.setup({ + sources = { + null_ls.builtins.formatting.black, + null_ls.builtins.formatting.isort, + null_ls.builtins.formatting.prettier.with({ + filetypes = { 'css' } }), + null_ls.builtins.diagnostics.eslint, + null_ls.builtins.completion.spell, + }, +}) + +return {}