Transition from my neovim config to LunarVim

This commit is contained in:
Smirnov-O 2021-08-01 19:30:54 +03:00
parent e3fa73c712
commit 4c57b36f1b
16 changed files with 128 additions and 342 deletions

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
sudo pacman -Syyuu --noconfirm sudo pacman -Syyuu --noconfirm
yay -Sua --noconfirm yay -Sua --noconfirm
sudo pacman -Rs $(pacman -Qdtq) --noconfirm sudo pacman -Rs $(pacman -Qdtq) --noconfirm

View file

@ -1,34 +0,0 @@
#!/bin/sh
# Kernel version
kernel=$(cat /proc/sys/kernel/osrelease | cut -d '-' -f1)
# Window manager
[ ! "$wm" ] && [ "$DISPLAY" ] && command -v xprop >/dev/null && {
wmname="$(xprop -id $(xprop -root -notype\
| awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') -notype -f _NET_WM_NAME 8t\
| grep "WM_NAME"\
| cut -f2 -d \")"
}
# Shell
shell=$(basename $SHELL)
# Installed packages
manager=$(which apt pacman yay 2>/dev/null)
manager=${manager##*/}
case "$manager" in
apt) packages="$(dpkg-query -f '${binary:Package}\n' -W | wc -l)" ;;
yay) packages="$(yay -Q | wc -l)" ;;
pacman) packages="$(pacman -Q | wc -l)" ;;
esac
# Text decorations
bold=$(tput bold)
reset="\e[0m"
blue="\e[36m"
echo -e " ${blue}${bold} WM ${reset}${wmname}"
echo -e " /\_/\ ${blue}${bold} SHELL ${reset}${shell}"
echo -e " (=^.^=) ${blue}${bold}KERNEL ${reset}${kernel}"
echo -e " (\") (\")_/ ${blue}${bold} PKG ${reset}${packages}"

View file

@ -1,18 +0,0 @@
#!/bin/sh
case "$1" in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*.deb) ar x $1 ;;
*.tar.xz) tar xf $1 ;;
*.tar.zst) unzstd $1 ;;
*) echo "'$1' is not a valid file" ;;
esac

View file

@ -32,11 +32,11 @@ function show() {
case "$1" in case "$1" in
add|a) shift; add "$@" ;; add|a) shift; add "$@" ;;
del|d) shift; del "$@" ;; del|d) shift; del "$@" ;;
mv) shift; edit "$@" ;; mv|m) shift; edit "$@" ;;
show) shift; show ;; show) shift; show ;;
help) echo "add|a - [file name] add to ignore." help) echo "add|a - [file name] add to ignore."
echo "del|d - [file name] delete from ignore." echo "del|d - [file name] delete from ignore."
echo "mv - [old] [new] file name for rename." echo "mv|m - [old] [new] file name for rename."
echo "show - show ignore file." ;; echo "show - show ignore file." ;;
*) echo "Command is not valid. Type 'giti help' for help." ;; *) echo "Command is not valid. Type 'giti help' for help." ;;
esac esac

View file

@ -1,2 +0,0 @@
#!/bin/sh
curl ifconfig.co

View file

@ -1,6 +1,6 @@
# BSPWM # BSPWM
[](screen.png) [](./screen.png)
-------------- --------------
### Install ### Install

63
config/lvim/lv-config.lua Normal file
View file

