118 lines
3.1 KiB
Lua
118 lines
3.1 KiB
Lua
---- Aliases ----
|
|
local cmd = vim.cmd
|
|
local g = vim.g
|
|
local opt = vim.opt
|
|
local o = vim.o
|
|
|
|
---- General Config ----
|
|
opt.mouse = 'a'
|
|
opt.tabstop = 4
|
|
opt.shiftwidth = 4
|
|
opt.number = true
|
|
opt.breakindent = true
|
|
--vim.o.inccomand = 'nosplit'
|
|
opt.showmatch = true
|
|
opt.ignorecase = true
|
|
opt.smartcase = true
|
|
opt.joinspaces = false
|
|
opt.showmode = false
|
|
opt.hidden = true
|
|
opt.backup = false
|
|
opt.writebackup = false
|
|
opt.swapfile = false
|
|
opt.shortmess:append({ I = true })
|
|
-- whichwrap -- left/right keys can traverse up/down
|
|
--opt.whichwrap = {'<','>','[',']'}
|
|
opt.cmdheight = 2
|
|
opt.showcmd = true
|
|
opt.showcmd = true
|
|
g.mapleader = ' '
|
|
|
|
---- Terminal ----
|
|
cmd 'autocmd TermOpen * setlocal nonumber'
|
|
|
|
---- Theming ----
|
|
opt.termguicolors = true
|
|
opt.background = 'dark'
|
|
g.gruvbox_italic = true
|
|
cmd 'colorscheme gruvbox'
|
|
opt.listchars = {
|
|
eol = '↲' ,
|
|
tab = '▶▹',
|
|
nbsp = '␣',
|
|
extends = '…',
|
|
trail = '•'}
|
|
-- vim-airline config ---
|
|
g.airline_powerline_fonts = true
|
|
g.airline_theme = 'powerlineish'
|
|
g['airline#extensions#tabline#enabled'] = 1
|
|
g['airline#extensions#tabline#left_sep'] = ' '
|
|
g['airline#extensions#tabline#left_alt_sep'] = '|'
|
|
|
|
---- Maps ----
|
|
local function map(mode, lhs, rhs, opts)
|
|
local options = {noremap = true, silent = true}
|
|
if opts then options = vim.tbl_extend('force', options, opts) end
|
|
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
|
end
|
|
map('!','<C-BS>','<C-w>')
|
|
map('v','>','>gv')
|
|
map('v','<','<gv')
|
|
map('n','<C-L>',':nohlsearch<CR>')
|
|
|
|
---- Treesitter ----
|
|
local ts = require 'nvim-treesitter.configs'
|
|
ts.setup {ensure_installed = 'maintained', highlight = {enable = true, indent = true}}
|
|
|
|
---- LSP ----
|
|
local lsp = require 'lspconfig'
|
|
|
|
---- Plugins ----
|
|
---- ale
|
|
g.ale_linters = {
|
|
bash = {'shellcheck'},
|
|
c = {},
|
|
cpp = {},
|
|
css = {'stylelint'},
|
|
html = {'tidy'},
|
|
javascript = {'eslint'},
|
|
python = {'flake8'},
|
|
tex = {'texlab'},
|
|
vim = {'vint'},
|
|
zsh = {'shell', 'shellcheck'},
|
|
}
|
|
g.ale_sign_error = '✘'
|
|
g.ale_sign_warning = '▲'
|
|
g.ale_set_highlights = 1
|
|
map('n', '[W', '<Plug>(ale_first)')
|
|
map('n', '[w', '<Plug>(ale_previous_wrap)')
|
|
map('n', ']w', '<Plug>(ale_next_wrap)')
|
|
map('n', ']W', '<Plug>(ale_last)')
|
|
---- completion-nvim
|
|
-- Use completion-nvim in every buffer
|
|
g.completion_enable_snippet = 'UltiSnips'
|
|
opt.completeopt = {'menuone', 'noinsert', 'noselect'}
|
|
g.completion_chain_complete_list = {
|
|
default = {
|
|
{ complete_items = { 'lsp' } },
|
|
{ complete_items = { 'buffers' } },
|
|
{ mode = { '<c-p>' } },
|
|
{ mode = { '<c-n>' } }
|
|
},
|
|
}
|
|
cmd [[autocmd BufEnter * lua require'completion'.on_attach()]]
|
|
---- Ultisnips
|
|
g.UltiSnipsSnippetDirectories = {'UltiSnips', 'mysnippets'}
|
|
---- vim-signify
|
|
g.signify_vcs_list = {'git'}
|
|
---- vim-markdown
|
|
g.vim_markdown_no_default_key_mappings = 1
|
|
g.vim_markdown_folding_disabled = 1
|
|
g.vim_markdown_toml_frontmatter = 1
|
|
---- Telescope
|
|
map('n', '<Leader>f', ':Telescope fd<CR>')
|
|
map('n', '<Leader>b', ':Telescope buffers<CR>')
|
|
map('n', '<Leader>/', ':Telescope current_buffer_fuzzy_find<CR>')
|
|
--map('n', '<Leader>*', ':Telescope grep_string<CR>')
|
|
map('n', '<Leader>g', ':Telescope live_grep<CR>')
|
|
map('n', '<Leader>cg', ':Telescope grep_string<CR>')
|