Repository navigation
Expand file tree
/
Copy pathinit.lua
More file actions
99 lines (82 loc) · 2.45 KB
/
Copy pathinit.lua
File metadata and controls
99 lines (82 loc) · 2.45 KB
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
vim.pack.add {
'https://github.com/nvim-treesitter/nvim-treesitter',
'https://github.com/neovim/nvim-lspconfig',
'https://github.com/wakatime/vim-wakatime',
'https://github.com/stevearc/oil.nvim',
'https://github.com/sphamba/smear-cursor.nvim',
'https://github.com/claridelune/lune.nvim',
}
vim.g.mapleader = ' '
vim.cmd.packadd('nvim.difftool')
vim.cmd.packadd('nvim.undotree')
vim.cmd.packadd('cfilter')
vim.o.number = true
vim.o.relativenumber = true
vim.o.confirm = true
vim.o.ignorecase = true
vim.opt.wildoptions:append { 'fuzzy' }
vim.opt.path:append { '**' }
vim.o.completeopt = "menu,menuone,fuzzy,noinsert"
vim.o.swapfile = false
vim.o.linebreak = true
vim.o.termguicolors = true
vim.o.smoothscroll = true
vim.o.grepprg = 'rg --vimgrep --no-messages --smart-case'
vim.o.statusline = '[%n] %<%f %h%w%m%r%=%-14.(%l,%c%V%) %P'
vim.o.colorcolumn = '80'
vim.o.textwidth = 80
vim.o.tabstop = 2
vim.o.shiftwidth = 2
vim.o.background = "dark"
vim.cmd.colorscheme('default')
vim.cmd('syntax off')
require('oil').setup({
skip_confim_for_simple_edits = true,
})
require('smear_cursor').setup({
stiffness = 1.0,
trailing_stiffness = 0.5,
distance_stop_animating = 0.5,
})
-- keymaps
vim.keymap.set('n', '<leader>cf', ':Cfilter /\\c/')
vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
-- Copy to OS clipboard.
vim.keymap.set('n', '<Leader>y', '"+y')
vim.keymap.set('v', '<Leader>y', '"+y')
vim.keymap.set('n', '<Leader>yy', '"+yy')
-- Copy all to OS clipboard
vim.keymap.set('n', '<Leader>+y', ':%y+<CR>')
-- Paste from OS clipboard
vim.keymap.set('n', '<Leader>p', '"+p')
vim.keymap.set('n', '<Leader>P', '"+P')
vim.keymap.set('v', '<Leader>p', '"+p')
vim.keymap.set('v', '<Leader>P', '"+P"`"`"')
-- Avoid accidental quit
vim.keymap.set('c', 'q', 'close', {noremap = true})
-- Highliting
vim.filetype.add({
extension = {
Rmd = "rmd",
qmd = "qmd"
}
})
vim.treesitter.language.register("markdown", "rmd")
vim.treesitter.language.register("markdown", "qmd")
vim.api.nvim_create_autocmd('FileType', {
callback = function()
pcall(vim.treesitter.start)
end,
})
-- LSP
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
vim.wo.signcolumn = 'yes:1'
if client:supports_method('textDocument/completion') then
vim.o.complete = 'o,.,w,b,u'
vim.o.completeopt = 'menu,menuone,popup,noinsert'
vim.lsp.completion.enable(true, client.id, args.buf)
end
end
})