@ -0,0 +1,63 @@
--- "lvim" configuration
lvim.format_on_save = false
lvim.lint_on_save = true
lvim.colorscheme = "spacegray"
lvim.builtin.dashboard.active = true
lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.side = "right"
lvim.builtin.nvimtree.show_icons.git = 0
lvim.builtin.nvimtree.auto_open = 0
lvim.builtin.nvimtree.hide_dotfiles = 0
lvim.builtin.telescope.defaults.layout_config.prompt_position = "top"
lvim.builtin.treesitter.ensure_installed = { "javascript", "jsdoc", "lua", "python" }
lvim.builtin.treesitter.highlight.enabled = true
lvim.builtin.treesitter.indent.disable = { "python" }
--- keymappings
lvim.leader = "space"
lvim.keys.normal_mode = {
{ "<C-s>", "<cmd>w<cr>" },
{ "<C-w>", "<cmd>BufferClose<cr>" },
-- Navigate split
{ "<C-h>", "<cmd>wincmd h<cr>" },
{ "<C-j>", "<cmd>wincmd j<cr>" },
{ "<C-k>", "<cmd>wincmd k<cr>" },
{ "<C-l>", "<cmd>wincmd l<cr>" },
-- Resize split
{ "<A-h>", "<cmd>vert res +2<cr>" },
{ "<A-j>", "<cmd>res -2<cr>" },
{ "<A-k>", "<cmd>res +2<cr>" },
{ "<A-l>", "<cmd>vert res -2<cr>" },
-- Resize
{ "<A-1>", "<cmd>BufferGoto 1<cr>" },
{ "<A-2>", "<cmd>BufferGoto 2<cr>" },
{ "<A-3>", "<cmd>BufferGoto 3<cr>" },
{ "<A-4>", "<cmd>BufferGoto 4<cr>" },
{ "<A-5>", "<cmd>BufferGoto 5<cr>" },
{ "<A-6>", "<cmd>BufferGoto 6<cr>" },
{ "<A-7>", "<cmd>BufferGoto 7<cr>" },
{ "<A-8>", "<cmd>BufferGoto 8<cr>" },
{ "<A-9>", "<cmd>BufferGoto 9<cr>" },
}
--- Plugins
lvim.plugins = {
}
--- LSP
lvim.lang.javascript.lsp.setup.handlers = {
["textDocument/publishDiagnostics"] = function(_, _, p, client_id, _, config)
if p.diagnostics ~= nil then
local i = 1
while i <= #p.diagnostics do
if p.diagnostics[i].code == 80001 then
table.remove(p.diagnostics, i)
else
i = i + 1
end
end
end
vim.lsp.diagnostic.on_publish_diagnostics(_, _, p, client_id, _, config)
end,
}

View file

@ -1,33 +0,0 @@
# NVIM
## Install nvim
```bash
# From AUR
yay -S neovim-nightly-bin
# From pacman
sudo pacman -S neovim
```
## Install plugin manager(`vim-plug`)
```bash
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
```
## Install LSP servers
```bash
# Go(gopls)
go get golang.org/x/tools/gopls@latest
# Efm (linters)
go get github.com/mattn/efm-langserver
# Python(pyls)
pip install python-language-server
# JS/TS
nvim +"LspInstall typescript"
# Lua
nvim +"LspInstall lua"
```

View file

