aboutsummaryrefslogtreecommitdiff
path: root/Common/nvim/lua/plugins.lua
blob: 6b8cbbf2f4b63b9b0e77c4fbd78255880586c4d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
-- Autoinstall packer
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
  packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
end

-- Autocompile packer
vim.cmd([[
  augroup packer_user_config
    autocmd!
    autocmd BufWritePost plugins.lua source <afile> | PackerCompile
  augroup end
]])

return require('packer').startup(function(use)
  -- Packer itself :)
  use 'wbthomason/packer.nvim'
  -- targets (extends vim's targets, allowing things like multiline select inside backticks)
  use 'wellle/targets.vim';

  -- GitSigns
  use {
    'lewis6991/gitsigns.nvim',
    config = function()
      require('gitsigns').setup()
      map("n", "<leader>s", ":Gitsigns toggle_current_line_blame<cr>", silentnoremap)
    end,
  }

  -- Lualine (Pretty statusbar and titlebar)
  use {
    'nvim-lualine/lualine.nvim',
    requires = { 'kyazdani42/nvim-web-devicons', opt = true },
    config = function()
      require('lualine').setup {
        options = {
          theme = 'Tomorrow',
          component_separators = '',
          section_separators = ''
        },
        sections = {
          lualine_a = {'mode'},
          lualine_x = {'filetype'},
          lualine_y = {}
        },
        -- tabline = {
        --   lualine_z = {'tabs'}
        -- }
      }
    end,
  }

  -- nvim-tree
  use {
    'kyazdani42/nvim-tree.lua',
    requires = { 'kyazdani42/nvim-web-devicons' },
    tag = 'nightly', -- optional, updated every week. (see issue #1193)
    config = function()
        require("nvim-tree").setup()
        map("n", "<F3>", ":NvimTreeToggle<cr>", silentnoremap)
    end,
  }

  -- TagBar
  use {
    'preservim/tagbar',
    config = function()
      map("n", "<F2>", ":TagbarToggle<cr>", silentnoremap)
    end,
  }

  -- Vim tmux navigator
  use 'christoomey/vim-tmux-navigator'

  -- fzf (Fuzzy finder for various things)
  use {
      'junegunn/fzf.vim',
      requires = { 'kyazdani42/nvim-web-devicons' },
      config = function()
        vim.cmd [[
        let g:fzf_layout = { 'down': '40%' }
        ]]
        map("n", ";", ":Files<cr>", silentnoremap)
        map("n", "<leader>;", ":Rg<cr>", silentnoremap)
        map("n", "<leader><leader>;", ":BLines<cr>", silentnoremap)
      end,
  }

  -- Tpope plugins :)
  -- vim-dadbob (run sql directly)
  use {
      'tpope/vim-dadbod',
      config = function()
        vim.cmd [[
        xnoremap <expr> <Plug>(DBExe)     db#op_exec()
        nnoremap <expr> <Plug>(DBExe)     db#op_exec()
        nnoremap <expr> <Plug>(DBExeLine) db#op_exec() . '_'

        xmap <leader>db  <Plug>(DBExe)
        nmap <leader>db  <Plug>(DBExe)
        omap <leader>db  <Plug>(DBExe)
        nmap <leader>dbb <Plug>(DBExeLine)

        autocmd FileType dbout setlocal nofoldenable

        if !empty(glob("~/.env.vim"))
            source ~/.env.vim
        endif
        ]]
      end,
  }
  -- vim-fugitive (Git commands)
  use { 'tpope/vim-fugitive' }
  -- Surround
  use { 'tpope/vim-surround' }

  -- Tree-sitter-mysql
  -- use { 'PatrickFeiring/tree-sitter-sql' }

  -- terryma/vim-multiple-cursors
  -- preservim/nerdcommenter

  -- Lsp things
  use {
    'williamboman/mason.nvim',
    'williamboman/mason-lspconfig.nvim',
    'neovim/nvim-lspconfig' ,
  }
  -- Language-specifics
  use 'simrat39/rust-tools.nvim'
  --use 'mfussenegger/nvim-jdtls'

  -- Completion framework:
  use 'hrsh7th/nvim-cmp'
  -- LSP completion source:
  use 'hrsh7th/cmp-nvim-lsp'
  -- Useful completion sources:
  use 'hrsh7th/cmp-nvim-lua'
  use 'hrsh7th/cmp-nvim-lsp-signature-help'
  use 'hrsh7th/cmp-vsnip'
  use 'hrsh7th/cmp-path'
  use 'hrsh7th/vim-vsnip'


  -- Goyo :)
  use {
      'junegunn/goyo.vim'
  }
  use { 'smithbm2316/centerpad.nvim' }

  -- Color preview
  use {
    'lilydjwg/colorizer',
    config = function()
    end,
  }

  -- Ledger
  use {
      'ledger/vim-ledger'
  }

  -- VimWiki stuff
  use {
      'vimwiki/vimwiki',
      config = function ()
          vim.g.vimwiki_list = {
            {
                path = '~/Nextcloud/2-Områder/204-profesjonelt/204.06-Infomedia/204.06.AA-wiki',
                syntax = 'markdown',
                ext = 'md',
                name = 'I45',
                auto_toc = 1,
                diary_frequency = 'daily',
                nested_syntaxes = {
                  python = 'python',
                  sql = 'sql',
                },
            },
            {
                path = '~/Nextcloud/wiki/M42',
                syntax = 'markdown',
                ext = 'md',
                name = 'M42',
                auto_toc = 1,
                nested_syntaxes = {
                  python = 'python',
                  sql = 'sql',
                },
            },
            {
                path = '~/Nextcloud/wiki/P01/',
                syntax = 'markdown',
                ext = 'md',
                name = 'P01',
                --nested_syntaxes = {
                --  python = 'python',
                --},
            },
          }
          vim.g.vimwiki_global_ext = 0
          vim.g.vimwiki_auto_header = 1
          vim.g.vimwiki_links_space_char = '_'
          vim.g.vimwiki_url_maxsave = 0
      end,
  }
  use {
      'mattn/calendar-vim',
      config = function()
        vim.g.calendar_monday = 1
        vim.g.calendar_weeknm = 5
        vim.api.nvim_create_autocmd("QuitPre", {
          callback = function()
          local invalid_win = {}
          local wins = vim.api.nvim_list_wins()
          for _, w in ipairs(wins) do
            local bufname = vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(w))
            if bufname:match("__Calendar") ~= nil then
              table.insert(invalid_win, w)
            end
          end
          if #invalid_win == #wins - 1 then
            for _, w in ipairs(invalid_win) do vim.api.nvim_win_close(w, true) end
          end
        end
        })
     end
  }

  -- packer.nvim
  use 'evanleck/vim-svelte'
  use 'pangloss/vim-javascript'

  -- Automatically set up your configuration after cloning packer.nvim
  -- Put this at the end after all plugins
  if packer_bootstrap then
    require('packer').sync()
  end
end)