]> git.armaanb.net Git - dotfiles.git/blobdiff - .config/nvim/init.lua
filetype.nvim tmp
[dotfiles.git] / .config / nvim / init.lua
index bcf75366046b223ccb9325dabc2725f3f055d2fe..ba9dbf4d5652a97eddf0861ed804511d5c63fce6 100644 (file)
@@ -6,9 +6,7 @@ vim.opt.mouse = 'a'
 vim.opt.undofile = true
 vim.opt.textwidth = 80
 map('', 'Q', '<nop>', opts)
-
--- Polyglot
-vim.g.polyglot_disabled = {'sensible'}
+vim.g.mapleader = ' '
 
 -- Plugins
 local install_path = vim.fn.stdpath('data') .. '/site/pack/paqs/start/paq-nvim'
@@ -18,16 +16,26 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
                'https://github.com/savq/paq-nvim.git', install_path})
 end
 
+require('impatient')
+
 require('paq') {
-       'ap/vim-css-color';               -- Highlight css colors
-       'ctrlpvim/ctrlp.vim';             -- Fuzzy file finding
+       'dstein64/vim-startuptime';       -- Profile startup time
        'editorconfig/editorconfig-vim';  -- Follow editorconfig
+       'folke/lsp-colors.nvim';          -- Add LSP colors to any theme
        'godlygeek/tabular';              -- Line things up
+       'junegunn/fzf';                   -- Fuzzy file finding
+       'junegunn/fzf.vim';               -- Fuzzy file finding
+       'lewis6991/impatient.nvim';       -- Improve startup time
        'lifepillar/vim-mucomplete';      -- Simple autocompletion
        'meain/hima-vim';                 -- Nice color scheme
+       'nathom/filetype.nvim';           -- Faster filetype.vim replacement
        'neovim/nvim-lspconfig';          -- LSP configurations
+       'norcalli/nvim-colorizer.lua';    -- Highlight css colors
+       'norcalli/nvim_utils';            -- Lua conveniences
        'ntpeters/vim-better-whitespace'; -- Highlight and strip whitespace
-       'sheerun/vim-polyglot';           -- Language pack
+       'nvim-treesitter/nvim-treesitter';-- Parsing
+       'romgrk/nvim-treesitter-context'; -- Shows context for where you are
+       'savq/paq-nvim';                  -- paq manages itself
        'tpope/vim-commentary';           -- Easily comment
        'tpope/vim-rsi';                  -- Readline bindings
        'tpope/vim-sensible';             -- Sensible defaults
@@ -35,6 +43,8 @@ require('paq') {
        'tpope/vim-surround';             -- Easily modify surrounding chars
 }
 
+require('nvim_utils')
+
 -- Colorscheme
 vim.opt.termguicolors = true
 vim.g.colors_name = 'hima'
@@ -48,6 +58,14 @@ map('n', '<C-l>', '<C-w><C-l>', opts)
 -- Clear search highlighting
 map('n', '<C-c>', ':noh<CR>', opts)
 
+-- FZF
+map('n', '<leader>ff', ':Files<CR>', opts)
+-- TODO: Sharp corners... I can't figure this out
+
+-- Disable keyword completion
+map('i', '<C-n>', '<Down>', opts)
+map('i', '<C-p>', '<Up>', opts)
+
 -- Completion
 vim.opt.completeopt = vim.opt.completeopt + 'menuone'
 vim.opt.completeopt = vim.opt.completeopt - 'preview'
@@ -75,12 +93,14 @@ local on_attach = function(client, bufnr)
                '<cmd>lua vim.lsp.buf.references()<CR>', opts)
        buf_set_keymap('n', 'K',
                '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
-       buf_set_keymap('n', '<space>rn',
+       buf_set_keymap('n', '<leader>rn',
                '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
        buf_set_keymap('n', '[d',
                '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
        buf_set_keymap('n', ']d',
                '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
+       buf_set_keymap('n', '<leader>e',
+               '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
 end
 
 -- Add servers
@@ -97,3 +117,47 @@ vim.opt.signcolumn = 'no'
 -- Jump to files with gf
 vim.opt.hidden = true
 vim.opt.path = vim.opt.path + '**'
+
+-- Disable intro message
+vim.opt.shortmess = "I"
+
+-- Treesitter
+require('nvim-treesitter.configs').setup {
+       ensure_installed = "maintained",
+       highlight = {
+               enable = true,
+               additional_vim_regex_highlighting = false,
+       },
+       incremental_selection = {
+               enable = true,
+               keymaps = {
+                       init_selection = "gnn",
+                       node_incremental = "grn",
+                       scope_incremental = "grc",
+                       node_decremental = "grm",
+               },
+       },
+       indent = {
+               enable = true
+       }
+}
+
+-- Folds
+vim.opt.foldmethod = 'expr'
+vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
+vim.opt.foldenable = false
+map('n', '<leader>fe', ':set foldenable<CR>', opts)
+map('n', '<leader>fd', ':set nofoldenable<CR>', opts)
+
+-- Autocommands
+local autocommands = {
+       highlight_yank = {
+               {'TextYankPost', '*',
+                       'lua vim.highlight.on_yank{on_visual=false}'};
+       };
+}
+
+nvim_create_augroups(autocommands)
+
+-- Do not source the default filetype.vim (uses nathom/filetype.nvim instead)
+vim.g.did_load_filetypes = 1