aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/init.lua
blob: 133d737b29a90507a644b0add579bc19a0db5076 (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
--
-- ~~~ neovim config
--

-- set up map leader
vim.g.mapleader = "\\"

--
-- ~~~ lazy.nvim

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"

-- load lazy.nvim
if not (vim.uv or vim.loop).fs_stat(lazypath) then

    -- clone repo
    local lazyrepo = "https://github.com/folke/lazy.nvim.git"
    local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })

end

-- load lazy.nvim
vim.opt.rtp:prepend(lazypath)

-- setup lazy.nvim
require("lazy").setup({

    -- plugins
    spec = {

        -- tree sitter
        {
            "nvim-treesitter/nvim-treesitter",
            branch = "master",
            lazy = false,
            build = ":TSUpdate"
        },

        -- vimwiki
        {
            "vimwiki/vimwiki",
            init = function()
                vim.g.vimwiki_list = {
                    {
                        path = "~/nexus",
                        syntax = "markdown",
                        ext = ".md"
                    }
                }
            end
        },

        -- lualine
        {
            "nvim-lualine/lualine.nvim",
            dependencies = {
                "nvim-tree/nvim-web-devicons"
            }
        },

        -- indent guides
        {
            "lukas-reineke/indent-blankline.nvim",
            main = "ibl",
        },

        -- fleet theme
        {
            "razcoen/fleet.nvim",
            priority = 1000
        },
    },

    -- installer options
    install = {

        -- set theme
        colorscheme = { "fleet" }
    }
})

--
-- ~~~ language options

-- use 4-spaces as tabs
vim.api.nvim_create_autocmd("FileType", {
    pattern = { "*" },
    callback = function()
        vim.o.shiftwidth = 4
        vim.o.tabstop = 4
        vim.o.softtabstop = 4
        vim.o.expandtab = true
    end
})

-- use system clipboard
vim.opt.clipboard:append("unnamedplus")

-- don't auto-add comments
vim.api.nvim_create_autocmd("FileType", {
    pattern = { "*" },
    callback = function()
        vim.opt.formatoptions = ""
    end
})

-- setup tree sitter
require("nvim-treesitter.configs").setup({

    -- ensure Nu is installed
    ensure_installed = { "nu" },

    -- enable syntax highlighting
    highlight = { enabled = true }
})

-- enable tree sitter for Nu
vim.api.nvim_create_autocmd("FileType", {
    pattern = { "nu" },
    callback = function()
        vim.treesitter.start()
    end
})

--
-- ~~~ keybindings

-- tabs
vim.keymap.set("n", "<Leader>tn", "<cmd>tabnew<cr>")
vim.keymap.set("n", "<Leader>tw", "<cmd>tabclose<cr>")
vim.keymap.set("n", "<Leader>tt", "<cmd>tabnext<cr>")
vim.keymap.set("n", "<Leader>tT", "<cmd>tabprev<cr>")

--
-- ~~~ theming

-- set theme
require("fleet").setup({ transparent_mode = true })
vim.cmd.colorscheme "fleet"

vim.opt.termguicolors = true

-- setup lualine
require("lualine").setup()

-- enable line numbers
vim.opt.number = true
vim.opt.cursorline = true

-- hide current mode
vim.opt.showmode = false

-- conceal information
vim.opt.concealcursor = "n"
vim.opt.conceallevel = 2

-- setup indent guides
require("ibl").setup()