@ -1,67 +0,0 @@
call plug#begin('~/.vim/plugged')
Plug 'Smirnov-O/nten.vim'
Plug 'hoob3rt/lualine.nvim'
Plug 'romgrk/barbar.nvim'
Plug 'b3nj5m1n/kommentary'
Plug 'jiangmiao/auto-pairs'
Plug 'nvim-lua/plenary.nvim'
Plug 'lewis6991/gitsigns.nvim'
" LSP
Plug 'hrsh7th/nvim-compe'
Plug 'neovim/nvim-lspconfig'
Plug 'kabouzeid/nvim-lspinstall'
" Files
Plug 'junegunn/fzf.vim', {'on': ['Files', 'GFiles']}
" Syntax
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'sheerun/vim-polyglot'
call plug#end()
colo codedark
let mapleader=";"
"== Config
set termguicolors " GUI colors
set nu rnu nocul " Line numbers & cursor line highlight
set nolbr nowrap " Line wrap
set mouse=a mh " Mouse
set history=500 " Set history size
set autoread " Auto read file on change
set hidden " Change buffet without warning
set visualbell t_vb= " Disable sounds
set pumheight=8 " Maximum items in pop up
set modeline " Enable modeline
set nosmd " Disable show mode
set nobk noswf noudf " Swap files
set is ic scs " Search
set spr " Split
set enc=utf-8 fenc=utf-8 " Encoding
set scrolloff=3 " Scroll padding
set list listchars=tab:\|·,trail:~,space
set completeopt=menuone,noselect
"== Netrw file tree
let g:netrw_liststyle = 3
let g:netrw_banner = 0
let g:netrw_dirhistmax = 0
"== Tab(or spaces)
set ts=4 sw=4 sts=4
set sta et ai
"== Custom commands
com! Prettier :sil !prettier --no-semi -w %
com! Term :vs|winc L|se nonu nornu|start|term
com! GoFmt :sil !gofmt -w %
com! Black :sil !black %
"== Filetypes
au FileType go setl noet
au FileType javascript,yaml,json setl et ts=2 sw=2 sts=4
au FileType python setl et ts=4 sw=4 sts=4 ai
autocmd BufReadPost,FileReadPost lua require "lsp_signature".on_attach()
"== Config's
lua require"config"
so $HOME/.config/nvim/vimscript/barbar.vim
so $HOME/.config/nvim/vimscript/mappings.vim

View file

@ -1,51 +0,0 @@
require"lspinstall".setup {}
require"lspconfig".gopls.setup {}
-- require"lspconfig".pyls.setup {}
-- require"lspconfig".rls.setup {}
-- require"lspconfig".denols.setup {}
-- require"lspconfig".lua.setup{}
require"tsserver"
require"efm"
-- Compe
require'compe'.setup {
enabled = true,
autocomplete = true,
source = {
-- path = true,
buffer = true,
description = true,
nvim_lsp = true
}
}
-- LuaLine
require'lualine'.setup {options={
theme = "codedark"
}}
-- GitSigns
require'gitsigns'.setup {
signs = {
add = {hl = 'GitSignsAdd', text = ''};
change = {hl = 'GitSignsChange', text = ''};
delete = {hl = 'GitSignsDelete', text = '_'};
topdelete = {hl = 'GitSignsDelete', text = ''};
changedelete = {hl = 'GitSignsChange', text = '~'};
};
watch_index = {interval = 1000};
current_line_blame = true,
sign_priority = 6,
update_debounce = 100,
status_formatter = nil,
use_decoration_api = true,
use_internal_diff = true,
}
-- TreeSitter
require'nvim-treesitter.configs'.setup {
ensure_installed = {'javascript', 'typescript', 'jsdoc', 'python', 'go', 'bash'};
highlight = {
enable=true
};
}

View file

@ -1,39 +0,0 @@
-- Python
local flake8 = {
lintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -",
lintStdin = true,
lintFormats = {"%f:%l:%c: %m"}
}
-- Javascript
local eslint = {
lintCommand = "./node_modules/.bin/eslint -f unix --stdin --stdin-filename ${INPUT}",
lintIgnoreExitCode = true,
lintStdin = true,
lintFormats = {"%f:%l:%c: %m"},
formatCommand = "./node_modules/.bin/eslint --fix-to-stdout --stdin --stdin-filename=${INPUT}",
formatStdin = true
}
-- GoLang
local golint = {
lintCommand = "golint",
lintIgnoreExitCode = true,
lintFormats = {"%f:%l:%c: %m"},
lintSource = "golint"
}
-- Setup
require"lspconfig".efm.setup {
init_options = {documentFormatting = false, codeAction = false},
filetypes = {"python", "javascript", "typescript", "go"},
settings = {
rootMarkers = {".git/"},
languages = {
python = {flake8},
javascript = {eslint},
typescript = {eslint},
go = {golint}
};
};
}

View file

