diff options
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 188 |
1 files changed, 188 insertions, 0 deletions
diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..79ac0ff --- /dev/null +++ b/init.lua @@ -0,0 +1,188 @@ +-- https://github.com/nvim-lua/kickstart.nvim +-- https://www.youtube.com/watch?v=stqUbv-5u2s +-- https://www.youtube.com/watch?v=w7i4amO_zaE + +local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim' +local is_bootstrap = false +if vim.fn.empty(vim.fn.glob(install_path)) > 0 then + is_bootstrap = true + vim.fn.system { 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path } + vim.cmd [[packadd packer.nvim]] +end + +------------------------------------------------------------------------- +-- From: https://github.com/nvim-tree/nvim-tree.lua +-- disable netrw at the very start of your init.lua (strongly advised) +-- vim.g.loaded_netrw = 1 +-- vim.g.loaded_netrwPlugin = 1 +------------------------------------------------------------------------- + + +require("mitch") + +vim.cmd [[packadd packer.nvim]] + +-- vim.cmd [[colorscheme nord]] + +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 'shaunsingh/nord.nvim' + + + use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'}) + + use 'nvim-treesitter/playground' + + use 'mbbill/undotree' + + 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 { + 'nvim-tree/nvim-tree.lua', + -- requires = { + -- 'nvim-tree/nvim-web-devicons', -- optional, for file icons + -- }, + -- tag = 'nightly' -- optional, updated every week. (see issue #1193) + } + + use 'mattn/emmet-vim' + + use 'lewis6991/gitsigns.nvim' + + -- replacement for syntastic, seems to work okay out of the box + use 'dense-analysis/ale' + + use { + 'nvim-lualine/lualine.nvim', -- status line + config = function () + end + } + + use 'simrat39/symbols-outline.nvim' + + use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines + +end) + +require('symbols-outline').setup { + symbols = { + File = {icon = "[f]", hl = "TSURI"}, + Module = {icon = "[m]", hl = "TSNamespace"}, + Namespace = {icon = "[n]", hl = "TSNamespace"}, + Package = {icon = "[p]", hl = "TSNamespace"}, + Class = {icon = "->", hl = "TSType"}, + Method = {icon = "->", hl = "TSMethod"}, + Property = {icon = "->", hl = "TSMethod"}, + Field = {icon = "->", hl = "TSField"}, + Constructor = {icon = "[con]", hl = "TSConstructor"}, + Enum = {icon = "[en]", hl = "TSType"}, + Interface = {icon = "[i]", hl = "TSType"}, + Function = {icon = "[func]", hl = "TSFunction"}, + Variable = {icon = "[var]", hl = "TSConstant"}, + Constant = {icon = "[const]", hl = "TSConstant"}, + String = {icon = "[s]", hl = "TSString"}, + Number = {icon = "[num]", hl = "TSNumber"}, + Boolean = {icon = "[bool]", hl = "TSBoolean"}, + Array = {icon = "[arr]", hl = "TSConstant"}, + Object = {icon = "[obj]", hl = "TSType"}, + Key = {icon = "[key]", hl = "TSType"}, + Null = {icon = "NULL", hl = "TSType"}, + EnumMember = {icon = "[enm]", hl = "TSField"}, + Struct = {icon = "[struct]", hl = "TSType"}, + Event = {icon = "[ev]", hl = "TSType"}, + Operator = {icon = "[op]", hl = "TSOperator"}, + TypeParameter = {icon = "[tparm]", hl = "TSParameter"} + } +} + + +require('lualine').setup { + options = { + icons_enabled = false, + component_separators = '|', + section_separators = '', + -- theme = 'nord', + theme = 'nord', + }, +} +require('lualine').setup() + +require('Comment').setup() + + +require('gitsigns').setup { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, +} + + +-- telescope +vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) +vim.keymap.set('n', '<leader>sb', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) +vim.keymap.set('n', '<leader>/', function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) +end, { desc = '[/] Fuzzily search in current buffer]' }) + +vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) +vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) +vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) +vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) +local builtin = require('telescope.builtin') +vim.keymap.set('n', '<C-p>', builtin.find_files, {}) +vim.keymap.set('n', '<C-o>', builtin.git_files, {}) +vim.keymap.set('n', '<leader>ps', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) +end) + + +vim.keymap.set('n', '<leader>so', function() + vim.cmd('SymbolsOutline') +end) + +vim.keymap.set('n', '<C-n>', function() + vim.cmd('NvimTreeToggle') +end) + + |
