forked from mgrosser3/nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
173 lines (135 loc) · 5.12 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
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
if vim.g.neovide then
vim.g.neovide_cursor_smooth_blink = true
vim.g.neovide_cursor_trail_size = 0.8
vim.g.neovide_cursor_animation_length = 0.05
vim.g.neovide_cursor_antialiasing = true
end
--
-- Global Editor Variables
--
vim.g.mapleader = " "
vim.g.maplocalleader = " "
--
-- NeoVim Options
-- :help options
--
-- Tabstop Settings
vim.opt.tabstop = 2 -- width of tab character
vim.opt.softtabstop = 2 -- amount of white space to be added
vim.opt.shiftwidth = 2 -- amount of white space to add in normal mode
vim.opt.expandtab = true -- use spaces instead of tabs
-- Indentation Settings
vim.opt.smartindent = true -- autoindenting when starting a new line
vim.opt.wrap = false -- disable line wrapping
-- Search
vim.opt.incsearch = true -- enable incremental search
vim.opt.ignorecase = true -- ignore case in search pattern
vim.opt.smartcase = true -- case sensitive, if search pattern contains upper case characters
vim.opt.hlsearch = true -- disable highlighting
-- Appearance
vim.opt.relativenumber = true -- enable relative line numbers
vim.opt.number = true -- enable line numbers
vim.opt.colorcolumn = "120" -- highlighted line length
vim.opt.signcolumn = "yes" -- draw the signcolumn (default = "auto")
vim.opt.cmdheight = 1 -- number of screen lines to use for the command-line
vim.opt.scrolloff = 10 -- minimal number of screen lines to keep above and below the cursor
vim.opt.completeopt = "menuone,noinsert,noselect"
vim.opt.showtabline = 0 -- never show tabline
vim.opt.pumheight = 10 -- limit completion items
vim.opt.cursorline = true -- highlight the current line
-- Behaviour
vim.opt.errorbells = false -- switch off noise in case of errors
vim.opt.swapfile = false -- disable swapfiles for buffers
vim.opt.backup = false -- disable backup file
vim.opt.undofile = true -- enable undo files
vim.opt.undodir = vim.fn.expand("~/.nvim/undo")
vim.opt.backspace = "indent,eol,start"
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.autochdir = true -- don't change the working directory automatically
vim.opt.iskeyword:append("-")
vim.opt.mouse:append("a") -- enable mouse support for all modes
vim.opt.clipboard = "unnamedplus"
vim.opt.modifiable = true -- buffers per default modifiable
vim.opt.encoding = "UTF-8"
-- -- Spell Check
-- vim.opt.spelllang = 'en_us'
-- vim.opt.spell = true
--
-- NeoVim Keymappings
--
-- Open file browser netrw
-- vim.keymap.set("n", "<leader>e", vim.cmd.Ex)
-- Move highlighted parts
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") -- move up
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") -- move down
-- Remaps
vim.keymap.set("i", "<C-c>", "<ESC>")
vim.keymap.set("i", "<C-BS>", "<C-W>")
vim.keymap.set("n", "<C-1>", "<C-w>o")
vim.keymap.set("n", "<C-2>", "<C-w>v")
vim.keymap.set("n", "<M-C-2>", "<C-w>v<C-w><C-w>")
vim.keymap.set("n", "<C-3>", "<C-w>s")
vim.keymap.set("n", "<C-.>", "<cmd>lua vim.lsp.buf.code_action()<CR>")
vim.keymap.set("v", "<C-.>", "<cmd>CodeActionMenu<CR>")
vim.keymap.set("n", "<M-C-9>", "<cmd>Telescope git_status theme=ivy<CR>")
vim.keymap.set("n", "<C-0>", "<cmd>Telescope projects<CR>")
vim.keymap.set("n", "<C-f>", "/")
vim.keymap.set("n", "<A-j>", "}")
vim.keymap.set("n", "<A-k>", "{")
vim.keymap.set("v", "<A-j>", "}")
vim.keymap.set("v", "<A-k>", "{")
vim.keymap.set("n", "<C-j>", "<cmd>lua vim.diagnostic.goto_next({ float = true })<CR>")
vim.keymap.set("n", "<C-k>", "<cmd>lua vim.diagnostic.goto_prev({ float = true })<CR>")
vim.keymap.set("n", "<M-NL>", ":cnext<CR>")
vim.keymap.set("n", "<M-C-K>", ":cprev<CR>")
vim.keymap.set("n", "<M-C-O>", "g;")
vim.keymap.set("n", "<M-Tab>", "g,")
vim.keymap.set("n", "<A-S-j>", "<cmd>lua require 'gitsigns'.next_hunk()<cr>")
vim.keymap.set("n", "<A-S-k>", "<cmd>lua require 'gitsigns'.prev_hunk()<cr>")
vim.keymap.set("n", "<A-S-o>", "<cmd>TSToolsOrganizeImports<CR>")
vim.keymap.set("n", "ø", "<cmd>TSToolsOrganizeImports<CR>")
vim.keymap.set("n", "ª", "<cmd>TSToolsFixAll<CR>")
vim.keymap.set("n", "↓", "<cmd>TSToolsRemoveUnused<CR>")
vim.keymap.set("n", "<A-S-i>", "<cmd>TSToolsAddMissingImports<CR>")
vim.keymap.set("n", "<A-S-r>", "<cmd>TSToolsRemoveUnused<CR>")
vim.keymap.set("i", "<C-s>", "<ESC>")
vim.keymap.set("n", "<C-s>", ":wall<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<C-tab>", ":e#<CR>")
vim.keymap.set("i", "<C-Enter>", "<C-o>O")
vim.keymap.set("n", "<A-u>", "<cmd>noh<cr>")
vim.diagnostic.config({
virtual_text = false,
})
--
-- Windows specific configuration
--
if vim.loop.os_uname().sysname == "Windows" then
pcall(require, "windows")
end
--
-- GUI specific configuration
--
require("gui")
--
-- Package Manager lazy.vim
-- https://github.com/folke/lazy.nvim
--
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{ import = "plugins" },
})
-- idealer Weg: Expressions udn Gültigkeiten topologisch sortiert und dann in
-- einem Durchlauf auswerten
--