first commit
This commit is contained in:
commit
355ff09d86
|
|
@ -0,0 +1 @@
|
||||||
|
plugged/
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
set number relativenumber
|
||||||
|
set clipboard=unnamedplus
|
||||||
|
set mouse=a
|
||||||
|
|
||||||
|
set t_Co=16
|
||||||
|
set termguicolors
|
||||||
|
|
||||||
|
filetype plugin indent on
|
||||||
|
" show existing tab with 4 spaces width
|
||||||
|
set tabstop=2
|
||||||
|
" when indenting with '>', use 4 spaces width
|
||||||
|
set shiftwidth=2
|
||||||
|
" On pressing tab, insert 4 spaces
|
||||||
|
set expandtab
|
||||||
|
" Spellcheck
|
||||||
|
autocmd FileType markdown setlocal spell spelllang=de,en
|
||||||
|
|
||||||
|
set splitright
|
||||||
|
set splitbelow
|
||||||
|
|
||||||
|
" allow two signs to show up in the sign collumn eg. todo comment and git status
|
||||||
|
set signcolumn=auto:2
|
||||||
|
|
||||||
|
" set leader key
|
||||||
|
let mapleader = ","
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
source ~/.config/nvim/basic.vim
|
||||||
|
source ~/.config/nvim/plugins.vim
|
||||||
|
|
||||||
|
autocmd bufnewfile,bufread *.tsx set filetype=typescriptreact
|
||||||
|
autocmd bufnewfile,bufread *.jsx set filetype=javascriptreact
|
||||||
|
|
@ -0,0 +1,321 @@
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'glepnir/galaxyline.nvim' , {'branch': 'main'}
|
||||||
|
Plug 'kyazdani42/nvim-web-devicons' " for file icons
|
||||||
|
Plug 'kyazdani42/nvim-tree.lua'
|
||||||
|
Plug 'junegunn/goyo.vim'
|
||||||
|
Plug 'JoosepAlviste/nvim-ts-context-commentstring'
|
||||||
|
Plug 'tpope/vim-commentary'
|
||||||
|
Plug 'mhinz/vim-signify'
|
||||||
|
Plug 'neovim/nvim-lspconfig'
|
||||||
|
Plug 'mhartington/formatter.nvim'
|
||||||
|
Plug 'hrsh7th/nvim-compe'
|
||||||
|
Plug 'onsails/lspkind-nvim'
|
||||||
|
Plug 'MasterGordon/monokai.nvim'
|
||||||
|
Plug 'ron89/thesaurus_query.vim'
|
||||||
|
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||||
|
Plug 'blackcauldron7/surround.nvim'
|
||||||
|
Plug 'nvim-lua/popup.nvim'
|
||||||
|
Plug 'nvim-lua/plenary.nvim'
|
||||||
|
Plug 'nvim-telescope/telescope.nvim'
|
||||||
|
Plug 'SidOfc/mkdx'
|
||||||
|
Plug 'nacro90/numb.nvim'
|
||||||
|
Plug 'glepnir/dashboard-nvim'
|
||||||
|
Plug 'norcalli/nvim-colorizer.lua'
|
||||||
|
Plug 'davidgranstrom/nvim-markdown-preview'
|
||||||
|
Plug 'RishabhRD/popfix'
|
||||||
|
Plug 'RishabhRD/nvim-lsputils'
|
||||||
|
Plug 'akinsho/nvim-bufferline.lua'
|
||||||
|
Plug 'folke/todo-comments.nvim'
|
||||||
|
Plug 'windwp/nvim-ts-autotag'
|
||||||
|
Plug 'jiangmiao/auto-pairs'
|
||||||
|
Plug 'simrat39/symbols-outline.nvim'
|
||||||
|
Plug 'ray-x/lsp_signature.nvim'
|
||||||
|
|
||||||
|
" post install (yarn install | npm install) then load plugin only for editing supported files
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
nmap <leader>f <CMD>Telescope find_files<CR>
|
||||||
|
|
||||||
|
lua require('numb').setup()
|
||||||
|
|
||||||
|
" Theme
|
||||||
|
colorscheme monokai
|
||||||
|
|
||||||
|
" StatusLine
|
||||||
|
luafile $HOME/.config/nvim/plugins/galaxyline.lua
|
||||||
|
|
||||||
|
" Lsp Signature
|
||||||
|
" lua require'lsp_signature'.on_attach()
|
||||||
|
|
||||||
|
" Dashboard
|
||||||
|
let g:dashboard_default_executive ='telescope'
|
||||||
|
nnoremap <silent> <Leader>r :DashboardFindHistory<CR>
|
||||||
|
|
||||||
|
" Startify
|
||||||
|
let g:startify_custom_header = startify#pad(split(system('cat $HOME/.config/nvim/splash'), '\n'))
|
||||||
|
lua << EOF
|
||||||
|
function _G.webDevIcons(path)
|
||||||
|
local filename = vim.fn.fnamemodify(path, ':t')
|
||||||
|
local extension = vim.fn.fnamemodify(path, ':e')
|
||||||
|
return require'nvim-web-devicons'.get_icon(filename, extension, { default = true })
|
||||||
|
end
|
||||||
|
EOF
|
||||||
|
|
||||||
|
function! StartifyEntryFormat() abort
|
||||||
|
return 'v:lua.webDevIcons(absolute_path) . " " . entry_path'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" commentstring
|
||||||
|
lua << EOF
|
||||||
|
require'nvim-treesitter.configs'.setup {
|
||||||
|
context_commentstring = {
|
||||||
|
enable = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
" Outline
|
||||||
|
noremap <silent> <leader>o :SymbolsOutline<CR>
|
||||||
|
|
||||||
|
" Bufferline
|
||||||
|
lua <<EOF
|
||||||
|
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||||
|
local s = " "
|
||||||
|
for e, n in pairs(diagnostics_dict) do
|
||||||
|
local sym = e == "error" and " "
|
||||||
|
or (e == "warning" and " " or "" )
|
||||||
|
s = s .. n .. sym
|
||||||
|
end
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
require'bufferline'.setup{
|
||||||
|
options = {
|
||||||
|
always_show_bufferline = true,
|
||||||
|
diagnostics_indicator = diagnostics_indicator,
|
||||||
|
diagnostics = "nvim_lsp",
|
||||||
|
separator_style = "thin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
noremap <silent> <A-1> :lua require"bufferline".go_to_buffer(1)<CR>
|
||||||
|
noremap <silent> <A-2> :lua require"bufferline".go_to_buffer(2)<CR>
|
||||||
|
noremap <silent> <A-3> :lua require"bufferline".go_to_buffer(3)<CR>
|
||||||
|
noremap <silent> <A-4> :lua require"bufferline".go_to_buffer(4)<CR>
|
||||||
|
noremap <silent> <A-5> :lua require"bufferline".go_to_buffer(5)<CR>
|
||||||
|
noremap <silent> <A-6> :lua require"bufferline".go_to_buffer(6)<CR>
|
||||||
|
noremap <silent> <A-7> :lua require"bufferline".go_to_buffer(7)<CR>
|
||||||
|
noremap <silent> <A-8> :lua require"bufferline".go_to_buffer(8)<CR>
|
||||||
|
noremap <silent> <A-9> :lua require"bufferline".go_to_buffer(9)<CR>
|
||||||
|
noremap <silent> <A-0> :lua require"bufferline".go_to_buffer(10)<CR>
|
||||||
|
noremap <A-Left> <C-w><Left>
|
||||||
|
noremap <A-Up> <C-w><Up>
|
||||||
|
noremap <A-Down> <C-w><Down>
|
||||||
|
noremap <A-Right> <C-w><Right>
|
||||||
|
|
||||||
|
" colorizer
|
||||||
|
lua <<EOF
|
||||||
|
require 'colorizer'.setup {
|
||||||
|
'*'; -- Highlight all files, but customize some others.
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
" Prettier
|
||||||
|
command! -nargs=0 Prettier :CocCommand prettier.formatFile
|
||||||
|
map <leader>p :Prettier<CR>
|
||||||
|
|
||||||
|
" Surround
|
||||||
|
lua require"surround".setup{}
|
||||||
|
|
||||||
|
" NVim Tree Config
|
||||||
|
let g:nvim_tree_auto_close = 1
|
||||||
|
let g:nvim_tree_ignore = [ '.git', 'node_modules', '.cache' ]
|
||||||
|
let g:nvim_tree_indent_markers = 1
|
||||||
|
map <TAB> :NvimTreeFindFile<CR>
|
||||||
|
|
||||||
|
let g:nvim_tree_icons = {
|
||||||
|
\ 'default': '',
|
||||||
|
\ 'symlink': '',
|
||||||
|
\ 'git': {
|
||||||
|
\ 'unstaged': "✗",
|
||||||
|
\ 'staged': "✓",
|
||||||
|
\ 'unmerged': "",
|
||||||
|
\ 'renamed': "➜",
|
||||||
|
\ 'untracked': "★"
|
||||||
|
\ },
|
||||||
|
\ 'folder': {
|
||||||
|
\ 'default': "",
|
||||||
|
\ 'open': "",
|
||||||
|
\ 'symlink': "",
|
||||||
|
\ }
|
||||||
|
\ }
|
||||||
|
|
||||||
|
lua <<EOF
|
||||||
|
local tree_cb = require'nvim-tree.config'.nvim_tree_callback
|
||||||
|
vim.g.nvim_tree_bindings = {
|
||||||
|
-- default mappings
|
||||||
|
["<CR>"] = tree_cb("edit"),
|
||||||
|
["<2-LeftMouse>"] = tree_cb("edit"),
|
||||||
|
["<2-RightMouse>"] = tree_cb("cd"),
|
||||||
|
["<C-]>"] = tree_cb("cd"),
|
||||||
|
["s"] = tree_cb("vsplit"),
|
||||||
|
["i"] = tree_cb("split"),
|
||||||
|
["t"] = tree_cb("tabnew"),
|
||||||
|
["<"] = tree_cb("prev_sibling"),
|
||||||
|
[">"] = tree_cb("next_sibling"),
|
||||||
|
["<BS>"] = tree_cb("close_node"),
|
||||||
|
["<S-CR>"] = tree_cb("close_node"),
|
||||||
|
["<Tab>"] = tree_cb("preview"),
|
||||||
|
["I"] = tree_cb("toggle_ignored"),
|
||||||
|
["I"] = tree_cb("toggle_dotfiles"),
|
||||||
|
["r"] = tree_cb("refresh"),
|
||||||
|
["c"] = tree_cb("create"),
|
||||||
|
["d"] = tree_cb("remove"),
|
||||||
|
["m"] = tree_cb("rename"),
|
||||||
|
["<C-r>"] = tree_cb("full_rename"),
|
||||||
|
["x"] = tree_cb("cut"),
|
||||||
|
["c"] = tree_cb("copy"),
|
||||||
|
["p"] = tree_cb("paste"),
|
||||||
|
["[c"] = tree_cb("prev_git_item"),
|
||||||
|
["]c"] = tree_cb("next_git_item"),
|
||||||
|
["-"] = tree_cb("dir_up"),
|
||||||
|
["q"] = tree_cb("close"),
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
" TreeSitter
|
||||||
|
lua <<EOF
|
||||||
|
require'nvim-treesitter.configs'.setup {
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
enable = true
|
||||||
|
},
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
" Closetag
|
||||||
|
let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.mako,*.jsx,*.tsx'
|
||||||
|
|
||||||
|
" TS-Autotag
|
||||||
|
luafile $HOME/.config/nvim/plugins/autotag.lua
|
||||||
|
" Thesaurus
|
||||||
|
nnoremap <Leader>s :ThesaurusQueryReplaceCurrentWord<CR>
|
||||||
|
let g:tq_language=['en', 'de']
|
||||||
|
let g:tq_enabled_backends=["openthesaurus_de", "woxikon_de", "openoffice_en", "datamuse_com"]
|
||||||
|
|
||||||
|
" Tagalong
|
||||||
|
let g:tagalong_verbose = 1
|
||||||
|
let g:tagalong_filetypes = ['html', 'xml', 'jsx', 'tsx', 'eruby', 'ejs', 'eco', 'php', 'htmldjango', 'javascriptreact', 'typescriptreact', 'typescript.tsx', 'javascript.jsx', 'mako']
|
||||||
|
let g:tagalong_additional_filetypes = ['typescript.tsx', 'javascript.jsx', 'mako']
|
||||||
|
|
||||||
|
" coc.nvim
|
||||||
|
" source plugins/coc.vim
|
||||||
|
|
||||||
|
" nvim-lsp
|
||||||
|
luafile $HOME/.config/nvim/plugins/lsp.lua
|
||||||
|
|
||||||
|
" Formatter
|
||||||
|
luafile $HOME/.config/nvim/plugins/formatter.lua
|
||||||
|
|
||||||
|
" nvim.compe
|
||||||
|
luafile $HOME/.config/nvim/plugins/compe.lua
|
||||||
|
inoremap <silent><expr> <C-Space> compe#complete()
|
||||||
|
inoremap <silent><expr> <CR> compe#confirm('<CR>')
|
||||||
|
inoremap <silent><expr> <C-e> compe#close('<C-e>')
|
||||||
|
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
|
||||||
|
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
|
||||||
|
|
||||||
|
" lspkind
|
||||||
|
lua <<EOF
|
||||||
|
require('lspkind').init({
|
||||||
|
-- with_text = true,
|
||||||
|
-- symbol_map = {
|
||||||
|
-- Text = '',
|
||||||
|
-- Method = 'ƒ',
|
||||||
|
-- Function = '',
|
||||||
|
-- Constructor = '',
|
||||||
|
-- Variable = '',
|
||||||
|
-- Class = '',
|
||||||
|
-- Interface = 'ﰮ',
|
||||||
|
-- Module = '',
|
||||||
|
-- Property = '',
|
||||||
|
-- Unit = '',
|
||||||
|
-- Value = '',
|
||||||
|
-- Enum = '了',
|
||||||
|
-- Keyword = '',
|
||||||
|
-- Snippet = '',
|
||||||
|
-- Color = '',
|
||||||
|
-- File = '',
|
||||||
|
-- Folder = '',
|
||||||
|
-- EnumMember = '',
|
||||||
|
-- Constant = '',
|
||||||
|
-- Struct = ''
|
||||||
|
-- },
|
||||||
|
})
|
||||||
|
EOF
|
||||||
|
|
||||||
|
" vim-signify
|
||||||
|
|
||||||
|
let g:signify_sign_add = '│'
|
||||||
|
let g:signify_sign_change = '│'
|
||||||
|
|
||||||
|
" todo-comments
|
||||||
|
lua << EOF
|
||||||
|
require("todo-comments").setup (
|
||||||
|
{
|
||||||
|
signs = true, -- show icons in the signs column
|
||||||
|
sign_priority = 20, -- sign priority
|
||||||
|
-- keywords recognized as todo comments
|
||||||
|
keywords = {
|
||||||
|
FIX = {
|
||||||
|
icon = " ", -- icon used for the sign, and in search results
|
||||||
|
color = "error", -- can be a hex color, or a named color (see below)
|
||||||
|
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
|
||||||
|
-- signs = false, -- configure signs for some keywords individually
|
||||||
|
},
|
||||||
|
TODO = { icon = " ", color = "info" },
|
||||||
|
HACK = { icon = " ", color = "warning" },
|
||||||
|
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
|
||||||
|
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||||
|
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
|
||||||
|
},
|
||||||
|
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
|
||||||
|
-- highlighting of the line containing the todo comment
|
||||||
|
-- * before: highlights before the keyword (typically comment characters)
|
||||||
|
-- * keyword: highlights of the keyword
|
||||||
|
-- * after: highlights after the keyword (todo text)
|
||||||
|
highlight = {
|
||||||
|
before = "", -- "fg" or "bg" or empty
|
||||||
|
keyword = "wide", -- "fg", "bg", "wide" or empty. (wide is the same as bg, but will also highlight surrounding characters)
|
||||||
|
after = "fg", -- "fg" or "bg" or empty
|
||||||
|
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern used for highlightng (vim regex)
|
||||||
|
comments_only = true, -- uses treesitter to match keywords in comments only
|
||||||
|
max_line_len = 400, -- ignore lines longer than this
|
||||||
|
},
|
||||||
|
-- list of named colors where we try to extract the guifg from the
|
||||||
|
-- list of hilight groups or use the hex color if hl not found as a fallback
|
||||||
|
colors = {
|
||||||
|
error = { "LspDiagnosticsDefaultError", "ErrorMsg", "#DC2626" },
|
||||||
|
warning = { "LspDiagnosticsDefaultWarning", "WarningMsg", "#FBBF24" },
|
||||||
|
info = { "LspDiagnosticsDefaultInformation", "#2563EB" },
|
||||||
|
hint = { "LspDiagnosticsDefaultHint", "#10B981" },
|
||||||
|
default = { "Identifier", "#7C3AED" },
|
||||||
|
},
|
||||||
|
search = {
|
||||||
|
command = "rg",
|
||||||
|
args = {
|
||||||
|
"--color=never",
|
||||||
|
"--no-heading",
|
||||||
|
"--with-filename",
|
||||||
|
"--line-number",
|
||||||
|
"--column",
|
||||||
|
},
|
||||||
|
-- regex that will be used to match keywords.
|
||||||
|
-- don't replace the (KEYWORDS) placeholder
|
||||||
|
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
|
||||||
|
-- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
EOF
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
require('nvim-ts-autotag').setup()
|
||||||
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
vim.o.completeopt = "menuone,noselect"
|
||||||
|
require'compe'.setup {
|
||||||
|
enabled = true;
|
||||||
|
autocomplete = true;
|
||||||
|
debug = false;
|
||||||
|
min_length = 1;
|
||||||
|
preselect = 'enable';
|
||||||
|
throttle_time = 80;
|
||||||
|
source_timeout = 200;
|
||||||
|
incomplete_delay = 400;
|
||||||
|
max_abbr_width = 100;
|
||||||
|
max_kind_width = 100;
|
||||||
|
max_menu_width = 100;
|
||||||
|
documentation = true;
|
||||||
|
|
||||||
|
source = {
|
||||||
|
path = true;
|
||||||
|
buffer = true;
|
||||||
|
calc = true;
|
||||||
|
nvim_lsp = true;
|
||||||
|
nvim_lua = true;
|
||||||
|
vsnip = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
local prettierd = function()
|
||||||
|
return {
|
||||||
|
exe = "prettierd",
|
||||||
|
args = {vim.api.nvim_buf_get_name(0)},
|
||||||
|
stdin = true
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
require("formatter").setup(
|
||||||
|
{
|
||||||
|
logging = false,
|
||||||
|
filetype = {
|
||||||
|
typescriptreact = {prettierd},
|
||||||
|
json = {prettierd},
|
||||||
|
css = {prettierd},
|
||||||
|
scss = {prettierd},
|
||||||
|
markdown = {prettierd},
|
||||||
|
typescript = {prettierd},
|
||||||
|
javascript = {prettierd},
|
||||||
|
javascriptreact = {prettierd},
|
||||||
|
lua = {
|
||||||
|
-- luafmt
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = "luafmt",
|
||||||
|
args = {"--indent-count", 2, "--stdin"},
|
||||||
|
stdin = true
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
vim.api.nvim_exec(
|
||||||
|
[[
|
||||||
|
augroup FormatAutogroup
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWritePost *.lua,*.tsx,*.ts,*.js,*.jsx,*.json FormatWrite
|
||||||
|
augroup END
|
||||||
|
]],
|
||||||
|
true
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,214 @@
|
||||||
|
local gl = require('galaxyline')
|
||||||
|
local colors = require('galaxyline.theme').default
|
||||||
|
local monokai = require('monokai')
|
||||||
|
local condition = require('galaxyline.condition')
|
||||||
|
local gls = gl.section
|
||||||
|
colors.bg = monokai.bg;
|
||||||
|
gl.short_line_list = {'NvimTree','vista','dbui','packer'}
|
||||||
|
|
||||||
|
gls.left[2] = {
|
||||||
|
ViMode = {
|
||||||
|
provider = function()
|
||||||
|
-- auto change color according the vim mode
|
||||||
|
local mode_color = {n = colors.green, i = colors.red,v=colors.blue,
|
||||||
|
[''] = colors.blue,V=colors.blue,
|
||||||
|
c = colors.magenta,no = colors.red,s = colors.orange,
|
||||||
|
S=colors.orange,[''] = colors.orange,
|
||||||
|
ic = colors.yellow,R = colors.violet,Rv = colors.violet,
|
||||||
|
cv = colors.red,ce=colors.red, r = colors.cyan,
|
||||||
|
rm = colors.cyan, ['r?'] = colors.cyan,
|
||||||
|
['!'] = colors.red,t = colors.red}
|
||||||
|
local mode_map = {
|
||||||
|
['n'] = 'NORMAL ',
|
||||||
|
['no'] = 'N·OPERATOR PENDING ',
|
||||||
|
['v'] = 'VISUAL ',
|
||||||
|
['V'] = 'V·LINE ',
|
||||||
|
[''] = 'V·BLOCK ',
|
||||||
|
['s'] = 'SELECT ',
|
||||||
|
['S'] = 'S·LINE ',
|
||||||
|
[''] = 'S·BLOCK ',
|
||||||
|
['i'] = 'INSERT ',
|
||||||
|
['R'] = 'REPLACE ',
|
||||||
|
['Rv'] = 'V·REPLACE ',
|
||||||
|
['c'] = 'COMMAND ',
|
||||||
|
['cv'] = 'VIM EX ',
|
||||||
|
['ce'] = 'EX ',
|
||||||
|
['r'] = 'PROMPT ',
|
||||||
|
['rm'] = 'MORE ',
|
||||||
|
['r?'] = 'CONFIRM ',
|
||||||
|
['!'] = 'SHELL ',
|
||||||
|
['t'] = 'TERMINAL '}
|
||||||
|
vim.api.nvim_command('hi GalaxyViMode guibg='..mode_color[vim.fn.mode()])
|
||||||
|
return ' '..mode_map[vim.fn.mode()]
|
||||||
|
end,
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {nil,colors.bg},
|
||||||
|
highlight = {colors.bg,colors.bg,'bold'},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
gls.left[3] = {
|
||||||
|
Macro = {
|
||||||
|
provider = function()
|
||||||
|
local reg = vim.fn.reg_recording()
|
||||||
|
|
||||||
|
if (reg == nil) or (reg == '') then
|
||||||
|
return ''
|
||||||
|
else
|
||||||
|
return ' ' .. vim.call('reg_recording') .. ' '
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
highlight = {colors.red, colors.bg},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gls.left[5] ={
|
||||||
|
FileIcon = {
|
||||||
|
provider = 'FileIcon',
|
||||||
|
condition = condition.buffer_not_empty,
|
||||||
|
highlight = {require('galaxyline.provider_fileinfo').get_file_icon_color,colors.bg},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
gls.left[6] = {
|
||||||
|
FileName = {
|
||||||
|
provider = 'FileName',
|
||||||
|
condition = condition.buffer_not_empty,
|
||||||
|
highlight = {colors.magenta,colors.bg,'bold'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gls.left[7] = {
|
||||||
|
LineInfo = {
|
||||||
|
provider = 'LineColumn',
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE',colors.bg},
|
||||||
|
highlight = {colors.fg,colors.bg},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
gls.left[8] = {
|
||||||
|
PerCent = {
|
||||||
|
provider = 'LinePercent',
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE',colors.bg},
|
||||||
|
highlight = {colors.fg,colors.bg,'bold'},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gls.left[9] = {
|
||||||
|
DiagnosticError = {
|
||||||
|
provider = 'DiagnosticError',
|
||||||
|
icon = ' ',
|
||||||
|
highlight = {colors.red,colors.bg}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gls.left[10] = {
|
||||||
|
DiagnosticWarn = {
|
||||||
|
provider = 'DiagnosticWarn',
|
||||||
|
icon = ' ',
|
||||||
|
highlight = {colors.yellow,colors.bg},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gls.left[11] = {
|
||||||
|
DiagnosticHint = {
|
||||||
|
provider = 'DiagnosticHint',
|
||||||
|
icon = ' ',
|
||||||
|
highlight = {colors.cyan,colors.bg},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gls.left[12] = {
|
||||||
|
DiagnosticInfo = {
|
||||||
|
provider = 'DiagnosticInfo',
|
||||||
|
icon = ' ',
|
||||||
|
highlight = {colors.blue,colors.bg},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gls.right[1] = {
|
||||||
|
FileEncode = {
|
||||||
|
provider = 'FileEncode',
|
||||||
|
condition = condition.hide_in_width,
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE',colors.bg},
|
||||||
|
highlight = {colors.green,colors.bg,'bold'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gls.right[2] = {
|
||||||
|
FileFormat = {
|
||||||
|
provider = 'FileFormat',
|
||||||
|
condition = condition.hide_in_width,
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE',colors.bg},
|
||||||
|
highlight = {colors.green,colors.bg,'bold'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gls.right[3] = {
|
||||||
|
GitIcon = {
|
||||||
|
provider = function() return ' ' end,
|
||||||
|
condition = condition.check_git_workspace,
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE',colors.bg},
|
||||||
|
highlight = {colors.violet,colors.bg,'bold'},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gls.right[4] = {
|
||||||
|
GitBranch = {
|
||||||
|
provider = 'GitBranch',
|
||||||
|
condition = condition.check_git_workspace,
|
||||||
|
highlight = {colors.violet,colors.bg,'bold'},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gls.right[5] = {
|
||||||
|
DiffAdd = {
|
||||||
|
provider = 'DiffAdd',
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {nil,colors.bg},
|
||||||
|
condition = condition.hide_in_width,
|
||||||
|
icon = ' ',
|
||||||
|
highlight = {colors.green,colors.bg},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gls.right[6] = {
|
||||||
|
DiffModified = {
|
||||||
|
provider = 'DiffModified',
|
||||||
|
condition = condition.hide_in_width,
|
||||||
|
icon = ' 柳',
|
||||||
|
highlight = {colors.orane,colors.bg},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gls.right[7] = {
|
||||||
|
DiffRemove = {
|
||||||
|
provider = 'DiffRemove',
|
||||||
|
condition = condition.hide_in_width,
|
||||||
|
icon = ' ',
|
||||||
|
highlight = {colors.red,colors.bg},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- File type name
|
||||||
|
-- --------------
|
||||||
|
|
||||||
|
gls.short_line_left[1] = {
|
||||||
|
ShortLineFileName = {
|
||||||
|
provider = 'FileName',
|
||||||
|
condition = condition.buffer_not_empty,
|
||||||
|
highlight = {colors.fg, colors.bg},
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {nil, colors.bg}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Buffer icon
|
||||||
|
-- -----------
|
||||||
|
|
||||||
|
gls.short_line_right[1] = {
|
||||||
|
BufferIcon = {
|
||||||
|
provider = 'BufferIcon',
|
||||||
|
highlight = {colors.fg, colors.bg},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
vim.lsp.handlers["textDocument/codeAction"] = require "lsputil.codeAction".code_action_handler
|
||||||
|
vim.lsp.handlers["textDocument/references"] = require "lsputil.locations".references_handler
|
||||||
|
vim.lsp.handlers["textDocument/definition"] = require "lsputil.locations".definition_handler
|
||||||
|
vim.lsp.handlers["textDocument/declaration"] = require "lsputil.locations".declaration_handler
|
||||||
|
vim.lsp.handlers["textDocument/typeDefinition"] = require "lsputil.locations".typeDefinition_handler
|
||||||
|
vim.lsp.handlers["textDocument/implementation"] = require "lsputil.locations".implementation_handler
|
||||||
|
vim.lsp.handlers["textDocument/documentSymbol"] = require "lsputil.symbols".document_handler
|
||||||
|
vim.lsp.handlers["workspace/symbol"] = require "lsputil.symbols".workspace_handler
|
||||||
|
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"LspDiagnosticsSignError",
|
||||||
|
{texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"}
|
||||||
|
)
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"LspDiagnosticsSignWarning",
|
||||||
|
{texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"}
|
||||||
|
)
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"LspDiagnosticsSignHint",
|
||||||
|
{texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"}
|
||||||
|
)
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"LspDiagnosticsSignInformation",
|
||||||
|
{texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"}
|
||||||
|
)
|
||||||
|
|
||||||
|
--- Languages
|
||||||
|
require "lspconfig".bashls.setup {}
|
||||||
|
require "lspconfig".ccls.setup {}
|
||||||
|
require "lspconfig".clangd.setup {}
|
||||||
|
require "lspconfig".cssls.setup {}
|
||||||
|
require "lspconfig".html.setup {}
|
||||||
|
require "lspconfig".jsonls.setup {}
|
||||||
|
require "lspconfig".pyls.setup {}
|
||||||
|
require "lspconfig".pyright.setup {}
|
||||||
|
require "lspconfig".tsserver.setup {}
|
||||||
|
require "lspconfig".vimls.setup {}
|
||||||
|
require "lspconfig".yamlls.setup {}
|
||||||
|
|
||||||
|
--- ESLINT
|
||||||
|
|
||||||
|
local eslint = {
|
||||||
|
lintCommand = "eslint_d -f visualstudio --stdin --stdin-filename ${INPUT}",
|
||||||
|
lintIgnoreExitCode = true,
|
||||||
|
lintStdin = true,
|
||||||
|
lintFormats = {
|
||||||
|
"%f(%l,%c): %tarning %m",
|
||||||
|
"%f(%l,%c): %rror %m"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require "lspconfig".efm.setup {
|
||||||
|
init_options = {documentFormatting = true},
|
||||||
|
filetypes = {"javascript", "typescript", "javascriptreact", "typescriptreact"},
|
||||||
|
init_options = {documentFormatting = true},
|
||||||
|
settings = {
|
||||||
|
rootMarkers = {".eslintrc.js", ".git/"},
|
||||||
|
languages = {
|
||||||
|
javascript = {eslint},
|
||||||
|
typescript = {eslint},
|
||||||
|
typescriptreact = {eslint},
|
||||||
|
javascriptreact = {eslint}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Keybindings
|
||||||
|
|
||||||
|
local nvim_lsp = require("lspconfig")
|
||||||
|
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
local function buf_set_keymap(...)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
|
end
|
||||||
|
local function buf_set_option(...)
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Mappings.
|
||||||
|
local opts = {noremap = true, silent = true}
|
||||||
|
buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<leader>t", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<F2>", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<leader>a", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<leader>d", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
local servers = {"pyright", "rust_analyzer", "tsserver"}
|
||||||
|
for _, lsp in ipairs(servers) do
|
||||||
|
nvim_lsp[lsp].setup {on_attach = on_attach}
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
local saga = require 'lspsaga'
|
||||||
|
|
||||||
|
saga.init_lsp_saga {
|
||||||
|
use_saga_diagnostic_sign = true,
|
||||||
|
error_sign = '',
|
||||||
|
warn_sign = '',
|
||||||
|
hint_sign = '',
|
||||||
|
infor_sign = '',
|
||||||
|
dianostic_header_icon = ' ',
|
||||||
|
code_action_icon = ' ',
|
||||||
|
code_action_prompt = {
|
||||||
|
enable = true,
|
||||||
|
sign = true,
|
||||||
|
sign_priority = 20,
|
||||||
|
virtual_text = true,
|
||||||
|
},
|
||||||
|
finder_definition_icon = ' ',
|
||||||
|
finder_reference_icon = ' ',
|
||||||
|
max_preview_lines = 10, -- preview lines of lsp_finder and definition preview
|
||||||
|
finder_action_keys = {
|
||||||
|
open = 'o', vsplit = 's',split = 'i',quit = 'q',scroll_down = '<C-f>', scroll_up = '<C-b>' -- quit can be a table
|
||||||
|
},
|
||||||
|
code_action_keys = {
|
||||||
|
quit = 'q',exec = '<CR>'
|
||||||
|
},
|
||||||
|
rename_action_keys = {
|
||||||
|
quit = '<C-c>',exec = '<CR>' -- quit can be a table
|
||||||
|
},
|
||||||
|
definition_preview_icon = ' ',
|
||||||
|
-- "single" "double" "round" "plus"
|
||||||
|
border_style = "single",
|
||||||
|
rename_prompt_prefix = '➤',
|
||||||
|
-- if you don't use nvim-lspconfig you must pass your server name and
|
||||||
|
-- the related filetypes into this table
|
||||||
|
server_filetype_map = {},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
data
|
||||||
|
content
|
||||||
|
app
|
||||||
|
JS
|
||||||
|
CSS
|
||||||
|
JSON
|
||||||
|
Frameworks
|
||||||
|
cherrypy
|
||||||
|
mappings
|
||||||
|
Application
|
||||||
|
templates
|
||||||
|
Gordon
|
||||||
|
author
|
||||||
|
index
|
||||||
|
request
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue