Merge pull request #2 from siduck76/main

merge
This commit is contained in:
Jeevan Shah 2021-05-05 10:24:15 -04:00 committed by GitHub
commit 8c369f629b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 402 additions and 197 deletions

View File

@ -59,12 +59,9 @@ Lua fork of vim devicons which lets me change icons of filetypes
### nvim-treesitter ### nvim-treesitter
Better syntax highlighting for programming languages ( my config just has html,css,js support for now ). Better syntax highlighting for programming languages ( my config just has html,css,js support for now ).
without Treesitter : without / with Treesitter :
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/woTree.png"></kbd> <kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/woTree.png"></kbd>
with Treesitter :
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/wiTree.png"></kbd><hr>
### nvim-base16 - ### nvim-base16 -
contains a collection of all base16 themes for vim , plugin written in lua (comparison of base16-vim and nvim-base16): contains a collection of all base16 themes for vim , plugin written in lua (comparison of base16-vim and nvim-base16):
@ -82,12 +79,13 @@ nvim-base16 doesnt even take time to load unlike base16-vim which was eating hal
nvim nvim
├──init.lua ├──init.lua
└──lua └──lua
└──foo └──anything.lua
└──lua.lua
``` ```
- The init.lua is used instead of init.vim. - The init.lua is used instead of init.vim.
- The lua folder contains modules , in the example above "foo" could be considered as a module and it contains a lua.lua file in which you could write your config in lua , its like splitting the overall config into small bit . To load/source that "foo" module , you need to specify it in init.lua like this : require('foo.lua'). - The lua folder contains modules ( config files ) , in the example above anything.lua file in lua folder could be considered as a module.
- The anything.lua file is supposed to have any neovim config written in lua , its like splitting the overall config into small bits and make it more organized , like one module for highlights and colors , another one for statusline and so on!.
- To load or source that "anything" module (like making it load with init.lua ) ,add this is in init.lua : require "anything".
# Features # Features
@ -109,6 +107,7 @@ nvim-base16 doesnt even take time to load unlike base16-vim which was eating hal
- packer.nvim as package manager - packer.nvim as package manager
- indent-blankline.Nvim for indentlines - indent-blankline.Nvim for indentlines
- smooth scrolling - smooth scrolling
- Snip support from VSCode through vsnip supporting custom and predefined snips (friendly-snippets)
# Guides to migrate your nvim configs to init.lua - # Guides to migrate your nvim configs to init.lua -
@ -120,17 +119,24 @@ nvim-base16 doesnt even take time to load unlike base16-vim which was eating hal
- https://icyphox.sh/blog/nvim-lua/ - https://icyphox.sh/blog/nvim-lua/
- https://github.com/rafamadriz/friendly-snippets/wiki
# Clone my setup - # Clone my setup -
- Install neovim-nightly , also use a nerdfont on your terminal. - Install neovim-nightly , also use a nerdfont on your terminal.
- run the install.sh (this might work only on nix systems) and open neovim , do :PackerInstall - Use these [colors](https://github.com/siduck76/dotfiles/blob/master/thinkpad/.Xresources) for your terminal , Its in xresources format so it'd would be easier to use a terminal that supports xresources like st , urxvt , xterm , My [st build](https://github.com/siduck76/st).
- or do it manually : - run the install.sh (this might work only on nix systems),this opens neovim (press enter or y to skip the errors , the errors will only show once).
- Install ripgrep , fd , ueberzug for telescope media extension to work.
- Manual installation , incase the install.sh doesnt work for you :
- Install packer.nvim - Install packer.nvim
```shell ```
git clone https://github.com/wbthomason/packer.nvim\ git clone https://github.com/wbthomason/packer.nvim\
~/.local/share/nvim/site/pack/packer/start/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
``` ```
- copy lua folder and init.lua into ~/.config/nvim - copy lua folder and init.lua into ~/.config/nvim
@ -138,7 +144,10 @@ git clone https://github.com/wbthomason/packer.nvim\
- Install language servers and prettier ( for autocompletion etc and code formatting , nodejs should be installed too!) , this usually depends on the language support you want to add in your neovim config. - Install language servers and prettier ( for autocompletion etc and code formatting , nodejs should be installed too!) , this usually depends on the language support you want to add in your neovim config.
``` ```
sudo npm install -g vscode-html-languageserver-bin typescript typescript-language-server vscode-css-languageserver-bin prettier npm config set prefix=~/.node_modules
npm install -g vscode-html-languageserver-bin typescript typescript-language-server vscode-css-languageserver-bin prettier
(ADD ~/.node_modules at your PATH)
``` ```
To setup any language server , follow this guide https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md and search up the needed LSP. For example if I needed clangd's lsp server : To setup any language server , follow this guide https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md and search up the needed LSP. For example if I needed clangd's lsp server :
@ -152,29 +161,61 @@ I'd install it first and add its setup line :
require'lspconfig'.clangd.setup{} `` require'lspconfig'.clangd.setup{} ``
# Default Mappings to make stuffs easier! # Default Mappings
<kbd> space </kbd> is the leader key <kbd> space </kbd> is the **leader** key.
- Opening terminals!
- <kbd> Ctrl </kbd> <kbd> l </kbd> Open terminal vertically over right - <kbd> Ctrl </kbd> <kbd> l </kbd> Open terminal vertically over right
- <kbd> Ctrl </kbd> <kbd> x </kbd> Open terminal horizontally below the current window - <kbd> Ctrl </kbd> <kbd> x </kbd> Open terminal horizontally below the current window
- **File tree (nvim-tree)**
- <kbd> Ctrl </kbd> <kbd> n </kbd> toggle neovim tree - <kbd> Ctrl </kbd> <kbd> n </kbd> toggle neovim tree
- <kbd> Shift </kbd> <kbd> h </kbd> show hidden files (use these keybinds when cursor's in the filetree, same for the keybinds below).
- <kbd> Ctrl </kbd> + <kbd> v </kbd> open files in vertical split
- <kbd> Ctrl </kbd> + <kbd> x </kbd> open files in horizontal split
- **Toggling stuffs**
- leader + <kbd> n </kbd> toggle line number
- leader + <kbd> z </kbd> toggle truezen.nvim's Ataraxis mode
- leader + <kbd> m </kbd> toggle truezen.nvim's minimalistic mode
- **Copy text**
- <kbd> Ctrl </kbd> <kbd> a </kbd> copies everything in the current file - <kbd> Ctrl </kbd> <kbd> a </kbd> copies everything in the current file
- select any text + <kbd> y </kbd> copies the selected text - select any text + <kbd> y </kbd> copies the selected text
- leader + <kbd> f </kbd> <kbd> b </kbd> open all buffers , with telescope
- leader + <kbd> f </kbd> <kbd> p </kbd> search and preview images with telescope - **Telescope**
- leader + <kbd> f </kbd> <kbd> f </kbd> find files in the current DIR , with telescope
- leader + <kbd> f </kbd> <kbd> o </kbd> open recently edited files , with telescope - leader + <kbd> f </kbd> <kbd> b </kbd> open all buffers
- leader + <kbd> f </kbd> <kbd> f </kbd> find files in the current DIR , with telescope - leader + <kbd> f </kbd> <kbd> f </kbd> find files in the current DIR
- leader + <kbd> f </kbd> <kbd> h </kbd> opens up a manpage like thing but for all vim related things , with telescope - leader + <kbd> f </kbd> <kbd> o </kbd> open recently edited files
- leader + <kbd> f </kbd> <kbd> h </kbd> opens up a help page like thing
- <kbd> Ctrl </kbd> + <kbd> v </kbd> open files in vertical split
- <kbd> Ctrl </kbd> + <kbd> x </kbd> open files in horizontal split
- **Formatting code**
- leader + <kbd> f </kbd> <kbd> m </kbd> formats or beautifies the code in current window via neoformat - leader + <kbd> f </kbd> <kbd> m </kbd> formats or beautifies the code in current window via neoformat
(currently only html ,css , js can be formatted . To be able to use this keybind you need to install the formatter locally for your language , in my case prettier was required only so I installed it. check this <a> https://github.com/sbdchd/neoformat</a>). (currently only html ,css , js can be formatted . To be able to use this keybind you need to install the formatter locally for your language , in my case prettier was required only so I installed it. check (this)[https://github.com/sbdchd/neoformat].
- **Neoscroll**
- `<C-u>`, `<C-d>`, `<C-b>`, `<C-f>`, `<C-y>` and `<C-e>` : Smooth scrolling for window movement commands. - `<C-u>`, `<C-d>`, `<C-b>`, `<C-f>`, `<C-y>` and `<C-e>` : Smooth scrolling for window movement commands.
- **Managing tabs with bufferline!**
- <kbd> Shift </kbd> <kbd> l or s </kbd> cycle through opened tabs
- <kbd> Shift </kbd> <kbd> d </kbd> close current tab
- <kbd> Shift </kbd> <kbd> b </kbd> open new tab
# TODO # TODO
- add snippets support - Make the statusline more elegant.
- show statusline in inactive windows - Add more themes.
# Contact - # Contact -

View File

@ -1,25 +1,23 @@
-- load all plugins -- load all plugins
require("pluginsList.lua") require "pluginList"
require("file-icons.lua") require "file-icons"
require("misc-utils.lua") require "misc-utils"
require("nvimTree.lua") require "top-bufferline"
require("bufferline.lua") require "statusline"
require("statusline.lua")
require("telescope.lua")
require("gitsigns.lua") require("colorizer").setup()
require "colorizer".setup() require("neoscroll").setup() -- smooth scroll
-- lsp -- lsp
require("lspconfig.lua") require "nvim-lspconfig"
require("compe.lua") require "compe-completion"
local cmd = vim.cmd local cmd = vim.cmd
local g = vim.g local g = vim.g
g.mapleader = " " g.mapleader = " "
g.auto_save = 1 g.auto_save = 0
-- colorscheme related stuff -- colorscheme related stuff
@ -36,7 +34,7 @@ local indent = 2
g.indentLine_enabled = 1 g.indentLine_enabled = 1
g.indent_blankline_char = "" g.indent_blankline_char = ""
cmd("hi IndentBlanklineChar guifg=#2a2e36") cmd "hi IndentBlanklineChar guifg=#2a2e36"
g.indent_blankline_filetype_exclude = {"help", "terminal"} g.indent_blankline_filetype_exclude = {"help", "terminal"}
g.indent_blankline_buftype_exclude = {"terminal"} g.indent_blankline_buftype_exclude = {"terminal"}
@ -44,43 +42,29 @@ g.indent_blankline_buftype_exclude = {"terminal"}
g.indent_blankline_show_trailing_blankline_indent = false g.indent_blankline_show_trailing_blankline_indent = false
g.indent_blankline_show_first_indent_level = false g.indent_blankline_show_first_indent_level = false
require("treesitter.lua") require "treesitter-nvim"
require("mappings.lua") require "mappings"
-- highlights -- -- highlights --
cmd("hi LineNr guifg=#383c44 guibg=NONE") cmd "hi LineNr guifg=#42464e guibg=NONE"
cmd("hi Comment guifg=#3d4149") cmd "hi Comment guifg=#42464e"
cmd("hi SignColumn guibg=NONE") cmd "hi SignColumn guibg=NONE"
cmd("hi VertSplit guibg=NONE guifg=#2a2e36") cmd "hi VertSplit guibg=NONE guifg=#2a2e36"
cmd("hi DiffAdd guifg=#81A1C1 guibg = none") cmd "hi EndOfBuffer guifg=#1e222a"
cmd("hi DiffChange guifg =#3A3E44 guibg = none") cmd "hi PmenuSel guibg=#98c379"
cmd("hi DiffModified guifg = #81A1C1 guibg = none") cmd "hi Pmenu guibg=#282c34"
cmd("hi EndOfBuffer guifg=#1e222a")
-- telescope stuff and popupmenu cmd "hi Normal guibg=NONE ctermbg=NONE"
cmd("hi TelescopeBorder guifg=#2a2e36") -- cmd "hi Normal guibg=#1e222a"
cmd("hi TelescopePromptBorder guifg=#2a2e36")
cmd("hi TelescopeResultsBorder guifg=#2a2e36")
cmd("hi TelescopePreviewBorder guifg=#525865")
cmd("hi PmenuSel guibg=#98c379")
cmd("hi Pmenu guibg=#282c34")
-- tree folder name , icon color require "telescope-nvim"
cmd("hi NvimTreeFolderIcon guifg = #61afef") require "nvimTree"
cmd("hi NvimTreeFolderName guifg = #61afef")
cmd("hi NvimTreeIndentMarker guifg=#383c44")
cmd("hi Normal guibg=NONE ctermbg=NONE")
-- git signs , lsp symbols etc
require "gitsigns-nvim"
require("nvim-autopairs").setup() require("nvim-autopairs").setup()
require("lspkind").init( require("lspkind").init()
{
File = ""
}
)
-- nvimTree bg color
-- hide line numbers in terminal windows -- hide line numbers in terminal windows
vim.api.nvim_exec([[ vim.api.nvim_exec([[
@ -90,5 +74,8 @@ vim.api.nvim_exec([[
-- inactive statuslines as thin splitlines -- inactive statuslines as thin splitlines
cmd("highlight! StatusLineNC gui=underline guibg=NONE guifg=#383c44") cmd("highlight! StatusLineNC gui=underline guibg=NONE guifg=#383c44")
-- smooth scroll cmd "hi clear CursorLine"
require("neoscroll").setup() cmd "hi cursorlinenr guibg=NONE guifg=#abb2bf"
-- setup for TrueZen.nvim
require "zenmode"

View File

@ -2,22 +2,22 @@
BASE=$(git rev-parse --show-toplevel) BASE=$(git rev-parse --show-toplevel)
LSP_BIN_PATH=$HOME/.local/bin LSP_BIN_PATH=$HOME/.local/bin
default_lsp_langs="css html ts rust python" default_lsp_langs="css html ts rust python bash"
lsp_langs="" lsp_langs=""
choose_langs() { choose_langs() {
read -p "Would you like to install $1 lsp?(y/n)" lang read -p "Would you like to install $1 lsp?(y/n)" lang
if [ "$lang" = "y" ] if [ "$lang" = "y" ]; then
then
lsp_langs+="$1 " lsp_langs+="$1 "
fi fi
} }
for lang in $default_lsp_langs for lang in $default_lsp_langs; do
do
choose_langs $lang choose_langs $lang
done done
npm config set prefix=~/.node_modules # for global npm pkg installation
pfx="~~~~~ " pfx="~~~~~ "
heading() { heading() {
echo echo
@ -26,11 +26,11 @@ heading() {
get_platform() { get_platform() {
case "$(uname -s)" in case "$(uname -s)" in
Linux*) platform=Linux;; Linux*) platform=Linux ;;
Darwin*) platform=Mac;; Darwin*) platform=Mac ;;
CYGWIN*) platform=Cygwin;; CYGWIN*) platform=Cygwin ;;
MINGW*) platform=MinGw;; MINGW*) platform=MinGw ;;
*) platform="UNKNOWN:${unameOut}" *) platform="UNKNOWN:${unameOut}" ;;
esac esac
echo $platform echo $platform
} }
@ -39,7 +39,7 @@ heading "installing packer"
if [[ ! -e ~/.local/share/nvim/site/pack/packer/start/packer.nvim ]]; then if [[ ! -e ~/.local/share/nvim/site/pack/packer/start/packer.nvim ]]; then
heading "Installing packer" heading "Installing packer"
git clone https://github.com/wbthomason/packer.nvim\ git clone https://github.com/wbthomason/packer.nvim \
~/.local/share/nvim/site/pack/packer/start/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
fi fi
@ -51,6 +51,18 @@ heading "old nvim config will be deleted so watchout :0"
rm -rf ~/.config/nvim/ && mkdir -p ~/.config/nvim rm -rf ~/.config/nvim/ && mkdir -p ~/.config/nvim
cp -r init.lua ~/.config/nvim && cp -r lua ~/.config/nvim cp -r init.lua ~/.config/nvim && cp -r lua ~/.config/nvim
# change shell for nvim
read -p "which shell do you use?: " shellname
echo "$shellname"
if [ "$(get_platform)" = "Mac" ]; then
gsed -i "s/bash/$shellname/g" ~/.config/nvim/lua/mappings/lua.lua
else
sed -i "s/bash/$shellname/g" ~/.config/nvim/lua/mappings/lua.lua
fi
echo "shell changed to $shellname on nvim successfully!"
#for f in `find -E . -regex ".*\.vim$|.*\.lua$"`; do #for f in `find -E . -regex ".*\.vim$|.*\.lua$"`; do
# p=${f#*/} # p=${f#*/}
# echo -e '\t' ${p} # echo -e '\t' ${p}
@ -65,24 +77,18 @@ cp -r init.lua ~/.config/nvim && cp -r lua ~/.config/nvim
#nvim --headless +TSUpdate +qa #nvim --headless +TSUpdate +qa
echo echo
fn_exists() { declare -F "$1" > /dev/null; } fn_exists() { declare -F "$1" >/dev/null; }
warn_path=false warn_path=false
install_node_deps () { install_node_deps() {
if [[ -z $(which npm) ]]; then if [[ -z $(which npm) ]]; then
echo "npm not installed" echo "npm not installed"
return return
fi fi
sudo npm install -g $@ npm install -g $@
} }
install_python_deps () { # install languages
if [[ -z $(which pip) && -z $(which pip3) ]]; then
echo "python/pip not installed"
return
fi
sudo python3 -m pip install $@
}
install_ts() { install_ts() {
install_node_deps typescript typescript-language-server prettier install_node_deps typescript typescript-language-server prettier
@ -107,12 +113,16 @@ install_rust() {
fi fi
} }
install_python(){ install_python() {
install_python_deps 'python-language-server[all]' install_node_deps pyright
}
install_bash() {
install_node_deps bash-language-server
} }
for lang in ${lsp_langs}; do for lang in ${lsp_langs}; do
if fn_exists install_$lang ; then if fn_exists install_$lang; then
heading "Installing $lang language server" heading "Installing $lang language server"
install_$lang install_$lang
else else
@ -121,7 +131,13 @@ for lang in ${lsp_langs}; do
fi fi
done done
if [[ ${warn_path} = true ]]; then if [[ ${warn_path} == true ]]; then
echo "" echo ""
echo "Ensure ${LSP_BIN_PATH} is available in your \$PATH variable" echo "Ensure ${LSP_BIN_PATH} is available in your \$PATH variable"
fi fi
echo "add ~/.node_modules/bin at PATH!"
# install all plugins via packer
nvim +PackerInstall

View File

@ -1,6 +1,3 @@
vim.cmd [[packadd nvim-lspconfig]]
vim.cmd [[packadd nvim-compe]]
vim.o.completeopt = "menuone,noselect" vim.o.completeopt = "menuone,noselect"
require "compe".setup { require "compe".setup {
@ -18,9 +15,9 @@ require "compe".setup {
documentation = true, documentation = true,
source = { source = {
path = true, path = true,
buffer = true, buffer = {kind = "" , true},
calc = true, calc = true,
vsnip = true, vsnip = {kind = ""}, --replace to what sign you prefer
nvim_lsp = true, nvim_lsp = true,
nvim_lua = true, nvim_lua = true,
spell = true, spell = true,

View File

@ -1,5 +1,3 @@
vim.cmd [[packadd nvim-web-devicons]]
require "nvim-web-devicons".setup { require "nvim-web-devicons".setup {
override = { override = {
html = { html = {
@ -96,6 +94,16 @@ require "nvim-web-devicons".setup {
icon = "", icon = "",
color = "#EBCB8B", color = "#EBCB8B",
name = "xz" name = "xz"
},
deb = {
icon = "",
color = "#a3b8ef",
name = "deb"
},
rpm = {
icon = "",
color = "#fca2aa",
name = "rpm"
} }
} }
} }

View File

@ -25,3 +25,9 @@ require("gitsigns").setup {
sign_priority = 5, sign_priority = 5,
status_formatter = nil -- Use default status_formatter = nil -- Use default
} }
local cmd = vim.cmd
cmd "hi DiffAdd guifg=#81A1C1 guibg = none"
cmd "hi DiffChange guifg =#3A3E44 guibg = none"
cmd "hi DiffModified guifg = #81A1C1 guibg = none"

View File

@ -1,45 +0,0 @@
vim.cmd [[packadd nvim-lspconfig]]
vim.cmd [[packadd nvim-compe]]
local nvim_lsp = require("lspconfig")
function on_attach(client)
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
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- 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", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
buf_set_keymap("n", "<space>e", "<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)
-- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
elseif client.resolved_capabilities.document_range_formatting then
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
end
end
local servers = {"tsserver", "cssls", "html" , "pyls"}
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {on_attach = on_attach}
end

View File

@ -6,6 +6,17 @@ local function map(mode, lhs, rhs, opts)
vim.api.nvim_set_keymap(mode, lhs, rhs, options) vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end end
local opt = {}
-- dont copy any deleted text , this is disabled by default so uncomment the below mappings if you want them!
--[[
map("n", "dd", [=[ "_dd ]=], opt)
map("v", "dd", [=[ "_dd ]=], opt)
map("v", "x", [=[ "_x ]=], opt)
]]
-- copy any selected text with pressing y -- copy any selected text with pressing y
map("", "<leader>c", '"+y') map("", "<leader>c", '"+y')
@ -15,3 +26,11 @@ map("n", "<C-x>", [[<Cmd> split term://bash | resize 10 <CR>]], opt) -- open ter
-- COPY EVERYTHING -- -- COPY EVERYTHING --
map("n", "<C-a>", [[ <Cmd> %y+<CR>]], opt) map("n", "<C-a>", [[ <Cmd> %y+<CR>]], opt)
-- toggle numbers ---
map("n", "<leader>n", [[ <Cmd> set nu!<CR>]], opt)
-- toggle truezen.nvim's ataraxis and minimalist mode
map("n", "<leader>z", [[ <Cmd> TZAtaraxis<CR>]], opt)
map("n", "<leader>m", [[ <Cmd> TZMinimalist<CR>]], opt)

View File

@ -14,6 +14,7 @@ opt("o", "splitright", true)
opt("o", "termguicolors", true) opt("o", "termguicolors", true)
opt("w", "number", true) opt("w", "number", true)
opt("o", "numberwidth", 2) opt("o", "numberwidth", 2)
opt("w", "cul", true)
opt("o", "mouse", "a") opt("o", "mouse", "a")
@ -24,9 +25,8 @@ opt("o", "updatetime", 250) -- update interval for gitsigns
opt("o", "clipboard", "unnamedplus") opt("o", "clipboard", "unnamedplus")
-- for indenline -- for indenline
opt("b", "expandtab", true ) opt("b", "expandtab", true)
opt("b", "shiftwidth", 2 ) opt("b", "shiftwidth", 2)
local M = {} local M = {}

100
lua/nvim-lspconfig.lua Normal file
View File

@ -0,0 +1,100 @@
function on_attach(client)
local function map(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
end
local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...)
end
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- Mappings.
local opts = {noremap = true, silent = true, normal = true}
map("gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
map("gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
map("K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
map("gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
map("<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
map("<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
map("<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
map("<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
map("<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
map("<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
map("gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
map("<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
map("[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
map("]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
map("<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
-- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then
map("<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
elseif client.resolved_capabilities.document_range_formatting then
map("<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
end
end
local lspconf = require "lspconfig"
local servers = {"html", "cssls", "tsserver", "pyright", "bashls"}
for k, lang in pairs(servers) do
lspconf[lang].setup {
root_dir = vim.loop.cwd
}
end
-- lua lsp settings
USER = "/home/" .. vim.fn.expand("$USER")
local sumneko_root_path = USER .. "/.config/lua-language-server"
local sumneko_binary = USER .. "/.config/lua-language-server/bin/Linux/lua-language-server"
require "lspconfig".sumneko_lua.setup {
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
root_dir = function()
return vim.loop.cwd()
end,
settings = {
Lua = {
runtime = {
version = "LuaJIT",
path = vim.split(package.path, ";")
},
diagnostics = {
globals = {"vim"}
},
workspace = {
library = {
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true
}
},
telemetry = {
enable = false
}
}
}
}
-- replace the default lsp diagnostic letters with prettier symbols
vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"})
vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"})
vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"})
vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"})
-- diagnostics highlights
local cmd = vim.cmd
cmd "hi LspDiagnosticsSignError guifg=#f9929b"
cmd "hi LspDiagnosticsVirtualTextError guifg=#BF616A"
cmd "hi LspDiagnosticsSignWarning guifg=#EBCB8B"
cmd "hi LspDiagnosticsVirtualTextWarning guifg=#EBCB8B"
cmd "hi LspDiagnosticsSignInformation guifg=#A3BE8C"
cmd "hi LspDiagnosticsVirtualTextInformation guifg=#A3BE8C"
cmd "hi LspDiagnosticsSignHint guifg=#b6bdca"
cmd "hi LspDiagnosticsVirtualTextHint guifg=#b6bdca"

View File

@ -1,9 +1,8 @@
vim.cmd [[packadd nvim-tree.lua]] local cmd = vim.cmd
local g = vim.g
vim.o.termguicolors = true vim.o.termguicolors = true
local g = vim.g
g.nvim_tree_side = "left" g.nvim_tree_side = "left"
g.nvim_tree_width = 25 g.nvim_tree_width = 25
g.nvim_tree_ignore = {".git", "node_modules", ".cache"} g.nvim_tree_ignore = {".git", "node_modules", ".cache"}
@ -84,3 +83,7 @@ g.nvim_tree_bindings = {
["-"] = get_lua_cb("dir_up"), ["-"] = get_lua_cb("dir_up"),
["q"] = get_lua_cb("close") ["q"] = get_lua_cb("close")
} }
cmd "hi NvimTreeFolderIcon guifg = #61afef"
cmd "hi NvimTreeFolderName guifg = #61afef"
cmd "hi NvimTreeIndentMarker guifg=#383c44"

View File

@ -1,36 +1,47 @@
-- check if packer is installed (~/local/share/nvim/site/pack) local packer = require("packer")
local packer_exists = pcall(vim.cmd, [[packadd packer.nvim]]) local use = packer.use
-- using { } when using a different branch of the plugin or loading the plugin with certain commands -- using { } for using different branch , loading plugin with certain commands etc
return require("packer").startup( return require("packer").startup(
function() function()
use {"wbthomason/packer.nvim", opt = true} use "wbthomason/packer.nvim"
use {"lukas-reineke/indent-blankline.nvim", branch = "lua"}
-- color related stuff
use "norcalli/nvim-base16.lua" use "norcalli/nvim-base16.lua"
use "kyazdani42/nvim-web-devicons" use "norcalli/nvim-colorizer.lua"
use "kyazdani42/nvim-tree.lua"
-- lsp stuff
use "nvim-treesitter/nvim-treesitter"
use "neovim/nvim-lspconfig"
use "hrsh7th/nvim-compe"
use "onsails/lspkind-nvim"
use "sbdchd/neoformat"
use "nvim-lua/plenary.nvim" use "nvim-lua/plenary.nvim"
use "lewis6991/gitsigns.nvim" use "lewis6991/gitsigns.nvim"
use "akinsho/nvim-bufferline.lua" use "akinsho/nvim-bufferline.lua"
use "glepnir/galaxyline.nvim" use "glepnir/galaxyline.nvim"
use "907th/vim-auto-save"
use "nvim-treesitter/nvim-treesitter"
use "norcalli/nvim-colorizer.lua"
use "ryanoasis/vim-devicons"
use "sbdchd/neoformat"
use "neovim/nvim-lspconfig"
use "hrsh7th/nvim-compe"
use "windwp/nvim-autopairs" use "windwp/nvim-autopairs"
use "alvan/vim-closetag" use "alvan/vim-closetag"
use "tweekmonster/startuptime.vim"
use "onsails/lspkind-nvim" -- snippet support
use "hrsh7th/vim-vsnip"
use "rafamadriz/friendly-snippets"
-- file managing , picker etc
use "kyazdani42/nvim-tree.lua"
use "kyazdani42/nvim-web-devicons"
use "ryanoasis/vim-devicons"
use "nvim-telescope/telescope.nvim" use "nvim-telescope/telescope.nvim"
use "nvim-telescope/telescope-media-files.nvim" use "nvim-telescope/telescope-media-files.nvim"
use "nvim-lua/popup.nvim" use "nvim-lua/popup.nvim"
-- misc
use "tweekmonster/startuptime.vim"
use "907th/vim-auto-save"
use "karb94/neoscroll.nvim" use "karb94/neoscroll.nvim"
use "kdav5758/TrueZen.nvim"
use "nekonako/xresources-nvim" use {"lukas-reineke/indent-blankline.nvim", branch = "lua"}
end end
) )

View File

@ -73,3 +73,12 @@ vim.api.nvim_set_keymap("n", "<Leader>fb", [[<Cmd>lua require('telescope.builtin
vim.api.nvim_set_keymap("n", "<Leader>fh", [[<Cmd>lua require('telescope.builtin').help_tags()<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fh", [[<Cmd>lua require('telescope.builtin').help_tags()<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>fo", [[<Cmd>lua require('telescope.builtin').oldfiles()<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fo", [[<Cmd>lua require('telescope.builtin').oldfiles()<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt)
-- highlights
local cmd = vim.cmd
cmd "hi TelescopeBorder guifg=#2a2e36"
cmd "hi TelescopePromptBorder guifg=#2a2e36"
cmd "hi TelescopeResultsBorder guifg=#2a2e36"
cmd "hi TelescopePreviewBorder guifg=#525865"

View File

@ -1,10 +1,12 @@
vim.o.termguicolors = true -- colors
local bar_fg = "#565c64"
local activeBuffer_fg = "#c8ccd4"
-- colors for active , inactive uffer tabs
require "bufferline".setup { require "bufferline".setup {
options = { options = {
buffer_close_icon = "", buffer_close_icon = "",
modified_icon = "", modified_icon = "",
close_icon = "", close_icon = "",
left_trunc_marker = "", left_trunc_marker = "",
right_trunc_marker = "", right_trunc_marker = "",
@ -18,29 +20,31 @@ require "bufferline".setup {
}, },
highlights = { highlights = {
background = { background = {
guifg = comment_fg, guifg = bar_fg,
guibg = "#1e222a" guibg = "#1e222a"
}, },
fill = { fill = {
guifg = comment_fg, guifg = bar_fg,
guibg = "#1e222a" guibg = "#1e222a"
}, },
-- focused window
buffer_selected = { buffer_selected = {
guifg = normal_fg, guifg = activeBuffer_fg,
guibg = "#282c34", guibg = "#353b45",
gui = "bold" gui = "bold"
}, },
separator_selected = {
guifg = "#353b45",
guibg = "#353b45"
},
-- unfocused opened window
buffer_visible = { buffer_visible = {
guifg = "#3e4451", guifg = "#9298a0",
guibg = "#1e222a" guibg = "#282c34"
}, },
separator_visible = { separator_visible = {
guifg = "#1e222a", guifg = "#282c34",
guibg = "#1e222a" guibg = "#282c34"
},
separator_selected = {
guifg = "#1e222a",
guibg = "#1e222a"
}, },
separator = { separator = {
guifg = "#1e222a", guifg = "#1e222a",
@ -51,7 +55,7 @@ require "bufferline".setup {
guibg = "#1e222a" guibg = "#1e222a"
}, },
modified_selected = { modified_selected = {
guifg = string_fg, guifg = "#d0f5c2",
guibg = "#353b45" guibg = "#353b45"
} }
} }
@ -59,15 +63,15 @@ require "bufferline".setup {
local opt = {silent = true} local opt = {silent = true}
local map = vim.api.nvim_set_keymap
vim.g.mapleader = " " vim.g.mapleader = " "
--command that adds new buffer and moves to it --command that adds new buffer and moves to it
vim.api.nvim_command "com -nargs=? -complete=file_in_path New badd <args> | blast" map("n", "<S-t>", [[<Cmd>tabnew<CR>]], opt)
vim.api.nvim_set_keymap("n", "<S-b>", ":New ", opt)
--removing a buffer --removing a buffer
vim.api.nvim_set_keymap("n", "<S-f>", [[<Cmd>bdelete<CR>]], opt) map("n", "<S-x>", [[<Cmd>bdelete<CR>]], opt)
-- tabnew and tabprev -- tabnew and tabprev
vim.api.nvim_set_keymap("n", "<S-l>", [[<Cmd>BufferLineCycleNext<CR>]], opt) map("n", "<S-l>", [[<Cmd>BufferLineCycleNext<CR>]], opt)
vim.api.nvim_set_keymap("n", "<S-s>", [[<Cmd>BufferLineCyclePrev<CR>]], opt) map("n", "<S-p>", [[<Cmd>BufferLineCyclePrev<CR>]], opt)

View File

@ -6,9 +6,11 @@ ts_config.setup {
"html", "html",
"css", "css",
"bash", "bash",
"cpp", "lua",
"rust", "json",
"lua" "python"
-- "cpp",
-- "rust",
}, },
highlight = { highlight = {
enable = true, enable = true,

47
lua/zenmode.lua Normal file
View File

@ -0,0 +1,47 @@
local true_zen = require("true-zen")
true_zen.setup(
{
true_false_commands = false,
cursor_by_mode = false,
before_minimalist_mode_shown = true,
before_minimalist_mode_hidden = true,
after_minimalist_mode_shown = true,
after_minimalist_mode_hidden = true,
bottom = {
hidden_laststatus = 0,
hidden_ruler = false,
hidden_showmode = false,
hidden_showcmd = false,
hidden_cmdheight = 1,
shown_laststatus = 2,
shown_ruler = true,
shown_showmode = false,
shown_showcmd = false,
shown_cmdheight = 1
},
top = {
hidden_showtabline = 0,
shown_showtabline = 2
},
left = {
hidden_number = false,
hidden_relativenumber = false,
hidden_signcolumn = "no",
shown_number = true,
shown_relativenumber = false,
shown_signcolumn = "no"
},
ataraxis = {
just_do_it_for_me = false,
left_padding = 37,
right_padding = 37,
top_padding = 2,
bottom_padding = 2,
custome_bg = "#1e222a"
},
integrations = {
integration_galaxyline = true
}
}
)