-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.lua
139 lines (108 loc) · 3.03 KB
/
init.lua
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
package.path = package.path .. ";" .. os.getenv("HOME") .. "/.config/nvim/?.lua"
require 'term'
local set = vim.opt
local Plug = vim.fn['plug#']
vim.g.mapleader="\\"
vim.keymap.set('n', '<space>', ':')
set.ruler = true
vim.cmd [[
syntax enable
]]
vim.wo.wrap = false
vim.api.nvim_set_option("clipboard", "unnamedplus")
-- size of a hard tabstop
set.tabstop=2
-- size of an "indent"
set.shiftwidth=2
-- a combination of spaces and tabs are used to simulate tab stops at a width
-- other than the (hard)tabstop
set.softtabstop=2
-- make "tab" insert indents instead of tabs at the beginning of a line
set.smarttab=true
set.filetype="html"
set.smartindent=true
-- always uses spaces instead of tab characters
set.expandtab=true
set.textwidth=0
set.wrapmargin=0
set.number=true
-- terminal
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>")
vim.keymap.set({ 'n', 't' }, "<S-Tab>", ToggleTerminal)
-- disable mouse
vim.opt.mouse = ""
vim.call('plug#begin', '~/.config/nvim/plugged')
Plug 'windwp/nvim-autopairs'
Plug 'othree/yajs.vim'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'mattn/emmet-vim'
Plug 'frazrepo/vim-rainbow'
Plug 'nvim-lua/plenary.nvim'
Plug 'neovim/nvim-lspconfig'
Plug 'pmizio/typescript-tools.nvim'
Plug 'nvimdev/lspsaga.nvim'
Plug 'nvim-lualine/lualine.nvim'
Plug 'nvim-tree/nvim-web-devicons'
Plug 'catppuccin/nvim'
vim.call('plug#end')
-- theme
require("catppuccin").setup {
highlight_overrides = {
macchiato = function(colors)
return {
-- LineNr = { fg = colors.flamingo },
}
end,
},
}
vim.cmd [[colorscheme catppuccin-macchiato]]
-- Autopairs
require("nvim-autopairs").setup {}
-- Lualine
require('lualine').setup {
options = { theme = 'molokai' },
sections = {
lualine_c = {{'filename', path = 1}}
}
}
-- TypeScript
local status, nvim_lsp = pcall(require, "lspconfig")
local protocol = require('vim.lsp.protocol')
local on_attach = function(client, bufnr)
-- format on save
if client.server_capabilities.documentFormattingProvider then
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("Format", { clear = true }),
buffer = bufnr,
callback = function() vim.lsp.buf.formatting_seq_sync() end
})
end
end
nvim_lsp.tsserver.setup {
on_attach = on_attach,
filetypes = { "typescript", "typescriptreact", "typescript.tsx" },
cmd = { "typescript-language-server", "--stdio" }
}
-- Better floats
local _border = "single"
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = _border
}
)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
border = _border
}
)
vim.diagnostic.config{
float={border=_border}
}
-- Diagnostics navigation
vim.api.nvim_create_user_command('Dnext', vim.diagnostic.goto_next, {})
vim.api.nvim_create_user_command('Dprev', vim.diagnostic.goto_prev, {})
vim.api.nvim_create_user_command('Dopen', vim.diagnostic.open_float, {})
-- LspSaga
local lspsaga = require('lspsaga')
lspsaga.setup({lightbulb = { enable = false }})