@ -1,21 +0,0 @@
local root_pattern = require("lspconfig/util").root_pattern
require('lspconfig').typescript.setup({
handlers = {
["textDocument/publishDiagnostics"] = function(_, _, params, client_id, _, config)
if params.diagnostics ~= nil then
local idx = 1
while idx <= #params.diagnostics do
if params.diagnostics[idx].code == 80001 then
table.remove(params.diagnostics, idx)
else
idx = idx + 1
end
end
end
vim.lsp.diagnostic.on_publish_diagnostics(_, _, params, client_id, _, config)
end,
},
filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" };
root_dir = root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git");
})

View file

@ -1,19 +0,0 @@
" Settings
let bufferline = get(g:, 'bufferline', {})
let bufferline.icon_close_tab = '🗴'
let bufferline.icons = v:false
" Mappings
nno <A-1> :BufferGoto 1<cr>
nno <A-2> :BufferGoto 2<cr>
nno <A-3> :BufferGoto 3<cr>
nno <A-4> :BufferGoto 4<cr>
nno <A-5> :BufferGoto 5<cr>
nno <A-6> :BufferGoto 6<cr>
nno <A-7> :BufferGoto 7<cr>
nno <A-8> :BufferGoto 8<cr>
nno <A-9> :BufferGoto 9<cr>
nno <C-w> :BufferClose<cr>
nno <S-x> :BufferClose!<cr>
nno <leader><right> :BufferMoveNext<cr>
nno <leader><left> :BufferMovePrevious<cr>

View file

@ -1,36 +0,0 @@
nno <C-s> :w<cr>
nno <C-p> :GFiles<cr>
nno <C-n> :enew<cr>
nno <leader>; :Files<cr>
nno <space> :noh<cr>
" Buffer
nno <leader>j :bn<cr>
nno <leader>k :bp<cr>
" Compe
ino <expr> <tab> pumvisible() ? "\<C-n>" : "\<tab>"
ino <expr> <s-tab> pumvisible() ? "\<C-p>" : "\<tab>"
ino <expr> <cr> compe#confirm('<CR>')
ino <expr> <c-space> compe#complete()
nno sr :lua vim.lsp.buf.rename()<cr>
nno sh :lua vim.lsp.buf.hover()<cr>
nno sd :lua vim.lsp.buf.definition()<cr>
nno sa :lua vim.lsp.buf.code_action()<cr>
nno si :lua vim.lsp.buf.implementation()<cr>
" Split
nno <C-h> :winc h<cr>
nno <C-j> :winc j<cr>
nno <C-k> :winc k<cr>
nno<C-l> :winc l<cr>
nno <A-h> :vert res +3<cr>
nno <A-j> :res -3<cr>
nno <A-k> :res +3<cr>
nno <A-l> :vert res -3<cr>
nno spv :vnew<cr>
nno sph :new<cr>
nno spk :winc K<cr>
nno spl :winc L<cr>

View file

