Skip to content

Instantly share code, notes, and snippets.

th_pass_mark = 0
th_max_mark = 0
pr_pass_mark = 0
pr_max_mark = 0
def parmark(pr_max_mark, pr_pass_mark, th_max_mark, th_pass_mark, score_mark):
if score_mark <= th_pass_mark:
score_pr_mark = pr_pass_mark
@shaeinst
shaeinst / autopairs.lua
Created November 7, 2021 18:02
Medium-Setting Up Neovim for Web Development - 15
require('nvim-autopairs').setup({
enable_check_bracket_line = true, -- Don't add pairs if it already have a close pairs in same line
disable_filetype = { "TelescopePrompt" , "vim" }, --
enable_afterquote = false, -- add bracket pairs after quote
enable_moveright = true
})
-- If you want insert `(` after select function or method item
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
@shaeinst
shaeinst / init.lua
Created November 7, 2021 17:57
Medium-Setting Up Neovim for Web Development - 14
require('configs')
--If you want to automatically ensure that packer.nvim is installed on any machine you clone your configuration to,
--add the following snippet (which is due to @Iron-E) somewhere in your config before your first usage of packer:
local execute = vim.api.nvim_command
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
execute 'packadd packer.nvim'
@shaeinst
shaeinst / init.lua
Created November 7, 2021 17:02
Medium-Setting Up Neovim for Web Development - 13
require('configs')
--If you want to automatically ensure that packer.nvim is installed on any machine you clone your configuration to,
--add the following snippet (which is due to @Iron-E) somewhere in your config before your first usage of packer:
local execute = vim.api.nvim_command
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
execute 'packadd packer.nvim'
@shaeinst
shaeinst / configs.lua
Created November 7, 2021 16:51
Medium-Setting Up Neovim for Web Development - 12
local exec = vim.api.nvim_exec -- execute Vimscript
local set = vim.opt -- global options
local cmd = vim.cmd -- execute Vim commands
-- local fn = vim.fn -- call Vim functions
-- local g = vim.g -- global variables
-- local b = vim.bo -- buffer-scoped options
-- local w = vim.wo -- windows-scoped options
cmd('autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=grey') --to Show whitespace, MUST be inserted BEFORE the colorscheme command
cmd('colorscheme rvcs')
@shaeinst
shaeinst / treesitter.lua
Created November 7, 2021 16:36
Medium-Setting Up Neovim for Web Development - 11
require'nvim-treesitter.configs'.setup {
highlight = {
enable = {"c", "cpp", "dart", "python", "javascript"}, -- enable = true (false will disable the whole extension)
-- disable = { "c", "rust" }, -- list of language that will be disabled
custom_captures = {
-- Highlight the @foo.bar capture group with the "Identifier" highlight group.
["foo.bar"] = "Identifier",
},
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
@shaeinst
shaeinst / init.lua
Created November 7, 2021 16:30
Medium-Setting Up Neovim for Web Development - 10
--If you want to automatically ensure that packer.nvim is installed on any machine you clone your configuration to,
--add the following snippet (which is due to @Iron-E) somewhere in your config before your first usage of packer:
local execute = vim.api.nvim_command
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
execute 'packadd packer.nvim'
end
@shaeinst
shaeinst / luasnip.lua
Last active November 8, 2021 17:47
Medium-Setting Up Neovim for Web Development - 9
local ls = require("luasnip")
-- some shorthands...
local s = ls.snippet
local sn = ls.snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
@shaeinst
shaeinst / cmp.lua
Created November 7, 2021 15:55
Medium-Setting Up Neovim for Web Development - 8
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
local cmp = require'cmp'
cmp.setup({
completion = {
--completeopt = 'menu,menuone,noinsert',
},
snippet = {
expand = function(args)
@shaeinst
shaeinst / lsp_installer_nvim.lua
Created November 7, 2021 14:31
Medium-Setting Up Neovim for Web Development - 6
local lsp_installer = require("nvim-lsp-installer")
-- Provide settings first!
lsp_installer.settings {
ui = {
icons = {
server_installed = "✓",
server_pending = "➜",
server_uninstalled = "✗",
},