aboutsummaryrefslogtreecommitdiff
path: root/nvim/plugins.vim
blob: cc0136b6bb480cee79c31032c7404fe4af5c1382 (plain)
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
" automatische Installation von vim-plug
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
  silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
endif

" vim-plug
call plug#begin()
  Plug 'mattn/emmet-vim'
  Plug 'preservim/nerdtree'
  Plug 'Xuyuanp/nerdtree-git-plugin'
  Plug 'preservim/tagbar'
  Plug 'romainl/vim-cool'
  Plug 'simnalamburt/vim-mundo'
  Plug 'tpope/vim-repeat'
  Plug 'tpope/vim-surround'
  Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
  Plug 'neovim/nvim-lspconfig'
  Plug 'windwp/nvim-autopairs'
  Plug 'windwp/nvim-ts-autotag'

  Plug 'hrsh7th/nvim-cmp'
  Plug 'L3MON4D3/LuaSnip'
  Plug 'saadparwaiz1/cmp_luasnip'
  Plug 'rafamadriz/friendly-snippets'

  Plug 'hrsh7th/cmp-nvim-lsp'
  Plug 'hrsh7th/cmp-buffer'
  " Plug 'hrsh7th/cmp-path'
  " Plug 'hrsh7th/cmp-cmdline'

  Plug 'lewis6991/gitsigns.nvim'
call plug#end()

" EMMET
let g:user_emmet_install_global=0
let g:user_emmet_leader_key='<C-y>'

" NERDTree
let NERDTreeMinimalUI=1
let NERDTreeShowHidden=0

" NERDTree GIT Plugin
let g:NERDTreeGitStatusUntrackedFilesMode='all'
let g:NERDTreeGitStatusShowClean=1
let g:NERDTreeGitStatusConcealBrackets=1
let g:NERDTreeDirArrowExpandable='+'
let g:NERDTreeDirArrowCollapsible='-'

let g:WebDevIconsUnicodeDecorateFolderNodes=1
let g:DevIconsEnableFoldersOpenClose=1
let g:WebDevIconsNerdTreeBeforeGlyphPadding=''

" Tagbar
let g:tagbar_ctags_bin='/usr/local/bin/uctags'

" Vimundo
let g:mundo_right=1
let g:mundo_width=40
let g:mundo_preview_height=30

" Autopairs
" let b:autopairs_enabled=1
" let g:AutoPairsMapBS=1
" let g:AutoPairsPrefix='<M-P>'

" Treesitter
lua << EOF
require('nvim-treesitter.configs').setup {
  ensure_installed = { "c", "cpp", "lua", "vim", "vimdoc", "typescript", "python" },
  sync_install = false,
  auto_install = false,
  highlight = {
    enable = true,
    disable = { "html" },
    additional_vim_regex_highlighting = true,
  },
  indent = {
    enable = false,
  },
  autotag = {
    enable = true,
  }
}
EOF

lua << EOF
require('nvim-autopairs').setup {}
require('nvim-ts-autotag').setup {}
EOF

" LSP
lua << EOF
local capabilities = require('cmp_nvim_lsp').default_capabilities()

local lspconfig = require('lspconfig')

lspconfig.clangd.setup{
  cmd = { 'clangd15' },
  capabilities = capabilities
}

lspconfig.lua_ls.setup {
  settings = {
    Lua = {
      runtime = {
        -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
        version = 'LuaJIT',
      },
      diagnostics = {
        -- Get the language server to recognize the `vim` global
        globals = {'vim'},
      },
      workspace = {
        -- Make the server aware of Neovim runtime files
        library = vim.api.nvim_get_runtime_file("", true),
      },
      -- Do not send telemetry data containing a randomized but unique identifier
      telemetry = {
        enable = false,
      },
    },
  },
  capabilities = capabilities
}

lspconfig.html.setup{
  capabilities = capabilities
}

lspconfig.tsserver.setup{
  capabilities = capabilities
}

lspconfig.vimls.setup{
  capabilities = capabilities
}
EOF

lua << EOF
require('gitsigns').setup()
EOF

lua << EOF
require("luasnip.loaders.from_vscode").lazy_load()

local cmp = require('cmp')

cmp.setup({
  snippet = {
    expand = function(args)
      require('luasnip').lsp_expand(args.body)
    end,
  },
  window = {
    completion = cmp.config.window.bordered(),
    documentation = cmp.config.window.bordered(),
  },
  mapping = cmp.mapping.preset.insert({
    ['<C-b>'] = cmp.mapping.scroll_docs(-4),
    ['<C-f>'] = cmp.mapping.scroll_docs(4),
    ['<C-Space>'] = cmp.mapping.complete(),
    ['<C-e>'] = cmp.mapping.abort(),
    ['<CR>'] = cmp.mapping.confirm({ select = true }),
  }),
  sources = cmp.config.sources({
    { name = 'nvim_lsp' },
    { name = 'luasnip' },
  }, {
    { name = 'buffer' },
  })
})
EOF