@ -1,5 +1,4 @@
{ {
"update.showReleaseNotes": false,
"window.menuBarVisibility": "toggle", "window.menuBarVisibility": "toggle",
"workbench.iconTheme": "material-icon-theme", "workbench.iconTheme": "material-icon-theme",
"workbench.colorTheme": "GitHub Dark", "workbench.colorTheme": "GitHub Dark",
@ -8,11 +7,11 @@
"workbench.startupEditor": "none", "workbench.startupEditor": "none",
"workbench.panel.defaultLocation": "left", "workbench.panel.defaultLocation": "left",
"workbench.activityBar.visible": false, "workbench.activityBar.visible": false,
"explorer.compactFolders": false, "update.showReleaseNotes": false,
"explorer.confirmDragAndDrop": false, // Editor
"explorer.confirmDelete": false,
// "editor.cursorSmoothCaretAnimation": true, // "editor.cursorSmoothCaretAnimation": true,
"editor.fontFamily": "'Jetbrains Mono', monospace", "editor.fontFamily": "'Jetbrains Mono', monospace",
"editor.inlineSuggest.enabled": true,
"editor.hover.enabled": true, "editor.hover.enabled": true,
"editor.minimap.enabled": false, "editor.minimap.enabled": false,
"editor.suggestSelection": "first", "editor.suggestSelection": "first",
@ -24,28 +23,72 @@
"editor.wordWrap": "off", "editor.wordWrap": "off",
"editor.fontSize": 14, "editor.fontSize": 14,
"editor.tabSize": 4, "editor.tabSize": 4,
"files.insertFinalNewline": true, // Files
"files.trimFinalNewlines": true, "explorer.compactFolders": false,
"files.trimTrailingWhitespace": true, "explorer.confirmDragAndDrop": false,
"search.quickOpen.includeHistory": false, "explorer.confirmDelete": false,
"files.insertFinalNewline": false,
"files.trimFinalNewlines": false,
"files.trimTrailingWhitespace": false,
"files.exclude": {
"**/node_modules": true,
"**/env": true
},
// Git
"gitlens.codeLens.enabled": true, "gitlens.codeLens.enabled": true,
"git.autofetch": true, "git.autofetch": true,
"git.confirmSync": false, "git.confirmSync": false,
"git.enableSmartCommit": true, "git.enableSmartCommit": true,
// Vim
"vim.easymotion": true,
"vim.surround": true,
"vim.useSystemClipboard": true,
"vim.hlsearch": true,
"vim.incsearch": true,
"vim.leader": ";",
"vim.normalModeKeyBindings": [
{
"before": [
"<space>"
],
"commands": [
":nohl"
]
},
],
"vim.insertModeKeyBindings": [
{
"before": [
"j",
"k"
],
"after": [
"<esc>"
]
}
],
"vim.handleKeys": {
"<C-w>": false,
"<C-b>": false,
"<C-n>": false,
"<C-h>": false
},
// Expensions
"extensions.ignoreRecommendations": true, "extensions.ignoreRecommendations": true,
"docker.showStartPage": false, "docker.showStartPage": false,
"prettier.semi": false, "prettier.semi": false,
// Languages
"javascript.suggestionActions.enabled": false, "javascript.suggestionActions.enabled": false,
"typescript.suggestionActions.enabled": false, "typescript.suggestionActions.enabled": false,
"files.exclude": {
"**/.cache": true,
"**/node_modules": true,
"**/env": true
},
"[javascript]": { "[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode", "editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2 "editor.tabSize": 2
}, },
"vim.useSystemClipboard": true, "workbench.editorAssociations": {
"editor.inlineSuggest.enabled": true, "*.ipynb": "jupyter-notebook"
} },
"notebook.cellToolbarLocation": {
"default": "right",
"jupyter-notebook": "left"
}
}

4
zshrc
View file

@ -10,7 +10,7 @@ export EDITOR="nvim"
export FZF_DEFAULT_COMMAND="fd -t f -t l -E node_modules -E env -E __pycache__" export FZF_DEFAULT_COMMAND="fd -t f -t l -E node_modules -E env -E __pycache__"
## Oh my zsh ## Oh my zsh
plugins=(dotenv yarn node) plugins=(dotenv yarn pip)
ZSH_THEME="simple" ZSH_THEME="simple"
source "$HOME/.oh-my-zsh/oh-my-zsh.sh" source "$HOME/.oh-my-zsh/oh-my-zsh.sh"
@ -19,7 +19,7 @@ eval $(fnm env)
## Aliases ## Aliases
alias cls="clear" cp="cp -r" mkdir="mkdir -p" alias cls="clear" cp="cp -r" mkdir="mkdir -p"
alias vim="nvim" vi="vim" e="$EDITOR" alias nvim="lvim" vim="nvim" vi="vim" e="$EDITOR" lv="lvim"
alias ...="cd ../.." .3="cd ../../.." alias ...="cd ../.." .3="cd ../../.."
alias gor="go run" gob="go build" gog="go get" goi="go install" alias gor="go run" gob="go build" gog="go get" goi="go install"