summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/settings.lua
blob: eaa5617b3adb5ae7ae82618490174e8b46f3a230 (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
bo.expandtab = false
bo.shiftwidth = 8
bo.softtabstop = 8

o.completeopt = 'longest,menuone'
o.shell = '/bin/sh'
o.encoding = 'utf-8'
o.scrolloff = 3
o.lazyredraw = true
o.autochdir = false
o.smarttab = true
o.number = true
o.list = true
o.mouse = ''
o.backspace = 'indent,eol,start'


o.swapfile = false

-- o.foldmethod = 'expr'
-- o.foldexpr = 'nvim_treesitter#foldexpr()'

local format = function(diagnostic)
  if diagnostic.severity == vim.diagnostic.severity.ERROR then
    -- return string.format("E: %s", diagnostic.message)
    return diagnostic.message .. diagnostic.source
  end
  return diagnostic.message
end

cmd 'syntax enable'
cmd 'filetype on'
cmd 'filetype plugin on'
cmd 'filetype indent on'
cmd 'colorscheme colorscheme'

vim.cmd([[
  au BufNewFile,BufRead *.j2*,*.jinja* setlocal filetype=django

  au BufNewFile,BufRead */.config/neomutt/*
    \ if &filetype == "" |
    \ setlocal filetype=neomuttrc |
    \ endif
]])

vim.filetype.add({
  pattern = {
    ['.*playbooks/.*%.yml'] = 'yaml.ansible',
    ['.*roles/.*/tasks/.*%.yml'] = 'yaml.ansible',
    ['.*roles/.*/defaults/.*%.yml'] = 'yaml.ansible',
    ['.*roles/.*/vars/.*%.yml'] = 'yaml.ansible',
    ['.*roles/.*/meta/.*%.yml'] = 'yaml.ansible',
    ['.*roles/.*/templates/.*%.yml'] = 'yaml.ansible',
    ['.*%.Dockerfile'] = 'dockerfile',
    ['Dockerfile%..*'] = 'dockerfile',
    ['.*%.env.*'] = 'sh',
    ['.*/task/config'] = 'taskrc',
    ['%.ansible%-lint'] = 'yaml',
    ['%.yamllint'] = 'yaml',
  }
})

--[[
require'nvim-treesitter.configs'.setup {
  textobjects = {
    lsp_interop = {
      enable = true,
      border = 'none',
      peek_definition_code = {
        ["<space>k"] = "@function.outer",
        ["<space>K"] = "@class.outer",
      },
    },
  },
}
]]--
remember that computers suck.