dotfiles

[ACTIVE] managed with chezmoi
git clone git://git.figbert.com/dotfiles.git
Log | Files | Refs

init.lua.tmpl (3884B)


      1 ----- HELPERS -----
      2 local function map(mode, lhs, rhs, opts)
      3   local options = { noremap = true }
      4   if opts then options = vim.tbl_extend("force", options, opts) end
      5   vim.api.nvim_set_keymap(mode, lhs, rhs, options)
      6 end
      7 
      8 ----- CUSTOMIZE EDITOR -----
      9 vim.opt.number = true
     10 vim.opt.tabstop = 2
     11 vim.opt.softtabstop = 2
     12 vim.opt.shiftwidth = 2
     13 vim.opt.textwidth = 72
     14 vim.opt.autoindent = true
     15 vim.opt.expandtab = true
     16 vim.opt.wrap = true
     17 vim.opt.showmode = true
     18 vim.opt.showcmd = true
     19 vim.opt.hlsearch = true
     20 vim.opt.incsearch = true
     21 vim.opt.termguicolors = true
     22 vim.opt.timeoutlen = 500
     23 vim.opt.guicursor = ""
     24 vim.opt.completeopt = "menuone,noinsert,noselect"
     25 vim.cmd("colorscheme apple")
     26 
     27 ----- VIMWIKI -----
     28 vim.g.vimwiki_list = { { path = "~/sync/wiki/" } }
     29 vim.g.vimwiki_global_ext = 1
     30 
     31 ----- CONTROLS -----
     32 map("", "<Up>", "<Nop>")
     33 map("", "<Down>", "<Nop>")
     34 map("", "<Left>", "<Nop>")
     35 map("", "<Right>", "<Nop>")
     36 map("", "<C-p>", ":Files<cr>")
     37 map("t", "<esc>", "<C-\\><C-N>")
     38 map("n", "glt", ":VimwikiToggleListItem<cr>")
     39 map("", "<C-n>", ":NvimTreeToggle<cr>")
     40 map("", "<leader>r", ":NvimTreeRefresh<cr>")
     41 map("", "<leader>n", ":NvimTreeFindFile<cr>")
     42 map("", "<leader>ff", ":Telescope find_files<cr>")
     43 map("", "<leader>fg", ":Telescope live_grep<cr>")
     44 map("", "<leader>fb", ":Telescope buffers<cr>")
     45 map("", "<leader>fh", ":Telescope help_tags<cr>")
     46 
     47 {{ if eq .chezmoi.os "darwin" -}}
     48 ----- PROVIDERS -----
     49 vim.g.python3_host_prog = "{{ .chezmoi.homeDir }}/.pyenv/versions/py3nvim/bin/python"
     50 {{- end }}
     51 
     52 ----- PLUGINS -----
     53 require "paq" {
     54   "savq/paq-nvim";
     55   "neovim/nvim-lspconfig";
     56   { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" };
     57 
     58   "hrsh7th/cmp-nvim-lsp";
     59   "hrsh7th/cmp-buffer";
     60   "hrsh7th/cmp-path";
     61   "hrsh7th/cmp-cmdline";
     62   "hrsh7th/nvim-cmp";
     63   "dcampos/nvim-snippy";
     64   "dcampos/cmp-snippy";
     65 
     66   "nvim-lua/plenary.nvim";
     67   "nvim-lua/popup.nvim";
     68   "TimUntersberger/neogit";
     69   "vimwiki/vimwiki";
     70   "kyazdani42/nvim-web-devicons";
     71   "kyazdani42/nvim-tree.lua";
     72   "nvim-telescope/telescope.nvim";
     73   "folke/zen-mode.nvim";
     74   "hoob3rt/lualine.nvim";
     75   "folke/which-key.nvim";
     76 
     77   "pirmd/gemini.vim";
     78   "alaviss/nim.nvim";
     79 }
     80 
     81 require("cmp").setup({
     82   snippet = {
     83     expand = function(args)
     84       require'snippy'.expand_snippet(args.body)
     85     end,
     86   },
     87   sources = require("cmp").config.sources({
     88     { name = 'nvim_lsp' },
     89     { name = 'snippy' },
     90   }, {
     91     { name = 'buffer' },
     92   })
     93 })
     94 require("cmp").setup.cmdline("/", {
     95   sources = {
     96     { name = "buffer" }
     97   }
     98 })
     99 require("cmp").setup.cmdline(":", {
    100   sources = require("cmp").config.sources({
    101     { name = "path" }
    102   }, {
    103     { name = "cmdline" }
    104   })
    105 })
    106 
    107 require("zen-mode").setup {
    108   window = {
    109     height = 0.8,
    110     options = {
    111       number = false
    112     }
    113   }
    114 }
    115 require("lualine").setup { options = { theme = "horizon" } }
    116 require("which-key").setup{}
    117 
    118 ----- LANGUAGE SERVERS -----
    119 local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
    120 
    121 local ts = require "nvim-treesitter.configs"
    122 ts.setup { ensure_installed = "all", highlight = { enable = true }}
    123 
    124 require"lspconfig".gdscript.setup{capabilities = capabilities}
    125 require"lspconfig".denols.setup{
    126   capabilities = capabilities,
    127   init_options = {
    128     lint = true,
    129   },
    130 }
    131 require"lspconfig".sourcekit.setup{capabilities = capabilities}
    132 require"lspconfig".html.setup{capabilities = capabilities}
    133 require"lspconfig".cssls.setup{capabilities = capabilities}
    134 require"lspconfig".gopls.setup{capabilities = capabilities}
    135 require"lspconfig".rust_analyzer.setup{capabilities = capabilities}
    136 require"lspconfig".zls.setup{capabilities = capabilities}
    137 require"lspconfig".jedi_language_server.setup{capabilities = capabilities}
    138 require"lspconfig".nimls.setup{capabilities = capabilities}
    139 require'lspconfig'.texlab.setup{capabilities = capabilities}
    140 require'lspconfig'.jdtls.setup{capabilities = capabilities}