Update nvim

This commit is contained in:
Smirnov Alexander 2021-06-10 19:09:35 +03:00
parent a01c2ab92c
commit 093639a28a
24 changed files with 102 additions and 119 deletions

View file

@ -1,18 +1,18 @@
<h1 align="center">dotfiles</h1> <h1 align="center">dotfiles</h1>
#### System configuration ### System configuration
- `OS` Arch - `OS` Arch
- `WM` bspwm - `WM` bspwm
- `Terminal` kitty - `Terminal` kitty
- `Shell` zsh - `Shell` zsh
- `Editor` nvim, vscode - `Editor` nvim, vscode
- `File manager` ranger - `File manager` ranger
- `Browser` firefox, chrome - `Browser` chrome
- `Font` Jatbrains Mono - `Font` Jatbrains Mono
- `Icon font` Font Awesome - `Icon font` Font Awesome
- `Launcher` rofi - `Launcher` rofi
#### Install config ### Install config
Since i use **[rcm](https://github.com/thoughtbot/rcm)** set it: Since i use **[rcm](https://github.com/thoughtbot/rcm)** set it:
```bash ```bash
yay -S rcm yay -S rcm

View file

@ -1,9 +1,24 @@
# NVIM # NVIM
### Install LSP ## Install nvim
```bash
yay -S neovim-nightly-bin
```
## 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 ```bash
# tsserver(JS/TS) # tsserver(JS/TS)
npm i -g typescript typescript-language-server npm i -g typescript typescript-language-server
# Go(gopls) # Go(gopls)
go get golang.org/x/tools/gopls@latest go get golang.org/x/tools/gopls@latest
# Python(pyls)
pip install python-language-server
``` ```

View file

@ -1,28 +1,33 @@
call plug#begin('~/.vim/plugged') call plug#begin('~/.vim/plugged')
Plug 'Smirnov-O/nten.vim'
Plug 'b3nj5m1n/kommentary'
" Plug 'mattn/emmet-vim', {'on': 'EmmetInstall'}
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-lua/popup.nvim'
" Plug 'editorconfig/editorconfig-vim'
Plug 'norcalli/nvim-colorizer.lua'
Plug 'kyazdani42/nvim-web-devicons'
" Status line && Tab line
Plug 'hoob3rt/lualine.nvim'
Plug 'romgrk/barbar.nvim'
" LSP && Completion " LSP && Completion
Plug 'neovim/nvim-lspconfig' Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/nvim-compe' Plug 'hrsh7th/nvim-compe'
Plug 'jiangmiao/auto-pairs' Plug 'jiangmiao/auto-pairs'
Plug 'mattn/emmet-vim', {'on': 'EmmetInstall'}
" File explorer
Plug 'junegunn/fzf.vim'
Plug 'kyazdani42/nvim-tree.lua'
" Git " Git
Plug 'TimUntersberger/neogit'
Plug 'lewis6991/gitsigns.nvim' Plug 'lewis6991/gitsigns.nvim'
" Theme " File explorer
Plug 'Smirnov-O/nten.vim' Plug 'kyazdani42/nvim-tree.lua'
" Status line && Tab line Plug 'nvim-telescope/telescope.nvim'
Plug 'hoob3rt/lualine.nvim'
Plug 'romgrk/barbar.nvim'
" Better syntax hl " Better syntax hl
Plug 'sheerun/vim-polyglot' Plug 'sheerun/vim-polyglot'
Plug 'norcalli/nvim-colorizer.lua' Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
" Other
Plug 'nvim-lua/plenary.nvim'
call plug#end() call plug#end()
colo codedark colo codedark
let mapleader=";" let mapleader=";"
set termguicolors
"== Tab(or spaces) "== Tab(or spaces)
set ts=4 sw=4 sts=4 set ts=4 sw=4 sts=4
@ -35,18 +40,10 @@ com! Notes :Files ~/notes
com! GoFmt :sil !gofmt -w % com! GoFmt :sil !gofmt -w %
"== Configs "== Configs
luafile $HOME/.config/nvim/lua/plugins.lua
source $HOME/.config/nvim/vimscript/config.vim source $HOME/.config/nvim/vimscript/config.vim
source $HOME/.config/nvim/vimscript/barbar.vim source $HOME/.config/nvim/vimscript/barbar.vim
source $HOME/.config/nvim/vimscript/emmet.vim source $HOME/.config/nvim/vimscript/emmet.vim
source /home/sasha/.config/nvim/vimscript/compe.vim source $HOME/.config/nvim/vimscript/compe.vim
source $HOME/.config/nvim/vimscript/filetypes.vim
source $HOME/.config/nvim/vimscript/mappings.vim source $HOME/.config/nvim/vimscript/mappings.vim
luafile $HOME/.config/nvim/lua/n-compe.lua
luafile $HOME/.config/nvim/lua/n-lualine.lua
luafile $HOME/.config/nvim/lua/n-nvimtree.lua
luafile $HOME/.config/nvim/lua/n-gitsigns.lua
luafile $HOME/.config/nvim/lua/n-colorizer.lua
"== Custom setting for another files
au FileType python,elm setl sw=4 ts=4 sts=2
au FileType javascript,html,vue,jst,pug,css,less,scss,json,yaml,lua setl sw=2 ts=2 sts=2
au FileType go setl noet sw=4 ts=4 sts=2

View file

@ -1,13 +0,0 @@
require'colorizer'.setup(
{'*';}, {
mode = 'background';
RGB = true; -- #RGB hex codes
RRGGBB = true; -- #RRGGBB hex codes
RRGGBBAA = false; -- #RRGGBBAA hex codes
rgb_fn = true; -- CSS rgb() and rgba() functions
hsl_fn = false; -- CSS hsl() and hsla() functions
css = false; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn
names = false; -- "Name" codes like Blue
}
)

View file

@ -0,0 +1,11 @@
require'colorizer'.setup({'*';}, {
mode = 'background';
RGB = true;
RRGGBB = true;
RRGGBBAA = false;
rgb_fn = true;
hsl_fn = false;
css = false;
css_fn = true;
names = false;
})

View file

@ -1,7 +1,3 @@
require'lspconfig'.tsserver.setup {}
require'lspconfig'.gopls.setup {}
require'lspconfig'.pyls.setup {}
require'compe'.setup { require'compe'.setup {
enabled = true, enabled = true,
autocomplete = true, autocomplete = true,

View file

@ -0,0 +1,3 @@
require'lspconfig'.tsserver.setup {}
require'lspconfig'.gopls.setup {}
require'lspconfig'.pyls.setup {}

View file

@ -0,0 +1 @@
require'neogit'.setup {}

View file

@ -2,7 +2,7 @@ local S = vim.g
-- Settings -- Settings
S.nvim_tree_side = "left" S.nvim_tree_side = "left"
S.nvim_tree_ignore = {".git", ".cache", "node_modules", "venv"} S.nvim_tree_ignore = {".git", ".cache", "node_modules", "venv", "env"}
S.nvim_tree_auto_close = 0 S.nvim_tree_auto_close = 0
S.nvim_tree_quit_on_open = 0 S.nvim_tree_quit_on_open = 0
S.nvim_tree_width = 24 S.nvim_tree_width = 24

View file

@ -0,0 +1,13 @@
local actions = require('telescope.actions')
require('telescope').setup{
defaults = {
prompt_prefix = "Search > ",
selection_caret = " ",
entry_prefix = " ",
file_ignore_patterns = {"node_modules", "env", ".cache"},
mappings = {
i = {["<esc>"] = actions.close}
};
};
}

View file

@ -0,0 +1,5 @@
require'nvim-treesitter.configs'.setup {
ensure_installed = {'javascript', 'typescript', 'python', 'go'};
highlight = { enable = true };
indent = { enable = true };
}

View file

@ -0,0 +1,9 @@
require'plug.compe'
require'plug.lspconfig'
require'plug.nvimtree'
require'plug.lualine'
require'plug.gitsigns'
require'plug.neogit'
require'plug.treesitter'
require'plug.telescope'
require'plug.colorizer'

View file

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

View file

@ -1,6 +1,6 @@
"== Vim config "== Vim config
set termguicolors " GUI colors set termguicolors " GUI colors
set nu rnu cul " Line numbers & cursor line highlight set nu rnu nocul " Line numbers & cursor line highlight
set nolbr nowrap " Line wrap set nolbr nowrap " Line wrap
set mouse=a mh " Mouse set mouse=a mh " Mouse
set history=500 " Set history size set history=500 " Set history size

View file

@ -5,5 +5,5 @@ let g:user_emmet_leader = ","
let g:user_emmet_settings = { let g:user_emmet_settings = {
\ 'javascript': {'extends': 'jsx'}} \ 'javascript': {'extends': 'jsx'}}
"== Auto load "== Load
au FileType html,jst,pug,vue,css,less,scss :EmmetInstall au FileType html,jst,pug,vue,css,less,scss :EmmetInstall

View file

@ -0,0 +1,3 @@
au FileType python,elm setl sw=4 ts=4 sts=2
au FileType go setl noet sw=4 ts=4 sts=2
au FileType javascript,html,jst,pug,css,less,scss,json,yaml,lua,vim setl sw=2 ts=2 sts=2

View file

@ -2,7 +2,9 @@ nno <C-s> :w<cr>
nno <space> :noh<cr> nno <space> :noh<cr>
nno <leader>t :Term<cr> nno <leader>t :Term<cr>
nno <leader>e :NvimTreeToggle<cr> nno <leader>e :NvimTreeToggle<cr>
nno <leader>; :Files<cr> nno <leader>; :Telescope fd<cr>
nno <leader>: :Telescope git_files<cr>
nno <leader>g :Neogit<cr>
" Buffer " Buffer
nno <leader>j :bn<cr> nno <leader>j :bn<cr>

View file

@ -38,4 +38,3 @@ map sa shell zip -r archive.zip %s
map ss shell tar -czvf archive.tar.gz %s map ss shell tar -czvf archive.tar.gz %s
map sd shell 7z a archive.7z %s map sd shell 7z a archive.7z %s
map se shell extract %s map se shell extract %s

View file

@ -1,52 +0,0 @@
# vim:ft=cfg
#== Web
ext x?html?, has google-chrome, X, flag f = google-chrome $@
ext x?html?, has firefox, X, flag f = firefox -- "$@"
#== Script
ext py = python -- "$1"
ext js = node -- "$1"
ext sh = bash -- "$1"
#== Misc
#mime ^text, lable editor = $EDITOR -- "$@"
#mime ^text, label pager = $PAGER -- "$@"
!mime ^text, label editor, ext json|csv|tex|py|rb|js|sh = ${EDITOR} -- "$@"
!mime ^text, label pager, ext json|csv|tex|py|rb|js|sh = "$PAGER" -- "$@"
name ^[mM]akefile$ = make
#== Video/Audio
mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
mime ^video|audio, has vlc, X, flag f = vlc -- "$@"
#== Documents
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
ext pdf, has zathura, X, flag f = zathura -- "$@"
ext djvu, has zathura, X, flag f = zathura -- "$@"
ext epub, has zathura, X, flag f = zathura -- "$@"
#== Images
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
mime ^image, has feh, X, flag f = feh -- "$@"
mime ^image, has ristretto, X, flag f = ristretto "$@"
mime ^image, has gimp, X, flag f = gimp -- "$@"
ext xcf, X, flag f = gimp -- "$@"
#== Archives
ext 7z, has 7z = 7z -p l "$@" | "$PAGER"
ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | "$PAGER"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | "$PAGER"
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@"
ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER"
ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done
ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done
ext zip, has unzip = unzip -l "$1" | less
ext zip, has unzip = for file in "$@"; do unzip -d "${file%.*}" "$file"; done
ext rar, has unrar = unrar l "$1" | less
ext rar, has unrar = for file in "$@"; do unrar x "$file"; done

View file

@ -1,6 +1,7 @@
{ {
"update.showReleaseNotes": false, "update.showReleaseNotes": false,
"window.menuBarVisibility": "hidden", "window.menuBarVisibility": "hidden",
"workbench.iconTheme": "vs-seti",
"workbench.sideBar.location": "right", "workbench.sideBar.location": "right",
"workbench.editor.untitled.hint": "hidden", "workbench.editor.untitled.hint": "hidden",
@ -37,19 +38,17 @@
"extensions.ignoreRecommendations": true, "extensions.ignoreRecommendations": true,
"docker.showStartPage": false, "docker.showStartPage": false,
"prettier.semi": false, "prettier.semi": false,
"javascript.suggestionActions.enabled": false,
"typescript.suggestionActions.enabled": false,
"emmet.includeLanguages": {"javascript": "javascriptreact"},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
},
"files.exclude": { "files.exclude": {
"**/.cache": true, "**/.cache": true,
"**/node_modules": true "**/node_modules": true
}, },
"emmet.includeLanguages": {"javascript": "javascriptreact"},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
}
} }

4
zshrc
View file

@ -6,9 +6,6 @@ export GOPATH="$HOME/go"
export PATH="$HOME/bin:$HOME/.local/bin:$HOME/.golang/bin:$GOPATH/bin:$PATH" export PATH="$HOME/bin:$HOME/.local/bin:$HOME/.golang/bin:$GOPATH/bin:$PATH"
export EDITOR="nvim" export EDITOR="nvim"
## FZF
export FZF_DEFAULT_COMMAND="fd -t f -E node_modules"
## Oh my zsh ## Oh my zsh
plugins=(dotenv) plugins=(dotenv)
ZSH_THEME="simple" ZSH_THEME="simple"
@ -20,7 +17,6 @@ bindkey -s "^g" "lazygit\n"
## FNM ## FNM
eval $(fnm env) eval $(fnm env)
eval $(fnm completions)
## Aliases ## Aliases
alias cls="clear" cp="cp -r" mkdir="mkdir -p" alias cls="clear" cp="cp -r" mkdir="mkdir -p"